isahipster: e9cba2ffd3225e111ce71b29426a588bf0f80c26
1: theory prop_23
2: imports Main
3: "$HIPSTER_HOME/IsaHipster"
4: begin
5: datatype 'a list = Nil2 | Cons2 "'a" "'a list"
6: datatype Nat = Z | S "Nat"
7: fun length :: "'a list => Nat" where
8: "length (Nil2) = Z"
9: | "length (Cons2 y xs) = S (length xs)"
10: fun half :: "Nat => Nat" where
11: "half (Z) = Z"
12: | "half (S (Z)) = Z"
13: | "half (S (S z)) = S (half z)"
14: fun append :: "'a list => 'a list => 'a list" where
15: "append (Nil2) y = y"
16: | "append (Cons2 z xs) y = Cons2 z (append xs y)"
17: (*hipster length half append *)
18:
19: lemma lemma_a [thy_expl]: "append x2 Nil2 = x2"
20: by (hipster_induct_schemes length.simps append.simps)
21:
22: lemma lemma_aa [thy_expl]: "append (append x1 y1) z1 = append x1 (append y1 z1)"
23: by (hipster_induct_schemes length.simps append.simps)
24:
25: lemma unknown []: "length (append x y) = length (append y x)"
26: oops
27:
28: (*hipster length half append*)
29:
30: lemma ax2[thy_expl]: "length (append y (Cons2 ya xs)) = S (length (append y xs))"
31: by(hipster_induct_schemes)
32:
33: theorem x0 :
34: "(half (length (append x y))) = (half (length (append y x)))"
35: by (hipster_induct_schemes length.simps append.simps half.simps list.exhaust Nat.exhaust)
36: by (tactic {* Subgoal.FOCUS_PARAMS (K (Tactic_Data.hard_tac @{context})) @{context} 1 *})
37: end
Generated by git2html.