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
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
4 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
5 |
fun
|
281
|
6 |
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
|
7 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
8 |
"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
|
9 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
10 |
quotient my_int = "nat \<times> nat" / intrel
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
11 |
apply(unfold EQUIV_def)
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
12 |
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
|
13 |
done
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
14 |
|
239
|
15 |
print_theorems
|
274
|
16 |
print_quotients
|
239
|
17 |
|
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
|
18 |
quotient_def
|
218
|
19 |
ZERO::"my_int"
|
|
20 |
where
|
|
21 |
"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
|
22 |
|
318
|
23 |
ML {* print_qconstinfo @{context} *}
|
|
24 |
|
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
|
25 |
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
|
26 |
thm ZERO_def
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
27 |
|
290
a0be84b0c707
removed typing information from get_fun in quotient_def; *potentially* dangerous
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
28 |
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
|
29 |
|
318
|
30 |
ML {* separate *}
|
|
31 |
|
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
|
32 |
quotient_def
|
218
|
33 |
ONE::"my_int"
|
193
|
34 |
where
|
218
|
35 |
"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
|
36 |
|
318
|
37 |
ML {* print_qconstinfo @{context} *}
|
|
38 |
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
39 |
term ONE
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
40 |
thm ONE_def
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
41 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
42 |
fun
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
43 |
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
|
44 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
45 |
"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
|
46 |
|
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
|
47 |
quotient_def
|
218
|
48 |
PLUS::"my_int \<Rightarrow> my_int \<Rightarrow> my_int"
|
|
49 |
where
|
275
|
50 |
"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
|
51 |
|
318
|
52 |
term my_plus
|
181
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
53 |
term PLUS
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
54 |
thm PLUS_def
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
55 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
56 |
fun
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
57 |
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
|
58 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
59 |
"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
|
60 |
|
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
|
61 |
quotient_def
|
220
|
62 |
NEG::"my_int \<Rightarrow> my_int"
|
|
63 |
where
|
|
64 |
"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
|
65 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
66 |
term NEG
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
67 |
thm NEG_def
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
68 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
69 |
definition
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
70 |
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
|
71 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
72 |
"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
|
73 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
74 |
fun
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
75 |
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
|
76 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
77 |
"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
|
78 |
|
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
|
79 |
quotient_def
|
220
|
80 |
MULT::"my_int \<Rightarrow> my_int \<Rightarrow> my_int"
|
|
81 |
where
|
|
82 |
"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
|
83 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
84 |
term MULT
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
85 |
thm MULT_def
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
86 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
87 |
(* 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
|
88 |
fun
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
89 |
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
|
90 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
91 |
"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
|
92 |
|
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
|
93 |
quotient_def
|
220
|
94 |
LE :: "my_int \<Rightarrow> my_int \<Rightarrow> bool"
|
|
95 |
where
|
|
96 |
"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
|
97 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
98 |
term LE
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
99 |
thm LE_def
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
100 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
101 |
definition
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
102 |
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
|
103 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
104 |
"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
|
105 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
106 |
term LESS
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
107 |
thm LESS_def
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
108 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
109 |
definition
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
110 |
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
|
111 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
112 |
"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
|
113 |
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
114 |
definition
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
115 |
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
|
116 |
where
|
3e53081ad53a
added another example file about integers (see HOL/Int.thy)
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
117 |
"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
|
118 |
|
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
119 |
ML {* print_qconstinfo @{context} *}
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
120 |
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
121 |
ML {* print_qconstinfo @{context} *}
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
122 |
|
199
|
123 |
lemma plus_sym_pre:
|
281
|
124 |
shows "my_plus a b \<approx> my_plus b a"
|
199
|
125 |
apply(cases a)
|
|
126 |
apply(cases b)
|
|
127 |
apply(auto)
|
|
128 |
done
|
|
129 |
|
206
|
130 |
lemma ho_plus_rsp:
|
228
|
131 |
"(intrel ===> intrel ===> intrel) my_plus my_plus"
|
192
|
132 |
by (simp)
|
|
133 |
|
|
134 |
ML {* val qty = @{typ "my_int"} *}
|
239
|
135 |
ML {* val ty_name = "my_int" *}
|
192
|
136 |
ML {* val rsp_thms = @{thms ho_plus_rsp} @ @{thms ho_all_prs ho_ex_prs} *}
|
260
59578f428bbe
Fixes after optimization and preparing for a general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
137 |
ML {* val defs = @{thms PLUS_def} *}
|
197
|
138 |
|
198
|
139 |
ML {*
|
|
140 |
fun lift_thm_my_int lthy t =
|
260
59578f428bbe
Fixes after optimization and preparing for a general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
141 |
lift_thm lthy qty ty_name rsp_thms defs t
|
239
|
142 |
*}
|
|
143 |
|
312
4cf79f70efec
looking up data in quot_info works now (needs qualified string)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
144 |
print_quotients
|
320
7d3d86beacd6
started regularize of rtrm/qtrm version; looks quite promising
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
145 |
ML {* quotdata_lookup @{context} "IntEx.my_int" *}
|
7d3d86beacd6
started regularize of rtrm/qtrm version; looks quite promising
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
146 |
ML {* quotdata_lookup @{context} "my_int" *}
|
312
4cf79f70efec
looking up data in quot_info works now (needs qualified string)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
147 |
|
319
|
148 |
ML {*
|
|
149 |
val test = lift_thm_my_int @{context} @{thm plus_sym_pre}
|
|
150 |
*}
|
|
151 |
|
|
152 |
|
|
153 |
ML {*
|
320
7d3d86beacd6
started regularize of rtrm/qtrm version; looks quite promising
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
154 |
val aqtrm = HOLogic.dest_Trueprop (prop_of (atomize_thm test))
|
7d3d86beacd6
started regularize of rtrm/qtrm version; looks quite promising
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
155 |
val artrm = HOLogic.dest_Trueprop (prop_of (atomize_thm @{thm plus_sym_pre}))
|
319
|
156 |
*}
|
198
|
157 |
|
320
7d3d86beacd6
started regularize of rtrm/qtrm version; looks quite promising
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
158 |
|
198
|
159 |
lemma plus_assoc_pre:
|
281
|
160 |
shows "my_plus (my_plus i j) k \<approx> my_plus i (my_plus j k)"
|
198
|
161 |
apply (cases i)
|
|
162 |
apply (cases j)
|
|
163 |
apply (cases k)
|
224
|
164 |
apply (simp)
|
198
|
165 |
done
|
|
166 |
|
224
|
167 |
ML {* lift_thm_my_int @{context} @{thm plus_assoc_pre} *}
|
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
|
|
172 |
|
197
|
173 |
|
191
|
174 |
|
224
|
175 |
|
281
|
176 |
lemma ho_tst: "foldl my_plus x [] = x"
|
|
177 |
apply simp
|
|
178 |
done
|
276
|
179 |
|
224
|
180 |
text {* Below is the construction site code used if things do not work *}
|
276
|
181 |
ML {* val (rty, rel, rel_refl, rel_eqv) = lookup_quot_data @{context} qty *}
|
|
182 |
ML {* val (trans2, reps_same, absrep, quot) = lookup_quot_thms @{context} "my_int" *}
|
|
183 |
(* ML {* val consts = [@{const_name my_plus}] *}*)
|
260
59578f428bbe
Fixes after optimization and preparing for a general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
184 |
ML {* val consts = lookup_quot_consts defs *}
|
276
|
185 |
ML {* val t_a = atomize_thm @{thm ho_tst} *}
|
281
|
186 |
|
286
|
187 |
(*
|
|
188 |
prove t_r: {* build_regularize_goal t_a rty rel @{context} *}
|
276
|
189 |
ML_prf {* fun tac ctxt =
|
|
190 |
(ObjectLogic.full_atomize_tac) THEN'
|
|
191 |
REPEAT_ALL_NEW (FIRST' [
|
|
192 |
rtac rel_refl,
|
|
193 |
atac,
|
|
194 |
rtac @{thm universal_twice},
|
|
195 |
(rtac @{thm impI} THEN' atac),
|
|
196 |
(*rtac @{thm equality_twice},*)
|
|
197 |
EqSubst.eqsubst_tac ctxt [0]
|
|
198 |
[(@{thm equiv_res_forall} OF [rel_eqv]),
|
|
199 |
(@{thm equiv_res_exists} OF [rel_eqv])],
|
|
200 |
(rtac @{thm impI} THEN' (asm_full_simp_tac (Simplifier.context ctxt HOL_ss)) THEN' rtac rel_refl),
|
|
201 |
(rtac @{thm RIGHT_RES_FORALL_REGULAR})
|
|
202 |
]);*}
|
|
203 |
apply (atomize(full))
|
|
204 |
apply (tactic {* tac @{context} 1 *})
|
|
205 |
apply (auto)
|
281
|
206 |
done
|
|
207 |
ML {* val t_r = @{thm t_r} OF [t_a] *}*)
|
|
208 |
ML {* val t_r = regularize t_a rty rel rel_eqv rel_refl @{context} *}
|
|
209 |
ML {*
|
|
210 |
val rt = build_repabs_term @{context} t_r consts rty qty
|
|
211 |
val rg = Logic.mk_equals ((Thm.prop_of t_r), rt);
|
|
212 |
*}
|
286
|
213 |
*)
|
281
|
214 |
|
|
215 |
lemma foldl_rsp:
|
|
216 |
"((IntEx.intrel ===> IntEx.intrel ===> IntEx.intrel) ===>
|
|
217 |
IntEx.intrel ===> op = ===> IntEx.intrel)
|
|
218 |
foldl foldl"
|
|
219 |
apply (simp only:FUN_REL.simps)
|
|
220 |
apply (rule allI)
|
|
221 |
apply (rule allI)
|
|
222 |
apply (rule impI)
|
|
223 |
apply (rule allI)
|
|
224 |
apply (rule allI)
|
|
225 |
apply (rule impI)
|
|
226 |
apply (rule allI)
|
|
227 |
apply (rule allI)
|
|
228 |
apply (rule impI)
|
|
229 |
apply (simp only:)
|
|
230 |
apply (rule list.induct)
|
|
231 |
apply (simp)
|
|
232 |
apply (simp only: foldl.simps)
|
|
233 |
sorry
|
|
234 |
|
|
235 |
ML {* val rsp_thms = @{thm foldl_rsp} :: rsp_thms *}
|
|
236 |
prove t_t: rg
|
|
237 |
apply(atomize(full))
|
|
238 |
ML_prf {* fun r_mk_comb_tac_int lthy = r_mk_comb_tac lthy rty quot rel_refl trans2 rsp_thms *}
|
|
239 |
apply (tactic {* REPEAT_ALL_NEW (r_mk_comb_tac_int @{context}) 1 *})
|
|
240 |
done
|
|
241 |
ML {* val t_t = @{thm Pure.equal_elim_rule1} OF [@{thm t_t},t_r] *}
|
|
242 |
ML {* val abs = findabs rty (prop_of t_a) *}
|
|
243 |
ML {* val aps = findaps rty (prop_of t_a); *}
|
|
244 |
ML {* val simp_lam_prs_thms = map (make_simp_prs_thm @{context} quot @{thm LAMBDA_PRS}) abs *}
|
|
245 |
|
305
|
246 |
(*ML {* val t_t = repabs @{context} @{thm t_r} consts rty qty quot rel_refl trans2 rsp_thms *}*)
|
276
|
247 |
ML {* val (alls, exs) = findallex rty qty (prop_of t_a) *}
|
|
248 |
ML {* val allthms = map (make_allex_prs_thm @{context} quot @{thm FORALL_PRS}) alls *}
|
|
249 |
ML {* val t_a = MetaSimplifier.rewrite_rule (allthms) t_t *}
|
|
250 |
ML {* val t_l = repeat_eqsubst_thm @{context} simp_lam_prs_thms t_a *}
|
281
|
251 |
ML {* val defs_sym = add_lower_defs @{context} defs *}
|
276
|
252 |
ML {* val t_d = repeat_eqsubst_thm @{context} defs_sym t_l *}
|
197
|
253 |
ML {* val t_r = MetaSimplifier.rewrite_rule [reps_same] t_d *}
|
191
|
254 |
ML {* ObjectLogic.rulify t_r *}
|