src/Pure/theory.ML
changeset 25059 e6e0ee56a672
parent 25017 e82ab4962f80
child 26631 d6b6c74a8bcf
equal deleted inserted replaced
25058:d8d8bac48031 25059:e6e0ee56a672
    81   if Context.exists_name name thy then ()
    81   if Context.exists_name name thy then ()
    82   else error ("Require theory " ^ quote name ^ " as an ancestor for " ^ what);
    82   else error ("Require theory " ^ quote name ^ " as an ancestor for " ^ what);
    83 
    83 
    84 
    84 
    85 
    85 
    86 (** theory wrappers **)
    86 (** datatype thy **)
    87 
    87 
    88 type wrapper = (theory -> theory option) * stamp;
    88 type wrapper = (theory -> theory option) * stamp;
    89 
    89 
    90 fun apply_wrappers (wrappers: wrapper list) =
    90 fun apply_wrappers (wrappers: wrapper list) =
    91   let
    91   perhaps (perhaps_loop (perhaps_apply (map fst wrappers)));
    92     fun app [] res = res
       
    93       | app ((f, _) :: fs) (changed, thy) =
       
    94           (case f thy of
       
    95             NONE => app fs (changed, thy)
       
    96           | SOME thy' => app fs (true, thy'));
       
    97     fun app_fixpoint thy =
       
    98       (case app wrappers (false, thy) of
       
    99         (false, _) => thy
       
   100       | (true, thy') => app_fixpoint thy');
       
   101   in app_fixpoint end;
       
   102 
       
   103 
       
   104 
       
   105 (** datatype thy **)
       
   106 
    92 
   107 datatype thy = Thy of
    93 datatype thy = Thy of
   108  {axioms: term NameSpace.table,
    94  {axioms: term NameSpace.table,
   109   defs: Defs.T,
    95   defs: Defs.T,
   110   oracles: ((theory * Object.T -> term) * stamp) NameSpace.table,
    96   oracles: ((theory * Object.T -> term) * stamp) NameSpace.table,