equal
deleted
inserted
replaced
52 goal SList.thy "inj(Rep_list)"; |
52 goal SList.thy "inj(Rep_list)"; |
53 by (rtac inj_inverseI 1); |
53 by (rtac inj_inverseI 1); |
54 by (rtac Rep_list_inverse 1); |
54 by (rtac Rep_list_inverse 1); |
55 qed "inj_Rep_list"; |
55 qed "inj_Rep_list"; |
56 |
56 |
57 goal SList.thy "inj_onto Abs_list (list(range Leaf))"; |
57 goal SList.thy "inj_on Abs_list (list(range Leaf))"; |
58 by (rtac inj_onto_inverseI 1); |
58 by (rtac inj_on_inverseI 1); |
59 by (etac Abs_list_inverse 1); |
59 by (etac Abs_list_inverse 1); |
60 qed "inj_onto_Abs_list"; |
60 qed "inj_on_Abs_list"; |
61 |
61 |
62 (** Distinctness of constructors **) |
62 (** Distinctness of constructors **) |
63 |
63 |
64 goalw SList.thy list_con_defs "CONS M N ~= NIL"; |
64 goalw SList.thy list_con_defs "CONS M N ~= NIL"; |
65 by (rtac In1_not_In0 1); |
65 by (rtac In1_not_In0 1); |
68 |
68 |
69 bind_thm ("CONS_neq_NIL", (CONS_not_NIL RS notE)); |
69 bind_thm ("CONS_neq_NIL", (CONS_not_NIL RS notE)); |
70 val NIL_neq_CONS = sym RS CONS_neq_NIL; |
70 val NIL_neq_CONS = sym RS CONS_neq_NIL; |
71 |
71 |
72 goalw SList.thy [Nil_def,Cons_def] "x # xs ~= Nil"; |
72 goalw SList.thy [Nil_def,Cons_def] "x # xs ~= Nil"; |
73 by (rtac (CONS_not_NIL RS (inj_onto_Abs_list RS inj_onto_contraD)) 1); |
73 by (rtac (CONS_not_NIL RS (inj_on_Abs_list RS inj_on_contraD)) 1); |
74 by (REPEAT (resolve_tac (list.intrs @ [rangeI, Rep_list]) 1)); |
74 by (REPEAT (resolve_tac (list.intrs @ [rangeI, Rep_list]) 1)); |
75 qed "Cons_not_Nil"; |
75 qed "Cons_not_Nil"; |
76 |
76 |
77 bind_thm ("Nil_not_Cons", Cons_not_Nil RS not_sym); |
77 bind_thm ("Nil_not_Cons", Cons_not_Nil RS not_sym); |
78 |
78 |
85 (*For reasoning about abstract list constructors*) |
85 (*For reasoning about abstract list constructors*) |
86 AddIs ([Rep_list] @ list.intrs); |
86 AddIs ([Rep_list] @ list.intrs); |
87 |
87 |
88 AddIffs [CONS_not_NIL, NIL_not_CONS, CONS_CONS_eq]; |
88 AddIffs [CONS_not_NIL, NIL_not_CONS, CONS_CONS_eq]; |
89 |
89 |
90 AddSDs [inj_onto_Abs_list RS inj_ontoD, |
90 AddSDs [inj_on_Abs_list RS inj_onD, |
91 inj_Rep_list RS injD, Leaf_inject]; |
91 inj_Rep_list RS injD, Leaf_inject]; |
92 |
92 |
93 goalw SList.thy [Cons_def] "(x#xs=y#ys) = (x=y & xs=ys)"; |
93 goalw SList.thy [Cons_def] "(x#xs=y#ys) = (x=y & xs=ys)"; |
94 by (Fast_tac 1); |
94 by (Fast_tac 1); |
95 qed "Cons_Cons_eq"; |
95 qed "Cons_Cons_eq"; |
344 goal SList.thy |
344 goal SList.thy |
345 "P(list_case a f xs) = ((xs=[] --> P(a)) & \ |
345 "P(list_case a f xs) = ((xs=[] --> P(a)) & \ |
346 \ (!y ys. xs=y#ys --> P(f y ys)))"; |
346 \ (!y ys. xs=y#ys --> P(f y ys)))"; |
347 by (list_ind_tac "xs" 1); |
347 by (list_ind_tac "xs" 1); |
348 by (ALLGOALS Asm_simp_tac); |
348 by (ALLGOALS Asm_simp_tac); |
349 qed "expand_list_case2"; |
349 qed "split_list_case2"; |
350 |
350 |
351 |
351 |
352 (** Additional mapping lemmas **) |
352 (** Additional mapping lemmas **) |
353 |
353 |
354 goal SList.thy "map (%x. x) xs = xs"; |
354 goal SList.thy "map (%x. x) xs = xs"; |