src/Pure/Isar/object_logic.ML
changeset 74341 edf8b141a8c4
parent 74340 e098fa45bfe0
child 74344 1c2c0380d58b
equal deleted inserted replaced
74340:e098fa45bfe0 74341:edf8b141a8c4
     9   val get_base_sort: Proof.context -> sort option
     9   val get_base_sort: Proof.context -> sort option
    10   val add_base_sort: sort -> theory -> theory
    10   val add_base_sort: sort -> theory -> theory
    11   val add_judgment: binding * typ * mixfix -> theory -> theory
    11   val add_judgment: binding * typ * mixfix -> theory -> theory
    12   val add_judgment_cmd: binding * string * mixfix -> theory -> theory
    12   val add_judgment_cmd: binding * string * mixfix -> theory -> theory
    13   val judgment_name: Proof.context -> string
    13   val judgment_name: Proof.context -> string
       
    14   val judgment_const: Proof.context -> string * typ
    14   val is_judgment: Proof.context -> term -> bool
    15   val is_judgment: Proof.context -> term -> bool
    15   val drop_judgment: Proof.context -> term -> term
    16   val drop_judgment: Proof.context -> term -> term
    16   val fixed_judgment: Proof.context -> string -> term
    17   val fixed_judgment: Proof.context -> string -> term
    17   val ensure_propT: Proof.context -> term -> term
    18   val ensure_propT: Proof.context -> term -> term
    18   val dest_judgment: Proof.context -> cterm -> cterm
    19   val dest_judgment: Proof.context -> cterm -> cterm
   112 fun judgment_name ctxt =
   113 fun judgment_name ctxt =
   113   (case #judgment (get_data ctxt) of
   114   (case #judgment (get_data ctxt) of
   114     SOME name => name
   115     SOME name => name
   115   | _ => raise TERM ("Unknown object-logic judgment", []));
   116   | _ => raise TERM ("Unknown object-logic judgment", []));
   116 
   117 
       
   118 fun judgment_const ctxt =
       
   119   let
       
   120     val thy = Proof_Context.theory_of ctxt;
       
   121     val c = judgment_name ctxt;
       
   122     val T = Sign.the_const_type thy c;
       
   123   in (c, T) end;
       
   124 
   117 fun is_judgment ctxt (Const (c, _) $ _) = c = judgment_name ctxt
   125 fun is_judgment ctxt (Const (c, _) $ _) = c = judgment_name ctxt
   118   | is_judgment _ _ = false;
   126   | is_judgment _ _ = false;
   119 
   127 
   120 fun drop_judgment ctxt (Abs (x, T, t)) = Abs (x, T, drop_judgment ctxt t)
   128 fun drop_judgment ctxt (Abs (x, T, t)) = Abs (x, T, drop_judgment ctxt t)
   121   | drop_judgment ctxt (tm as (Const (c, _) $ t)) =
   129   | drop_judgment ctxt (tm as (Const (c, _) $ t)) =