src/Pure/Syntax/sextension.ML
changeset 473 fdacecc688a1
parent 382 2d876467663b
equal deleted inserted replaced
472:bbaa2a02bd82 473:fdacecc688a1
   214 (* meta propositions *)
   214 (* meta propositions *)
   215 
   215 
   216 fun aprop_tr (*"_aprop"*) [t] = const constrainC $ t $ const "prop"
   216 fun aprop_tr (*"_aprop"*) [t] = const constrainC $ t $ const "prop"
   217   | aprop_tr (*"_aprop"*) ts = raise_term "aprop_tr" ts;
   217   | aprop_tr (*"_aprop"*) ts = raise_term "aprop_tr" ts;
   218 
   218 
   219 fun insort_tr (*"_insort"*) [ty, srt] =
   219 fun ofclass_tr (*"_ofclass"*) [ty, cls] =
   220       srt $ (const constrainC $ const "TYPE" $ (const "itself" $ ty))
   220       cls $ (const constrainC $ const "TYPE" $ (const "itself" $ ty))
   221   | insort_tr (*"_insort"*) ts = raise_term "insort_tr" ts;
   221   | ofclass_tr (*"_ofclass"*) ts = raise_term "ofclass_tr" ts;
   222 
   222 
   223 
   223 
   224 (* meta implication *)
   224 (* meta implication *)
   225 
   225 
   226 fun bigimpl_ast_tr (*"_bigimpl"*) [asms, concl] =
   226 fun bigimpl_ast_tr (*"_bigimpl"*) [asms, concl] =
   356       | tr' tys (t as Bound _) =
   356       | tr' tys (t as Bound _) =
   357           if is_prop tys t then aprop t else t
   357           if is_prop tys t then aprop t else t
   358       | tr' tys (Abs (x, ty, t)) = Abs (x, ty, tr' (ty :: tys) t)
   358       | tr' tys (Abs (x, ty, t)) = Abs (x, ty, tr' (ty :: tys) t)
   359       | tr' tys (t as t1 $ (t2 as Const ("TYPE", Type ("itself", [ty])))) =
   359       | tr' tys (t as t1 $ (t2 as Const ("TYPE", Type ("itself", [ty])))) =
   360           if is_prop tys t then
   360           if is_prop tys t then
   361             const "_insort" $ term_of_typ show_sorts ty $ tr' tys t1
   361             const "_ofclass" $ term_of_typ show_sorts ty $ tr' tys t1
   362           else tr' tys t1 $ tr' tys t2
   362           else tr' tys t1 $ tr' tys t2
   363       | tr' tys (t as t1 $ t2) =
   363       | tr' tys (t as t1 $ t2) =
   364           (if is_Const (head_of t) orelse not (is_prop tys t)
   364           (if is_Const (head_of t) orelse not (is_prop tys t)
   365             then I else aprop) (tr' tys t1 $ tr' tys t2);
   365             then I else aprop) (tr' tys t1 $ tr' tys t2);
   366   in
   366   in
   537 (** pure_trfuns **)
   537 (** pure_trfuns **)
   538 
   538 
   539 val pure_trfuns =
   539 val pure_trfuns =
   540  ([(applC, appl_ast_tr), ("_lambda", lambda_ast_tr), ("_idtyp", idtyp_ast_tr),
   540  ([(applC, appl_ast_tr), ("_lambda", lambda_ast_tr), ("_idtyp", idtyp_ast_tr),
   541     ("_bigimpl", bigimpl_ast_tr)],
   541     ("_bigimpl", bigimpl_ast_tr)],
   542   [("_abs", abs_tr), ("_aprop", aprop_tr), ("_insort", insort_tr), ("_K", k_tr),
   542   [("_abs", abs_tr), ("_aprop", aprop_tr), ("_ofclass", ofclass_tr),
   543     ("_explode", explode_tr)],
   543     ("_K", k_tr), ("_explode", explode_tr)],
   544   [],
   544   [],
   545   [("_abs", abs_ast_tr'), ("_idts", idts_ast_tr'), ("==>", impl_ast_tr'),
   545   [("_abs", abs_ast_tr'), ("_idts", idts_ast_tr'), ("==>", impl_ast_tr'),
   546     ("_implode", implode_ast_tr')]);
   546     ("_implode", implode_ast_tr')]);
   547 
   547 
   548 val constrainAbsC = "_constrainAbs";
   548 val constrainAbsC = "_constrainAbs";