181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1 |
theory IntEx
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
2 |
imports QuotMain
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
3 |
begin
|
504
|
4 |
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
5 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
6 |
fun
|
281
|
7 |
intrel :: "(nat \<times> nat) \<Rightarrow> (nat \<times> nat) \<Rightarrow> bool" (infix "\<approx>" 50)
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
8 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
9 |
"intrel (x, y) (u, v) = (x + v = u + y)"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
10 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
11 |
quotient my_int = "nat \<times> nat" / intrel
|
529
|
12 |
apply(unfold equivp_def)
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
13 |
apply(auto simp add: mem_def expand_fun_eq)
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
14 |
done
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
15 |
|
506
|
16 |
thm quotient_thm
|
|
17 |
|
529
|
18 |
thm my_int_equivp
|
321
f46dc0ca08c3
simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
19 |
|
239
|
20 |
print_theorems
|
274
|
21 |
print_quotients
|
239
|
22 |
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
23 |
quotient_def
|
218
|
24 |
ZERO::"my_int"
|
|
25 |
where
|
|
26 |
"ZERO \<equiv> (0::nat, 0::nat)"
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
27 |
|
318
|
28 |
ML {* print_qconstinfo @{context} *}
|
|
29 |
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
30 |
term ZERO
|
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
31 |
thm ZERO_def
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
32 |
|
290
a0be84b0c707
removed typing information from get_fun in quotient_def; *potentially* dangerous
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
33 |
ML {* prop_of @{thm ZERO_def} *}
|
a0be84b0c707
removed typing information from get_fun in quotient_def; *potentially* dangerous
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
34 |
|
318
|
35 |
ML {* separate *}
|
|
36 |
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
37 |
quotient_def
|
218
|
38 |
ONE::"my_int"
|
193
|
39 |
where
|
218
|
40 |
"ONE \<equiv> (1::nat, 0::nat)"
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
41 |
|
318
|
42 |
ML {* print_qconstinfo @{context} *}
|
|
43 |
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
44 |
term ONE
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
45 |
thm ONE_def
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
46 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
47 |
fun
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
48 |
my_plus :: "(nat \<times> nat) \<Rightarrow> (nat \<times> nat) \<Rightarrow> (nat \<times> nat)"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
49 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
50 |
"my_plus (x, y) (u, v) = (x + u, y + v)"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
51 |
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
52 |
quotient_def
|
218
|
53 |
PLUS::"my_int \<Rightarrow> my_int \<Rightarrow> my_int"
|
|
54 |
where
|
275
|
55 |
"PLUS \<equiv> my_plus"
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
56 |
|
318
|
57 |
term my_plus
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
58 |
term PLUS
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
59 |
thm PLUS_def
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
60 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
61 |
fun
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
62 |
my_neg :: "(nat \<times> nat) \<Rightarrow> (nat \<times> nat)"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
63 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
64 |
"my_neg (x, y) = (y, x)"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
65 |
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
66 |
quotient_def
|
220
|
67 |
NEG::"my_int \<Rightarrow> my_int"
|
|
68 |
where
|
|
69 |
"NEG \<equiv> my_neg"
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
70 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
71 |
term NEG
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
72 |
thm NEG_def
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
73 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
74 |
definition
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
75 |
MINUS :: "my_int \<Rightarrow> my_int \<Rightarrow> my_int"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
76 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
77 |
"MINUS z w = PLUS z (NEG w)"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
78 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
79 |
fun
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
80 |
my_mult :: "(nat \<times> nat) \<Rightarrow> (nat \<times> nat) \<Rightarrow> (nat \<times> nat)"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
81 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
82 |
"my_mult (x, y) (u, v) = (x*u + y*v, x*v + y*u)"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
83 |
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
84 |
quotient_def
|
220
|
85 |
MULT::"my_int \<Rightarrow> my_int \<Rightarrow> my_int"
|
|
86 |
where
|
|
87 |
"MULT \<equiv> my_mult"
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
88 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
89 |
term MULT
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
90 |
thm MULT_def
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
91 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
92 |
(* NOT SURE WETHER THIS DEFINITION IS CORRECT *)
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
93 |
fun
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
94 |
my_le :: "(nat \<times> nat) \<Rightarrow> (nat \<times> nat) \<Rightarrow> bool"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
95 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
96 |
"my_le (x, y) (u, v) = (x+v \<le> u+y)"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
97 |
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
98 |
quotient_def
|
220
|
99 |
LE :: "my_int \<Rightarrow> my_int \<Rightarrow> bool"
|
|
100 |
where
|
|
101 |
"LE \<equiv> my_le"
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
102 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
103 |
term LE
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
104 |
thm LE_def
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
105 |
|
321
f46dc0ca08c3
simplified get_fun so that it uses directly rty and qty, instead of qenv
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
106 |
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
107 |
definition
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
108 |
LESS :: "my_int \<Rightarrow> my_int \<Rightarrow> bool"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
109 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
110 |
"LESS z w = (LE z w \<and> z \<noteq> w)"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
111 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
112 |
term LESS
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
113 |
thm LESS_def
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
114 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
115 |
definition
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
116 |
ABS :: "my_int \<Rightarrow> my_int"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
117 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
118 |
"ABS i = (if (LESS i ZERO) then (NEG i) else i)"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
119 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
120 |
definition
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
121 |
SIGN :: "my_int \<Rightarrow> my_int"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
122 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
123 |
"SIGN i = (if i = ZERO then ZERO else if (LESS ZERO i) then ONE else (NEG ONE))"
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
124 |
|
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
125 |
ML {* print_qconstinfo @{context} *}
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
126 |
|
199
|
127 |
lemma plus_sym_pre:
|
281
|
128 |
shows "my_plus a b \<approx> my_plus b a"
|
199
|
129 |
apply(cases a)
|
|
130 |
apply(cases b)
|
|
131 |
apply(auto)
|
|
132 |
done
|
|
133 |
|
506
|
134 |
lemma ho_plus_rsp[quotient_rsp]:
|
450
2dc708ddb93a
introduced a global list of respectfulness lemmas; the attribute is [quot_rsp]
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
135 |
shows "(intrel ===> intrel ===> intrel) my_plus my_plus"
|
2dc708ddb93a
introduced a global list of respectfulness lemmas; the attribute is [quot_rsp]
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
136 |
by (simp)
|
192
|
137 |
|
|
138 |
ML {* val qty = @{typ "my_int"} *}
|
239
|
139 |
ML {* val ty_name = "my_int" *}
|
458
|
140 |
ML {* val rsp_thms = @{thms ho_plus_rsp} *}
|
377
|
141 |
ML {* val (rty, rel, rel_refl, rel_eqv) = lookup_quot_data @{context} qty *}
|
|
142 |
ML {* val (trans2, reps_same, absrep, quot) = lookup_quot_thms @{context} "my_int"; *}
|
197
|
143 |
|
506
|
144 |
ML {* fun lift_tac_intex lthy t = lift_tac lthy t [rel_eqv] *}
|
423
2f0ad33f0241
annotated a proof with all steps and simplified LAMBDA_RES_TAC
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
145 |
|
506
|
146 |
ML {* fun inj_repabs_tac_intex lthy = inj_repabs_tac lthy [rel_refl] [trans2] *}
|
|
147 |
ML {* fun all_inj_repabs_tac_intex lthy = all_inj_repabs_tac lthy [rel_refl] [trans2] *}
|
423
2f0ad33f0241
annotated a proof with all steps and simplified LAMBDA_RES_TAC
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
148 |
|
2f0ad33f0241
annotated a proof with all steps and simplified LAMBDA_RES_TAC
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
149 |
|
377
|
150 |
lemma "PLUS a b = PLUS b a"
|
423
2f0ad33f0241
annotated a proof with all steps and simplified LAMBDA_RES_TAC
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
151 |
apply(tactic {* procedure_tac @{context} @{thm plus_sym_pre} 1 *})
|
432
|
152 |
apply(tactic {* regularize_tac @{context} [rel_eqv] 1 *})
|
423
2f0ad33f0241
annotated a proof with all steps and simplified LAMBDA_RES_TAC
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
153 |
prefer 2
|
506
|
154 |
apply(tactic {* clean_tac @{context} 1 *})
|
445
|
155 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
156 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
157 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
158 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
159 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
160 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
161 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
162 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
163 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
164 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
165 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
166 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
167 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
168 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
169 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
170 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
171 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
172 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
173 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
174 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
175 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
176 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
|
177 |
apply(tactic {* inj_repabs_tac_intex @{context} 1*})
|
423
2f0ad33f0241
annotated a proof with all steps and simplified LAMBDA_RES_TAC
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
178 |
done
|
342
|
179 |
|
198
|
180 |
lemma plus_assoc_pre:
|
281
|
181 |
shows "my_plus (my_plus i j) k \<approx> my_plus i (my_plus j k)"
|
198
|
182 |
apply (cases i)
|
|
183 |
apply (cases j)
|
|
184 |
apply (cases k)
|
224
|
185 |
apply (simp)
|
198
|
186 |
done
|
|
187 |
|
377
|
188 |
lemma plus_assoc: "PLUS (PLUS x xa) xb = PLUS x (PLUS xa xb)"
|
423
2f0ad33f0241
annotated a proof with all steps and simplified LAMBDA_RES_TAC
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
189 |
apply(tactic {* procedure_tac @{context} @{thm plus_assoc_pre} 1 *})
|
432
|
190 |
apply(tactic {* regularize_tac @{context} [rel_eqv] 1 *})
|
445
|
191 |
apply(tactic {* all_inj_repabs_tac_intex @{context} 1*})
|
506
|
192 |
apply(tactic {* clean_tac @{context} 1 *})
|
423
2f0ad33f0241
annotated a proof with all steps and simplified LAMBDA_RES_TAC
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
193 |
done
|
354
2eb6d527dfe4
addded a tactic, which sets up the three goals of the `algorithm'
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
194 |
|
379
|
195 |
lemma ho_tst: "foldl my_plus x [] = x"
|
|
196 |
apply simp
|
|
197 |
done
|
|
198 |
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
199 |
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
200 |
lemma foldr_prs:
|
529
|
201 |
assumes a: "Quotient R1 abs1 rep1"
|
|
202 |
and b: "Quotient R2 abs2 rep2"
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
203 |
shows "abs2 (foldr ((abs1 ---> abs2 ---> rep2) f) (map rep1 l) (rep2 e)) = foldr f l e"
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
204 |
apply (induct l)
|
529
|
205 |
apply (simp add: Quotient_ABS_REP[OF b])
|
|
206 |
apply (simp add: Quotient_ABS_REP[OF a] Quotient_ABS_REP[OF b])
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
207 |
done
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
208 |
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
209 |
lemma foldl_prs:
|
529
|
210 |
assumes a: "Quotient R1 abs1 rep1"
|
|
211 |
and b: "Quotient R2 abs2 rep2"
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
212 |
shows "abs1 (foldl ((abs1 ---> abs2 ---> rep1) f) (rep1 e) (map rep2 l)) = foldl f e l"
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
213 |
apply (induct l arbitrary:e)
|
529
|
214 |
apply (simp add: Quotient_ABS_REP[OF a])
|
|
215 |
apply (simp add: Quotient_ABS_REP[OF a] Quotient_ABS_REP[OF b])
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
216 |
done
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
217 |
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
218 |
lemma map_prs:
|
529
|
219 |
assumes a: "Quotient R1 abs1 rep1"
|
|
220 |
and b: "Quotient R2 abs2 rep2"
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
221 |
shows "(map abs2) (map ((abs1 ---> rep2) f) (map rep1 l)) = map f l"
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
222 |
apply (induct l)
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
223 |
apply (simp)
|
529
|
224 |
apply (simp add: Quotient_ABS_REP[OF a] Quotient_ABS_REP[OF b])
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
225 |
done
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
226 |
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
227 |
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
228 |
(* Removed unneeded assumption: "QUOTIENT R abs1 rep1" *)
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
229 |
lemma nil_prs:
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
230 |
shows "map abs1 [] = []"
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
231 |
by simp
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
232 |
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
233 |
lemma cons_prs:
|
529
|
234 |
assumes a: "Quotient R1 abs1 rep1"
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
235 |
shows "(map abs1) ((rep1 h) # (map rep1 t)) = h # t"
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
236 |
apply (induct t)
|
529
|
237 |
by (simp_all add: Quotient_ABS_REP[OF a])
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
238 |
|
506
|
239 |
lemma cons_rsp[quotient_rsp]:
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
240 |
"(op \<approx> ===> LIST_REL op \<approx> ===> LIST_REL op \<approx>) op # op #"
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
241 |
by simp
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
242 |
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
243 |
(* I believe it's true. *)
|
506
|
244 |
lemma foldl_rsp[quotient_rsp]:
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
245 |
"((op \<approx> ===> op \<approx> ===> op \<approx>) ===> op \<approx> ===> LIST_REL op \<approx> ===> op \<approx>) foldl foldl"
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
246 |
apply (simp only: FUN_REL.simps)
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
247 |
apply (rule allI)
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
248 |
apply (rule allI)
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
249 |
apply (rule impI)
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
250 |
apply (rule allI)
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
251 |
apply (rule allI)
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
252 |
apply (rule impI)
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
253 |
apply (rule allI)
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
254 |
apply (rule allI)
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
255 |
apply (rule impI)
|
489
|
256 |
apply (induct_tac xb yb rule: list_induct2) (* To finish I need to give it: arbitrary:xa ya *)
|
414
|
257 |
sorry
|
|
258 |
|
506
|
259 |
lemma nil_listrel_rsp[quotient_rsp]:
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
260 |
"(LIST_REL R) [] []"
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
261 |
by simp
|
416
3f3927f793d4
Removing arguments of tactics: absrep, rel_refl, reps_same are computed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
262 |
|
379
|
263 |
lemma "foldl PLUS x [] = x"
|
445
|
264 |
apply(tactic {* procedure_tac @{context} @{thm ho_tst} 1 *})
|
|
265 |
apply(tactic {* regularize_tac @{context} [rel_eqv] 1 *})
|
|
266 |
apply(tactic {* all_inj_repabs_tac_intex @{context} 1*})
|
529
|
267 |
apply(simp only: foldl_prs[OF Quotient_my_int Quotient_my_int])
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
268 |
apply(simp only: nil_prs)
|
506
|
269 |
apply(tactic {* clean_tac @{context} 1 *})
|
423
2f0ad33f0241
annotated a proof with all steps and simplified LAMBDA_RES_TAC
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
270 |
done
|
359
|
271 |
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
272 |
lemma ho_tst2: "foldl my_plus x (h # t) \<approx> my_plus h (foldl my_plus x t)"
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
273 |
sorry
|
327
22c8bf90cadb
tried to prove the repabs_inj lemma, but failed for the moment
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
274 |
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
275 |
lemma "foldl PLUS x (h # t) = PLUS h (foldl PLUS x t)"
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
276 |
apply(tactic {* procedure_tac @{context} @{thm ho_tst2} 1 *})
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
277 |
apply(tactic {* regularize_tac @{context} [rel_eqv] 1 *})
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
278 |
apply(tactic {* all_inj_repabs_tac_intex @{context} 1*})
|
529
|
279 |
apply(simp only: foldl_prs[OF Quotient_my_int Quotient_my_int])
|
|
280 |
apply(simp only: cons_prs[OF Quotient_my_int])
|
506
|
281 |
apply(tactic {* clean_tac @{context} 1 *})
|
485
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
282 |
done
|
4efb104514f7
More experiments with higher order quotients and theorems with non-lifted constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
283 |
|