src/HOL/Tools/transfer.ML
changeset 47503 cb44d09d9d22
parent 47356 19fb95255ec9
child 47523 1bf0e92c1ca0
equal deleted inserted replaced
47502:4c949049cd78 47503:cb44d09d9d22
     6 
     6 
     7 signature TRANSFER =
     7 signature TRANSFER =
     8 sig
     8 sig
     9   val fo_conv: Proof.context -> conv
     9   val fo_conv: Proof.context -> conv
    10   val prep_conv: conv
    10   val prep_conv: conv
       
    11   val get_relator_eq: Proof.context -> thm list
    11   val transfer_add: attribute
    12   val transfer_add: attribute
    12   val transfer_del: attribute
    13   val transfer_del: attribute
    13   val transfer_tac: Proof.context -> int -> tactic
    14   val transfer_tac: Proof.context -> int -> tactic
    14   val correspondence_tac: Proof.context -> int -> tactic
    15   val correspondence_tac: Proof.context -> int -> tactic
    15   val setup: theory -> theory
    16   val setup: theory -> theory
    21 structure Data = Named_Thms
    22 structure Data = Named_Thms
    22 (
    23 (
    23   val name = @{binding transfer_raw}
    24   val name = @{binding transfer_raw}
    24   val description = "raw correspondence rule for transfer method"
    25   val description = "raw correspondence rule for transfer method"
    25 )
    26 )
       
    27 
       
    28 structure Relator_Eq = Named_Thms
       
    29 (
       
    30   val name = @{binding relator_eq}
       
    31   val description = "relator equality rule (used by transfer method)"
       
    32 )
       
    33 
       
    34 fun get_relator_eq ctxt =
       
    35   map (Thm.symmetric o mk_meta_eq) (Relator_Eq.get ctxt)
    26 
    36 
    27 (** Conversions **)
    37 (** Conversions **)
    28 
    38 
    29 val App_rule = Thm.symmetric @{thm App_def}
    39 val App_rule = Thm.symmetric @{thm App_def}
    30 val Abs_rule = Thm.symmetric @{thm Abs_def}
    40 val Abs_rule = Thm.symmetric @{thm Abs_def}
   104 (* Tactic to correspond a value to itself *)
   114 (* Tactic to correspond a value to itself *)
   105 fun eq_tac ctxt = SUBGOAL (fn (t, i) =>
   115 fun eq_tac ctxt = SUBGOAL (fn (t, i) =>
   106   let
   116   let
   107     val T = RelT (HOLogic.dest_Trueprop (Logic.strip_assums_concl t))
   117     val T = RelT (HOLogic.dest_Trueprop (Logic.strip_assums_concl t))
   108     val cT = ctyp_of (Proof_Context.theory_of ctxt) T
   118     val cT = ctyp_of (Proof_Context.theory_of ctxt) T
   109     val rews = [@{thm fun_rel_eq [symmetric, THEN eq_reflection]}]
   119     val rews = get_relator_eq ctxt
   110     val thm1 = Drule.instantiate' [SOME cT] [] @{thm Rel_eq_refl}
   120     val thm1 = Drule.instantiate' [SOME cT] [] @{thm Rel_eq_refl}
   111     val thm2 = Raw_Simplifier.rewrite_rule rews thm1
   121     val thm2 = Raw_Simplifier.rewrite_rule rews thm1
   112   in
   122   in
   113     rtac thm2 i
   123     rtac thm2 i
   114   end handle Match => no_tac | TERM _ => no_tac)
   124   end handle Match => no_tac | TERM _ => no_tac)
   175 
   185 
   176 (* Theory setup *)
   186 (* Theory setup *)
   177 
   187 
   178 val setup =
   188 val setup =
   179   Data.setup
   189   Data.setup
       
   190   #> Relator_Eq.setup
   180   #> Attrib.setup @{binding transfer_rule} transfer_attribute
   191   #> Attrib.setup @{binding transfer_rule} transfer_attribute
   181      "correspondence rule for transfer method"
   192      "correspondence rule for transfer method"
   182   #> Method.setup @{binding transfer} transfer_method
   193   #> Method.setup @{binding transfer} transfer_method
   183      "generic theorem transfer method"
   194      "generic theorem transfer method"
   184   #> Method.setup @{binding correspondence} correspondence_method
   195   #> Method.setup @{binding correspondence} correspondence_method