src/HOL/Tools/SMT2/smt2_builtin.ML
changeset 57230 ec5ff6bb2a92
parent 57229 489083abce44
equal deleted inserted replaced
57229:489083abce44 57230:ec5ff6bb2a92
    48 
    48 
    49 (* built-in tables *)
    49 (* built-in tables *)
    50 
    50 
    51 datatype ('a, 'b) kind = Ext of 'a | Int of 'b
    51 datatype ('a, 'b) kind = Ext of 'a | Int of 'b
    52 
    52 
    53 type ('a, 'b) ttab = ((typ * ('a, 'b) kind) Ord_List.T) SMT2_Util.dict 
    53 type ('a, 'b) ttab = ((typ * ('a, 'b) kind) Ord_List.T) SMT2_Util.dict
    54 
    54 
    55 fun typ_ord ((T, _), (U, _)) =
    55 fun typ_ord ((T, _), (U, _)) =
    56   let
    56   let
    57     fun tord (TVar _, Type _) = GREATER
    57     fun tord (TVar _, Type _) = GREATER
    58       | tord (Type _, TVar _) = LESS
    58       | tord (Type _, TVar _) = LESS
   118   lookup_ttab ctxt (fst (Builtins.get (Context.Proof ctxt)))
   118   lookup_ttab ctxt (fst (Builtins.get (Context.Proof ctxt)))
   119 
   119 
   120 fun dest_builtin_typ ctxt T =
   120 fun dest_builtin_typ ctxt T =
   121   (case lookup_builtin_typ ctxt T of
   121   (case lookup_builtin_typ ctxt T of
   122     SOME (_, Int (f, _)) => f T
   122     SOME (_, Int (f, _)) => f T
   123   | _ => NONE) 
   123   | _ => NONE)
   124 
   124 
   125 fun is_builtin_typ_ext ctxt T =
   125 fun is_builtin_typ_ext ctxt T =
   126   (case lookup_builtin_typ ctxt T of
   126   (case lookup_builtin_typ ctxt T of
   127     SOME (_, Int (f, _)) => is_some (f T)
   127     SOME (_, Int (f, _)) => is_some (f T)
   128   | SOME (_, Ext f) => f T
   128   | SOME (_, Ext f) => f T
   203     (case dest_builtin_num ctxt t of
   203     (case dest_builtin_num ctxt t of
   204       SOME (n, _) => SOME (n, 0, [], K t)
   204       SOME (n, _) => SOME (n, 0, [], K t)
   205     | NONE => dest_builtin_fun ctxt c ts)
   205     | NONE => dest_builtin_fun ctxt c ts)
   206   end
   206   end
   207 
   207 
   208 fun dest_builtin_fun_ext ctxt (c as (_, T)) ts =    
   208 fun dest_builtin_fun_ext ctxt (c as (_, T)) ts =
   209   (case lookup_builtin_fun ctxt c of
   209   (case lookup_builtin_fun ctxt c of
   210     SOME (_, Int f) => f ctxt T ts |> Option.map (fn (_, _, us, _) => us)
   210     SOME (_, Int f) => f ctxt T ts |> Option.map (fn (_, _, us, _) => us)
   211   | SOME (_, Ext f) => SOME (f ctxt T ts)
   211   | SOME (_, Ext f) => SOME (f ctxt T ts)
   212   | NONE => NONE)
   212   | NONE => NONE)
   213 
   213