author | boehmes |
Wed, 15 Dec 2010 08:39:24 +0100 | |
changeset 41123 | 3bb9be510a9d |
parent 40579 | 98ebd2300823 |
child 41172 | a17c2d669c40 |
permissions | -rw-r--r-- |
36898 | 1 |
(* Title: HOL/Tools/SMT/z3_proof_literals.ML |
2 |
Author: Sascha Boehme, TU Muenchen |
|
3 |
||
4 |
Proof tools related to conjunctions and disjunctions. |
|
5 |
*) |
|
6 |
||
7 |
signature Z3_PROOF_LITERALS = |
|
8 |
sig |
|
41123 | 9 |
(*literal table*) |
36898 | 10 |
type littab = thm Termtab.table |
11 |
val make_littab: thm list -> littab |
|
12 |
val insert_lit: thm -> littab -> littab |
|
13 |
val delete_lit: thm -> littab -> littab |
|
14 |
val lookup_lit: littab -> term -> thm option |
|
15 |
val get_first_lit: (term -> bool) -> littab -> thm option |
|
16 |
||
41123 | 17 |
(*rules*) |
36898 | 18 |
val true_thm: thm |
19 |
val rewrite_true: thm |
|
20 |
||
41123 | 21 |
(*properties*) |
36898 | 22 |
val is_conj: term -> bool |
23 |
val is_disj: term -> bool |
|
24 |
val exists_lit: bool -> (term -> bool) -> term -> bool |
|
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
25 |
val negate: cterm -> cterm |
36898 | 26 |
|
41123 | 27 |
(*proof tools*) |
36898 | 28 |
val explode: bool -> bool -> bool -> term list -> thm -> thm list |
29 |
val join: bool -> littab -> term -> thm |
|
30 |
val prove_conj_disj_eq: cterm -> thm |
|
31 |
end |
|
32 |
||
33 |
structure Z3_Proof_Literals: Z3_PROOF_LITERALS = |
|
34 |
struct |
|
35 |
||
36 |
structure T = Z3_Proof_Tools |
|
37 |
||
38 |
||
39 |
||
41123 | 40 |
(* literal table *) |
36898 | 41 |
|
42 |
type littab = thm Termtab.table |
|
43 |
||
44 |
fun make_littab thms = fold (Termtab.update o `T.prop_of) thms Termtab.empty |
|
45 |
||
46 |
fun insert_lit thm = Termtab.update (`T.prop_of thm) |
|
47 |
fun delete_lit thm = Termtab.delete (T.prop_of thm) |
|
48 |
fun lookup_lit lits = Termtab.lookup lits |
|
49 |
fun get_first_lit f = |
|
50 |
Termtab.get_first (fn (t, thm) => if f t then SOME thm else NONE) |
|
51 |
||
52 |
||
53 |
||
41123 | 54 |
(* rules *) |
36898 | 55 |
|
56 |
val true_thm = @{lemma "~False" by simp} |
|
57 |
val rewrite_true = @{lemma "True == ~ False" by simp} |
|
58 |
||
59 |
||
60 |
||
41123 | 61 |
(* properties and term operations *) |
36898 | 62 |
|
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
63 |
val is_neg = (fn @{const Not} $ _ => true | _ => false) |
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
64 |
fun is_neg' f = (fn @{const Not} $ t => f t | _ => false) |
36898 | 65 |
val is_dneg = is_neg' is_neg |
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
66 |
val is_conj = (fn @{const HOL.conj} $ _ $ _ => true | _ => false) |
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
67 |
val is_disj = (fn @{const HOL.disj} $ _ $ _ => true | _ => false) |
36898 | 68 |
|
69 |
fun dest_disj_term' f = (fn |
|
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
70 |
@{const Not} $ (@{const HOL.disj} $ t $ u) => SOME (f t, f u) |
36898 | 71 |
| _ => NONE) |
72 |
||
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
73 |
val dest_conj_term = (fn @{const HOL.conj} $ t $ u => SOME (t, u) | _ => NONE) |
36898 | 74 |
val dest_disj_term = |
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
75 |
dest_disj_term' (fn @{const Not} $ t => t | t => @{const Not} $ t) |
36898 | 76 |
|
77 |
fun exists_lit is_conj P = |
|
78 |
let |
|
79 |
val dest = if is_conj then dest_conj_term else dest_disj_term |
|
80 |
fun exists t = P t orelse |
|
81 |
(case dest t of |
|
82 |
SOME (t1, t2) => exists t1 orelse exists t2 |
|
83 |
| NONE => false) |
|
84 |
in exists end |
|
85 |
||
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
86 |
val negate = Thm.capply (Thm.cterm_of @{theory} @{const Not}) |
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
87 |
|
36898 | 88 |
|
89 |
||
41123 | 90 |
(* proof tools *) |
36898 | 91 |
|
41123 | 92 |
(** explosion of conjunctions and disjunctions **) |
36898 | 93 |
|
94 |
local |
|
95 |
fun destc ct = Thm.dest_binop (Thm.dest_arg ct) |
|
96 |
val dest_conj1 = T.precompose2 destc @{thm conjunct1} |
|
97 |
val dest_conj2 = T.precompose2 destc @{thm conjunct2} |
|
98 |
fun dest_conj_rules t = |
|
99 |
dest_conj_term t |> Option.map (K (dest_conj1, dest_conj2)) |
|
100 |
||
101 |
fun destd f ct = f (Thm.dest_binop (Thm.dest_arg (Thm.dest_arg ct))) |
|
102 |
val dn1 = apfst Thm.dest_arg and dn2 = apsnd Thm.dest_arg |
|
103 |
val dest_disj1 = T.precompose2 (destd I) @{lemma "~(P | Q) ==> ~P" by fast} |
|
104 |
val dest_disj2 = T.precompose2 (destd dn1) @{lemma "~(~P | Q) ==> P" by fast} |
|
105 |
val dest_disj3 = T.precompose2 (destd I) @{lemma "~(P | Q) ==> ~Q" by fast} |
|
106 |
val dest_disj4 = T.precompose2 (destd dn2) @{lemma "~(P | ~Q) ==> Q" by fast} |
|
107 |
||
108 |
fun dest_disj_rules t = |
|
109 |
(case dest_disj_term' is_neg t of |
|
110 |
SOME (true, true) => SOME (dest_disj2, dest_disj4) |
|
111 |
| SOME (true, false) => SOME (dest_disj2, dest_disj3) |
|
112 |
| SOME (false, true) => SOME (dest_disj1, dest_disj4) |
|
113 |
| SOME (false, false) => SOME (dest_disj1, dest_disj3) |
|
114 |
| NONE => NONE) |
|
115 |
||
116 |
fun destn ct = [Thm.dest_arg (Thm.dest_arg (Thm.dest_arg ct))] |
|
117 |
val dneg_rule = T.precompose destn @{thm notnotD} |
|
118 |
in |
|
119 |
||
41123 | 120 |
(* |
121 |
explode a term into literals and collect all rules to be able to deduce |
|
122 |
particular literals afterwards |
|
123 |
*) |
|
36898 | 124 |
fun explode_term is_conj = |
125 |
let |
|
126 |
val dest = if is_conj then dest_conj_term else dest_disj_term |
|
127 |
val dest_rules = if is_conj then dest_conj_rules else dest_disj_rules |
|
128 |
||
129 |
fun add (t, rs) = Termtab.map_default (t, rs) |
|
130 |
(fn rs' => if length rs' < length rs then rs' else rs) |
|
131 |
||
132 |
fun explode1 rules t = |
|
133 |
(case dest t of |
|
134 |
SOME (t1, t2) => |
|
135 |
let val (rule1, rule2) = the (dest_rules t) |
|
136 |
in |
|
137 |
explode1 (rule1 :: rules) t1 #> |
|
138 |
explode1 (rule2 :: rules) t2 #> |
|
139 |
add (t, rev rules) |
|
140 |
end |
|
141 |
| NONE => add (t, rev rules)) |
|
142 |
||
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
143 |
fun explode0 (@{const Not} $ (@{const Not} $ t)) = |
36898 | 144 |
Termtab.make [(t, [dneg_rule])] |
145 |
| explode0 t = explode1 [] t Termtab.empty |
|
146 |
||
147 |
in explode0 end |
|
148 |
||
41123 | 149 |
(* |
150 |
extract a literal by applying previously collected rules |
|
151 |
*) |
|
36898 | 152 |
fun extract_lit thm rules = fold T.compose rules thm |
153 |
||
154 |
||
41123 | 155 |
(* |
156 |
explode a theorem into its literals |
|
157 |
*) |
|
36898 | 158 |
fun explode is_conj full keep_intermediate stop_lits = |
159 |
let |
|
160 |
val dest_rules = if is_conj then dest_conj_rules else dest_disj_rules |
|
161 |
val tab = fold (Termtab.update o rpair ()) stop_lits Termtab.empty |
|
162 |
||
163 |
fun explode1 thm = |
|
164 |
if Termtab.defined tab (T.prop_of thm) then cons thm |
|
165 |
else |
|
166 |
(case dest_rules (T.prop_of thm) of |
|
167 |
SOME (rule1, rule2) => |
|
168 |
explode2 rule1 thm #> |
|
169 |
explode2 rule2 thm #> |
|
170 |
keep_intermediate ? cons thm |
|
171 |
| NONE => cons thm) |
|
172 |
||
173 |
and explode2 dest_rule thm = |
|
174 |
if full orelse exists_lit is_conj (Termtab.defined tab) (T.prop_of thm) |
|
175 |
then explode1 (T.compose dest_rule thm) |
|
176 |
else cons (T.compose dest_rule thm) |
|
177 |
||
178 |
fun explode0 thm = |
|
179 |
if not is_conj andalso is_dneg (T.prop_of thm) |
|
180 |
then [T.compose dneg_rule thm] |
|
181 |
else explode1 thm [] |
|
182 |
||
183 |
in explode0 end |
|
184 |
||
185 |
end |
|
186 |
||
187 |
||
188 |
||
41123 | 189 |
(** joining of literals to conjunctions or disjunctions **) |
36898 | 190 |
|
191 |
local |
|
192 |
fun on_cprem i f thm = f (Thm.cprem_of thm i) |
|
193 |
fun on_cprop f thm = f (Thm.cprop_of thm) |
|
194 |
fun precomp2 f g thm = (on_cprem 1 f thm, on_cprem 2 g thm, f, g, thm) |
|
195 |
fun comp2 (cv1, cv2, f, g, rule) thm1 thm2 = |
|
196 |
Thm.instantiate ([], [(cv1, on_cprop f thm1), (cv2, on_cprop g thm2)]) rule |
|
197 |
|> T.discharge thm1 |> T.discharge thm2 |
|
198 |
||
199 |
fun d1 ct = Thm.dest_arg ct and d2 ct = Thm.dest_arg (Thm.dest_arg ct) |
|
200 |
||
201 |
val conj_rule = precomp2 d1 d1 @{thm conjI} |
|
202 |
fun comp_conj ((_, thm1), (_, thm2)) = comp2 conj_rule thm1 thm2 |
|
203 |
||
204 |
val disj1 = precomp2 d2 d2 @{lemma "~P ==> ~Q ==> ~(P | Q)" by fast} |
|
205 |
val disj2 = precomp2 d2 d1 @{lemma "~P ==> Q ==> ~(P | ~Q)" by fast} |
|
206 |
val disj3 = precomp2 d1 d2 @{lemma "P ==> ~Q ==> ~(~P | Q)" by fast} |
|
207 |
val disj4 = precomp2 d1 d1 @{lemma "P ==> Q ==> ~(~P | ~Q)" by fast} |
|
208 |
||
209 |
fun comp_disj ((false, thm1), (false, thm2)) = comp2 disj1 thm1 thm2 |
|
210 |
| comp_disj ((false, thm1), (true, thm2)) = comp2 disj2 thm1 thm2 |
|
211 |
| comp_disj ((true, thm1), (false, thm2)) = comp2 disj3 thm1 thm2 |
|
212 |
| comp_disj ((true, thm1), (true, thm2)) = comp2 disj4 thm1 thm2 |
|
213 |
||
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
214 |
fun dest_conj (@{const HOL.conj} $ t $ u) = ((false, t), (false, u)) |
36898 | 215 |
| dest_conj t = raise TERM ("dest_conj", [t]) |
216 |
||
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
217 |
val neg = (fn @{const Not} $ t => (true, t) | t => (false, @{const Not} $ t)) |
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
218 |
fun dest_disj (@{const Not} $ (@{const HOL.disj} $ t $ u)) = (neg t, neg u) |
36898 | 219 |
| dest_disj t = raise TERM ("dest_disj", [t]) |
220 |
||
221 |
val dnegE = T.precompose (single o d2 o d1) @{thm notnotD} |
|
222 |
val dnegI = T.precompose (single o d1) @{lemma "P ==> ~~P" by fast} |
|
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
223 |
fun as_dneg f t = f (@{const Not} $ (@{const Not} $ t)) |
36898 | 224 |
|
225 |
fun dni f = apsnd f o Thm.dest_binop o f o d1 |
|
226 |
val negIffE = T.precompose2 (dni d1) @{lemma "~(P = (~Q)) ==> Q = P" by fast} |
|
227 |
val negIffI = T.precompose2 (dni I) @{lemma "P = Q ==> ~(Q = (~P))" by fast} |
|
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
228 |
val iff_const = @{const HOL.eq (bool)} |
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
229 |
fun as_negIff f (@{const HOL.eq (bool)} $ t $ u) = |
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
230 |
f (@{const Not} $ (iff_const $ u $ (@{const Not} $ t))) |
36898 | 231 |
| as_negIff _ _ = NONE |
232 |
in |
|
233 |
||
234 |
fun join is_conj littab t = |
|
235 |
let |
|
236 |
val comp = if is_conj then comp_conj else comp_disj |
|
237 |
val dest = if is_conj then dest_conj else dest_disj |
|
238 |
||
239 |
val lookup = lookup_lit littab |
|
240 |
||
241 |
fun lookup_rule t = |
|
242 |
(case t of |
|
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
243 |
@{const Not} $ (@{const Not} $ t) => (T.compose dnegI, lookup t) |
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
244 |
| @{const Not} $ (@{const HOL.eq (bool)} $ t $ (@{const Not} $ u)) => |
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
245 |
(T.compose negIffI, lookup (iff_const $ u $ t)) |
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
246 |
| @{const Not} $ ((eq as Const (@{const_name HOL.eq}, _)) $ t $ u) => |
36898 | 247 |
let fun rewr lit = lit COMP @{thm not_sym} |
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
248 |
in (rewr, lookup (@{const Not} $ (eq $ u $ t))) end |
36898 | 249 |
| _ => |
250 |
(case as_dneg lookup t of |
|
251 |
NONE => (T.compose negIffE, as_negIff lookup t) |
|
252 |
| x => (T.compose dnegE, x))) |
|
253 |
||
254 |
fun join1 (s, t) = |
|
255 |
(case lookup t of |
|
256 |
SOME lit => (s, lit) |
|
257 |
| NONE => |
|
258 |
(case lookup_rule t of |
|
259 |
(rewrite, SOME lit) => (s, rewrite lit) |
|
260 |
| (_, NONE) => (s, comp (pairself join1 (dest t))))) |
|
261 |
||
262 |
in snd (join1 (if is_conj then (false, t) else (true, t))) end |
|
263 |
||
264 |
end |
|
265 |
||
266 |
||
267 |
||
41123 | 268 |
(** proving equality of conjunctions or disjunctions **) |
36898 | 269 |
|
270 |
fun iff_intro thm1 thm2 = thm2 COMP (thm1 COMP @{thm iffI}) |
|
271 |
||
272 |
local |
|
273 |
val cp1 = @{lemma "(~P) = (~Q) ==> P = Q" by simp} |
|
274 |
val cp2 = @{lemma "(~P) = Q ==> P = (~Q)" by fastsimp} |
|
275 |
val cp3 = @{lemma "P = (~Q) ==> (~P) = Q" by simp} |
|
276 |
in |
|
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
277 |
fun contrapos1 prove (ct, cu) = prove (negate ct, negate cu) COMP cp1 |
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
278 |
fun contrapos2 prove (ct, cu) = prove (negate ct, Thm.dest_arg cu) COMP cp2 |
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
279 |
fun contrapos3 prove (ct, cu) = prove (Thm.dest_arg ct, negate cu) COMP cp3 |
36898 | 280 |
end |
281 |
||
282 |
||
283 |
local |
|
284 |
val contra_rule = @{lemma "P ==> ~P ==> False" by (rule notE)} |
|
285 |
fun contra_left conj thm = |
|
286 |
let |
|
287 |
val rules = explode_term conj (T.prop_of thm) |
|
288 |
fun contra_lits (t, rs) = |
|
289 |
(case t of |
|
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
290 |
@{const Not} $ u => Termtab.lookup rules u |> Option.map (pair rs) |
36898 | 291 |
| _ => NONE) |
292 |
in |
|
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
293 |
(case Termtab.lookup rules @{const False} of |
36898 | 294 |
SOME rs => extract_lit thm rs |
295 |
| NONE => |
|
296 |
the (Termtab.get_first contra_lits rules) |
|
297 |
|> pairself (extract_lit thm) |
|
298 |
|> (fn (nlit, plit) => nlit COMP (plit COMP contra_rule))) |
|
299 |
end |
|
300 |
||
301 |
val falseE_v = Thm.dest_arg (Thm.dest_arg (Thm.cprop_of @{thm FalseE})) |
|
302 |
fun contra_right ct = Thm.instantiate ([], [(falseE_v, ct)]) @{thm FalseE} |
|
303 |
in |
|
304 |
fun contradict conj ct = |
|
305 |
iff_intro (T.under_assumption (contra_left conj) ct) (contra_right ct) |
|
306 |
end |
|
307 |
||
308 |
||
309 |
local |
|
310 |
fun prove_eq l r (cl, cr) = |
|
311 |
let |
|
312 |
fun explode' is_conj = explode is_conj true (l <> r) [] |
|
313 |
fun make_tab is_conj thm = make_littab (true_thm :: explode' is_conj thm) |
|
314 |
fun prove is_conj ct tab = join is_conj tab (Thm.term_of ct) |
|
315 |
||
316 |
val thm1 = T.under_assumption (prove r cr o make_tab l) cl |
|
317 |
val thm2 = T.under_assumption (prove l cl o make_tab r) cr |
|
318 |
in iff_intro thm1 thm2 end |
|
319 |
||
320 |
datatype conj_disj = CONJ | DISJ | NCON | NDIS |
|
321 |
fun kind_of t = |
|
322 |
if is_conj t then SOME CONJ |
|
323 |
else if is_disj t then SOME DISJ |
|
324 |
else if is_neg' is_conj t then SOME NCON |
|
325 |
else if is_neg' is_disj t then SOME NDIS |
|
326 |
else NONE |
|
327 |
in |
|
328 |
||
329 |
fun prove_conj_disj_eq ct = |
|
330 |
let val cp as (cl, cr) = Thm.dest_binop (Thm.dest_arg ct) |
|
331 |
in |
|
332 |
(case (kind_of (Thm.term_of cl), Thm.term_of cr) of |
|
40579
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
333 |
(SOME CONJ, @{const False}) => contradict true cl |
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
334 |
| (SOME DISJ, @{const Not} $ @{const False}) => |
98ebd2300823
use the const antiquotation for constants (this checks that the constant is declared, whereas the more general term antiquotation treats undeclared names as free variable)
boehmes
parents:
38864
diff
changeset
|
335 |
contrapos2 (contradict false o fst) cp |
36898 | 336 |
| (kl, _) => |
337 |
(case (kl, kind_of (Thm.term_of cr)) of |
|
338 |
(SOME CONJ, SOME CONJ) => prove_eq true true cp |
|
339 |
| (SOME CONJ, SOME NDIS) => prove_eq true false cp |
|
340 |
| (SOME CONJ, _) => prove_eq true true cp |
|
341 |
| (SOME DISJ, SOME DISJ) => contrapos1 (prove_eq false false) cp |
|
342 |
| (SOME DISJ, SOME NCON) => contrapos2 (prove_eq false true) cp |
|
343 |
| (SOME DISJ, _) => contrapos1 (prove_eq false false) cp |
|
344 |
| (SOME NCON, SOME NCON) => contrapos1 (prove_eq true true) cp |
|
345 |
| (SOME NCON, SOME DISJ) => contrapos3 (prove_eq true false) cp |
|
346 |
| (SOME NCON, NONE) => contrapos3 (prove_eq true false) cp |
|
347 |
| (SOME NDIS, SOME NDIS) => prove_eq false false cp |
|
348 |
| (SOME NDIS, SOME CONJ) => prove_eq false true cp |
|
349 |
| (SOME NDIS, NONE) => prove_eq false true cp |
|
350 |
| _ => raise CTERM ("prove_conj_disj_eq", [ct]))) |
|
351 |
end |
|
352 |
||
353 |
end |
|
354 |
||
355 |
end |