src/HOL/Tools/TFL/dcterm.ML
changeset 59621 291934bac95e
parent 59586 ddf6deaadfe8
child 59640 a6d29266f01c
equal deleted inserted replaced
59620:92d7d8e4f1bf 59621:291934bac95e
    65 
    65 
    66 (*---------------------------------------------------------------------------
    66 (*---------------------------------------------------------------------------
    67  * Some simple constructor functions.
    67  * Some simple constructor functions.
    68  *---------------------------------------------------------------------------*)
    68  *---------------------------------------------------------------------------*)
    69 
    69 
    70 val mk_hol_const = Thm.cterm_of @{theory HOL} o Const;
    70 val mk_hol_const = Thm.global_cterm_of @{theory HOL} o Const;
    71 
    71 
    72 fun mk_exists (r as (Bvar, Body)) =
    72 fun mk_exists (r as (Bvar, Body)) =
    73   let val ty = Thm.typ_of_cterm Bvar
    73   let val ty = Thm.typ_of_cterm Bvar
    74       val c = mk_hol_const(@{const_name Ex}, (ty --> HOLogic.boolT) --> HOLogic.boolT)
    74       val c = mk_hol_const(@{const_name Ex}, (ty --> HOLogic.boolT) --> HOLogic.boolT)
    75   in capply c (uncurry cabs r) end;
    75   in capply c (uncurry cabs r) end;
   179   let
   179   let
   180     val thy = Thm.theory_of_cterm ctm;
   180     val thy = Thm.theory_of_cterm ctm;
   181     val t = Thm.term_of ctm;
   181     val t = Thm.term_of ctm;
   182   in
   182   in
   183     if can HOLogic.dest_Trueprop t then ctm
   183     if can HOLogic.dest_Trueprop t then ctm
   184     else Thm.cterm_of thy (HOLogic.mk_Trueprop t)
   184     else Thm.global_cterm_of thy (HOLogic.mk_Trueprop t)
   185   end
   185   end
   186   handle TYPE (msg, _, _) => raise ERR "mk_prop" msg
   186   handle TYPE (msg, _, _) => raise ERR "mk_prop" msg
   187     | TERM (msg, _) => raise ERR "mk_prop" msg;
   187     | TERM (msg, _) => raise ERR "mk_prop" msg;
   188 
   188 
   189 fun drop_prop ctm = dest_monop @{const_name Trueprop} ctm handle Utils.ERR _ => ctm;
   189 fun drop_prop ctm = dest_monop @{const_name Trueprop} ctm handle Utils.ERR _ => ctm;