src/HOL/Tools/Argo/argo_tactic.ML
changeset 81942 da3c3948a39c
parent 80910 406a85a25189
equal deleted inserted replaced
81941:cb8f396dd39f 81942:da3c3948a39c
   284   | term_of (cx as (ctxt, _)) e =
   284   | term_of (cx as (ctxt, _)) e =
   285       (case ext_term_of ctxt (term_of cx) e of
   285       (case ext_term_of ctxt (term_of cx) e of
   286         SOME t => t
   286         SOME t => t
   287       | NONE => raise Fail "bad expression")
   287       | NONE => raise Fail "bad expression")
   288 
   288 
   289 fun as_prop ct = Thm.apply \<^cterm>\<open>Trueprop\<close> ct
       
   290 
       
   291 fun cterm_of ctxt cons e = Thm.cterm_of ctxt (term_of (ctxt, cons) e)
   289 fun cterm_of ctxt cons e = Thm.cterm_of ctxt (term_of (ctxt, cons) e)
   292 fun cprop_of ctxt cons e = as_prop (cterm_of ctxt cons e)
   290 fun cprop_of ctxt cons e = HOLogic.mk_judgment (cterm_of ctxt cons e)
   293 
   291 
   294 
   292 
   295 (* generic proof tools *)
   293 (* generic proof tools *)
   296 
   294 
   297 fun discharge thm rule = thm INCR_COMP rule
   295 fun discharge thm rule = thm INCR_COMP rule
   298 fun discharge2 thm1 thm2 rule = discharge thm2 (discharge thm1 rule)
   296 fun discharge2 thm1 thm2 rule = discharge thm2 (discharge thm1 rule)
   299 fun discharges thm rules = [thm] RL rules
   297 fun discharges thm rules = [thm] RL rules
   300 
   298 
   301 fun under_assumption f ct =
   299 fun under_assumption f ct =
   302   let val cprop = as_prop ct
   300   let val cprop = HOLogic.mk_judgment ct
   303   in Thm.implies_intr cprop (f (Thm.assume cprop)) end
   301   in Thm.implies_intr cprop (f (Thm.assume cprop)) end
   304 
   302 
   305 
   303 
   306 (* proof replay for tautologies *)
   304 (* proof replay for tautologies *)
   307 
   305 
   535 val dneg_rule = @{lemma "\<not>\<not>P \<Longrightarrow> P" by auto}
   533 val dneg_rule = @{lemma "\<not>\<not>P \<Longrightarrow> P" by auto}
   536 
   534 
   537 fun replay_hyp i ct =
   535 fun replay_hyp i ct =
   538   if i < 0 then (Thm.assume ct, [(~i, ct)])
   536   if i < 0 then (Thm.assume ct, [(~i, ct)])
   539   else
   537   else
   540     let val cu = as_prop (Thm.apply \<^cterm>\<open>Not\<close> (Thm.apply \<^cterm>\<open>Not\<close> (Thm.dest_arg ct)))
   538     let val cu = HOLogic.mk_judgment (Thm.apply \<^cterm>\<open>Not\<close> (Thm.apply \<^cterm>\<open>Not\<close> (Thm.dest_arg ct)))
   541     in (discharge (Thm.assume cu) dneg_rule, [(~i, cu)]) end
   539     in (discharge (Thm.assume cu) dneg_rule, [(~i, cu)]) end
   542 
   540 
   543 
   541 
   544 (* proof replay for lemma *)
   542 (* proof replay for lemma *)
   545 
   543