src/Pure/Proof/proofchecker.ML
changeset 11612 ae8450657bf0
parent 11539 0f17da240450
child 12238 09966ccbc84c
equal deleted inserted replaced
11611:b0c69f4db64c 11612:ae8450657bf0
    10 signature PROOF_CHECKER =
    10 signature PROOF_CHECKER =
    11 sig
    11 sig
    12   val thm_of_proof : theory -> Proofterm.proof -> thm
    12   val thm_of_proof : theory -> Proofterm.proof -> thm
    13 end;
    13 end;
    14 
    14 
    15 structure ProofChecker =
    15 structure ProofChecker : PROOF_CHECKER =
    16 struct
    16 struct
    17 
    17 
    18 open Proofterm;
    18 open Proofterm;
    19 
    19 
    20 (***** construct a theorem out of a proof term *****)
    20 (***** construct a theorem out of a proof term *****)
    70             val thm = thm_of ((x, T) :: vs) Hs prf
    70             val thm = thm_of ((x, T) :: vs) Hs prf
    71           in
    71           in
    72             Thm.forall_intr (Thm.cterm_of sg (Free (x, T))) thm
    72             Thm.forall_intr (Thm.cterm_of sg (Free (x, T))) thm
    73           end
    73           end
    74 
    74 
    75       | thm_of vs Hs (prf %% Some t) =
    75       | thm_of vs Hs (prf % Some t) =
    76           let
    76           let
    77             val thm = thm_of vs Hs prf
    77             val thm = thm_of vs Hs prf
    78             val ct = Thm.cterm_of sg (Term.subst_bounds (map Free vs, t))
    78             val ct = Thm.cterm_of sg (Term.subst_bounds (map Free vs, t))
    79           in Thm.forall_elim ct thm end
    79           in Thm.forall_elim ct thm end
    80 
    80 
    84             val thm = thm_of vs (Thm.assume ct :: Hs) prf
    84             val thm = thm_of vs (Thm.assume ct :: Hs) prf
    85           in
    85           in
    86             Thm.implies_intr ct thm
    86             Thm.implies_intr ct thm
    87           end
    87           end
    88 
    88 
    89       | thm_of vs Hs (prf % prf') =
    89       | thm_of vs Hs (prf %% prf') =
    90           let 
    90           let 
    91             val thm = beta_eta_convert (thm_of vs Hs prf);
    91             val thm = beta_eta_convert (thm_of vs Hs prf);
    92             val thm' = beta_eta_convert (thm_of vs Hs prf')
    92             val thm' = beta_eta_convert (thm_of vs Hs prf')
    93           in
    93           in
    94             Thm.implies_elim thm thm'
    94             Thm.implies_elim thm thm'