src/HOL/Tools/SMT/z3_proof_reconstruction.ML
changeset 42318 0fd33b6b22cf
parent 42196 9893b2913a44
child 42361 23f352990944
equal deleted inserted replaced
42317:c2b5dbb76b7e 42318:0fd33b6b22cf
   562     (* FIXME: not very well tested *)
   562     (* FIXME: not very well tested *)
   563 
   563 
   564 
   564 
   565 (* |- (ALL x1 ... xn y1 ... yn. P x1 ... xn) = (ALL x1 ... xn. P x1 ... xn) *)
   565 (* |- (ALL x1 ... xn y1 ... yn. P x1 ... xn) = (ALL x1 ... xn. P x1 ... xn) *)
   566 local
   566 local
   567   val elim_all = @{lemma "(ALL x. P) == P" by simp}
   567   val elim_all = @{lemma "P = Q ==> (ALL x. P) = Q" by fast}
   568   val elim_ex = @{lemma "(EX x. P) == P" by simp}
   568   val elim_ex = @{lemma "P = Q ==> (EX x. P) = Q" by fast}
   569 
   569 
   570   fun elim_unused_conv ctxt =
   570   fun elim_unused_tac i st = (
   571     Conv.params_conv ~1 (K (Conv.arg_conv (Conv.arg1_conv
   571     Tactic.match_tac [@{thm refl}]
   572       (Conv.rewrs_conv [elim_all, elim_ex])))) ctxt
   572     ORELSE' (Tactic.match_tac [elim_all, elim_ex] THEN' elim_unused_tac)
   573 
   573     ORELSE' (
   574   fun elim_unused_tac ctxt =
   574       Tactic.match_tac [@{thm iff_allI}, @{thm iff_exI}]
   575     REPEAT_ALL_NEW (
   575       THEN' elim_unused_tac)) i st
   576       Tactic.match_tac [@{thm refl}, @{thm iff_allI}, @{thm iff_exI}]
   576 in
   577       ORELSE' CONVERSION (elim_unused_conv ctxt))
   577 
   578 in
   578 val elim_unused_vars = Thm o Z3_Proof_Tools.by_tac elim_unused_tac
   579 fun elim_unused_vars ctxt = Thm o Z3_Proof_Tools.by_tac (elim_unused_tac ctxt)
   579 
   580 end
   580 end
   581 
   581 
   582 
   582 
   583 (* |- (ALL x1 ... xn. ~(x1 = t1 & ... xn = tn) | P x1 ... xn) = P t1 ... tn *)
   583 (* |- (ALL x1 ... xn. ~(x1 = t1 & ... xn = tn) | P x1 ... xn) = P t1 ... tn *)
   584 fun dest_eq_res ctxt = Thm o try_apply ctxt [] [
   584 fun dest_eq_res ctxt = Thm o try_apply ctxt [] [
   779 
   779 
   780       (* quantifier rules *)
   780       (* quantifier rules *)
   781     | (Z3_Proof_Parser.Quant_Intro, [(p, _)]) => (quant_intro vars p ct, cxp)
   781     | (Z3_Proof_Parser.Quant_Intro, [(p, _)]) => (quant_intro vars p ct, cxp)
   782     | (Z3_Proof_Parser.Pull_Quant, _) => (pull_quant cx ct, cxp)
   782     | (Z3_Proof_Parser.Pull_Quant, _) => (pull_quant cx ct, cxp)
   783     | (Z3_Proof_Parser.Push_Quant, _) => (push_quant cx ct, cxp)
   783     | (Z3_Proof_Parser.Push_Quant, _) => (push_quant cx ct, cxp)
   784     | (Z3_Proof_Parser.Elim_Unused_Vars, _) => (elim_unused_vars cx ct, cxp)
   784     | (Z3_Proof_Parser.Elim_Unused_Vars, _) => (elim_unused_vars ct, cxp)
   785     | (Z3_Proof_Parser.Dest_Eq_Res, _) => (dest_eq_res cx ct, cxp)
   785     | (Z3_Proof_Parser.Dest_Eq_Res, _) => (dest_eq_res cx ct, cxp)
   786     | (Z3_Proof_Parser.Quant_Inst, _) => (quant_inst ct, cxp)
   786     | (Z3_Proof_Parser.Quant_Inst, _) => (quant_inst ct, cxp)
   787     | (Z3_Proof_Parser.Skolemize, _) => skolemize vars ct cx ||> rpair ptab
   787     | (Z3_Proof_Parser.Skolemize, _) => skolemize vars ct cx ||> rpair ptab
   788 
   788 
   789       (* theory rules *)
   789       (* theory rules *)