author | blanchet |
Fri, 16 May 2014 19:14:00 +0200 | |
changeset 56985 | 82c83978fbd9 |
parent 56981 | 3ef45ce002b5 |
child 57056 | 8b2283566f6e |
permissions | -rw-r--r-- |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
1 |
(* Title: HOL/Tools/SMT2/z3_new_isar.ML |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
2 |
Author: Jasmin Blanchette, TU Muenchen |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
3 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
4 |
Z3 proofs as generic ATP proofs for Isar proof reconstruction. |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
5 |
*) |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
6 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
7 |
signature Z3_NEW_ISAR = |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
8 |
sig |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
9 |
type ('a, 'b) atp_step = ('a, 'b) ATP_Proof.atp_step |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
10 |
|
56985
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
11 |
val atp_proof_of_z3_proof: Proof.context -> thm list -> term list -> term -> |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
12 |
(string * term) list -> int list -> int -> (int * string) list -> Z3_New_Proof.z3_step list -> |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
13 |
(term, string) atp_step list |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
14 |
end; |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
15 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
16 |
structure Z3_New_Isar: Z3_NEW_ISAR = |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
17 |
struct |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
18 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
19 |
open ATP_Util |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
20 |
open ATP_Problem |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
21 |
open ATP_Proof |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
22 |
open ATP_Proof_Reconstruct |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
23 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
24 |
val z3_apply_def_rule = Z3_New_Proof.string_of_rule Z3_New_Proof.Apply_Def |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
25 |
val z3_hypothesis_rule = Z3_New_Proof.string_of_rule Z3_New_Proof.Hypothesis |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
26 |
val z3_intro_def_rule = Z3_New_Proof.string_of_rule Z3_New_Proof.Intro_Def |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
27 |
val z3_lemma_rule = Z3_New_Proof.string_of_rule Z3_New_Proof.Lemma |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
28 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
29 |
fun inline_z3_defs _ [] = [] |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
30 |
| inline_z3_defs defs ((name, role, t, rule, deps) :: lines) = |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
31 |
if rule = z3_intro_def_rule then |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
32 |
let val def = t |> HOLogic.dest_Trueprop |> HOLogic.dest_eq |> swap in |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
33 |
inline_z3_defs (insert (op =) def defs) |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
34 |
(map (replace_dependencies_in_line (name, [])) lines) |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
35 |
end |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
36 |
else if rule = z3_apply_def_rule then |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
37 |
inline_z3_defs defs (map (replace_dependencies_in_line (name, [])) lines) |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
38 |
else |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
39 |
(name, role, Term.subst_atomic defs t, rule, deps) :: inline_z3_defs defs lines |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
40 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
41 |
fun add_z3_hypotheses [] = I |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
42 |
| add_z3_hypotheses hyps = |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
43 |
HOLogic.dest_Trueprop |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
44 |
#> curry s_imp (Library.foldr1 s_conj (map HOLogic.dest_Trueprop hyps)) |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
45 |
#> HOLogic.mk_Trueprop |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
46 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
47 |
fun inline_z3_hypotheses _ _ [] = [] |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
48 |
| inline_z3_hypotheses hyp_names hyps ((name, role, t, rule, deps) :: lines) = |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
49 |
if rule = z3_hypothesis_rule then |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
50 |
inline_z3_hypotheses (name :: hyp_names) (AList.map_default (op =) (t, []) (cons name) hyps) |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
51 |
lines |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
52 |
else |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
53 |
let val deps' = subtract (op =) hyp_names deps in |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
54 |
if rule = z3_lemma_rule then |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
55 |
(name, role, t, rule, deps') :: inline_z3_hypotheses hyp_names hyps lines |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
56 |
else |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
57 |
let |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
58 |
val add_hyps = filter_out (null o inter (op =) deps o snd) hyps |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
59 |
val t' = add_z3_hypotheses (map fst add_hyps) t |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
60 |
val deps' = subtract (op =) hyp_names deps |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
61 |
val hyps' = fold (AList.update (op =) o apsnd (insert (op =) name)) add_hyps hyps |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
62 |
in |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
63 |
(name, role, t', rule, deps') :: inline_z3_hypotheses hyp_names hyps' lines |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
64 |
end |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
65 |
end |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
66 |
|
56855
e7a55d295b8e
simplify unused universally quantified variables in Z3 proofs
blanchet
parents:
56129
diff
changeset
|
67 |
fun simplify_bool ((all as Const (@{const_name All}, _)) $ Abs (s, T, t)) = |
e7a55d295b8e
simplify unused universally quantified variables in Z3 proofs
blanchet
parents:
56129
diff
changeset
|
68 |
let val t' = simplify_bool t in |
e7a55d295b8e
simplify unused universally quantified variables in Z3 proofs
blanchet
parents:
56129
diff
changeset
|
69 |
if loose_bvar1 (t', 0) then all $ Abs (s, T, t') else t' |
e7a55d295b8e
simplify unused universally quantified variables in Z3 proofs
blanchet
parents:
56129
diff
changeset
|
70 |
end |
e7a55d295b8e
simplify unused universally quantified variables in Z3 proofs
blanchet
parents:
56129
diff
changeset
|
71 |
| simplify_bool (@{const Not} $ t) = s_not (simplify_bool t) |
56129
9ee083f9da5b
remove '__' skolem suffixes before showing terms to users
blanchet
parents:
56128
diff
changeset
|
72 |
| simplify_bool (@{const conj} $ t $ u) = s_conj (simplify_bool t, simplify_bool u) |
9ee083f9da5b
remove '__' skolem suffixes before showing terms to users
blanchet
parents:
56128
diff
changeset
|
73 |
| simplify_bool (@{const disj} $ t $ u) = s_disj (simplify_bool t, simplify_bool u) |
9ee083f9da5b
remove '__' skolem suffixes before showing terms to users
blanchet
parents:
56128
diff
changeset
|
74 |
| simplify_bool (@{const implies} $ t $ u) = s_imp (simplify_bool t, simplify_bool u) |
9ee083f9da5b
remove '__' skolem suffixes before showing terms to users
blanchet
parents:
56128
diff
changeset
|
75 |
| simplify_bool (@{const HOL.eq (bool)} $ t $ u) = s_iff (simplify_bool t, simplify_bool u) |
9ee083f9da5b
remove '__' skolem suffixes before showing terms to users
blanchet
parents:
56128
diff
changeset
|
76 |
| simplify_bool (t as Const (@{const_name HOL.eq}, _) $ u $ v) = |
56126 | 77 |
if u aconv v then @{const True} else t |
56129
9ee083f9da5b
remove '__' skolem suffixes before showing terms to users
blanchet
parents:
56128
diff
changeset
|
78 |
| simplify_bool (t $ u) = simplify_bool t $ simplify_bool u |
9ee083f9da5b
remove '__' skolem suffixes before showing terms to users
blanchet
parents:
56128
diff
changeset
|
79 |
| simplify_bool (Abs (s, T, t)) = Abs (s, T, simplify_bool t) |
9ee083f9da5b
remove '__' skolem suffixes before showing terms to users
blanchet
parents:
56128
diff
changeset
|
80 |
| simplify_bool t = t |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
81 |
|
56129
9ee083f9da5b
remove '__' skolem suffixes before showing terms to users
blanchet
parents:
56128
diff
changeset
|
82 |
(* It is not entirely clear why this should be necessary, especially for abstractions variables. *) |
9ee083f9da5b
remove '__' skolem suffixes before showing terms to users
blanchet
parents:
56128
diff
changeset
|
83 |
val unskolemize_names = |
9ee083f9da5b
remove '__' skolem suffixes before showing terms to users
blanchet
parents:
56128
diff
changeset
|
84 |
Term.map_abs_vars (perhaps (try Name.dest_skolem)) |
9ee083f9da5b
remove '__' skolem suffixes before showing terms to users
blanchet
parents:
56128
diff
changeset
|
85 |
#> Term.map_aterms (perhaps (try (fn Free (s, T) => Free (Name.dest_skolem s, T)))) |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
86 |
|
56985
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
87 |
fun atp_proof_of_z3_proof ctxt rewrite_rules hyp_ts concl_t fact_ts prem_ids conjecture_id fact_ids |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
88 |
proof = |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
89 |
let |
56981
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
90 |
val thy = Proof_Context.theory_of ctxt |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
91 |
|
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
92 |
fun steps_of (Z3_New_Proof.Z3_Step {id, rule, prems, concl, ...}) = |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
93 |
let |
56985
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
94 |
val sid = string_of_int id |
56128 | 95 |
|
56981
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
96 |
val concl' = |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
97 |
concl |
56128 | 98 |
|> Raw_Simplifier.rewrite_term thy rewrite_rules [] |
99 |
|> Object_Logic.atomize_term thy |
|
56129
9ee083f9da5b
remove '__' skolem suffixes before showing terms to users
blanchet
parents:
56128
diff
changeset
|
100 |
|> simplify_bool |
9ee083f9da5b
remove '__' skolem suffixes before showing terms to users
blanchet
parents:
56128
diff
changeset
|
101 |
|> unskolemize_names |
56128 | 102 |
|> HOLogic.mk_Trueprop |
56981
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
103 |
|
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
104 |
fun standard_step role = |
56985
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
105 |
((sid, []), role, concl', Z3_New_Proof.string_of_rule rule, |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
106 |
map (fn id => (string_of_int id, [])) prems) |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
107 |
in |
56981
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
108 |
(case rule of |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
109 |
Z3_New_Proof.Asserted => |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
110 |
let |
56985
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
111 |
val ss = the_list (AList.lookup (op =) fact_ids id) |
56981
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
112 |
val name0 = (sid ^ "a", ss) |
56985
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
113 |
|
56981
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
114 |
val (role0, concl0) = |
56985
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
115 |
(case ss of |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
116 |
[s] => (Axiom, the (AList.lookup (op =) fact_ts s)) |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
117 |
| _ => |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
118 |
if id = conjecture_id then |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
119 |
(Conjecture, concl_t) |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
120 |
else |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
121 |
(Hypothesis, |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
122 |
(case find_index (curry (op =) id) prem_ids of |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
123 |
~1 => concl |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
124 |
| i => nth hyp_ts i))) |
56981
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
125 |
|
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
126 |
val normalize_prems = |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
127 |
SMT2_Normalize.case_bool_entry :: SMT2_Normalize.special_quant_table @ |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
128 |
SMT2_Normalize.abs_min_max_table |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
129 |
|> map_filter (fn (c, th) => |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
130 |
if exists_Const (curry (op =) c o fst) concl0 then |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
131 |
let val s = short_thm_name ctxt th in SOME (s, [s]) end |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
132 |
else |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
133 |
NONE) |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
134 |
in |
56985
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
135 |
[(name0, role0, concl0, Z3_New_Proof.string_of_rule rule, []), |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
136 |
((sid, []), Plain, concl', Z3_New_Proof.string_of_rule Z3_New_Proof.Rewrite, |
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
blanchet
parents:
56981
diff
changeset
|
137 |
name0 :: normalize_prems)] |
56981
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
138 |
end |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
139 |
| Z3_New_Proof.Rewrite => [standard_step Lemma] |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
140 |
| Z3_New_Proof.Rewrite_Star => [standard_step Lemma] |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
141 |
| Z3_New_Proof.Skolemize => [standard_step Lemma] |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
142 |
| Z3_New_Proof.Th_Lemma _ => [standard_step Lemma] |
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
143 |
| _ => [standard_step Plain]) |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
144 |
end |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
145 |
in |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
146 |
proof |
56981
3ef45ce002b5
honor original format of conjecture or hypotheses in Z3-to-Isar proofs
blanchet
parents:
56855
diff
changeset
|
147 |
|> maps steps_of |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
148 |
|> inline_z3_defs [] |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
149 |
|> inline_z3_hypotheses [] [] |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
150 |
end |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
151 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
152 |
end; |