src/HOL/Tools/TFL/dcterm.ML
changeset 59582 0fbed69ff081
parent 46497 89ccf66aa73d
child 59586 ddf6deaadfe8
equal deleted inserted replaced
59580:cbc38731d42f 59582:0fbed69ff081
    68  *---------------------------------------------------------------------------*)
    68  *---------------------------------------------------------------------------*)
    69 
    69 
    70 val mk_hol_const = Thm.cterm_of @{theory HOL} o Const;
    70 val mk_hol_const = Thm.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 = #T(rep_cterm Bvar)
    73   let val ty = #T(Thm.rep_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;
    76 
    76 
    77 
    77 
    78 local val c = mk_hol_const(@{const_name HOL.conj}, HOLogic.boolT --> HOLogic.boolT --> HOLogic.boolT)
    78 local val c = mk_hol_const(@{const_name HOL.conj}, HOLogic.boolT --> HOLogic.boolT --> HOLogic.boolT)
    86 
    86 
    87 (*---------------------------------------------------------------------------
    87 (*---------------------------------------------------------------------------
    88  * The primitives.
    88  * The primitives.
    89  *---------------------------------------------------------------------------*)
    89  *---------------------------------------------------------------------------*)
    90 fun dest_const ctm =
    90 fun dest_const ctm =
    91    (case #t(rep_cterm ctm)
    91    (case #t(Thm.rep_cterm ctm)
    92       of Const(s,ty) => {Name = s, Ty = ty}
    92       of Const(s,ty) => {Name = s, Ty = ty}
    93        | _ => raise ERR "dest_const" "not a constant");
    93        | _ => raise ERR "dest_const" "not a constant");
    94 
    94 
    95 fun dest_var ctm =
    95 fun dest_var ctm =
    96    (case #t(rep_cterm ctm)
    96    (case #t(Thm.rep_cterm ctm)
    97       of Var((s,i),ty) => {Name=s, Ty=ty}
    97       of Var((s,i),ty) => {Name=s, Ty=ty}
    98        | Free(s,ty)    => {Name=s, Ty=ty}
    98        | Free(s,ty)    => {Name=s, Ty=ty}
    99        |             _ => raise ERR "dest_var" "not a variable");
    99        |             _ => raise ERR "dest_var" "not a variable");
   100 
   100 
   101 
   101