src/Pure/Isar/local_theory.ML
changeset 72451 e51f1733618d
parent 72450 24bd1316eaae
child 72502 ff181cd78bb7
equal deleted inserted replaced
72450:24bd1316eaae 72451:e51f1733618d
    74   val exit_result: (morphism -> 'a -> 'b) -> 'a * local_theory -> 'b * Proof.context
    74   val exit_result: (morphism -> 'a -> 'b) -> 'a * local_theory -> 'b * Proof.context
    75   val exit_result_global: (morphism -> 'a -> 'b) -> 'a * local_theory -> 'b * theory
    75   val exit_result_global: (morphism -> 'a -> 'b) -> 'a * local_theory -> 'b * theory
    76   val begin_nested: local_theory -> Binding.scope * local_theory
    76   val begin_nested: local_theory -> Binding.scope * local_theory
    77   val end_nested: local_theory -> local_theory
    77   val end_nested: local_theory -> local_theory
    78   val end_nested_result: (morphism -> 'a -> 'b) ->  'a * local_theory -> 'b * local_theory
    78   val end_nested_result: (morphism -> 'a -> 'b) ->  'a * local_theory -> 'b * local_theory
    79   val subtarget: (local_theory -> local_theory) -> local_theory -> local_theory
       
    80   val subtarget_result: (morphism -> 'a -> 'b) -> (local_theory -> 'a * local_theory) ->
       
    81     local_theory -> 'b * local_theory
       
    82 end;
    79 end;
    83 
    80 
    84 signature PRIVATE_LOCAL_THEORY =
    81 signature PRIVATE_LOCAL_THEORY =
    85 sig
    82 sig
    86   include LOCAL_THEORY
    83   include LOCAL_THEORY
   402    let
   399    let
   403     val outer_lthy = end_nested lthy;
   400     val outer_lthy = end_nested lthy;
   404     val phi = Proof_Context.export_morphism lthy outer_lthy;
   401     val phi = Proof_Context.export_morphism lthy outer_lthy;
   405   in (decl phi x, outer_lthy) end;
   402   in (decl phi x, outer_lthy) end;
   406 
   403 
   407 fun subtarget body = begin_nested #> snd #> body #> end_nested;
       
   408 
       
   409 fun subtarget_result decl body lthy =
       
   410   let
       
   411     val (x, inner_lthy) = lthy |> begin_nested |> snd |> body;
       
   412     val lthy' = inner_lthy |> end_nested;
       
   413     val phi = Proof_Context.export_morphism inner_lthy lthy';
       
   414   in (decl phi x, lthy') end;
       
   415 
       
   416 end;
   404 end;