src/HOL/Tools/SMT2/verit_isar.ML
author fleury
Wed, 30 Jul 2014 14:03:13 +0200
changeset 57714 4856a7b8b9c3
parent 57712 3c4e6bc7455f
child 57730 d39815cdb7ba
permissions -rw-r--r--
Changing the role of rule "tmp_ite_elim" of the SMT solver veriT to Lemma.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
57704
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
     1
(*  Title:      HOL/Tools/SMT2/verit_isar.ML
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
     2
    Author:     Mathias Fleury, TU Muenchen
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
     3
    Author:     Jasmin Blanchette, TU Muenchen
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
     4
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
     5
VeriT proofs as generic ATP proofs for Isar proof reconstruction.
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
     6
*)
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
     7
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
     8
signature VERIT_ISAR =
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
     9
sig
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    10
  type ('a, 'b) atp_step = ('a, 'b) ATP_Proof.atp_step
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    11
  val atp_proof_of_veriT_proof: Proof.context -> term list -> thm list -> term list -> term ->
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    12
    (string * term) list -> int list -> int -> (int * string) list -> VeriT_Proof.veriT_step list ->
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    13
    (term, string) ATP_Proof.atp_step list
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    14
end;
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    15
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    16
structure VeriT_Isar: VERIT_ISAR =
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    17
struct
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    18
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    19
open ATP_Util
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    20
open ATP_Problem
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    21
open ATP_Proof
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    22
open ATP_Proof_Reconstruct
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    23
open SMTLIB2_Isar
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    24
open VeriT_Proof
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    25
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    26
fun atp_proof_of_veriT_proof ctxt ll_defs rewrite_rules hyp_ts concl_t fact_helper_ts prem_ids
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    27
    conjecture_id fact_helper_ids proof =
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    28
  let
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    29
    val thy = Proof_Context.theory_of ctxt
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    30
    fun steps_of (VeriT_Proof.VeriT_Step {id, rule, prems, concl, ...}) =
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    31
      let
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    32
        val concl' = postprocess_step_conclusion concl thy rewrite_rules ll_defs
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    33
        fun standard_step role =
57712
3c4e6bc7455f Simplifying the labels in the proof of the SMT solver veriT.
fleury
parents: 57708
diff changeset
    34
          ((id, []), role, concl', rule,
57704
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    35
           map (fn id => (id, [])) prems)
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    36
      in
57705
5da48dae7d03 Subproofs for the SMT solver veriT.
fleury
parents: 57704
diff changeset
    37
        if rule = veriT_input_rule then
57704
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    38
          let
57712
3c4e6bc7455f Simplifying the labels in the proof of the SMT solver veriT.
fleury
parents: 57708
diff changeset
    39
            val ss = the_list (AList.lookup (op =) fact_helper_ids (the (Int.fromString id)))
3c4e6bc7455f Simplifying the labels in the proof of the SMT solver veriT.
fleury
parents: 57708
diff changeset
    40
            val name0 = (id ^ "a", ss)
3c4e6bc7455f Simplifying the labels in the proof of the SMT solver veriT.
fleury
parents: 57708
diff changeset
    41
            val (role0, concl0) = distinguish_conjecture_and_hypothesis ss (the (Int.fromString id))
3c4e6bc7455f Simplifying the labels in the proof of the SMT solver veriT.
fleury
parents: 57708
diff changeset
    42
              conjecture_id prem_ids fact_helper_ts hyp_ts concl_t concl ||> unskolemize_names
57704
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    43
          in
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    44
            [(name0, role0, concl0, rule, []),
57712
3c4e6bc7455f Simplifying the labels in the proof of the SMT solver veriT.
fleury
parents: 57708
diff changeset
    45
             ((id, []), Plain, concl', veriT_rewrite_rule,
57705
5da48dae7d03 Subproofs for the SMT solver veriT.
fleury
parents: 57704
diff changeset
    46
              name0 :: normalizing_prems ctxt concl0)] end
57714
4856a7b8b9c3 Changing the role of rule "tmp_ite_elim" of the SMT solver veriT to Lemma.
fleury
parents: 57712
diff changeset
    47
        else if rule = veriT_tmp_ite_elim_rule then
4856a7b8b9c3 Changing the role of rule "tmp_ite_elim" of the SMT solver veriT to Lemma.
fleury
parents: 57712
diff changeset
    48
          [standard_step Lemma]
57704
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    49
        else
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    50
          [standard_step Plain]
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    51
      end
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    52
  in
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    53
    maps steps_of proof
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    54
  end
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    55
c0da3fc313e3 Basic support for the SMT prover veriT.
fleury
parents:
diff changeset
    56
end;