author | wenzelm |
Fri, 29 Nov 2024 17:40:15 +0100 | |
changeset 81507 | 08574da77b4a |
parent 74395 | 5399dfe9141c |
permissions | -rw-r--r-- |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
1 |
(* Title: HOL/ex/veriT_Preprocessing.thy |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
2 |
Author: Jasmin Christian Blanchette, Inria, LORIA, MPII |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
3 |
*) |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
4 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
5 |
section \<open>Proof Reconstruction for veriT's Preprocessing\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
6 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
7 |
theory veriT_Preprocessing |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
8 |
imports Main |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
9 |
begin |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
10 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
11 |
declare [[eta_contract = false]] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
12 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
13 |
lemma |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
14 |
some_All_iffI: "p (SOME x. \<not> p x) = q \<Longrightarrow> (\<forall>x. p x) = q" and |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
15 |
some_Ex_iffI: "p (SOME x. p x) = q \<Longrightarrow> (\<exists>x. p x) = q" |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
16 |
by (metis (full_types) someI_ex)+ |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
17 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
18 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
19 |
fun mk_prod1 bound_Ts (t, u) = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
20 |
HOLogic.pair_const (fastype_of1 (bound_Ts, t)) (fastype_of1 (bound_Ts, u)) $ t $ u; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
21 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
22 |
fun mk_tuple1 bound_Ts = the_default HOLogic.unit o try (foldr1 (mk_prod1 bound_Ts)); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
23 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
24 |
fun mk_arg_congN 0 = refl |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
25 |
| mk_arg_congN 1 = arg_cong |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
26 |
| mk_arg_congN 2 = @{thm arg_cong2} |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
27 |
| mk_arg_congN n = arg_cong RS funpow (n - 2) (fn th => @{thm cong} RS th) @{thm cong}; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
28 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
29 |
fun mk_let_iffNI ctxt n = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
30 |
let |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
31 |
val ((As, [B]), _) = ctxt |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
32 |
|> Ctr_Sugar_Util.mk_TFrees n |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
33 |
||>> Ctr_Sugar_Util.mk_TFrees 1; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
34 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
35 |
val ((((ts, us), [p]), [q]), _) = ctxt |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
36 |
|> Ctr_Sugar_Util.mk_Frees "t" As |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
37 |
||>> Ctr_Sugar_Util.mk_Frees "u" As |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
38 |
||>> Ctr_Sugar_Util.mk_Frees "p" [As ---> B] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
39 |
||>> Ctr_Sugar_Util.mk_Frees "q" [B]; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
40 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
41 |
val tuple_t = HOLogic.mk_tuple ts; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
42 |
val tuple_T = fastype_of tuple_t; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
43 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
44 |
val lambda_t = HOLogic.tupled_lambda tuple_t (list_comb (p, ts)); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
45 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
46 |
val left_prems = map2 (curry Ctr_Sugar_Util.mk_Trueprop_eq) ts us; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
47 |
val right_prem = Ctr_Sugar_Util.mk_Trueprop_eq (list_comb (p, us), q); |
74395 | 48 |
val concl = Ctr_Sugar_Util.mk_Trueprop_eq (\<^Const>\<open>Let tuple_T B for tuple_t lambda_t\<close>, q); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
49 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
50 |
val goal = Logic.list_implies (left_prems @ [right_prem], concl); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
51 |
val vars = Variable.add_free_names ctxt goal []; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
52 |
in |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
53 |
Goal.prove_sorry ctxt vars [] goal (fn {context = ctxt, ...} => |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
54 |
HEADGOAL (hyp_subst_tac ctxt) THEN |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
55 |
Local_Defs.unfold0_tac ctxt @{thms Let_def prod.case} THEN |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
56 |
HEADGOAL (resolve_tac ctxt [refl])) |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
57 |
end; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
58 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
59 |
datatype rule_name = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
60 |
Refl |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
61 |
| Taut of thm |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
62 |
| Trans of term |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
63 |
| Cong |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
64 |
| Bind |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
65 |
| Sko_Ex |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
66 |
| Sko_All |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
67 |
| Let of term list; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
68 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
69 |
fun str_of_rule_name Refl = "Refl" |
69597 | 70 |
| str_of_rule_name (Taut th) = "Taut[" ^ \<^make_string> th ^ "]" |
71 |
| str_of_rule_name (Trans t) = "Trans[" ^ Syntax.string_of_term \<^context> t ^ "]" |
|
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
72 |
| str_of_rule_name Cong = "Cong" |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
73 |
| str_of_rule_name Bind = "Bind" |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
74 |
| str_of_rule_name Sko_Ex = "Sko_Ex" |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
75 |
| str_of_rule_name Sko_All = "Sko_All" |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
76 |
| str_of_rule_name (Let ts) = |
69597 | 77 |
"Let[" ^ commas (map (Syntax.string_of_term \<^context>) ts) ^ "]"; |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
78 |
|
65017 | 79 |
datatype node = N of rule_name * node list; |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
80 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
81 |
fun lambda_count (Abs (_, _, t)) = lambda_count t + 1 |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
82 |
| lambda_count ((t as Abs _) $ _) = lambda_count t - 1 |
74395 | 83 |
| lambda_count ((t as \<^Const_>\<open>case_prod _ _ _\<close> $ _) $ _) = lambda_count t - 1 |
84 |
| lambda_count \<^Const_>\<open>case_prod _ _ _ for t\<close> = lambda_count t - 1 |
|
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
85 |
| lambda_count _ = 0; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
86 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
87 |
fun zoom apply = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
88 |
let |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
89 |
fun zo 0 bound_Ts (Abs (r, T, t), Abs (s, U, u)) = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
90 |
let val (t', u') = zo 0 (T :: bound_Ts) (t, u) in |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
91 |
(lambda (Free (r, T)) t', lambda (Free (s, U)) u') |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
92 |
end |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
93 |
| zo 0 bound_Ts ((t as Abs (_, T, _)) $ arg, u) = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
94 |
let val (t', u') = zo 1 (T :: bound_Ts) (t, u) in |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
95 |
(t' $ arg, u') |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
96 |
end |
74395 | 97 |
| zo 0 bound_Ts ((t as \<^Const_>\<open>case_prod _ _ _\<close> $ _) $ arg, u) = |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
98 |
let val (t', u') = zo 1 bound_Ts (t, u) in |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
99 |
(t' $ arg, u') |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
100 |
end |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
101 |
| zo 0 bound_Ts tu = apply bound_Ts tu |
74395 | 102 |
| zo n bound_Ts (\<^Const_>\<open>case_prod A B _ for t\<close>, u) = |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
103 |
let |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
104 |
val (t', u') = zo (n + 1) bound_Ts (t, u); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
105 |
val C = range_type (range_type (fastype_of t')); |
74395 | 106 |
in (\<^Const>\<open>case_prod A B C for t'\<close>, u') end |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
107 |
| zo n bound_Ts (Abs (s, T, t), u) = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
108 |
let val (t', u') = zo (n - 1) (T :: bound_Ts) (t, u) in |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
109 |
(Abs (s, T, t'), u') |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
110 |
end |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
111 |
| zo _ _ (t, u) = raise TERM ("zoom", [t, u]); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
112 |
in |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
113 |
zo 0 [] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
114 |
end; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
115 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
116 |
fun apply_Trans_left t (lhs, _) = (lhs, t); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
117 |
fun apply_Trans_right t (_, rhs) = (t, rhs); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
118 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
119 |
fun apply_Cong ary j (lhs, rhs) = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
120 |
(case apply2 strip_comb (lhs, rhs) of |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
121 |
((c, ts), (d, us)) => |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
122 |
if c aconv d andalso length ts = ary andalso length us = ary then (nth ts j, nth us j) |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
123 |
else raise TERM ("apply_Cong", [lhs, rhs])); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
124 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
125 |
fun apply_Bind (lhs, rhs) = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
126 |
(case (lhs, rhs) of |
74395 | 127 |
(\<^Const_>\<open>All _ for \<open>Abs (_, T, t)\<close>\<close>, \<^Const_>\<open>All _ for \<open>Abs (s, U, u)\<close>\<close>) => |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
128 |
(Abs (s, T, t), Abs (s, U, u)) |
74395 | 129 |
| (\<^Const_>\<open>Ex _ for t\<close>, \<^Const_>\<open>Ex _ for u\<close>) => (t, u) |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
130 |
| _ => raise TERM ("apply_Bind", [lhs, rhs])); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
131 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
132 |
fun apply_Sko_Ex (lhs, rhs) = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
133 |
(case lhs of |
74395 | 134 |
\<^Const_>\<open>Ex _ for \<open>t as Abs (_, T, _)\<close>\<close> => |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
135 |
(t $ (HOLogic.choice_const T $ t), rhs) |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
136 |
| _ => raise TERM ("apply_Sko_Ex", [lhs])); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
137 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
138 |
fun apply_Sko_All (lhs, rhs) = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
139 |
(case lhs of |
74395 | 140 |
\<^Const_>\<open>All _ for \<open>t as Abs (s, T, body)\<close>\<close> => |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
141 |
(t $ (HOLogic.choice_const T $ Abs (s, T, HOLogic.mk_not body)), rhs) |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
142 |
| _ => raise TERM ("apply_Sko_All", [lhs])); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
143 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
144 |
fun apply_Let_left ts j (lhs, _) = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
145 |
(case lhs of |
74395 | 146 |
\<^Const_>\<open>Let _ _ for t _\<close> => |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
147 |
let val ts0 = HOLogic.strip_tuple t in |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
148 |
(nth ts0 j, nth ts j) |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
149 |
end |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
150 |
| _ => raise TERM ("apply_Let_left", [lhs])); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
151 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
152 |
fun apply_Let_right ts bound_Ts (lhs, rhs) = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
153 |
let val t' = mk_tuple1 bound_Ts ts in |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
154 |
(case lhs of |
74395 | 155 |
\<^Const_>\<open>Let _ _ for _ u\<close> => (u $ t', rhs) |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
156 |
| _ => raise TERM ("apply_Let_right", [lhs, rhs])) |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
157 |
end; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
158 |
|
65017 | 159 |
fun reconstruct_proof ctxt (lrhs as (_, rhs), N (rule_name, prems)) = |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
160 |
let |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
161 |
val goal = HOLogic.mk_Trueprop (HOLogic.mk_eq lrhs); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
162 |
val ary = length prems; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
163 |
|
69597 | 164 |
val _ = warning (Syntax.string_of_term \<^context> goal); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
165 |
val _ = warning (str_of_rule_name rule_name); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
166 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
167 |
val parents = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
168 |
(case (rule_name, prems) of |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
169 |
(Refl, []) => [] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
170 |
| (Taut _, []) => [] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
171 |
| (Trans t, [left_prem, right_prem]) => |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
172 |
[reconstruct_proof ctxt (zoom (K (apply_Trans_left t)) lrhs, left_prem), |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
173 |
reconstruct_proof ctxt (zoom (K (apply_Trans_right t)) (rhs, rhs), right_prem)] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
174 |
| (Cong, _) => |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
175 |
map_index (fn (j, prem) => reconstruct_proof ctxt (zoom (K (apply_Cong ary j)) lrhs, prem)) |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
176 |
prems |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
177 |
| (Bind, [prem]) => [reconstruct_proof ctxt (zoom (K apply_Bind) lrhs, prem)] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
178 |
| (Sko_Ex, [prem]) => [reconstruct_proof ctxt (zoom (K apply_Sko_Ex) lrhs, prem)] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
179 |
| (Sko_All, [prem]) => [reconstruct_proof ctxt (zoom (K apply_Sko_All) lrhs, prem)] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
180 |
| (Let ts, prems) => |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
181 |
let val (left_prems, right_prem) = split_last prems in |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
182 |
map2 (fn j => fn prem => |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
183 |
reconstruct_proof ctxt (zoom (K (apply_Let_left ts j)) lrhs, prem)) |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
184 |
(0 upto length left_prems - 1) left_prems @ |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
185 |
[reconstruct_proof ctxt (zoom (apply_Let_right ts) lrhs, right_prem)] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
186 |
end |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
187 |
| _ => raise Fail ("Invalid rule: " ^ str_of_rule_name rule_name ^ "/" ^ |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
188 |
string_of_int (length prems))); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
189 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
190 |
val rule_thms = |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
191 |
(case rule_name of |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
192 |
Refl => [refl] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
193 |
| Taut th => [th] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
194 |
| Trans _ => [trans] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
195 |
| Cong => [mk_arg_congN ary] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
196 |
| Bind => @{thms arg_cong[of _ _ All] arg_cong[of _ _ Ex]} |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
197 |
| Sko_Ex => [@{thm some_Ex_iffI}] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
198 |
| Sko_All => [@{thm some_All_iffI}] |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
199 |
| Let ts => [mk_let_iffNI ctxt (length ts)]); |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
200 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
201 |
val num_lams = lambda_count rhs; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
202 |
val conged_parents = map (funpow num_lams (fn th => th RS fun_cong) |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
203 |
#> Local_Defs.unfold0 ctxt @{thms prod.case}) parents; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
204 |
in |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
205 |
Goal.prove_sorry ctxt [] [] goal (fn {context = ctxt, ...} => |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
206 |
Local_Defs.unfold0_tac ctxt @{thms prod.case} THEN |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
207 |
HEADGOAL (REPEAT_DETERM_N num_lams o resolve_tac ctxt [ext] THEN' |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
208 |
resolve_tac ctxt rule_thms THEN' |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
209 |
K (Local_Defs.unfold0_tac ctxt @{thms prod.case}) THEN' |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
210 |
EVERY' (map (resolve_tac ctxt o single) conged_parents))) |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
211 |
end; |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
212 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
213 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
214 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
215 |
val proof0 = |
69597 | 216 |
((\<^term>\<open>\<exists>x :: nat. p x\<close>, |
217 |
\<^term>\<open>p (SOME x :: nat. p x)\<close>), |
|
65017 | 218 |
N (Sko_Ex, [N (Refl, [])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
219 |
|
69597 | 220 |
reconstruct_proof \<^context> proof0; |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
221 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
222 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
223 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
224 |
val proof1 = |
69597 | 225 |
((\<^term>\<open>\<not> (\<forall>x :: nat. \<exists>y :: nat. p x y)\<close>, |
226 |
\<^term>\<open>\<not> (\<exists>y :: nat. p (SOME x :: nat. \<not> (\<exists>y :: nat. p x y)) y)\<close>), |
|
65017 | 227 |
N (Cong, [N (Sko_All, [N (Bind, [N (Refl, [])])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
228 |
|
69597 | 229 |
reconstruct_proof \<^context> proof1; |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
230 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
231 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
232 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
233 |
val proof2 = |
69597 | 234 |
((\<^term>\<open>\<forall>x :: nat. \<exists>y :: nat. \<exists>z :: nat. p x y z\<close>, |
235 |
\<^term>\<open>\<forall>x :: nat. p x (SOME y :: nat. \<exists>z :: nat. p x y z) |
|
236 |
(SOME z :: nat. p x (SOME y :: nat. \<exists>z :: nat. p x y z) z)\<close>), |
|
65017 | 237 |
N (Bind, [N (Sko_Ex, [N (Sko_Ex, [N (Refl, [])])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
238 |
|
69597 | 239 |
reconstruct_proof \<^context> proof2 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
240 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
241 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
242 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
243 |
val proof3 = |
69597 | 244 |
((\<^term>\<open>\<forall>x :: nat. \<exists>x :: nat. \<exists>x :: nat. p x x x\<close>, |
245 |
\<^term>\<open>\<forall>x :: nat. p (SOME x :: nat. p x x x) (SOME x. p x x x) (SOME x. p x x x)\<close>), |
|
65017 | 246 |
N (Bind, [N (Sko_Ex, [N (Sko_Ex, [N (Refl, [])])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
247 |
|
69597 | 248 |
reconstruct_proof \<^context> proof3 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
249 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
250 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
251 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
252 |
val proof4 = |
69597 | 253 |
((\<^term>\<open>\<forall>x :: nat. \<exists>x :: nat. \<exists>x :: nat. p x x x\<close>, |
254 |
\<^term>\<open>\<forall>x :: nat. \<exists>x :: nat. p (SOME x :: nat. p x x x) (SOME x. p x x x) (SOME x. p x x x)\<close>), |
|
65017 | 255 |
N (Bind, [N (Bind, [N (Sko_Ex, [N (Refl, [])])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
256 |
|
69597 | 257 |
reconstruct_proof \<^context> proof4 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
258 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
259 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
260 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
261 |
val proof5 = |
69597 | 262 |
((\<^term>\<open>\<forall>x :: nat. q \<and> (\<exists>x :: nat. \<exists>x :: nat. p x x x)\<close>, |
263 |
\<^term>\<open>\<forall>x :: nat. q \<and> |
|
264 |
(\<exists>x :: nat. p (SOME x :: nat. p x x x) (SOME x. p x x x) (SOME x. p x x x))\<close>), |
|
65017 | 265 |
N (Bind, [N (Cong, [N (Refl, []), N (Bind, [N (Sko_Ex, [N (Refl, [])])])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
266 |
|
69597 | 267 |
reconstruct_proof \<^context> proof5 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
268 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
269 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
270 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
271 |
val proof6 = |
69597 | 272 |
((\<^term>\<open>\<not> (\<forall>x :: nat. p \<and> (\<exists>x :: nat. \<forall>x :: nat. q x x))\<close>, |
273 |
\<^term>\<open>\<not> (\<forall>x :: nat. p \<and> |
|
274 |
(\<exists>x :: nat. q (SOME x :: nat. \<not> q x x) (SOME x. \<not> q x x)))\<close>), |
|
65017 | 275 |
N (Cong, [N (Bind, [N (Cong, [N (Refl, []), N (Bind, [N (Sko_All, [N (Refl, [])])])])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
276 |
|
69597 | 277 |
reconstruct_proof \<^context> proof6 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
278 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
279 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
280 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
281 |
val proof7 = |
69597 | 282 |
((\<^term>\<open>\<not> \<not> (\<exists>x. p x)\<close>, |
283 |
\<^term>\<open>\<not> \<not> p (SOME x. p x)\<close>), |
|
65017 | 284 |
N (Cong, [N (Cong, [N (Sko_Ex, [N (Refl, [])])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
285 |
|
69597 | 286 |
reconstruct_proof \<^context> proof7 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
287 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
288 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
289 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
290 |
val proof8 = |
69597 | 291 |
((\<^term>\<open>\<not> \<not> (let x = Suc x in x = 0)\<close>, |
292 |
\<^term>\<open>\<not> \<not> Suc x = 0\<close>), |
|
293 |
N (Cong, [N (Cong, [N (Let [\<^term>\<open>Suc x\<close>], [N (Refl, []), N (Refl, [])])])])); |
|
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
294 |
|
69597 | 295 |
reconstruct_proof \<^context> proof8 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
296 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
297 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
298 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
299 |
val proof9 = |
69597 | 300 |
((\<^term>\<open>\<not> (let x = Suc x in x = 0)\<close>, |
301 |
\<^term>\<open>\<not> Suc x = 0\<close>), |
|
302 |
N (Cong, [N (Let [\<^term>\<open>Suc x\<close>], [N (Refl, []), N (Refl, [])])])); |
|
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
303 |
|
69597 | 304 |
reconstruct_proof \<^context> proof9 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
305 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
306 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
307 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
308 |
val proof10 = |
69597 | 309 |
((\<^term>\<open>\<exists>x :: nat. p (x + 0)\<close>, |
310 |
\<^term>\<open>\<exists>x :: nat. p x\<close>), |
|
65017 | 311 |
N (Bind, [N (Cong, [N (Taut @{thm add_0_right}, [])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
312 |
|
69597 | 313 |
reconstruct_proof \<^context> proof10; |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
314 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
315 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
316 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
317 |
val proof11 = |
69597 | 318 |
((\<^term>\<open>\<not> (let (x, y) = (Suc y, Suc x) in y = 0)\<close>, |
319 |
\<^term>\<open>\<not> Suc x = 0\<close>), |
|
320 |
N (Cong, [N (Let [\<^term>\<open>Suc y\<close>, \<^term>\<open>Suc x\<close>], [N (Refl, []), N (Refl, []), |
|
65017 | 321 |
N (Refl, [])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
322 |
|
69597 | 323 |
reconstruct_proof \<^context> proof11 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
324 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
325 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
326 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
327 |
val proof12 = |
69597 | 328 |
((\<^term>\<open>\<not> (let (x, y) = (Suc y, Suc x); (u, v, w) = (y, x, y) in w = 0)\<close>, |
329 |
\<^term>\<open>\<not> Suc x = 0\<close>), |
|
330 |
N (Cong, [N (Let [\<^term>\<open>Suc y\<close>, \<^term>\<open>Suc x\<close>], [N (Refl, []), N (Refl, []), |
|
331 |
N (Let [\<^term>\<open>Suc x\<close>, \<^term>\<open>Suc y\<close>, \<^term>\<open>Suc x\<close>], |
|
65017 | 332 |
[N (Refl, []), N (Refl, []), N (Refl, []), N (Refl, [])])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
333 |
|
69597 | 334 |
reconstruct_proof \<^context> proof12 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
335 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
336 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
337 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
338 |
val proof13 = |
69597 | 339 |
((\<^term>\<open>\<not> \<not> (let x = Suc x in x = 0)\<close>, |
340 |
\<^term>\<open>\<not> \<not> Suc x = 0\<close>), |
|
341 |
N (Cong, [N (Cong, [N (Let [\<^term>\<open>Suc x\<close>], [N (Refl, []), N (Refl, [])])])])); |
|
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
342 |
|
69597 | 343 |
reconstruct_proof \<^context> proof13 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
344 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
345 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
346 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
347 |
val proof14 = |
69597 | 348 |
((\<^term>\<open>let (x, y) = (f (a :: nat), b :: nat) in x > a\<close>, |
349 |
\<^term>\<open>f (a :: nat) > a\<close>), |
|
350 |
N (Let [\<^term>\<open>f (a :: nat) :: nat\<close>, \<^term>\<open>b :: nat\<close>], |
|
65017 | 351 |
[N (Cong, [N (Refl, [])]), N (Refl, []), N (Refl, [])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
352 |
|
69597 | 353 |
reconstruct_proof \<^context> proof14 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
354 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
355 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
356 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
357 |
val proof15 = |
69597 | 358 |
((\<^term>\<open>let x = (let y = g (z :: nat) in f (y :: nat)) in x = Suc 0\<close>, |
359 |
\<^term>\<open>f (g (z :: nat) :: nat) = Suc 0\<close>), |
|
360 |
N (Let [\<^term>\<open>f (g (z :: nat) :: nat) :: nat\<close>], |
|
361 |
[N (Let [\<^term>\<open>g (z :: nat) :: nat\<close>], [N (Refl, []), N (Refl, [])]), N (Refl, [])])); |
|
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
362 |
|
69597 | 363 |
reconstruct_proof \<^context> proof15 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
364 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
365 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
366 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
367 |
val proof16 = |
69597 | 368 |
((\<^term>\<open>a > Suc b\<close>, |
369 |
\<^term>\<open>a > Suc b\<close>), |
|
370 |
N (Trans \<^term>\<open>a > Suc b\<close>, [N (Refl, []), N (Refl, [])])); |
|
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
371 |
|
69597 | 372 |
reconstruct_proof \<^context> proof16 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
373 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
374 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
375 |
thm Suc_1 |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
376 |
thm numeral_2_eq_2 |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
377 |
thm One_nat_def |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
378 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
379 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
380 |
val proof17 = |
69597 | 381 |
((\<^term>\<open>2 :: nat\<close>, |
382 |
\<^term>\<open>Suc (Suc 0) :: nat\<close>), |
|
383 |
N (Trans \<^term>\<open>Suc 1\<close>, [N (Taut @{thm Suc_1[symmetric]}, []), N (Cong, |
|
65017 | 384 |
[N (Taut @{thm One_nat_def}, [])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
385 |
|
69597 | 386 |
reconstruct_proof \<^context> proof17 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
387 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
388 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
389 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
390 |
val proof18 = |
69597 | 391 |
((\<^term>\<open>let x = a in let y = b in Suc x + y\<close>, |
392 |
\<^term>\<open>Suc a + b\<close>), |
|
393 |
N (Trans \<^term>\<open>let y = b in Suc a + y\<close>, |
|
394 |
[N (Let [\<^term>\<open>a :: nat\<close>], [N (Refl, []), N (Refl, [])]), |
|
395 |
N (Let [\<^term>\<open>b :: nat\<close>], [N (Refl, []), N (Refl, [])])])); |
|
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
396 |
|
69597 | 397 |
reconstruct_proof \<^context> proof18 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
398 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
399 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
400 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
401 |
val proof19 = |
69597 | 402 |
((\<^term>\<open>\<forall>x. let x = f (x :: nat) :: nat in g x\<close>, |
403 |
\<^term>\<open>\<forall>x. g (f (x :: nat) :: nat)\<close>), |
|
404 |
N (Bind, [N (Let [\<^term>\<open>f :: nat \<Rightarrow> nat\<close> $ Bound 0], |
|
65017 | 405 |
[N (Refl, []), N (Refl, [])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
406 |
|
69597 | 407 |
reconstruct_proof \<^context> proof19 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
408 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
409 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
410 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
411 |
val proof20 = |
69597 | 412 |
((\<^term>\<open>\<forall>x. let y = Suc 0 in let x = f (x :: nat) :: nat in g x\<close>, |
413 |
\<^term>\<open>\<forall>x. g (f (x :: nat) :: nat)\<close>), |
|
414 |
N (Bind, [N (Let [\<^term>\<open>Suc 0\<close>], [N (Refl, []), N (Let [\<^term>\<open>f (x :: nat) :: nat\<close>], |
|
65017 | 415 |
[N (Refl, []), N (Refl, [])])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
416 |
|
69597 | 417 |
reconstruct_proof \<^context> proof20 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
418 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
419 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
420 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
421 |
val proof21 = |
69597 | 422 |
((\<^term>\<open>\<forall>x :: nat. let x = f x :: nat in let y = x in p y\<close>, |
423 |
\<^term>\<open>\<forall>z :: nat. p (f z :: nat)\<close>), |
|
424 |
N (Bind, [N (Let [\<^term>\<open>f (z :: nat) :: nat\<close>], |
|
425 |
[N (Refl, []), N (Let [\<^term>\<open>f (z :: nat) :: nat\<close>], |
|
65017 | 426 |
[N (Refl, []), N (Refl, [])])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
427 |
|
69597 | 428 |
reconstruct_proof \<^context> proof21 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
429 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
430 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
431 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
432 |
val proof22 = |
69597 | 433 |
((\<^term>\<open>\<forall>x :: nat. let x = f x :: nat in let y = x in p y\<close>, |
434 |
\<^term>\<open>\<forall>x :: nat. p (f x :: nat)\<close>), |
|
435 |
N (Bind, [N (Let [\<^term>\<open>f (x :: nat) :: nat\<close>], |
|
436 |
[N (Refl, []), N (Let [\<^term>\<open>f (x :: nat) :: nat\<close>], |
|
65017 | 437 |
[N (Refl, []), N (Refl, [])])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
438 |
|
69597 | 439 |
reconstruct_proof \<^context> proof22 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
440 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
441 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
442 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
443 |
val proof23 = |
69597 | 444 |
((\<^term>\<open>\<forall>x :: nat. let (x, a) = (f x :: nat, 0 ::nat) in let y = x in p y\<close>, |
445 |
\<^term>\<open>\<forall>z :: nat. p (f z :: nat)\<close>), |
|
446 |
N (Bind, [N (Let [\<^term>\<open>f (z :: nat) :: nat\<close>, \<^term>\<open>0 :: nat\<close>], |
|
447 |
[N (Refl, []), N (Refl, []), N (Let [\<^term>\<open>f (z :: nat) :: nat\<close>], |
|
65017 | 448 |
[N (Refl, []), N (Refl, [])])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
449 |
|
69597 | 450 |
reconstruct_proof \<^context> proof23 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
451 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
452 |
|
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
453 |
ML \<open> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
454 |
val proof24 = |
69597 | 455 |
((\<^term>\<open>\<forall>x :: nat. let (x, a) = (f x :: nat, 0 ::nat) in let y = x in p y\<close>, |
456 |
\<^term>\<open>\<forall>x :: nat. p (f x :: nat)\<close>), |
|
457 |
N (Bind, [N (Let [\<^term>\<open>f (x :: nat) :: nat\<close>, \<^term>\<open>0 :: nat\<close>], |
|
458 |
[N (Refl, []), N (Refl, []), N (Let [\<^term>\<open>f (x :: nat) :: nat\<close>], |
|
65017 | 459 |
[N (Refl, []), N (Refl, [])])])])); |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
460 |
|
69597 | 461 |
reconstruct_proof \<^context> proof24 |
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
462 |
\<close> |
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
463 |
|
69217 | 464 |
ML \<open> |
465 |
val proof25 = |
|
69597 | 466 |
((\<^term>\<open>let vr0 = vr1 in let vr1 = vr2 in vr0 + vr1 + vr2 :: nat\<close>, |
467 |
\<^term>\<open>vr1 + vr2 + vr2 :: nat\<close>), |
|
468 |
N (Trans \<^term>\<open>let vr1a = vr2 in vr1 + vr1a + vr2 :: nat\<close>, |
|
469 |
[N (Let [\<^term>\<open>vr1 :: nat\<close>], [N (Refl, []), N (Refl, [])]), |
|
470 |
N (Let [\<^term>\<open>vr2 :: nat\<close>], [N (Refl, []), N (Refl, [])])])); |
|
69217 | 471 |
|
69597 | 472 |
reconstruct_proof \<^context> proof25 |
69217 | 473 |
\<close> |
474 |
||
64978
5b9ba120d222
added veriT preprocessing proof reconstruction example
blanchet
parents:
diff
changeset
|
475 |
end |