modernized structure Proof_Context;
authorwenzelm
Sat Apr 16 16:15:37 2011 +0200 (2011-04-16)
changeset 4236123f352990944
parent 42360 da8817d01e7c
child 42362 5528970ac6f7
modernized structure Proof_Context;
doc-src/IsarImplementation/Thy/Prelim.thy
doc-src/IsarImplementation/Thy/Proof.thy
doc-src/IsarImplementation/Thy/document/Prelim.tex
doc-src/IsarImplementation/Thy/document/Proof.tex
doc-src/Main/Docs/Main_Doc.thy
doc-src/antiquote_setup.ML
doc-src/more_antiquote.ML
doc-src/rail.ML
src/HOL/Boogie/Tools/boogie_commands.ML
src/HOL/Boogie/Tools/boogie_loader.ML
src/HOL/Boogie/Tools/boogie_tactics.ML
src/HOL/Decision_Procs/Approximation.thy
src/HOL/Decision_Procs/Ferrack.thy
src/HOL/Decision_Procs/Parametric_Ferrante_Rackoff.thy
src/HOL/Decision_Procs/commutative_ring_tac.ML
src/HOL/Decision_Procs/cooper_tac.ML
src/HOL/Decision_Procs/ferrack_tac.ML
src/HOL/Decision_Procs/mir_tac.ML
src/HOL/HOL.thy
src/HOL/HOLCF/Tools/Domain/domain.ML
src/HOL/HOLCF/Tools/Domain/domain_induction.ML
src/HOL/HOLCF/Tools/Domain/domain_isomorphism.ML
src/HOL/HOLCF/Tools/Domain/domain_take_proofs.ML
src/HOL/HOLCF/Tools/cpodef.ML
src/HOL/HOLCF/Tools/domaindef.ML
src/HOL/HOLCF/Tools/fixrec.ML
src/HOL/Import/import.ML
src/HOL/Import/shuffler.ML
src/HOL/Library/Sum_of_Squares/positivstellensatz_tools.ML
src/HOL/Library/reflection.ML
src/HOL/List.thy
src/HOL/Mirabelle/Tools/mirabelle_metis.ML
src/HOL/Mirabelle/Tools/mirabelle_sledgehammer.ML
src/HOL/Multivariate_Analysis/normarith.ML
src/HOL/Mutabelle/Mutabelle.thy
src/HOL/Mutabelle/mutabelle.ML
src/HOL/Mutabelle/mutabelle_extra.ML
src/HOL/NSA/transfer.ML
src/HOL/Nominal/nominal_datatype.ML
src/HOL/Nominal/nominal_fresh_fun.ML
src/HOL/Nominal/nominal_induct.ML
src/HOL/Nominal/nominal_inductive.ML
src/HOL/Nominal/nominal_inductive2.ML
src/HOL/Nominal/nominal_primrec.ML
src/HOL/Nominal/nominal_thmdecls.ML
src/HOL/SPARK/Tools/spark_commands.ML
src/HOL/SPARK/Tools/spark_vcs.ML
src/HOL/Statespace/distinct_tree_prover.ML
src/HOL/Statespace/state_space.ML
src/HOL/Tools/Datatype/datatype_case.ML
src/HOL/Tools/Datatype/datatype_codegen.ML
src/HOL/Tools/Datatype/datatype_data.ML
src/HOL/Tools/Function/context_tree.ML
src/HOL/Tools/Function/fun.ML
src/HOL/Tools/Function/function.ML
src/HOL/Tools/Function/function_common.ML
src/HOL/Tools/Function/function_core.ML
src/HOL/Tools/Function/induction_schema.ML
src/HOL/Tools/Function/lexicographic_order.ML
src/HOL/Tools/Function/measure_functions.ML
src/HOL/Tools/Function/mutual.ML
src/HOL/Tools/Function/partial_function.ML
src/HOL/Tools/Function/pat_completeness.ML
src/HOL/Tools/Function/pattern_split.ML
src/HOL/Tools/Function/relation.ML
src/HOL/Tools/Function/scnp_reconstruct.ML
src/HOL/Tools/Function/size.ML
src/HOL/Tools/Function/termination.ML
src/HOL/Tools/Meson/meson.ML
src/HOL/Tools/Meson/meson_clausify.ML
src/HOL/Tools/Metis/metis_reconstruct.ML
src/HOL/Tools/Metis/metis_tactics.ML
src/HOL/Tools/Metis/metis_translate.ML
src/HOL/Tools/Nitpick/nitpick.ML
src/HOL/Tools/Nitpick/nitpick_hol.ML
src/HOL/Tools/Nitpick/nitpick_isar.ML
src/HOL/Tools/Nitpick/nitpick_model.ML
src/HOL/Tools/Nitpick/nitpick_preproc.ML
src/HOL/Tools/Predicate_Compile/code_prolog.ML
src/HOL/Tools/Predicate_Compile/core_data.ML
src/HOL/Tools/Predicate_Compile/predicate_compile.ML
src/HOL/Tools/Predicate_Compile/predicate_compile_aux.ML
src/HOL/Tools/Predicate_Compile/predicate_compile_core.ML
src/HOL/Tools/Predicate_Compile/predicate_compile_data.ML
src/HOL/Tools/Predicate_Compile/predicate_compile_fun.ML
src/HOL/Tools/Predicate_Compile/predicate_compile_pred.ML
src/HOL/Tools/Predicate_Compile/predicate_compile_proof.ML
src/HOL/Tools/Predicate_Compile/predicate_compile_quickcheck.ML
src/HOL/Tools/Predicate_Compile/predicate_compile_specialisation.ML
src/HOL/Tools/Qelim/cooper.ML
src/HOL/Tools/Quickcheck/exhaustive_generators.ML
src/HOL/Tools/Quickcheck/narrowing_generators.ML
src/HOL/Tools/Quickcheck/quickcheck_common.ML
src/HOL/Tools/Quickcheck/random_generators.ML
src/HOL/Tools/Quotient/quotient_info.ML
src/HOL/Tools/Quotient/quotient_tacs.ML
src/HOL/Tools/Quotient/quotient_term.ML
src/HOL/Tools/Quotient/quotient_typ.ML
src/HOL/Tools/SMT/smt_builtin.ML
src/HOL/Tools/SMT/smt_datatypes.ML
src/HOL/Tools/SMT/smt_monomorph.ML
src/HOL/Tools/SMT/smt_normalize.ML
src/HOL/Tools/SMT/smt_utils.ML
src/HOL/Tools/SMT/z3_interface.ML
src/HOL/Tools/SMT/z3_proof_reconstruction.ML
src/HOL/Tools/Sledgehammer/sledgehammer_atp_reconstruct.ML
src/HOL/Tools/Sledgehammer/sledgehammer_atp_translate.ML
src/HOL/Tools/Sledgehammer/sledgehammer_filter.ML
src/HOL/Tools/Sledgehammer/sledgehammer_isar.ML
src/HOL/Tools/Sledgehammer/sledgehammer_provers.ML
src/HOL/Tools/Sledgehammer/sledgehammer_run.ML
src/HOL/Tools/TFL/post.ML
src/HOL/Tools/TFL/rules.ML
src/HOL/Tools/TFL/tfl.ML
src/HOL/Tools/arith_data.ML
src/HOL/Tools/choice_specification.ML
src/HOL/Tools/cnf_funcs.ML
src/HOL/Tools/code_evaluation.ML
src/HOL/Tools/enriched_type.ML
src/HOL/Tools/inductive.ML
src/HOL/Tools/inductive_codegen.ML
src/HOL/Tools/inductive_realizer.ML
src/HOL/Tools/inductive_set.ML
src/HOL/Tools/lin_arith.ML
src/HOL/Tools/list_to_set_comprehension.ML
src/HOL/Tools/primrec.ML
src/HOL/Tools/recdef.ML
src/HOL/Tools/record.ML
src/HOL/Tools/refute.ML
src/HOL/Tools/transfer.ML
src/HOL/Tools/typedef.ML
src/HOL/ex/Iff_Oracle.thy
src/HOL/ex/sledgehammer_tactics.ML
src/Provers/Arith/cancel_sums.ML
src/Provers/Arith/fast_lin_arith.ML
src/Provers/classical.ML
src/Provers/order.ML
src/Provers/quantifier1.ML
src/Provers/quasi.ML
src/Provers/trancl.ML
src/Tools/Code/code_preproc.ML
src/Tools/Code/code_runtime.ML
src/Tools/Code/code_simp.ML
src/Tools/Code/code_target.ML
src/Tools/Code/code_thingol.ML
src/Tools/WWW_Find/find_theorems.ML
src/Tools/adhoc_overloading.ML
src/Tools/atomize_elim.ML
src/Tools/case_product.ML
src/Tools/coherent.ML
src/Tools/induct.ML
src/Tools/induct_tacs.ML
src/Tools/interpretation_with_defs.ML
src/Tools/misc_legacy.ML
src/Tools/nbe.ML
src/Tools/quickcheck.ML
src/Tools/subtyping.ML
src/Tools/value.ML
src/ZF/Tools/datatype_package.ML
src/ZF/Tools/ind_cases.ML
src/ZF/Tools/induct_tacs.ML
src/ZF/Tools/inductive_package.ML
     1.1 --- a/doc-src/IsarImplementation/Thy/Prelim.thy	Sat Apr 16 15:47:52 2011 +0200
     1.2 +++ b/doc-src/IsarImplementation/Thy/Prelim.thy	Sat Apr 16 16:15:37 2011 +0200
     1.3 @@ -279,9 +279,9 @@
     1.4  text %mlref {*
     1.5    \begin{mldecls}
     1.6    @{index_ML_type Proof.context} \\
     1.7 -  @{index_ML ProofContext.init_global: "theory -> Proof.context"} \\
     1.8 -  @{index_ML ProofContext.theory_of: "Proof.context -> theory"} \\
     1.9 -  @{index_ML ProofContext.transfer: "theory -> Proof.context -> Proof.context"} \\
    1.10 +  @{index_ML Proof_Context.init_global: "theory -> Proof.context"} \\
    1.11 +  @{index_ML Proof_Context.theory_of: "Proof.context -> theory"} \\
    1.12 +  @{index_ML Proof_Context.transfer: "theory -> Proof.context -> Proof.context"} \\
    1.13    \end{mldecls}
    1.14  
    1.15    \begin{description}
    1.16 @@ -290,14 +290,14 @@
    1.17    Elements of this type are essentially pure values, with a sliding
    1.18    reference to the background theory.
    1.19  
    1.20 -  \item @{ML ProofContext.init_global}~@{text "thy"} produces a proof context
    1.21 +  \item @{ML Proof_Context.init_global}~@{text "thy"} produces a proof context
    1.22    derived from @{text "thy"}, initializing all data.
    1.23  
    1.24 -  \item @{ML ProofContext.theory_of}~@{text "ctxt"} selects the
    1.25 +  \item @{ML Proof_Context.theory_of}~@{text "ctxt"} selects the
    1.26    background theory from @{text "ctxt"}, dereferencing its internal
    1.27    @{ML_type theory_ref}.
    1.28  
    1.29 -  \item @{ML ProofContext.transfer}~@{text "thy ctxt"} promotes the
    1.30 +  \item @{ML Proof_Context.transfer}~@{text "thy ctxt"} promotes the
    1.31    background theory of @{text "ctxt"} to the super theory @{text
    1.32    "thy"}.
    1.33  
    1.34 @@ -354,11 +354,11 @@
    1.35  
    1.36    \item @{ML Context.theory_of}~@{text "context"} always produces a
    1.37    theory from the generic @{text "context"}, using @{ML
    1.38 -  "ProofContext.theory_of"} as required.
    1.39 +  "Proof_Context.theory_of"} as required.
    1.40  
    1.41    \item @{ML Context.proof_of}~@{text "context"} always produces a
    1.42    proof context from the generic @{text "context"}, using @{ML
    1.43 -  "ProofContext.init_global"} as required (note that this re-initializes the
    1.44 +  "Proof_Context.init_global"} as required (note that this re-initializes the
    1.45    context data with each invocation).
    1.46  
    1.47    \end{description}
     2.1 --- a/doc-src/IsarImplementation/Thy/Proof.thy	Sat Apr 16 15:47:52 2011 +0200
     2.2 +++ b/doc-src/IsarImplementation/Thy/Proof.thy	Sat Apr 16 16:15:37 2011 +0200
     2.3 @@ -314,7 +314,7 @@
     2.4    exports result @{text "thm"} from the the @{text "inner"} context
     2.5    back into the @{text "outer"} one; @{text "is_goal = true"} means
     2.6    this is a goal context.  The result is in HHF normal form.  Note
     2.7 -  that @{ML "ProofContext.export"} combines @{ML "Variable.export"}
     2.8 +  that @{ML "Proof_Context.export"} combines @{ML "Variable.export"}
     2.9    and @{ML "Assumption.export"} in the canonical way.
    2.10  
    2.11    \end{description}
    2.12 @@ -341,7 +341,7 @@
    2.13  text {* Note that the variables of the resulting rule are not
    2.14    generalized.  This would have required to fix them properly in the
    2.15    context beforehand, and export wrt.\ variables afterwards (cf.\ @{ML
    2.16 -  Variable.export} or the combined @{ML "ProofContext.export"}).  *}
    2.17 +  Variable.export} or the combined @{ML "Proof_Context.export"}).  *}
    2.18  
    2.19  
    2.20  section {* Structured goals and results \label{sec:struct-goals} *}
    2.21 @@ -481,10 +481,10 @@
    2.22        |> Obtain.result (fn _ => etac @{thm exE} 1) [@{thm ex}];
    2.23    *}
    2.24    ML_prf %"ML" {*
    2.25 -    singleton (ProofContext.export ctxt1 ctxt0) @{thm refl};
    2.26 +    singleton (Proof_Context.export ctxt1 ctxt0) @{thm refl};
    2.27    *}
    2.28    ML_prf %"ML" {*
    2.29 -    ProofContext.export ctxt1 ctxt0 [Thm.reflexive x]
    2.30 +    Proof_Context.export ctxt1 ctxt0 [Thm.reflexive x]
    2.31        handle ERROR msg => (warning msg; []);
    2.32    *}
    2.33  end
     3.1 --- a/doc-src/IsarImplementation/Thy/document/Prelim.tex	Sat Apr 16 15:47:52 2011 +0200
     3.2 +++ b/doc-src/IsarImplementation/Thy/document/Prelim.tex	Sat Apr 16 16:15:37 2011 +0200
     3.3 @@ -331,9 +331,9 @@
     3.4  \begin{isamarkuptext}%
     3.5  \begin{mldecls}
     3.6    \indexdef{}{ML type}{Proof.context}\verb|type Proof.context| \\
     3.7 -  \indexdef{}{ML}{ProofContext.init\_global}\verb|ProofContext.init_global: theory -> Proof.context| \\
     3.8 -  \indexdef{}{ML}{ProofContext.theory\_of}\verb|ProofContext.theory_of: Proof.context -> theory| \\
     3.9 -  \indexdef{}{ML}{ProofContext.transfer}\verb|ProofContext.transfer: theory -> Proof.context -> Proof.context| \\
    3.10 +  \indexdef{}{ML}{Proof\_Context.init\_global}\verb|Proof_Context.init_global: theory -> Proof.context| \\
    3.11 +  \indexdef{}{ML}{Proof\_Context.theory\_of}\verb|Proof_Context.theory_of: Proof.context -> theory| \\
    3.12 +  \indexdef{}{ML}{Proof\_Context.transfer}\verb|Proof_Context.transfer: theory -> Proof.context -> Proof.context| \\
    3.13    \end{mldecls}
    3.14  
    3.15    \begin{description}
    3.16 @@ -342,14 +342,14 @@
    3.17    Elements of this type are essentially pure values, with a sliding
    3.18    reference to the background theory.
    3.19  
    3.20 -  \item \verb|ProofContext.init_global|~\isa{thy} produces a proof context
    3.21 +  \item \verb|Proof_Context.init_global|~\isa{thy} produces a proof context
    3.22    derived from \isa{thy}, initializing all data.
    3.23  
    3.24 -  \item \verb|ProofContext.theory_of|~\isa{ctxt} selects the
    3.25 +  \item \verb|Proof_Context.theory_of|~\isa{ctxt} selects the
    3.26    background theory from \isa{ctxt}, dereferencing its internal
    3.27    \verb|theory_ref|.
    3.28  
    3.29 -  \item \verb|ProofContext.transfer|~\isa{thy\ ctxt} promotes the
    3.30 +  \item \verb|Proof_Context.transfer|~\isa{thy\ ctxt} promotes the
    3.31    background theory of \isa{ctxt} to the super theory \isa{thy}.
    3.32  
    3.33    \end{description}%
    3.34 @@ -432,10 +432,10 @@
    3.35    constructors \verb|Context.Theory| and \verb|Context.Proof|.
    3.36  
    3.37    \item \verb|Context.theory_of|~\isa{context} always produces a
    3.38 -  theory from the generic \isa{context}, using \verb|ProofContext.theory_of| as required.
    3.39 +  theory from the generic \isa{context}, using \verb|Proof_Context.theory_of| as required.
    3.40  
    3.41    \item \verb|Context.proof_of|~\isa{context} always produces a
    3.42 -  proof context from the generic \isa{context}, using \verb|ProofContext.init_global| as required (note that this re-initializes the
    3.43 +  proof context from the generic \isa{context}, using \verb|Proof_Context.init_global| as required (note that this re-initializes the
    3.44    context data with each invocation).
    3.45  
    3.46    \end{description}%
     4.1 --- a/doc-src/IsarImplementation/Thy/document/Proof.tex	Sat Apr 16 15:47:52 2011 +0200
     4.2 +++ b/doc-src/IsarImplementation/Thy/document/Proof.tex	Sat Apr 16 16:15:37 2011 +0200
     4.3 @@ -462,7 +462,7 @@
     4.4    exports result \isa{thm} from the the \isa{inner} context
     4.5    back into the \isa{outer} one; \isa{is{\isaliteral{5F}{\isacharunderscore}}goal\ {\isaliteral{3D}{\isacharequal}}\ true} means
     4.6    this is a goal context.  The result is in HHF normal form.  Note
     4.7 -  that \verb|ProofContext.export| combines \verb|Variable.export|
     4.8 +  that \verb|Proof_Context.export| combines \verb|Variable.export|
     4.9    and \verb|Assumption.export| in the canonical way.
    4.10  
    4.11    \end{description}%
    4.12 @@ -532,7 +532,7 @@
    4.13  \begin{isamarkuptext}%
    4.14  Note that the variables of the resulting rule are not
    4.15    generalized.  This would have required to fix them properly in the
    4.16 -  context beforehand, and export wrt.\ variables afterwards (cf.\ \verb|Variable.export| or the combined \verb|ProofContext.export|).%
    4.17 +  context beforehand, and export wrt.\ variables afterwards (cf.\ \verb|Variable.export| or the combined \verb|Proof_Context.export|).%
    4.18  \end{isamarkuptext}%
    4.19  \isamarkuptrue%
    4.20  %
    4.21 @@ -786,7 +786,7 @@
    4.22  \ \ {\isaliteral{2A7D}{\isacharverbatimclose}}\isanewline
    4.23  \ \ \isacommand{ML{\isaliteral{5F}{\isacharunderscore}}prf}\isamarkupfalse%
    4.24  \ {\isaliteral{7B2A}{\isacharverbatimopen}}\isanewline
    4.25 -\ \ \ \ singleton\ {\isaliteral{28}{\isacharparenleft}}ProofContext{\isaliteral{2E}{\isachardot}}export\ ctxt{\isadigit{1}}\ ctxt{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}\ %
    4.26 +\ \ \ \ singleton\ {\isaliteral{28}{\isacharparenleft}}Proof{\isaliteral{5F}{\isacharunderscore}}Context{\isaliteral{2E}{\isachardot}}export\ ctxt{\isadigit{1}}\ ctxt{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}\ %
    4.27  \isaantiq
    4.28  thm\ refl{}%
    4.29  \endisaantiq
    4.30 @@ -794,7 +794,7 @@
    4.31  \ \ {\isaliteral{2A7D}{\isacharverbatimclose}}\isanewline
    4.32  \ \ \isacommand{ML{\isaliteral{5F}{\isacharunderscore}}prf}\isamarkupfalse%
    4.33  \ {\isaliteral{7B2A}{\isacharverbatimopen}}\isanewline
    4.34 -\ \ \ \ ProofContext{\isaliteral{2E}{\isachardot}}export\ ctxt{\isadigit{1}}\ ctxt{\isadigit{0}}\ {\isaliteral{5B}{\isacharbrackleft}}Thm{\isaliteral{2E}{\isachardot}}reflexive\ x{\isaliteral{5D}{\isacharbrackright}}\isanewline
    4.35 +\ \ \ \ Proof{\isaliteral{5F}{\isacharunderscore}}Context{\isaliteral{2E}{\isachardot}}export\ ctxt{\isadigit{1}}\ ctxt{\isadigit{0}}\ {\isaliteral{5B}{\isacharbrackleft}}Thm{\isaliteral{2E}{\isachardot}}reflexive\ x{\isaliteral{5D}{\isacharbrackright}}\isanewline
    4.36  \ \ \ \ \ \ handle\ ERROR\ msg\ {\isaliteral{3D}{\isacharequal}}{\isaliteral{3E}{\isachargreater}}\ {\isaliteral{28}{\isacharparenleft}}warning\ msg{\isaliteral{3B}{\isacharsemicolon}}\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{3B}{\isacharsemicolon}}\isanewline
    4.37  \ \ {\isaliteral{2A7D}{\isacharverbatimclose}}\isanewline
    4.38  \isacommand{end}\isamarkupfalse%
     5.1 --- a/doc-src/Main/Docs/Main_Doc.thy	Sat Apr 16 15:47:52 2011 +0200
     5.2 +++ b/doc-src/Main/Docs/Main_Doc.thy	Sat Apr 16 16:15:37 2011 +0200
     5.3 @@ -5,7 +5,7 @@
     5.4  
     5.5  ML {*
     5.6  fun pretty_term_type_only ctxt (t, T) =
     5.7 -  (if fastype_of t = Sign.certify_typ (ProofContext.theory_of ctxt) T then ()
     5.8 +  (if fastype_of t = Sign.certify_typ (Proof_Context.theory_of ctxt) T then ()
     5.9     else error "term_type_only: type mismatch";
    5.10     Syntax.pretty_typ ctxt T)
    5.11  
     6.1 --- a/doc-src/antiquote_setup.ML	Sat Apr 16 15:47:52 2011 +0200
     6.2 +++ b/doc-src/antiquote_setup.ML	Sat Apr 16 16:15:37 2011 +0200
     6.3 @@ -132,7 +132,7 @@
     6.4  fun no_check _ _ = true;
     6.5  
     6.6  fun thy_check intern defined ctxt =
     6.7 -  let val thy = ProofContext.theory_of ctxt
     6.8 +  let val thy = Proof_Context.theory_of ctxt
     6.9    in defined thy o intern thy end;
    6.10  
    6.11  fun check_tool name =
     7.1 --- a/doc-src/more_antiquote.ML	Sat Apr 16 15:47:52 2011 +0200
     7.2 +++ b/doc-src/more_antiquote.ML	Sat Apr 16 16:15:37 2011 +0200
     7.3 @@ -27,7 +27,7 @@
     7.4  
     7.5  fun pretty_code_thm src ctxt raw_const =
     7.6    let
     7.7 -    val thy = ProofContext.theory_of ctxt;
     7.8 +    val thy = Proof_Context.theory_of ctxt;
     7.9      val const = Code.check_const thy raw_const;
    7.10      val (_, eqngr) = Code_Preproc.obtain true thy [const] [];
    7.11      fun holize thm = @{thm meta_eq_to_obj_eq} OF [thm];
     8.1 --- a/doc-src/rail.ML	Sat Apr 16 15:47:52 2011 +0200
     8.2 +++ b/doc-src/rail.ML	Sat Apr 16 16:15:37 2011 +0200
     8.3 @@ -47,7 +47,7 @@
     8.4  fun false_check _ _ = false;
     8.5  
     8.6  fun thy_check intern defined ctxt =
     8.7 -  let val thy = ProofContext.theory_of ctxt
     8.8 +  let val thy = Proof_Context.theory_of ctxt
     8.9    in defined thy o intern thy end;
    8.10  
    8.11  fun check_tool name =
     9.1 --- a/src/HOL/Boogie/Tools/boogie_commands.ML	Sat Apr 16 15:47:52 2011 +0200
     9.2 +++ b/src/HOL/Boogie/Tools/boogie_commands.ML	Sat Apr 16 16:15:37 2011 +0200
     9.3 @@ -63,7 +63,7 @@
     9.4        val (us, u) = split_goal t
     9.5        val assms = [((@{binding vc_trace}, []), map (rpair []) us)]
     9.6      in
     9.7 -      pair [u] o snd o ProofContext.add_assms_i Assumption.assume_export assms
     9.8 +      pair [u] o snd o Proof_Context.add_assms_i Assumption.assume_export assms
     9.9      end
    9.10  
    9.11    fun single_prove goal ctxt thm =
    9.12 @@ -100,16 +100,16 @@
    9.13        | _ => (pair ts, K I))
    9.14  
    9.15      val discharge = fold (Boogie_VCs.discharge o pair vc_name)
    9.16 -    fun after_qed [thms] = ProofContext.background_theory (discharge (vcs ~~ thms))
    9.17 +    fun after_qed [thms] = Proof_Context.background_theory (discharge (vcs ~~ thms))
    9.18        | after_qed _ = I
    9.19    in
    9.20 -    ProofContext.init_global thy
    9.21 +    Proof_Context.init_global thy
    9.22      |> fold Variable.auto_fixes ts
    9.23      |> (fn ctxt1 => ctxt1
    9.24      |> prepare
    9.25      |-> (fn us => fn ctxt2 => ctxt2
    9.26      |> Proof.theorem NONE (fn thmss => fn ctxt =>
    9.27 -         let val export = map (finish ctxt1) o ProofContext.export ctxt ctxt2
    9.28 +         let val export = map (finish ctxt1) o Proof_Context.export ctxt ctxt2
    9.29           in after_qed (map export thmss) ctxt end) [map (rpair []) us]))
    9.30    end
    9.31  end
    9.32 @@ -196,7 +196,7 @@
    9.33      end
    9.34  
    9.35    fun prove thy meth vc =
    9.36 -    ProofContext.init_global thy
    9.37 +    Proof_Context.init_global thy
    9.38      |> Proof.theorem NONE (K I) [[(Boogie_VCs.prop_of_vc vc, [])]]
    9.39      |> Proof.apply meth
    9.40      |> Seq.hd
    10.1 --- a/src/HOL/Boogie/Tools/boogie_loader.ML	Sat Apr 16 15:47:52 2011 +0200
    10.2 +++ b/src/HOL/Boogie/Tools/boogie_loader.ML	Sat Apr 16 16:15:37 2011 +0200
    10.3 @@ -234,7 +234,7 @@
    10.4      in apsnd sort_fst_str (fold split axs ([], [])) end
    10.5  
    10.6    fun mark_axioms thy axs =
    10.7 -    Boogie_Axioms.get (ProofContext.init_global thy)
    10.8 +    Boogie_Axioms.get (Proof_Context.init_global thy)
    10.9      |> Termtab.make o map (fn thm => (Thm.prop_of thm, Unused thm))
   10.10      |> fold mark axs
   10.11      |> split_list_kind thy o Termtab.dest
    11.1 --- a/src/HOL/Boogie/Tools/boogie_tactics.ML	Sat Apr 16 15:47:52 2011 +0200
    11.2 +++ b/src/HOL/Boogie/Tools/boogie_tactics.ML	Sat Apr 16 16:15:37 2011 +0200
    11.3 @@ -90,7 +90,7 @@
    11.4      Seq.maps (fn (names, st) =>
    11.5        CASES
    11.6          (Rule_Cases.make_common
    11.7 -          (ProofContext.theory_of ctxt,
    11.8 +          (Proof_Context.theory_of ctxt,
    11.9             Thm.prop_of (Rule_Cases.internalize_params st)) names)
   11.10          Tactical.all_tac st))
   11.11  in
    12.1 --- a/src/HOL/Decision_Procs/Approximation.thy	Sat Apr 16 15:47:52 2011 +0200
    12.2 +++ b/src/HOL/Decision_Procs/Approximation.thy	Sat Apr 16 16:15:37 2011 +0200
    12.3 @@ -3341,10 +3341,10 @@
    12.4      end
    12.5  
    12.6    fun approximation_conv ctxt ct =
    12.7 -    approximation_oracle (ProofContext.theory_of ctxt, Thm.term_of ct |> tap (tracing o Syntax.string_of_term ctxt));
    12.8 +    approximation_oracle (Proof_Context.theory_of ctxt, Thm.term_of ct |> tap (tracing o Syntax.string_of_term ctxt));
    12.9  
   12.10    fun approximate ctxt t =
   12.11 -    approximation_oracle (ProofContext.theory_of ctxt, t)
   12.12 +    approximation_oracle (Proof_Context.theory_of ctxt, t)
   12.13      |> Thm.prop_of |> Logic.dest_equals |> snd;
   12.14  
   12.15    (* Should be in HOL.thy ? *)
   12.16 @@ -3366,16 +3366,16 @@
   12.17                 |> HOLogic.dest_list
   12.18        val p = prec
   12.19                |> HOLogic.mk_number @{typ nat}
   12.20 -              |> Thm.cterm_of (ProofContext.theory_of ctxt)
   12.21 +              |> Thm.cterm_of (Proof_Context.theory_of ctxt)
   12.22      in case taylor
   12.23      of NONE => let
   12.24           val n = vs |> length
   12.25                   |> HOLogic.mk_number @{typ nat}
   12.26 -                 |> Thm.cterm_of (ProofContext.theory_of ctxt)
   12.27 +                 |> Thm.cterm_of (Proof_Context.theory_of ctxt)
   12.28           val s = vs
   12.29                   |> map lookup_splitting
   12.30                   |> HOLogic.mk_list @{typ nat}
   12.31 -                 |> Thm.cterm_of (ProofContext.theory_of ctxt)
   12.32 +                 |> Thm.cterm_of (Proof_Context.theory_of ctxt)
   12.33         in
   12.34           (rtac (Thm.instantiate ([], [(@{cpat "?n::nat"}, n),
   12.35                                       (@{cpat "?prec::nat"}, p),
   12.36 @@ -3388,9 +3388,9 @@
   12.37         else let
   12.38           val t = t
   12.39                |> HOLogic.mk_number @{typ nat}
   12.40 -              |> Thm.cterm_of (ProofContext.theory_of ctxt)
   12.41 +              |> Thm.cterm_of (Proof_Context.theory_of ctxt)
   12.42           val s = vs |> map lookup_splitting |> hd
   12.43 -              |> Thm.cterm_of (ProofContext.theory_of ctxt)
   12.44 +              |> Thm.cterm_of (Proof_Context.theory_of ctxt)
   12.45         in
   12.46           rtac (Thm.instantiate ([], [(@{cpat "?s::nat"}, s),
   12.47                                       (@{cpat "?t::nat"}, t),
   12.48 @@ -3530,9 +3530,9 @@
   12.49  
   12.50    fun approx_form prec ctxt t =
   12.51            realify t
   12.52 -       |> prepare_form (ProofContext.theory_of ctxt)
   12.53 +       |> prepare_form (Proof_Context.theory_of ctxt)
   12.54         |> (fn arith_term =>
   12.55 -          reify_form (ProofContext.theory_of ctxt) arith_term
   12.56 +          reify_form (Proof_Context.theory_of ctxt) arith_term
   12.57         |> HOLogic.dest_Trueprop |> dest_interpret_form
   12.58         |> (fn (data, xs) =>
   12.59            mk_approx_form_eval prec data (HOLogic.mk_list @{typ "(float * float) option"}
    13.1 --- a/src/HOL/Decision_Procs/Ferrack.thy	Sat Apr 16 15:47:52 2011 +0200
    13.2 +++ b/src/HOL/Decision_Procs/Ferrack.thy	Sat Apr 16 16:15:37 2011 +0200
    13.3 @@ -1996,7 +1996,7 @@
    13.4    let 
    13.5      val vs = Term.add_frees t [];
    13.6      val t' = (term_of_fm vs o @{code linrqe} o fm_of_term vs) t;
    13.7 -  in (Thm.cterm_of (ProofContext.theory_of ctxt) o HOLogic.mk_Trueprop o HOLogic.mk_eq) (t, t') end
    13.8 +  in (Thm.cterm_of (Proof_Context.theory_of ctxt) o HOLogic.mk_Trueprop o HOLogic.mk_eq) (t, t') end
    13.9  end;
   13.10  *}
   13.11  
    14.1 --- a/src/HOL/Decision_Procs/Parametric_Ferrante_Rackoff.thy	Sat Apr 16 15:47:52 2011 +0200
    14.2 +++ b/src/HOL/Decision_Procs/Parametric_Ferrante_Rackoff.thy	Sat Apr 16 16:15:37 2011 +0200
    14.3 @@ -3012,7 +3012,7 @@
    14.4   THEN (fn st =>
    14.5    let
    14.6      val g = List.nth (cprems_of st, i - 1)
    14.7 -    val thy = ProofContext.theory_of ctxt
    14.8 +    val thy = Proof_Context.theory_of ctxt
    14.9      val fs = subtract (op aconv) (map Free (Term.add_frees (term_of g) [])) ps
   14.10      val th = frpar_oracle (T, fs,ps, (* Pattern.eta_long [] *)g)
   14.11    in rtac (th RS iffD2) i st end);
   14.12 @@ -3022,7 +3022,7 @@
   14.13   THEN (fn st =>
   14.14    let
   14.15      val g = List.nth (cprems_of st, i - 1)
   14.16 -    val thy = ProofContext.theory_of ctxt
   14.17 +    val thy = Proof_Context.theory_of ctxt
   14.18      val fs = subtract (op aconv) (map Free (Term.add_frees (term_of g) [])) ps
   14.19      val th = frpar_oracle2 (T, fs,ps, (* Pattern.eta_long [] *)g)
   14.20    in rtac (th RS iffD2) i st end);
    15.1 --- a/src/HOL/Decision_Procs/commutative_ring_tac.ML	Sat Apr 16 15:47:52 2011 +0200
    15.2 +++ b/src/HOL/Decision_Procs/commutative_ring_tac.ML	Sat Apr 16 16:15:37 2011 +0200
    15.3 @@ -86,7 +86,7 @@
    15.4  
    15.5  fun tac ctxt = SUBGOAL (fn (g, i) =>
    15.6    let
    15.7 -    val thy = ProofContext.theory_of ctxt;
    15.8 +    val thy = Proof_Context.theory_of ctxt;
    15.9      val cring_ss = Simplifier.simpset_of ctxt  (*FIXME really the full simpset!?*)
   15.10        addsimps cring_simps;
   15.11      val (ca, cvs, clhs, crhs) = reif_eq thy (HOLogic.dest_Trueprop g)
    16.1 --- a/src/HOL/Decision_Procs/cooper_tac.ML	Sat Apr 16 15:47:52 2011 +0200
    16.2 +++ b/src/HOL/Decision_Procs/cooper_tac.ML	Sat Apr 16 16:15:37 2011 +0200
    16.3 @@ -69,7 +69,7 @@
    16.4  fun linz_tac ctxt q i = Object_Logic.atomize_prems_tac i THEN (fn st =>
    16.5    let
    16.6      val g = List.nth (prems_of st, i - 1)
    16.7 -    val thy = ProofContext.theory_of ctxt
    16.8 +    val thy = Proof_Context.theory_of ctxt
    16.9      (* Transform the term*)
   16.10      val (t,np,nh) = prepare_for_linz q g
   16.11      (* Some simpsets for dealing with mod div abs and nat*)
    17.1 --- a/src/HOL/Decision_Procs/ferrack_tac.ML	Sat Apr 16 15:47:52 2011 +0200
    17.2 +++ b/src/HOL/Decision_Procs/ferrack_tac.ML	Sat Apr 16 16:15:37 2011 +0200
    17.3 @@ -77,7 +77,7 @@
    17.4          THEN' (REPEAT_DETERM o split_tac [@{thm split_min}, @{thm split_max}, @{thm abs_split}])
    17.5          THEN' SUBGOAL (fn (g, i) =>
    17.6    let
    17.7 -    val thy = ProofContext.theory_of ctxt
    17.8 +    val thy = Proof_Context.theory_of ctxt
    17.9      (* Transform the term*)
   17.10      val (t,np,nh) = prepare_for_linr thy q g
   17.11      (* Some simpsets for dealing with mod div abs and nat*)
    18.1 --- a/src/HOL/Decision_Procs/mir_tac.ML	Sat Apr 16 15:47:52 2011 +0200
    18.2 +++ b/src/HOL/Decision_Procs/mir_tac.ML	Sat Apr 16 16:15:37 2011 +0200
    18.3 @@ -94,7 +94,7 @@
    18.4          THEN (fn st =>
    18.5    let
    18.6      val g = List.nth (prems_of st, i - 1)
    18.7 -    val thy = ProofContext.theory_of ctxt
    18.8 +    val thy = Proof_Context.theory_of ctxt
    18.9      (* Transform the term*)
   18.10      val (t,np,nh) = prepare_for_mir thy q g
   18.11      (* Some simpsets for dealing with mod div abs and nat*)
    19.1 --- a/src/HOL/HOL.thy	Sat Apr 16 15:47:52 2011 +0200
    19.2 +++ b/src/HOL/HOL.thy	Sat Apr 16 16:15:37 2011 +0200
    19.3 @@ -1262,7 +1262,7 @@
    19.4    then SOME @{thm Let_def} (*no or one ocurrence of bound variable*)
    19.5    else let (*Norbert Schirmer's case*)
    19.6      val ctxt = Simplifier.the_context ss;
    19.7 -    val thy = ProofContext.theory_of ctxt;
    19.8 +    val thy = Proof_Context.theory_of ctxt;
    19.9      val t = Thm.term_of ct;
   19.10      val ([t'], ctxt') = Variable.import_terms false [t] ctxt;
   19.11    in Option.map (hd o Variable.export ctxt' ctxt o single)
   19.12 @@ -1612,7 +1612,7 @@
   19.13    fun proc phi ss ct =
   19.14      let
   19.15        val ctxt = Simplifier.the_context ss;
   19.16 -      val thy = ProofContext.theory_of ctxt;
   19.17 +      val thy = Proof_Context.theory_of ctxt;
   19.18      in
   19.19        case Thm.term_of ct of
   19.20          (_ $ t $ u) => if matches thy u then NONE else SOME meta_reorient
   19.21 @@ -1964,12 +1964,12 @@
   19.22  subsubsection {* Evaluation and normalization by evaluation *}
   19.23  
   19.24  setup {*
   19.25 -  Value.add_evaluator ("SML", Codegen.eval_term o ProofContext.theory_of)  (* FIXME proper context!? *)
   19.26 +  Value.add_evaluator ("SML", Codegen.eval_term o Proof_Context.theory_of)  (* FIXME proper context!? *)
   19.27  *}
   19.28  
   19.29  ML {*
   19.30  fun gen_eval_method conv ctxt = SIMPLE_METHOD'
   19.31 -  (CONVERSION (Conv.params_conv (~1) (K (Conv.concl_conv (~1) (conv (ProofContext.theory_of ctxt)))) ctxt)
   19.32 +  (CONVERSION (Conv.params_conv (~1) (K (Conv.concl_conv (~1) (conv (Proof_Context.theory_of ctxt)))) ctxt)
   19.33      THEN' rtac TrueI)
   19.34  *}
   19.35  
   19.36 @@ -1981,7 +1981,7 @@
   19.37  
   19.38  method_setup normalization = {*
   19.39    Scan.succeed (fn ctxt => SIMPLE_METHOD'
   19.40 -    (CHANGED_PROP o (CONVERSION (Nbe.dynamic_conv (ProofContext.theory_of ctxt))
   19.41 +    (CHANGED_PROP o (CONVERSION (Nbe.dynamic_conv (Proof_Context.theory_of ctxt))
   19.42        THEN' (fn k => TRY (rtac TrueI k)))))
   19.43  *} "solve goal by normalization"
   19.44  
    20.1 --- a/src/HOL/HOLCF/Tools/Domain/domain.ML	Sat Apr 16 15:47:52 2011 +0200
    20.2 +++ b/src/HOL/HOLCF/Tools/Domain/domain.ML	Sat Apr 16 16:15:37 2011 +0200
    20.3 @@ -193,7 +193,7 @@
    20.4  (* Adapted from src/HOL/Tools/Datatype/datatype_data.ML *)
    20.5  fun read_typ thy sorts str =
    20.6    let
    20.7 -    val ctxt = ProofContext.init_global thy
    20.8 +    val ctxt = Proof_Context.init_global thy
    20.9        |> fold (Variable.declare_typ o TFree) sorts
   20.10    in Syntax.read_typ ctxt str end
   20.11  
    21.1 --- a/src/HOL/HOLCF/Tools/Domain/domain_induction.ML	Sat Apr 16 15:47:52 2011 +0200
    21.2 +++ b/src/HOL/HOLCF/Tools/Domain/domain_induction.ML	Sat Apr 16 16:15:37 2011 +0200
    21.3 @@ -225,7 +225,7 @@
    21.4          in bot :: map name_of (#con_specs constr_info) end
    21.5      in adms @ flat (map2 one_eq bottoms constr_infos) end
    21.6  
    21.7 -  val inducts = Project_Rule.projections (ProofContext.init_global thy) ind
    21.8 +  val inducts = Project_Rule.projections (Proof_Context.init_global thy) ind
    21.9    fun ind_rule (dname, rule) =
   21.10        ((Binding.empty, rule),
   21.11         [Rule_Cases.case_names case_ns, Induct.induct_type dname])
    22.1 --- a/src/HOL/HOLCF/Tools/Domain/domain_isomorphism.ML	Sat Apr 16 15:47:52 2011 +0200
    22.2 +++ b/src/HOL/HOLCF/Tools/Domain/domain_isomorphism.ML	Sat Apr 16 16:15:37 2011 +0200
    22.3 @@ -177,7 +177,7 @@
    22.4      val cont_thm =
    22.5        let
    22.6          val prop = mk_trp (mk_cont functional)
    22.7 -        val rules = Cont2ContData.get (ProofContext.init_global thy)
    22.8 +        val rules = Cont2ContData.get (Proof_Context.init_global thy)
    22.9          val tac = REPEAT_ALL_NEW (match_tac rules) 1
   22.10        in
   22.11          Goal.prove_global thy [] [] prop (K tac)
   22.12 @@ -185,7 +185,7 @@
   22.13  
   22.14      val tuple_unfold_thm =
   22.15        (@{thm def_cont_fix_eq} OF [tuple_fixdef_thm, cont_thm])
   22.16 -      |> Local_Defs.unfold (ProofContext.init_global thy) @{thms split_conv}
   22.17 +      |> Local_Defs.unfold (Proof_Context.init_global thy) @{thms split_conv}
   22.18  
   22.19      fun mk_unfold_thms [] thm = []
   22.20        | mk_unfold_thms (n::[]) thm = [(n, thm)]
   22.21 @@ -214,7 +214,7 @@
   22.22      (tab2 : (typ * term) list)
   22.23      (T : typ) : term =
   22.24    let
   22.25 -    val defl_simps = RepData.get (ProofContext.init_global thy)
   22.26 +    val defl_simps = RepData.get (Proof_Context.init_global thy)
   22.27      val rules = map (Thm.concl_of #> HOLogic.dest_Trueprop #> HOLogic.dest_eq) defl_simps
   22.28      val rules' = map (apfst mk_DEFL) tab1 @ map (apfst mk_LIFTDEFL) tab2
   22.29      fun proc1 t =
   22.30 @@ -389,7 +389,7 @@
   22.31  
   22.32  fun read_typ thy str sorts =
   22.33    let
   22.34 -    val ctxt = ProofContext.init_global thy
   22.35 +    val ctxt = Proof_Context.init_global thy
   22.36        |> fold (Variable.declare_typ o TFree) sorts
   22.37      val T = Syntax.read_typ ctxt str
   22.38    in (T, Term.add_tfreesT T sorts) end
   22.39 @@ -541,7 +541,7 @@
   22.40      fun mk_DEFL_eq_thm (lhsT, rhsT) =
   22.41        let
   22.42          val goal = mk_eqs (mk_DEFL lhsT, mk_DEFL rhsT)
   22.43 -        val DEFL_simps = RepData.get (ProofContext.init_global thy)
   22.44 +        val DEFL_simps = RepData.get (Proof_Context.init_global thy)
   22.45          val tac =
   22.46            rewrite_goals_tac (map mk_meta_eq DEFL_simps)
   22.47            THEN TRY (resolve_tac defl_unfold_thms 1)
   22.48 @@ -647,7 +647,7 @@
   22.49          val isodefl_rules =
   22.50            @{thms conjI isodefl_ID_DEFL isodefl_LIFTDEFL}
   22.51            @ isodefl_abs_rep_thms
   22.52 -          @ IsodeflData.get (ProofContext.init_global thy)
   22.53 +          @ IsodeflData.get (Proof_Context.init_global thy)
   22.54        in
   22.55          Goal.prove_global thy [] assms goal (fn {prems, ...} =>
   22.56           EVERY
    23.1 --- a/src/HOL/HOLCF/Tools/Domain/domain_take_proofs.ML	Sat Apr 16 15:47:52 2011 +0200
    23.2 +++ b/src/HOL/HOLCF/Tools/Domain/domain_take_proofs.ML	Sat Apr 16 16:15:37 2011 +0200
    23.3 @@ -142,10 +142,10 @@
    23.4      Context.theory_map (DeflMapData.add_thm thm)
    23.5  
    23.6  val get_rec_tab = Rec_Data.get
    23.7 -fun get_deflation_thms thy = DeflMapData.get (ProofContext.init_global thy)
    23.8 +fun get_deflation_thms thy = DeflMapData.get (Proof_Context.init_global thy)
    23.9  
   23.10  val map_ID_add = Map_Id_Data.add
   23.11 -val get_map_ID_thms = Map_Id_Data.get o ProofContext.init_global
   23.12 +val get_map_ID_thms = Map_Id_Data.get o Proof_Context.init_global
   23.13  
   23.14  val setup = DeflMapData.setup #> Map_Id_Data.setup
   23.15  
    24.1 --- a/src/HOL/HOLCF/Tools/cpodef.ML	Sat Apr 16 15:47:52 2011 +0200
    24.2 +++ b/src/HOL/HOLCF/Tools/cpodef.ML	Sat Apr 16 16:15:37 2011 +0200
    24.3 @@ -163,7 +163,7 @@
    24.4  
    24.5      (*rhs*)
    24.6      val tmp_ctxt =
    24.7 -      ProofContext.init_global thy
    24.8 +      Proof_Context.init_global thy
    24.9        |> fold (Variable.declare_typ o TFree) raw_args
   24.10      val set = prep_term tmp_ctxt raw_set
   24.11      val tmp_ctxt' = tmp_ctxt |> Variable.declare_term set
   24.12 @@ -173,7 +173,7 @@
   24.13        error ("Not a set type: " ^ quote (Syntax.string_of_typ tmp_ctxt setT))
   24.14  
   24.15      (*lhs*)
   24.16 -    val lhs_tfrees = map (ProofContext.check_tfree tmp_ctxt') raw_args
   24.17 +    val lhs_tfrees = map (Proof_Context.check_tfree tmp_ctxt') raw_args
   24.18      val full_tname = Sign.full_name thy tname
   24.19      val newT = Type (full_tname, map TFree lhs_tfrees)
   24.20  
   24.21 @@ -199,8 +199,8 @@
   24.22        |> Class.instantiation ([full_tname], lhs_tfrees, @{sort po})
   24.23        |> Specification.definition (NONE,
   24.24            ((Binding.prefix_name "below_" (Binding.suffix_name "_def" name), []), below_eqn))
   24.25 -    val ctxt_thy = ProofContext.init_global (ProofContext.theory_of lthy)
   24.26 -    val below_def = singleton (ProofContext.export lthy ctxt_thy) below_ldef
   24.27 +    val ctxt_thy = Proof_Context.init_global (Proof_Context.theory_of lthy)
   24.28 +    val below_def = singleton (Proof_Context.export lthy ctxt_thy) below_ldef
   24.29      val thy = lthy
   24.30        |> Class.prove_instantiation_exit
   24.31            (K (Tactic.rtac (@{thm typedef_po} OF [type_definition, below_def]) 1))
   24.32 @@ -313,22 +313,22 @@
   24.33  fun gen_cpodef_proof prep_term prep_constraint
   24.34      ((def, name), (b, raw_args, mx), set, opt_morphs) thy =
   24.35    let
   24.36 -    val ctxt = ProofContext.init_global thy
   24.37 +    val ctxt = Proof_Context.init_global thy
   24.38      val args = map (apsnd (prep_constraint ctxt)) raw_args
   24.39      val (goal1, goal2, make_result) =
   24.40        prepare_cpodef prep_term def name (b, args, mx) set opt_morphs thy
   24.41 -    fun after_qed [[th1, th2]] = ProofContext.background_theory (snd o make_result th1 th2)
   24.42 +    fun after_qed [[th1, th2]] = Proof_Context.background_theory (snd o make_result th1 th2)
   24.43        | after_qed _ = raise Fail "cpodef_proof"
   24.44    in Proof.theorem NONE after_qed [[(goal1, []), (goal2, [])]] ctxt end
   24.45  
   24.46  fun gen_pcpodef_proof prep_term prep_constraint
   24.47      ((def, name), (b, raw_args, mx), set, opt_morphs) thy =
   24.48    let
   24.49 -    val ctxt = ProofContext.init_global thy
   24.50 +    val ctxt = Proof_Context.init_global thy
   24.51      val args = map (apsnd (prep_constraint ctxt)) raw_args
   24.52      val (goal1, goal2, make_result) =
   24.53        prepare_pcpodef prep_term def name (b, args, mx) set opt_morphs thy
   24.54 -    fun after_qed [[th1, th2]] = ProofContext.background_theory (snd o make_result th1 th2)
   24.55 +    fun after_qed [[th1, th2]] = Proof_Context.background_theory (snd o make_result th1 th2)
   24.56        | after_qed _ = raise Fail "pcpodef_proof"
   24.57    in Proof.theorem NONE after_qed [[(goal1, []), (goal2, [])]] ctxt end
   24.58  
    25.1 --- a/src/HOL/HOLCF/Tools/domaindef.ML	Sat Apr 16 15:47:52 2011 +0200
    25.2 +++ b/src/HOL/HOLCF/Tools/domaindef.ML	Sat Apr 16 16:15:37 2011 +0200
    25.3 @@ -93,7 +93,7 @@
    25.4  
    25.5      (*rhs*)
    25.6      val tmp_ctxt =
    25.7 -      ProofContext.init_global thy
    25.8 +      Proof_Context.init_global thy
    25.9        |> fold (Variable.declare_typ o TFree) raw_args
   25.10      val defl = prep_term tmp_ctxt raw_defl
   25.11      val tmp_ctxt = tmp_ctxt |> Variable.declare_constraints defl
   25.12 @@ -103,7 +103,7 @@
   25.13              else error ("Not type defl: " ^ quote (Syntax.string_of_typ tmp_ctxt deflT))
   25.14  
   25.15      (*lhs*)
   25.16 -    val lhs_tfrees = map (ProofContext.check_tfree tmp_ctxt) raw_args
   25.17 +    val lhs_tfrees = map (Proof_Context.check_tfree tmp_ctxt) raw_args
   25.18      val lhs_sorts = map snd lhs_tfrees
   25.19      val full_tname = Sign.full_name thy tname
   25.20      val newT = Type (full_tname, map TFree lhs_tfrees)
   25.21 @@ -161,13 +161,13 @@
   25.22          Specification.definition (NONE, (liftprj_bind, liftprj_eqn)) lthy
   25.23      val ((_, (_, liftdefl_ldef)), lthy) =
   25.24          Specification.definition (NONE, (liftdefl_bind, liftdefl_eqn)) lthy
   25.25 -    val ctxt_thy = ProofContext.init_global (ProofContext.theory_of lthy)
   25.26 -    val emb_def = singleton (ProofContext.export lthy ctxt_thy) emb_ldef
   25.27 -    val prj_def = singleton (ProofContext.export lthy ctxt_thy) prj_ldef
   25.28 -    val defl_def = singleton (ProofContext.export lthy ctxt_thy) defl_ldef
   25.29 -    val liftemb_def = singleton (ProofContext.export lthy ctxt_thy) liftemb_ldef
   25.30 -    val liftprj_def = singleton (ProofContext.export lthy ctxt_thy) liftprj_ldef
   25.31 -    val liftdefl_def = singleton (ProofContext.export lthy ctxt_thy) liftdefl_ldef
   25.32 +    val ctxt_thy = Proof_Context.init_global (Proof_Context.theory_of lthy)
   25.33 +    val emb_def = singleton (Proof_Context.export lthy ctxt_thy) emb_ldef
   25.34 +    val prj_def = singleton (Proof_Context.export lthy ctxt_thy) prj_ldef
   25.35 +    val defl_def = singleton (Proof_Context.export lthy ctxt_thy) defl_ldef
   25.36 +    val liftemb_def = singleton (Proof_Context.export lthy ctxt_thy) liftemb_ldef
   25.37 +    val liftprj_def = singleton (Proof_Context.export lthy ctxt_thy) liftprj_ldef
   25.38 +    val liftdefl_def = singleton (Proof_Context.export lthy ctxt_thy) liftdefl_ldef
   25.39      val type_definition_thm =
   25.40        Raw_Simplifier.rewrite_rule
   25.41          (the_list (#set_def (#2 info)))
   25.42 @@ -208,7 +208,7 @@
   25.43  
   25.44  fun domaindef_cmd ((def, name), (b, raw_args, mx), A, morphs) thy =
   25.45    let
   25.46 -    val ctxt = ProofContext.init_global thy
   25.47 +    val ctxt = Proof_Context.init_global thy
   25.48      val args = map (apsnd (Typedecl.read_constraint ctxt)) raw_args
   25.49    in snd (gen_add_domaindef Syntax.read_term def name (b, args, mx) A morphs thy) end
   25.50  
    26.1 --- a/src/HOL/HOLCF/Tools/fixrec.ML	Sat Apr 16 15:47:52 2011 +0200
    26.2 +++ b/src/HOL/HOLCF/Tools/fixrec.ML	Sat Apr 16 16:15:37 2011 +0200
    26.3 @@ -122,7 +122,7 @@
    26.4    (spec : (Attrib.binding * term) list)
    26.5    (lthy : local_theory) =
    26.6    let
    26.7 -    val thy = ProofContext.theory_of lthy
    26.8 +    val thy = Proof_Context.theory_of lthy
    26.9      val names = map (Binding.name_of o fst o fst) fixes
   26.10      val all_names = space_implode "_" names
   26.11      val (lhss, rhss) = ListPair.unzip (map (dest_eqs o snd) spec)
   26.12 @@ -355,7 +355,7 @@
   26.13          (all_names ~~ (spec ~~ skips))
   26.14      val blocks = map block_of_name names
   26.15  
   26.16 -    val matcher_tab = FixrecMatchData.get (ProofContext.theory_of lthy)
   26.17 +    val matcher_tab = FixrecMatchData.get (Proof_Context.theory_of lthy)
   26.18      fun match_name c =
   26.19        case Symtab.lookup matcher_tab c of SOME m => m
   26.20          | NONE => fixrec_err ("unknown pattern constructor: " ^ c)
    27.1 --- a/src/HOL/Import/import.ML	Sat Apr 16 15:47:52 2011 +0200
    27.2 +++ b/src/HOL/Import/import.ML	Sat Apr 16 16:15:37 2011 +0200
    27.3 @@ -25,11 +25,11 @@
    27.4  
    27.5  fun import_tac ctxt (thyname, thmname) =
    27.6      if ! quick_and_dirty
    27.7 -    then Skip_Proof.cheat_tac (ProofContext.theory_of ctxt)
    27.8 +    then Skip_Proof.cheat_tac (Proof_Context.theory_of ctxt)
    27.9      else
   27.10       fn th =>
   27.11          let
   27.12 -            val thy = ProofContext.theory_of ctxt
   27.13 +            val thy = Proof_Context.theory_of ctxt
   27.14              val prem = hd (prems_of th)
   27.15              val _ = message ("Import_tac: thyname=" ^ thyname ^ ", thmname=" ^ thmname)
   27.16              val _ = message ("Import trying to prove " ^ Syntax.string_of_term ctxt prem)
    28.1 --- a/src/HOL/Import/shuffler.ML	Sat Apr 16 15:47:52 2011 +0200
    28.2 +++ b/src/HOL/Import/shuffler.ML	Sat Apr 16 16:15:37 2011 +0200
    28.3 @@ -608,7 +608,7 @@
    28.4  
    28.5  fun gen_shuffle_tac ctxt search thms i st =
    28.6      let
    28.7 -        val thy = ProofContext.theory_of ctxt
    28.8 +        val thy = Proof_Context.theory_of ctxt
    28.9          val _ = message ("Shuffling " ^ (string_of_thm st))
   28.10          val t = List.nth(prems_of st,i-1)
   28.11          val set = set_prop thy t
    29.1 --- a/src/HOL/Library/Sum_of_Squares/positivstellensatz_tools.ML	Sat Apr 16 15:47:52 2011 +0200
    29.2 +++ b/src/HOL/Library/Sum_of_Squares/positivstellensatz_tools.ML	Sat Apr 16 16:15:37 2011 +0200
    29.3 @@ -98,7 +98,7 @@
    29.4  val parse_id = Scan.one Symbol.is_letter ::: Scan.many Symbol.is_letdig >> implode
    29.5  
    29.6  fun parse_varpow ctxt = parse_id -- Scan.optional (str "^" |-- nat) 1 >>
    29.7 -  (fn (x, k) => (cterm_of (ProofContext.theory_of ctxt) (Free (x, @{typ real})), k)) 
    29.8 +  (fn (x, k) => (cterm_of (Proof_Context.theory_of ctxt) (Free (x, @{typ real})), k)) 
    29.9  
   29.10  fun parse_monomial ctxt = repeat_sep "*" (parse_varpow ctxt) >>
   29.11    (fn xs => fold FuncUtil.Ctermfunc.update xs FuncUtil.Ctermfunc.empty)
    30.1 --- a/src/HOL/Library/reflection.ML	Sat Apr 16 15:47:52 2011 +0200
    30.2 +++ b/src/HOL/Library/reflection.ML	Sat Apr 16 16:15:37 2011 +0200
    30.3 @@ -33,7 +33,7 @@
    30.4    let
    30.5     val (f as Const(fN,fT)) = th |> prop_of |> HOLogic.dest_Trueprop |> HOLogic.dest_eq
    30.6       |> fst |> strip_comb |> fst
    30.7 -   val thy = ProofContext.theory_of ctxt
    30.8 +   val thy = Proof_Context.theory_of ctxt
    30.9     val cert = Thm.cterm_of thy
   30.10     val (((_,_),[th']), ctxt') = Variable.import true [th] ctxt
   30.11     val (lhs, rhs) = HOLogic.dest_eq (HOLogic.dest_Trueprop (Thm.prop_of th'))
   30.12 @@ -118,7 +118,7 @@
   30.13         constructor and n is the number of the atom corresponding to t *)
   30.14      fun decomp_genreif da cgns (t,ctxt) bds =
   30.15        let
   30.16 -        val thy = ProofContext.theory_of ctxt
   30.17 +        val thy = Proof_Context.theory_of ctxt
   30.18          val cert = cterm_of thy
   30.19          fun tryabsdecomp (s,ctxt) bds =
   30.20            (case s of
   30.21 @@ -192,7 +192,7 @@
   30.22                                        (insert (op aconv) vs vss, insert (op aconv) n ns)) nths ([],[])
   30.23              val (vsns, ctxt') = Variable.variant_fixes (replicate (length vss) "vs") ctxt
   30.24              val (xns, ctxt'') = Variable.variant_fixes (replicate (length nths) "x") ctxt'
   30.25 -            val thy = ProofContext.theory_of ctxt''
   30.26 +            val thy = Proof_Context.theory_of ctxt''
   30.27              val cert = cterm_of thy
   30.28              val certT = ctyp_of thy
   30.29              val vsns_map = vss ~~ vsns
   30.30 @@ -247,7 +247,7 @@
   30.31          val tys = fold_rev (fn f => fold (insert (op =)) (f |> fastype_of |> binder_types |> tl)
   30.32                              ) fs []
   30.33          val (vs, ctxt') = Variable.variant_fixes (replicate (length tys) "vs") ctxt
   30.34 -        val thy = ProofContext.theory_of ctxt'
   30.35 +        val thy = Proof_Context.theory_of ctxt'
   30.36          val cert = cterm_of thy
   30.37          val vstys = map (fn (t,v) => (t,SOME (cert (Free(v,t)))))
   30.38                      (tys ~~ vs)
   30.39 @@ -274,7 +274,7 @@
   30.40           | is_listVar _ = false
   30.41      val vars = th |> prop_of |> HOLogic.dest_Trueprop |> HOLogic.dest_eq |> snd
   30.42                    |> strip_comb |> snd |> filter is_listVar
   30.43 -    val cert = cterm_of (ProofContext.theory_of ctxt)
   30.44 +    val cert = cterm_of (Proof_Context.theory_of ctxt)
   30.45      val cvs = map (fn (v as Var(n,t)) => (cert v,
   30.46                    the (AList.lookup Type.could_unify bds t) |> snd |> HOLogic.mk_list (dest_listT t) |> cert)) vars
   30.47      val th' = instantiate ([], cvs) th
    31.1 --- a/src/HOL/List.thy	Sat Apr 16 15:47:52 2011 +0200
    31.2 +++ b/src/HOL/List.thy	Sat Apr 16 16:15:37 2011 +0200
    31.3 @@ -395,8 +395,8 @@
    31.4  
    31.5    fun abs_tr ctxt (p as Free (s, T)) e opti =
    31.6          let
    31.7 -          val thy = ProofContext.theory_of ctxt;
    31.8 -          val s' = ProofContext.intern_const ctxt s;
    31.9 +          val thy = Proof_Context.theory_of ctxt;
   31.10 +          val s' = Proof_Context.intern_const ctxt s;
   31.11          in
   31.12            if Sign.declared_const thy s'
   31.13            then (pat_tr ctxt p e opti, false)
    32.1 --- a/src/HOL/Mirabelle/Tools/mirabelle_metis.ML	Sat Apr 16 15:47:52 2011 +0200
    32.2 +++ b/src/HOL/Mirabelle/Tools/mirabelle_metis.ML	Sat Apr 16 16:15:37 2011 +0200
    32.3 @@ -16,7 +16,7 @@
    32.4      val names = map Thm.get_name_hint thms
    32.5      val add_info = if null names then I else suffix (":\n" ^ commas names)
    32.6  
    32.7 -    val facts = Facts.props (ProofContext.facts_of (Proof.context_of pre))
    32.8 +    val facts = Facts.props (Proof_Context.facts_of (Proof.context_of pre))
    32.9  
   32.10      fun metis ctxt = Metis_Tactics.metis_tac ctxt (thms @ facts)
   32.11    in
    33.1 --- a/src/HOL/Mirabelle/Tools/mirabelle_sledgehammer.ML	Sat Apr 16 15:47:52 2011 +0200
    33.2 +++ b/src/HOL/Mirabelle/Tools/mirabelle_sledgehammer.ML	Sat Apr 16 16:15:37 2011 +0200
    33.3 @@ -411,7 +411,7 @@
    33.4  fun thms_of_name ctxt name =
    33.5    let
    33.6      val lex = Keyword.get_lexicons
    33.7 -    val get = maps (ProofContext.get_fact ctxt o fst)
    33.8 +    val get = maps (Proof_Context.get_fact ctxt o fst)
    33.9    in
   33.10      Source.of_string name
   33.11      |> Symbol.source
    34.1 --- a/src/HOL/Multivariate_Analysis/normarith.ML	Sat Apr 16 15:47:52 2011 +0200
    34.2 +++ b/src/HOL/Multivariate_Analysis/normarith.ML	Sat Apr 16 16:15:37 2011 +0200
    34.3 @@ -331,7 +331,7 @@
    34.4    fun instantiate_cterm' ty tms = Drule.cterm_rule (Drule.instantiate' ty tms)
    34.5    fun mk_norm t = Thm.capply (instantiate_cterm' [SOME (ctyp_of_term t)] [] @{cpat "norm :: (?'a :: real_normed_vector) => real"}) t
    34.6    fun mk_equals l r = Thm.capply (Thm.capply (instantiate_cterm' [SOME (ctyp_of_term l)] [] @{cpat "op == :: ?'a =>_"}) l) r
    34.7 -  val asl = map2 (fn (t,_) => fn n => Thm.assume (mk_equals (mk_norm t) (cterm_of (ProofContext.theory_of ctxt') (Free(n,@{typ real}))))) lctab fxns
    34.8 +  val asl = map2 (fn (t,_) => fn n => Thm.assume (mk_equals (mk_norm t) (cterm_of (Proof_Context.theory_of ctxt') (Free(n,@{typ real}))))) lctab fxns
    34.9    val replace_conv = try_conv (rewrs_conv asl)
   34.10    val replace_rule = fconv_rule (funpow 2 arg_conv (replacenegnorms replace_conv))
   34.11    val ges' =
    35.1 --- a/src/HOL/Mutabelle/Mutabelle.thy	Sat Apr 16 15:47:52 2011 +0200
    35.2 +++ b/src/HOL/Mutabelle/Mutabelle.thy	Sat Apr 16 16:15:37 2011 +0200
    35.3 @@ -61,16 +61,16 @@
    35.4  
    35.5  (*
    35.6  ML {*
    35.7 -Quickcheck.test_term (ProofContext.init_global @{theory})
    35.8 +Quickcheck.test_term (Proof_Context.init_global @{theory})
    35.9   false (SOME "SML") 1 1 (prop_of (hd @{thms nibble_pair_of_char_simps}))
   35.10  *}
   35.11  
   35.12  ML {*
   35.13  fun is_executable thy th = can (Quickcheck.test_term
   35.14 - (ProofContext.init_global thy) false (SOME "SML") 1 1) (prop_of th);
   35.15 + (Proof_Context.init_global thy) false (SOME "SML") 1 1) (prop_of th);
   35.16  
   35.17  fun is_executable_term thy t = can (Quickcheck.test_term
   35.18 - (ProofContext.init_global thy) false (SOME "SML") 1 1) t;
   35.19 + (Proof_Context.init_global thy) false (SOME "SML") 1 1) t;
   35.20  
   35.21  fun thms_of thy = filter (fn (_, th) => not (Thm.is_internal th) andalso
   35.22     Context.theory_name (theory_of_thm th) = Context.theory_name thy andalso
    36.1 --- a/src/HOL/Mutabelle/mutabelle.ML	Sat Apr 16 15:47:52 2011 +0200
    36.2 +++ b/src/HOL/Mutabelle/mutabelle.ML	Sat Apr 16 16:15:37 2011 +0200
    36.3 @@ -496,7 +496,7 @@
    36.4  
    36.5  fun is_executable thy insts th =
    36.6    ((Quickcheck.test_term 
    36.7 -      (ProofContext.init_global thy
    36.8 +      (Proof_Context.init_global thy
    36.9        |> Config.put Quickcheck.size 1
   36.10        |> Config.put Quickcheck.iterations 1
   36.11        |> Config.put Quickcheck.tester (!testgen_name))
   36.12 @@ -510,7 +510,7 @@
   36.13       ((x, pretty (the_default [] (Quickcheck.counterexample_of (Quickcheck.test_term
   36.14         ((Config.put Quickcheck.size sz #> Config.put Quickcheck.iterations qciter
   36.15          #> Config.put Quickcheck.tester (!testgen_name))
   36.16 -         (ProofContext.init_global usedthy))
   36.17 +         (Proof_Context.init_global usedthy))
   36.18         (true, false) (preprocess usedthy insts x, []))))) :: acc))
   36.19            handle ERROR msg => (Output.urgent_message msg; qc_recursive usedthy xs insts sz qciter acc);
   36.20  
    37.1 --- a/src/HOL/Mutabelle/mutabelle_extra.ML	Sat Apr 16 15:47:52 2011 +0200
    37.2 +++ b/src/HOL/Mutabelle/mutabelle_extra.ML	Sat Apr 16 16:15:37 2011 +0200
    37.3 @@ -122,7 +122,7 @@
    37.4    TimeLimit.timeLimit (seconds (!Auto_Tools.time_limit))
    37.5        (fn _ =>
    37.6            let
    37.7 -            val [result] = Quickcheck.test_goal_terms (change_options (ProofContext.init_global thy))
    37.8 +            val [result] = Quickcheck.test_goal_terms (change_options (Proof_Context.init_global thy))
    37.9                (false, false) [] [(t, [])]
   37.10            in
   37.11              case Quickcheck.counterexample_of result of 
   37.12 @@ -139,7 +139,7 @@
   37.13   
   37.14  fun invoke_solve_direct thy t =
   37.15    let
   37.16 -    val state = Proof.theorem NONE (K I) (map (single o rpair []) [t]) (ProofContext.init_global thy) 
   37.17 +    val state = Proof.theorem NONE (K I) (map (single o rpair []) [t]) (Proof_Context.init_global thy) 
   37.18    in
   37.19      case Solve_Direct.solve_direct false state of
   37.20        (true, _) => (Solved, [])
   37.21 @@ -152,7 +152,7 @@
   37.22  
   37.23  fun invoke_try thy t =
   37.24    let
   37.25 -    val state = Proof.theorem NONE (K I) (map (single o rpair []) [t]) (ProofContext.init_global thy)
   37.26 +    val state = Proof.theorem NONE (K I) (map (single o rpair []) [t]) (Proof_Context.init_global thy)
   37.27    in
   37.28      case Try.invoke_try (SOME (seconds 5.0)) ([], [], [], []) state of
   37.29        true => (Solved, [])
   37.30 @@ -196,7 +196,7 @@
   37.31  
   37.32  fun invoke_nitpick thy t =
   37.33    let
   37.34 -    val ctxt = ProofContext.init_global thy
   37.35 +    val ctxt = Proof_Context.init_global thy
   37.36      val state = Proof.init ctxt
   37.37      val (res, _) = Nitpick.pick_nits_in_term state
   37.38        (Nitpick_Isar.default_params thy []) false 1 1 1 [] [] t
   37.39 @@ -312,7 +312,7 @@
   37.40  
   37.41  fun is_executable_term thy t =
   37.42    let
   37.43 -    val ctxt = ProofContext.init_global thy
   37.44 +    val ctxt = Proof_Context.init_global thy
   37.45    in
   37.46      can (TimeLimit.timeLimit (seconds 2.0)
   37.47        (Quickcheck.test_goal_terms
   37.48 @@ -414,7 +414,7 @@
   37.49  (*          |> filter (not o is_forbidden_mutant) *)
   37.50            |> List.mapPartial (try (Sign.cert_term thy))
   37.51            |> List.filter (is_some o try (Thm.cterm_of thy))
   37.52 -          |> List.filter (is_some o try (Syntax.check_term (ProofContext.init_global thy)))
   37.53 +          |> List.filter (is_some o try (Syntax.check_term (Proof_Context.init_global thy)))
   37.54            |> take_random max_mutants
   37.55      val _ = map (fn t => Output.urgent_message ("MUTANT: " ^ Syntax.string_of_term_global thy t)) mutants
   37.56    in
   37.57 @@ -490,7 +490,7 @@
   37.58  fun mutate_theorems_and_write_report thy mtds thms file_name =
   37.59    let
   37.60      val _ = Output.urgent_message "Starting Mutabelle..."
   37.61 -    val ctxt = ProofContext.init_global thy
   37.62 +    val ctxt = Proof_Context.init_global thy
   37.63      val path = Path.explode file_name
   37.64      (* for normal report: *)
   37.65      (*
    38.1 --- a/src/HOL/NSA/transfer.ML	Sat Apr 16 15:47:52 2011 +0200
    38.2 +++ b/src/HOL/NSA/transfer.ML	Sat Apr 16 16:15:37 2011 +0200
    38.3 @@ -53,7 +53,7 @@
    38.4  
    38.5  fun transfer_thm_of ctxt ths t =
    38.6    let
    38.7 -    val thy = ProofContext.theory_of ctxt;
    38.8 +    val thy = Proof_Context.theory_of ctxt;
    38.9      val {intros,unfolds,refolds,consts} = TransferData.get (Context.Proof ctxt);
   38.10      val meta = Local_Defs.meta_rewrite_rule ctxt;
   38.11      val ths' = map meta ths;
    39.1 --- a/src/HOL/Nominal/nominal_datatype.ML	Sat Apr 16 15:47:52 2011 +0200
    39.2 +++ b/src/HOL/Nominal/nominal_datatype.ML	Sat Apr 16 16:15:37 2011 +0200
    39.3 @@ -149,7 +149,7 @@
    39.4    Simplifier.simproc_global @{theory} "perm_simp" ["pi1 \<bullet> (pi2 \<bullet> x)"] perm_simproc';
    39.5  
    39.6  fun projections rule =
    39.7 -  Project_Rule.projections (ProofContext.init_global (Thm.theory_of_thm rule)) rule
    39.8 +  Project_Rule.projections (Proof_Context.init_global (Thm.theory_of_thm rule)) rule
    39.9    |> map (Drule.export_without_context #> Rule_Cases.save rule);
   39.10  
   39.11  val supp_prod = @{thm supp_prod};
   39.12 @@ -1374,7 +1374,7 @@
   39.13                                    resolve_tac freshs2' i
   39.14                                | _ => asm_simp_tac (HOL_basic_ss addsimps
   39.15                                    pt2_atoms addsimprocs [perm_simproc]) i)) 1])
   39.16 -                       val final = ProofContext.export context3 context2 [th]
   39.17 +                       val final = Proof_Context.export context3 context2 [th]
   39.18                       in
   39.19                         resolve_tac final 1
   39.20                       end) context1 1) (constrs ~~ constrs')) (descr'' ~~ ndescr)))
   39.21 @@ -1615,7 +1615,7 @@
   39.22              val y = Free ("y", U);
   39.23              val y' = Free ("y'", U)
   39.24            in
   39.25 -            Drule.export_without_context (Goal.prove (ProofContext.init_global thy11) []
   39.26 +            Drule.export_without_context (Goal.prove (Proof_Context.init_global thy11) []
   39.27                (map (augment_sort thy11 fs_cp_sort)
   39.28                  (finite_prems @
   39.29                     [HOLogic.mk_Trueprop (R $ x $ y),
   39.30 @@ -1710,7 +1710,7 @@
   39.31             (Const ("Nominal.supp", fsT' --> HOLogic.mk_setT aT) $ rec_ctxt))) dt_atomTs;
   39.32  
   39.33      val rec_unique_thms = split_conj_thm (Goal.prove
   39.34 -      (ProofContext.init_global thy11) (map fst rec_unique_frees)
   39.35 +      (Proof_Context.init_global thy11) (map fst rec_unique_frees)
   39.36        (map (augment_sort thy11 fs_cp_sort)
   39.37          (flat finite_premss @ finite_ctxt_prems @ rec_prems @ rec_prems'))
   39.38        (augment_sort thy11 fs_cp_sort
   39.39 @@ -1993,7 +1993,7 @@
   39.40                        (fn _ => cut_facts_tac [pi1_pi2_result RS sym] 1 THEN
   39.41                          full_simp_tac (HOL_basic_ss addsimps perm_fresh_fresh @
   39.42                            fresh_results @ fresh_results') 1);
   39.43 -                    val final' = ProofContext.export context'' context' [final];
   39.44 +                    val final' = Proof_Context.export context'' context' [final];
   39.45                      val _ = warning "finished!"
   39.46                    in
   39.47                      resolve_tac final' 1
    40.1 --- a/src/HOL/Nominal/nominal_fresh_fun.ML	Sat Apr 16 15:47:52 2011 +0200
    40.2 +++ b/src/HOL/Nominal/nominal_fresh_fun.ML	Sat Apr 16 16:15:37 2011 +0200
    40.3 @@ -125,7 +125,7 @@
    40.4    (* Find the variable we instantiate *)
    40.5    let
    40.6      val thy = theory_of_thm thm;
    40.7 -    val ctxt = ProofContext.init_global thy;
    40.8 +    val ctxt = Proof_Context.init_global thy;
    40.9      val ss = global_simpset_of thy;
   40.10      val abs_fresh = Global_Theory.get_thms thy "abs_fresh";
   40.11      val fresh_perm_app = Global_Theory.get_thms thy "fresh_perm_app";
    41.1 --- a/src/HOL/Nominal/nominal_induct.ML	Sat Apr 16 15:47:52 2011 +0200
    41.2 +++ b/src/HOL/Nominal/nominal_induct.ML	Sat Apr 16 16:15:37 2011 +0200
    41.3 @@ -54,7 +54,7 @@
    41.4        end;
    41.5       val substs =
    41.6         map2 subst insts concls |> flat |> distinct (op =)
    41.7 -       |> map (pairself (Thm.cterm_of (ProofContext.theory_of ctxt)));
    41.8 +       |> map (pairself (Thm.cterm_of (Proof_Context.theory_of ctxt)));
    41.9    in 
   41.10      (((cases, nconcls), consumes), Drule.cterm_instantiate substs joined_rule) 
   41.11    end;
   41.12 @@ -83,7 +83,7 @@
   41.13  
   41.14  fun nominal_induct_tac ctxt simp def_insts avoiding fixings rules facts =
   41.15    let
   41.16 -    val thy = ProofContext.theory_of ctxt;
   41.17 +    val thy = Proof_Context.theory_of ctxt;
   41.18      val cert = Thm.cterm_of thy;
   41.19  
   41.20      val ((insts, defs), defs_ctxt) = fold_map Induct.add_defs def_insts ctxt |>> split_list;
   41.21 @@ -92,7 +92,7 @@
   41.22      val finish_rule =
   41.23        split_all_tuples
   41.24        #> rename_params_rule true
   41.25 -        (map (Name.clean o ProofContext.revert_skolem defs_ctxt o fst) avoiding);
   41.26 +        (map (Name.clean o Proof_Context.revert_skolem defs_ctxt o fst) avoiding);
   41.27  
   41.28      fun rule_cases ctxt r =
   41.29        let val r' = if simp then Induct.simplified_rule ctxt r else r
   41.30 @@ -126,7 +126,7 @@
   41.31              |> Seq.maps (fn rule' =>
   41.32                CASES (rule_cases ctxt rule' cases)
   41.33                  (Tactic.rtac (rename_params_rule false [] rule') i THEN
   41.34 -                  PRIMITIVE (singleton (ProofContext.export defs_ctxt ctxt))) st'))))
   41.35 +                  PRIMITIVE (singleton (Proof_Context.export defs_ctxt ctxt))) st'))))
   41.36      THEN_ALL_NEW_CASES
   41.37        ((if simp then Induct.simplify_tac ctxt THEN' (TRY o Induct.trivial_tac)
   41.38          else K all_tac)
    42.1 --- a/src/HOL/Nominal/nominal_inductive.ML	Sat Apr 16 15:47:52 2011 +0200
    42.2 +++ b/src/HOL/Nominal/nominal_inductive.ML	Sat Apr 16 16:15:37 2011 +0200
    42.3 @@ -146,7 +146,7 @@
    42.4  
    42.5  fun prove_strong_ind s avoids ctxt =
    42.6    let
    42.7 -    val thy = ProofContext.theory_of ctxt;
    42.8 +    val thy = Proof_Context.theory_of ctxt;
    42.9      val ({names, ...}, {raw_induct, intrs, elims, ...}) =
   42.10        Inductive.the_inductive ctxt (Sign.intern_const thy s);
   42.11      val ind_params = Inductive.params_of raw_induct;
   42.12 @@ -396,7 +396,7 @@
   42.13                     (fn _ => cut_facts_tac [th] 1 THEN full_simp_tac (HOL_ss
   42.14                       addsimps vc_compat_ths'' @ freshs2' @
   42.15                         perm_fresh_fresh @ fresh_atm) 1);
   42.16 -                 val final' = ProofContext.export ctxt'' ctxt' [final];
   42.17 +                 val final' = Proof_Context.export ctxt'' ctxt' [final];
   42.18                 in resolve_tac final' 1 end) context 1])
   42.19                   (prems ~~ thss ~~ ihyps ~~ prems'')))
   42.20          in
   42.21 @@ -404,7 +404,7 @@
   42.22            REPEAT (REPEAT (resolve_tac [conjI, impI] 1) THEN
   42.23              etac impE 1 THEN atac 1 THEN REPEAT (etac @{thm allE_Nil} 1) THEN
   42.24              asm_full_simp_tac (simpset_of ctxt) 1)
   42.25 -        end) |> singleton (ProofContext.export ctxt' ctxt);
   42.26 +        end) |> singleton (Proof_Context.export ctxt' ctxt);
   42.27  
   42.28      (** strong case analysis rule **)
   42.29  
   42.30 @@ -536,10 +536,10 @@
   42.31                             REPEAT_DETERM (TRY (rtac conjI 1) THEN
   42.32                               resolve_tac case_hyps' 1)
   42.33                           end) ctxt4 1)
   42.34 -                  val final = ProofContext.export ctxt3 ctxt2 [th]
   42.35 +                  val final = Proof_Context.export ctxt3 ctxt2 [th]
   42.36                  in resolve_tac final 1 end) ctxt1 1)
   42.37                    (thss ~~ hyps ~~ prems))) |>
   42.38 -                  singleton (ProofContext.export ctxt' ctxt))
   42.39 +                  singleton (Proof_Context.export ctxt' ctxt))
   42.40  
   42.41    in
   42.42      ctxt'' |>
   42.43 @@ -584,7 +584,7 @@
   42.44  
   42.45  fun prove_eqvt s xatoms ctxt =
   42.46    let
   42.47 -    val thy = ProofContext.theory_of ctxt;
   42.48 +    val thy = Proof_Context.theory_of ctxt;
   42.49      val ({names, ...}, {raw_induct, intrs, elims, ...}) =
   42.50        Inductive.the_inductive ctxt (Sign.intern_const thy s);
   42.51      val raw_induct = atomize_induct ctxt raw_induct;
   42.52 @@ -659,7 +659,7 @@
   42.53            (fn {context, ...} => EVERY (rtac raw_induct 1 :: map (fn intr_vs =>
   42.54                full_simp_tac eqvt_ss 1 THEN
   42.55                eqvt_tac context pi' intr_vs) intrs')) |>
   42.56 -          singleton (ProofContext.export ctxt' ctxt)))
   42.57 +          singleton (Proof_Context.export ctxt' ctxt)))
   42.58        end) atoms
   42.59    in
   42.60      ctxt |>
    43.1 --- a/src/HOL/Nominal/nominal_inductive2.ML	Sat Apr 16 15:47:52 2011 +0200
    43.2 +++ b/src/HOL/Nominal/nominal_inductive2.ML	Sat Apr 16 16:15:37 2011 +0200
    43.3 @@ -153,7 +153,7 @@
    43.4  
    43.5  fun prove_strong_ind s alt_name avoids ctxt =
    43.6    let
    43.7 -    val thy = ProofContext.theory_of ctxt;
    43.8 +    val thy = Proof_Context.theory_of ctxt;
    43.9      val ({names, ...}, {raw_induct, intrs, elims, ...}) =
   43.10        Inductive.the_inductive ctxt (Sign.intern_const thy s);
   43.11      val ind_params = Inductive.params_of raw_induct;
   43.12 @@ -182,7 +182,7 @@
   43.13        | xs => error ("No such case(s) in inductive definition: " ^ commas_quote xs));
   43.14      fun mk_avoids params name sets =
   43.15        let
   43.16 -        val (_, ctxt') = ProofContext.add_fixes
   43.17 +        val (_, ctxt') = Proof_Context.add_fixes
   43.18            (map (fn (s, T) => (Binding.name s, SOME T, NoSyn)) params) ctxt;
   43.19          fun mk s =
   43.20            let
   43.21 @@ -311,7 +311,7 @@
   43.22  
   43.23      fun obtain_fresh_name ts sets (T, fin) (freshs, ths1, ths2, ths3, ctxt) =
   43.24        let
   43.25 -        val thy = ProofContext.theory_of ctxt;
   43.26 +        val thy = Proof_Context.theory_of ctxt;
   43.27          (** protect terms to avoid that fresh_star_prod_set interferes with  **)
   43.28          (** pairs used in introduction rules of inductive predicate          **)
   43.29          fun protect t =
   43.30 @@ -432,7 +432,7 @@
   43.31                     (fn _ => cut_facts_tac [th] 1 THEN full_simp_tac (HOL_ss
   43.32                       addsimps vc_compat_ths1' @ fresh_ths1 @
   43.33                         perm_freshs_freshs') 1);
   43.34 -                 val final' = ProofContext.export ctxt'' ctxt' [final];
   43.35 +                 val final' = Proof_Context.export ctxt'' ctxt' [final];
   43.36                 in resolve_tac final' 1 end) context 1])
   43.37                   (prems ~~ thss ~~ vc_compat' ~~ ihyps ~~ prems'')))
   43.38          in
   43.39 @@ -442,7 +442,7 @@
   43.40              asm_full_simp_tac (simpset_of ctxt) 1)
   43.41          end) |>
   43.42          fresh_postprocess |>
   43.43 -        singleton (ProofContext.export ctxt' ctxt);
   43.44 +        singleton (Proof_Context.export ctxt' ctxt);
   43.45  
   43.46    in
   43.47      ctxt'' |>
    44.1 --- a/src/HOL/Nominal/nominal_primrec.ML	Sat Apr 16 15:47:52 2011 +0200
    44.2 +++ b/src/HOL/Nominal/nominal_primrec.ML	Sat Apr 16 16:15:37 2011 +0200
    44.3 @@ -247,7 +247,7 @@
    44.4      val eqns' = map unquantify spec'
    44.5      val eqns = fold_rev (process_eqn lthy (fn v => Variable.is_fixed lthy v
    44.6        orelse exists (fn ((w, _), _) => v = Binding.name_of w) fixes)) spec' [];
    44.7 -    val dt_info = NominalDatatype.get_nominal_datatypes (ProofContext.theory_of lthy);
    44.8 +    val dt_info = NominalDatatype.get_nominal_datatypes (Proof_Context.theory_of lthy);
    44.9      val lsrs :: lsrss = maps (fn (_, (_, _, eqns)) =>
   44.10        map (fn (_, (ls, _, rs, _, _)) => ls @ rs) eqns) eqns
   44.11      val _ =
   44.12 @@ -284,7 +284,7 @@
   44.13      val qualify = Binding.qualify false
   44.14        (space_implode "_" (map (Long_Name.base_name o #1) defs));
   44.15      val names_atts' = map (apfst qualify) names_atts;
   44.16 -    val cert = cterm_of (ProofContext.theory_of lthy');
   44.17 +    val cert = cterm_of (Proof_Context.theory_of lthy');
   44.18  
   44.19      fun mk_idx eq =
   44.20        let
   44.21 @@ -366,7 +366,7 @@
   44.22      Proof.theorem NONE
   44.23        (fn thss => fn goal_ctxt =>
   44.24           let
   44.25 -           val simps = ProofContext.export goal_ctxt lthy' (flat thss);
   44.26 +           val simps = Proof_Context.export goal_ctxt lthy' (flat thss);
   44.27             val (simps', lthy'') =
   44.28              fold_map Local_Theory.note (names_atts' ~~ map single simps) lthy';
   44.29           in
    45.1 --- a/src/HOL/Nominal/nominal_thmdecls.ML	Sat Apr 16 15:47:52 2011 +0200
    45.2 +++ b/src/HOL/Nominal/nominal_thmdecls.ML	Sat Apr 16 16:15:37 2011 +0200
    45.3 @@ -52,7 +52,7 @@
    45.4  
    45.5  fun prove_eqvt_tac ctxt orig_thm pi pi' =
    45.6    let
    45.7 -    val thy = ProofContext.theory_of ctxt
    45.8 +    val thy = Proof_Context.theory_of ctxt
    45.9      val mypi = Thm.cterm_of thy pi
   45.10      val T = fastype_of pi'
   45.11      val mypifree = Thm.cterm_of thy (Const (@{const_name "rev"}, T --> T) $ pi')
   45.12 @@ -70,7 +70,7 @@
   45.13  
   45.14  fun get_derived_thm ctxt hyp concl orig_thm pi typi =
   45.15    let
   45.16 -    val thy = ProofContext.theory_of ctxt;
   45.17 +    val thy = Proof_Context.theory_of ctxt;
   45.18      val pi' = Var (pi, typi);
   45.19      val lhs = Const (@{const_name "perm"}, typi --> HOLogic.boolT --> HOLogic.boolT) $ pi' $ hyp;
   45.20      val ([goal_term, pi''], ctxt') = Variable.import_terms false
   45.21 @@ -79,7 +79,7 @@
   45.22    in
   45.23      Goal.prove ctxt' [] [] goal_term
   45.24        (fn _ => prove_eqvt_tac ctxt' orig_thm pi' pi'') |>
   45.25 -    singleton (ProofContext.export ctxt' ctxt)
   45.26 +    singleton (Proof_Context.export ctxt' ctxt)
   45.27    end
   45.28  
   45.29  (* replaces in t every variable, say x, with pi o x *)
    46.1 --- a/src/HOL/SPARK/Tools/spark_commands.ML	Sat Apr 16 15:47:52 2011 +0200
    46.2 +++ b/src/HOL/SPARK/Tools/spark_commands.ML	Sat Apr 16 16:15:37 2011 +0200
    46.3 @@ -32,7 +32,7 @@
    46.4    end;
    46.5  
    46.6  fun add_proof_fun_cmd pf thy =
    46.7 -  let val ctxt = ProofContext.init_global thy
    46.8 +  let val ctxt = Proof_Context.init_global thy
    46.9    in SPARK_VCs.add_proof_fun
   46.10      (fn optT => Syntax.parse_term ctxt #>
   46.11         the_default I (Option.map Type.constraint optT) #>
   46.12 @@ -54,7 +54,7 @@
   46.13  
   46.14  fun prove_vc vc_name lthy =
   46.15    let
   46.16 -    val thy = ProofContext.theory_of lthy;
   46.17 +    val thy = Proof_Context.theory_of lthy;
   46.18      val (ctxt, stmt) = get_vc thy vc_name
   46.19    in
   46.20      Specification.theorem Thm.theoremK NONE
   46.21 @@ -80,7 +80,7 @@
   46.22  
   46.23      val ctxt = state |>
   46.24        Toplevel.theory_of |>
   46.25 -      ProofContext.init_global |>
   46.26 +      Proof_Context.init_global |>
   46.27        Context.proof_map (fold Element.init context)
   46.28    in
   46.29      [Pretty.str "Context:",
    47.1 --- a/src/HOL/SPARK/Tools/spark_vcs.ML	Sat Apr 16 15:47:52 2011 +0200
    47.2 +++ b/src/HOL/SPARK/Tools/spark_vcs.ML	Sat Apr 16 16:15:37 2011 +0200
    47.3 @@ -95,7 +95,7 @@
    47.4    | mk_type thy ty =
    47.5        (case get_type thy ty of
    47.6           NONE =>
    47.7 -           Syntax.check_typ (ProofContext.init_global thy)
    47.8 +           Syntax.check_typ (Proof_Context.init_global thy)
    47.9               (Type (Sign.full_name thy (Binding.name ty), []))
   47.10         | SOME T => T);
   47.11  
   47.12 @@ -108,8 +108,8 @@
   47.13        Logic.dest_equals |>> dest_Free;
   47.14      val ((_, (_, thm)), lthy') = Local_Theory.define
   47.15        ((Binding.name c, NoSyn), ((Binding.name def_name, []), rhs)) lthy
   47.16 -    val ctxt_thy = ProofContext.init_global (ProofContext.theory_of lthy');
   47.17 -    val thm' = singleton (ProofContext.export lthy' ctxt_thy) thm
   47.18 +    val ctxt_thy = Proof_Context.init_global (Proof_Context.theory_of lthy');
   47.19 +    val thm' = singleton (Proof_Context.export lthy' ctxt_thy) thm
   47.20    in (thm', lthy') end;
   47.21  
   47.22  fun strip_underscores s =
   47.23 @@ -183,7 +183,7 @@
   47.24           rtac @{thm subset_antisym} 1 THEN
   47.25           rtac @{thm subsetI} 1 THEN
   47.26           Datatype_Aux.exh_tac (K (#exhaust (Datatype_Data.the_info
   47.27 -           (ProofContext.theory_of lthy) tyname'))) 1 THEN
   47.28 +           (Proof_Context.theory_of lthy) tyname'))) 1 THEN
   47.29           ALLGOALS (asm_full_simp_tac (simpset_of lthy)));
   47.30  
   47.31      val finite_UNIV = Goal.prove lthy [] []
   47.32 @@ -904,7 +904,7 @@
   47.33           val ((t', (_, th)), lthy') = Specification.definition
   47.34             (NONE, ((id', []), HOLogic.mk_Trueprop (HOLogic.mk_eq
   47.35               (Free (s, T), t)))) lthy;
   47.36 -         val phi = ProofContext.export_morphism lthy' lthy
   47.37 +         val phi = Proof_Context.export_morphism lthy' lthy
   47.38         in
   47.39           ((id', Morphism.thm phi th),
   47.40            ((Symtab.update (s, (Morphism.term phi t', ty)) tab,
    48.1 --- a/src/HOL/Statespace/distinct_tree_prover.ML	Sat Apr 16 15:47:52 2011 +0200
    48.2 +++ b/src/HOL/Statespace/distinct_tree_prover.ML	Sat Apr 16 16:15:37 2011 +0200
    48.3 @@ -334,7 +334,7 @@
    48.4  
    48.5  fun neq_x_y ctxt x y name =
    48.6    (let
    48.7 -    val dist_thm = the (try (ProofContext.get_thm ctxt) name);
    48.8 +    val dist_thm = the (try (Proof_Context.get_thm ctxt) name);
    48.9      val ctree = cprop_of dist_thm |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2;
   48.10      val tree = term_of ctree;
   48.11      val x_path = the (find_tree x tree);
    49.1 --- a/src/HOL/Statespace/state_space.ML	Sat Apr 16 15:47:52 2011 +0200
    49.2 +++ b/src/HOL/Statespace/state_space.ML	Sat Apr 16 16:15:37 2011 +0200
    49.3 @@ -148,7 +148,7 @@
    49.4     |> Expression.sublocale_cmd I name expr []
    49.5     |> Proof.global_terminal_proof
    49.6           (Method.Basic (fn ctxt => SIMPLE_METHOD (ctxt_tac ctxt)), NONE)
    49.7 -   |> ProofContext.theory_of
    49.8 +   |> Proof_Context.theory_of
    49.9  
   49.10  fun add_locale name expr elems thy =
   49.11    thy 
   49.12 @@ -197,7 +197,7 @@
   49.13    if Variable.is_fixed ctxt name orelse Variable.is_declared ctxt name
   49.14    then
   49.15      let val n' = lookupI (op =) (Variable.fixes_of ctxt) name
   49.16 -    in SOME (Free (n',ProofContext.infer_type ctxt (n', dummyT))) end
   49.17 +    in SOME (Free (n',Proof_Context.infer_type ctxt (n', dummyT))) end
   49.18    else NONE
   49.19  
   49.20  
   49.21 @@ -251,7 +251,7 @@
   49.22  
   49.23      fun solve_tac ctxt (_,i) st =
   49.24        let
   49.25 -        val distinct_thm = ProofContext.get_thm ctxt dist_thm_name;
   49.26 +        val distinct_thm = Proof_Context.get_thm ctxt dist_thm_name;
   49.27          val goal = List.nth (cprems_of st,i-1);
   49.28          val rule = DistinctTreeProver.distinct_implProver distinct_thm goal;
   49.29        in EVERY [rtac rule i] st
   49.30 @@ -312,7 +312,7 @@
   49.31                        ([]))])];
   49.32    in thy
   49.33       |> add_locale name ([],vars) [assumes]
   49.34 -     |> ProofContext.theory_of
   49.35 +     |> Proof_Context.theory_of
   49.36       |> interprete_parent name dist_thm_full_name parent_expr
   49.37    end;
   49.38  
   49.39 @@ -428,7 +428,7 @@
   49.40            let
   49.41              fun upd (n,v) =
   49.42                let
   49.43 -                val nT = ProofContext.infer_type (Local_Theory.target_of lthy) (n, dummyT)
   49.44 +                val nT = Proof_Context.infer_type (Local_Theory.target_of lthy) (n, dummyT)
   49.45                in Context.proof_map
   49.46                    (update_declinfo (Morphism.term phi (Free (n,nT)),v))
   49.47                end;
   49.48 @@ -458,12 +458,12 @@
   49.49             (map fst parent_comps) (map fst components)
   49.50       |> Context.theory_map (add_statespace full_name args parents components [])
   49.51       |> add_locale (suffix valuetypesN name) (locinsts,locs) []
   49.52 -     |> ProofContext.theory_of 
   49.53 +     |> Proof_Context.theory_of 
   49.54       |> fold interprete_parent_valuetypes parents
   49.55       |> add_locale_cmd name
   49.56                ([(suffix namespaceN full_name ,(("",false),Expression.Named [])),
   49.57                  (suffix valuetypesN full_name,(("",false),Expression.Named  []))],[]) fixestate
   49.58 -     |> ProofContext.theory_of 
   49.59 +     |> Proof_Context.theory_of 
   49.60       |> fold interprete_parent parents
   49.61       |> add_declaration full_name (declare_declinfo components')
   49.62    end;
   49.63 @@ -472,7 +472,7 @@
   49.64  (* prepare arguments *)
   49.65  
   49.66  fun read_raw_parent ctxt raw_T =
   49.67 -  (case ProofContext.read_typ_abbrev ctxt raw_T of
   49.68 +  (case Proof_Context.read_typ_abbrev ctxt raw_T of
   49.69      Type (name, Ts) => (Ts, name)
   49.70    | T => error ("Bad parent statespace specification: " ^ Syntax.string_of_typ ctxt T));
   49.71  
   49.72 @@ -485,7 +485,7 @@
   49.73  
   49.74  fun cert_typ ctxt raw_T env =
   49.75    let
   49.76 -    val thy = ProofContext.theory_of ctxt;
   49.77 +    val thy = Proof_Context.theory_of ctxt;
   49.78      val T = Type.no_tvars (Sign.certify_typ thy raw_T)
   49.79        handle TYPE (msg, _, _) => error msg;
   49.80      val env' = OldTerm.add_typ_tfrees (T, env);
   49.81 @@ -500,7 +500,7 @@
   49.82        *)
   49.83      val _ = writeln ("Defining statespace " ^ quote name ^ " ...");
   49.84  
   49.85 -    val ctxt = ProofContext.init_global thy;
   49.86 +    val ctxt = Proof_Context.init_global thy;
   49.87  
   49.88      fun add_parent (Ts,pname,rs) env =
   49.89        let
    50.1 --- a/src/HOL/Tools/Datatype/datatype_case.ML	Sat Apr 16 15:47:52 2011 +0200
    50.2 +++ b/src/HOL/Tools/Datatype/datatype_case.ML	Sat Apr 16 16:15:37 2011 +0200
    50.3 @@ -297,7 +297,7 @@
    50.4    end;
    50.5  
    50.6  fun make_case tab ctxt = gen_make_case
    50.7 -  (match_type (ProofContext.theory_of ctxt)) Envir.subst_term_types fastype_of tab ctxt;
    50.8 +  (match_type (Proof_Context.theory_of ctxt)) Envir.subst_term_types fastype_of tab ctxt;
    50.9  val make_case_untyped = gen_make_case (K (K Vartab.empty))
   50.10    (K (Term.map_types (K dummyT))) (K dummyT);
   50.11  
   50.12 @@ -306,8 +306,8 @@
   50.13  
   50.14  fun case_tr err tab_of ctxt [t, u] =
   50.15        let
   50.16 -        val thy = ProofContext.theory_of ctxt;
   50.17 -        val intern_const_syntax = Consts.intern_syntax (ProofContext.consts_of ctxt);
   50.18 +        val thy = Proof_Context.theory_of ctxt;
   50.19 +        val intern_const_syntax = Consts.intern_syntax (Proof_Context.consts_of ctxt);
   50.20  
   50.21          (* replace occurrences of dummy_pattern by distinct variables *)
   50.22          (* internalize constant names                                 *)
   50.23 @@ -320,7 +320,7 @@
   50.24            | prep_pat (Const (s, T)) used =
   50.25                (Const (intern_const_syntax s, T), used)
   50.26            | prep_pat (v as Free (s, T)) used =
   50.27 -              let val s' = ProofContext.intern_const ctxt s in
   50.28 +              let val s' = Proof_Context.intern_const ctxt s in
   50.29                  if Sign.declared_const thy s' then
   50.30                    (Const (s', T), used)
   50.31                  else (v, used)
   50.32 @@ -449,7 +449,7 @@
   50.33  
   50.34  fun case_tr' tab_of cname ctxt ts =
   50.35    let
   50.36 -    val thy = ProofContext.theory_of ctxt;
   50.37 +    val thy = Proof_Context.theory_of ctxt;
   50.38      fun mk_clause (pat, rhs) =
   50.39        let val xs = Term.add_frees pat [] in
   50.40          Syntax.const @{syntax_const "_case1"} $
    51.1 --- a/src/HOL/Tools/Datatype/datatype_codegen.ML	Sat Apr 16 15:47:52 2011 +0200
    51.2 +++ b/src/HOL/Tools/Datatype/datatype_codegen.ML	Sat Apr 16 16:15:37 2011 +0200
    51.3 @@ -100,11 +100,11 @@
    51.4          val def' = Syntax.check_term lthy def;
    51.5          val ((_, (_, thm)), lthy') = Specification.definition
    51.6            (NONE, (Attrib.empty_binding, def')) lthy;
    51.7 -        val ctxt_thy = ProofContext.init_global (ProofContext.theory_of lthy);
    51.8 -        val thm' = singleton (ProofContext.export lthy' ctxt_thy) thm;
    51.9 +        val ctxt_thy = Proof_Context.init_global (Proof_Context.theory_of lthy);
   51.10 +        val thm' = singleton (Proof_Context.export lthy' ctxt_thy) thm;
   51.11        in (thm', lthy') end;
   51.12      fun tac thms = Class.intro_classes_tac []
   51.13 -      THEN ALLGOALS (ProofContext.fact_tac thms);
   51.14 +      THEN ALLGOALS (Proof_Context.fact_tac thms);
   51.15      fun prefix tyco = Binding.qualify true (Long_Name.base_name tyco) o Binding.qualify true "eq" o Binding.name;
   51.16      fun add_eq_thms tyco =
   51.17        Theory.checkpoint
    52.1 --- a/src/HOL/Tools/Datatype/datatype_data.ML	Sat Apr 16 15:47:52 2011 +0200
    52.2 +++ b/src/HOL/Tools/Datatype/datatype_data.ML	Sat Apr 16 16:15:37 2011 +0200
    52.3 @@ -166,7 +166,7 @@
    52.4  
    52.5  fun read_typ thy str sorts =
    52.6    let
    52.7 -    val ctxt = ProofContext.init_global thy
    52.8 +    val ctxt = Proof_Context.init_global thy
    52.9        |> fold (Variable.declare_typ o TFree) sorts;
   52.10      val T = Syntax.read_typ ctxt str;
   52.11    in (T, Term.add_tfreesT T sorts) end;
   52.12 @@ -216,10 +216,10 @@
   52.13  (* translation rules for case *)
   52.14  
   52.15  fun make_case ctxt = Datatype_Case.make_case
   52.16 -  (info_of_constr (ProofContext.theory_of ctxt)) ctxt;
   52.17 +  (info_of_constr (Proof_Context.theory_of ctxt)) ctxt;
   52.18  
   52.19  fun strip_case ctxt = Datatype_Case.strip_case
   52.20 -  (info_of_case (ProofContext.theory_of ctxt));
   52.21 +  (info_of_case (Proof_Context.theory_of ctxt));
   52.22  
   52.23  fun add_case_tr' case_names thy =
   52.24    Sign.add_advanced_trfuns ([], [],
   52.25 @@ -240,7 +240,7 @@
   52.26  val _ = Thy_Output.antiquotation "datatype" (Args.type_name true)
   52.27    (fn {source = src, context = ctxt, ...} => fn dtco =>
   52.28      let
   52.29 -      val thy = ProofContext.theory_of ctxt;
   52.30 +      val thy = Proof_Context.theory_of ctxt;
   52.31        val (vs, cos) = the_spec thy dtco;
   52.32        val ty = Type (dtco, map TFree vs);
   52.33        val pretty_typ_bracket = Syntax.pretty_typ (Config.put pretty_priority 1001 ctxt);
   52.34 @@ -318,7 +318,7 @@
   52.35      val (splits, thy9) = Datatype_Abs_Proofs.prove_split_thms
   52.36        config new_type_names descr sorts inject distinct exhaust case_rewrites thy8;
   52.37  
   52.38 -    val inducts = Project_Rule.projections (ProofContext.init_global thy2) induct;
   52.39 +    val inducts = Project_Rule.projections (Proof_Context.init_global thy2) induct;
   52.40      val dt_infos = map_index
   52.41        (make_dt_info alt_names flat_descr sorts induct inducts rec_names rec_rewrites)
   52.42        (hd descr ~~ inject ~~ distinct ~~ exhaust ~~ nchotomys ~~
   52.43 @@ -378,12 +378,12 @@
   52.44  
   52.45  fun gen_rep_datatype prep_term config after_qed alt_names raw_ts thy =
   52.46    let
   52.47 -    val ctxt = ProofContext.init_global thy;
   52.48 +    val ctxt = Proof_Context.init_global thy;
   52.49  
   52.50      fun constr_of_term (Const (c, T)) = (c, T)
   52.51        | constr_of_term t = error ("Not a constant: " ^ Syntax.string_of_term ctxt t);
   52.52      fun no_constr (c, T) =
   52.53 -      error ("Bad constructor: " ^ ProofContext.extern_const ctxt c ^ "::" ^
   52.54 +      error ("Bad constructor: " ^ Proof_Context.extern_const ctxt c ^ "::" ^
   52.55          Syntax.string_of_typ ctxt T);
   52.56      fun type_of_constr (cT as (_, T)) =
   52.57        let
   52.58 @@ -432,7 +432,7 @@
   52.59            unflat rules (map Drule.zero_var_indexes_list raw_thms);
   52.60              (*FIXME somehow dubious*)
   52.61        in
   52.62 -        ProofContext.background_theory_result
   52.63 +        Proof_Context.background_theory_result
   52.64            (prove_rep_datatype config dt_names alt_names descr vs
   52.65              raw_inject half_distinct raw_induct)
   52.66          #-> after_qed
    53.1 --- a/src/HOL/Tools/Function/context_tree.ML	Sat Apr 16 15:47:52 2011 +0200
    53.2 +++ b/src/HOL/Tools/Function/context_tree.ML	Sat Apr 16 16:15:37 2011 +0200
    53.3 @@ -111,12 +111,12 @@
    53.4  
    53.5  fun find_cong_rule ctx fvar h ((r,dep)::rs) t =
    53.6    (let
    53.7 -     val thy = ProofContext.theory_of ctx
    53.8 +     val thy = Proof_Context.theory_of ctx
    53.9  
   53.10       val tt' = Logic.mk_equals (Pattern.rewrite_term thy [(Free fvar, h)] [] t, t)
   53.11       val (c, subs) = (concl_of r, prems_of r)
   53.12  
   53.13 -     val subst = Pattern.match (ProofContext.theory_of ctx) (c, tt') (Vartab.empty, Vartab.empty)
   53.14 +     val subst = Pattern.match (Proof_Context.theory_of ctx) (c, tt') (Vartab.empty, Vartab.empty)
   53.15       val branches = map (mk_branch ctx o Envir.beta_norm o Envir.subst_term subst) subs
   53.16       val inst = map (fn v =>
   53.17         (cterm_of thy (Var v), cterm_of thy (Envir.subst_term subst (Var v)))) (Term.add_vars c [])
   53.18 @@ -147,7 +147,7 @@
   53.19              val (r, dep, branches) = find_cong_rule ctx fvar h congs_deps t
   53.20              fun subtree (ctx', fixes, assumes, st) =
   53.21                ((fixes,
   53.22 -                map (Thm.assume o cterm_of (ProofContext.theory_of ctx)) assumes),
   53.23 +                map (Thm.assume o cterm_of (Proof_Context.theory_of ctx)) assumes),
   53.24                 mk_tree' ctx' st)
   53.25            in
   53.26              Cong (r, dep, map subtree branches)
    54.1 --- a/src/HOL/Tools/Function/fun.ML	Sat Apr 16 15:47:52 2011 +0200
    54.2 +++ b/src/HOL/Tools/Function/fun.ML	Sat Apr 16 16:15:37 2011 +0200
    54.3 @@ -29,7 +29,7 @@
    54.4      fun err str = error (cat_lines ["Malformed definition:",
    54.5        str ^ " not allowed in sequential mode.",
    54.6        Syntax.string_of_term ctxt geq])
    54.7 -    val thy = ProofContext.theory_of ctxt
    54.8 +    val thy = Proof_Context.theory_of ctxt
    54.9  
   54.10      fun check_constr_pattern (Bound _) = ()
   54.11        | check_constr_pattern t =
    55.1 --- a/src/HOL/Tools/Function/function.ML	Sat Apr 16 15:47:52 2011 +0200
    55.2 +++ b/src/HOL/Tools/Function/function.ML	Sat Apr 16 16:15:37 2011 +0200
    55.3 @@ -231,11 +231,11 @@
    55.4      val (goal, afterqed, termination) = prepare_termination_proof prep_term raw_term_opt lthy
    55.5    in
    55.6      lthy
    55.7 -    |> ProofContext.note_thmss ""
    55.8 +    |> Proof_Context.note_thmss ""
    55.9         [((Binding.empty, [Context_Rules.rule_del]), [([allI], [])])] |> snd
   55.10 -    |> ProofContext.note_thmss ""
   55.11 +    |> Proof_Context.note_thmss ""
   55.12         [((Binding.empty, [Context_Rules.intro_bang (SOME 1)]), [([allI], [])])] |> snd
   55.13 -    |> ProofContext.note_thmss ""
   55.14 +    |> Proof_Context.note_thmss ""
   55.15         [((Binding.name "termination", [Context_Rules.intro_bang (SOME 0)]),
   55.16           [([Goal.norm_result termination], [])])] |> snd
   55.17      |> Proof.theorem NONE (snd oo afterqed) [[(goal, [])]]
    56.1 --- a/src/HOL/Tools/Function/function_common.ML	Sat Apr 16 15:47:52 2011 +0200
    56.2 +++ b/src/HOL/Tools/Function/function_common.ML	Sat Apr 16 16:15:37 2011 +0200
    56.3 @@ -127,7 +127,7 @@
    56.4  
    56.5  fun import_function_data t ctxt =
    56.6    let
    56.7 -    val thy = ProofContext.theory_of ctxt
    56.8 +    val thy = Proof_Context.theory_of ctxt
    56.9      val ct = cterm_of thy t
   56.10      val inst_morph = lift_morphism thy o Thm.instantiate
   56.11  
   56.12 @@ -277,7 +277,7 @@
   56.13          plural " " "s " not_defined ^ commas_quote not_defined)
   56.14  
   56.15      fun check_sorts ((fname, fT), _) =
   56.16 -      Sorts.of_sort (Sign.classes_of (ProofContext.theory_of ctxt)) (fT, HOLogic.typeS)
   56.17 +      Sorts.of_sort (Sign.classes_of (Proof_Context.theory_of ctxt)) (fT, HOLogic.typeS)
   56.18        orelse error (cat_lines
   56.19        ["Type of " ^ quote fname ^ " is not of sort " ^ quote "type" ^ ":",
   56.20         Syntax.string_of_typ (Config.put show_sorts true ctxt) fT])
    57.1 --- a/src/HOL/Tools/Function/function_core.ML	Sat Apr 16 15:47:52 2011 +0200
    57.2 +++ b/src/HOL/Tools/Function/function_core.ML	Sat Apr 16 16:15:37 2011 +0200
    57.3 @@ -65,7 +65,7 @@
    57.4  
    57.5  
    57.6  fun transfer_clause_ctx thy (ClauseContext { ctxt, qs, gs, lhs, rhs, cqs, ags, case_hyp }) =
    57.7 -  ClauseContext { ctxt = ProofContext.transfer thy ctxt,
    57.8 +  ClauseContext { ctxt = Proof_Context.transfer thy ctxt,
    57.9      qs = qs, gs = gs, lhs = lhs, rhs = rhs, cqs = cqs, ags = ags, case_hyp = case_hyp }
   57.10  
   57.11  
   57.12 @@ -145,7 +145,7 @@
   57.13      val (qs, ctxt') = Variable.variant_fixes (map fst pre_qs) ctxt
   57.14        |>> map2 (fn (_, T) => fn n => Free (n, T)) pre_qs
   57.15  
   57.16 -    val thy = ProofContext.theory_of ctxt'
   57.17 +    val thy = Proof_Context.theory_of ctxt'
   57.18  
   57.19      fun inst t = subst_bounds (rev qs, t)
   57.20      val gs = map inst pre_gs
   57.21 @@ -183,7 +183,7 @@
   57.22      val Globals {h, ...} = globals
   57.23  
   57.24      val ClauseContext { ctxt, qs, cqs, ags, ... } = cdata
   57.25 -    val cert = Thm.cterm_of (ProofContext.theory_of ctxt)
   57.26 +    val cert = Thm.cterm_of (Proof_Context.theory_of ctxt)
   57.27  
   57.28      (* Instantiate the GIntro thm with "f" and import into the clause context. *)
   57.29      val lGI = GIntro_thm
   57.30 @@ -203,7 +203,7 @@
   57.31            HOLogic.mk_Trueprop (G $ rcarg $ (h $ rcarg))
   57.32            |> fold_rev (curry Logic.mk_implies o prop_of) rcassm
   57.33            |> fold_rev (Logic.all o Free) rcfix
   57.34 -          |> Pattern.rewrite_term (ProofContext.theory_of ctxt) [(f, h)] []
   57.35 +          |> Pattern.rewrite_term (Proof_Context.theory_of ctxt) [(f, h)] []
   57.36            |> abstract_over_list (rev qs)
   57.37        in
   57.38          RCInfo {RIvs=rcfix, rcarg=rcarg, CCas=rcassm, llRI=llRI, h_assum=h_assum}
   57.39 @@ -386,7 +386,7 @@
   57.40  fun prove_stuff ctxt globals G f R clauses complete compat compat_store G_elim f_def =
   57.41    let
   57.42      val Globals {h, domT, ranT, x, ...} = globals
   57.43 -    val thy = ProofContext.theory_of ctxt
   57.44 +    val thy = Proof_Context.theory_of ctxt
   57.45  
   57.46      (* Inductive Hypothesis: !!z. (z,x):R ==> EX!y. (z,y):G *)
   57.47      val ihyp = Term.all domT $ Abs ("z", domT,
   57.48 @@ -447,7 +447,7 @@
   57.49            [] (* no special monos *)
   57.50        ||> Local_Theory.restore_naming lthy
   57.51  
   57.52 -    val cert = cterm_of (ProofContext.theory_of lthy)
   57.53 +    val cert = cterm_of (Proof_Context.theory_of lthy)
   57.54      fun requantify orig_intro thm =
   57.55        let
   57.56          val (qs, t) = dest_all_all orig_intro
   57.57 @@ -692,7 +692,7 @@
   57.58  (* FIXME: broken by design *)
   57.59  fun mk_domain_intro ctxt (Globals {domT, ...}) R R_cases clause =
   57.60    let
   57.61 -    val thy = ProofContext.theory_of ctxt
   57.62 +    val thy = Proof_Context.theory_of ctxt
   57.63      val ClauseInfo {cdata = ClauseContext {gs, lhs, cqs, ...},
   57.64        qglr = (oqs, _, _, _), ...} = clause
   57.65      val goal = HOLogic.mk_Trueprop (mk_acc domT R $ lhs)
   57.66 @@ -849,8 +849,8 @@
   57.67      val ((f, (_, f_defthm)), lthy) =
   57.68        PROFILE "def_fun" (define_function (defname ^ "_sumC_def") (fname, mixfix) domT ranT G default) lthy
   57.69  
   57.70 -    val RCss = map (map (inst_RC (ProofContext.theory_of lthy) fvar f)) RCss
   57.71 -    val trees = map (Function_Ctx_Tree.inst_tree (ProofContext.theory_of lthy) fvar f) trees
   57.72 +    val RCss = map (map (inst_RC (Proof_Context.theory_of lthy) fvar f)) RCss
   57.73 +    val trees = map (Function_Ctx_Tree.inst_tree (Proof_Context.theory_of lthy) fvar f) trees
   57.74  
   57.75      val ((R, RIntro_thmss, R_elim), lthy) =
   57.76        PROFILE "def_rel" (define_recursion_relation (rel_name defname) domT abstract_qglrs clauses RCss) lthy
   57.77 @@ -858,10 +858,10 @@
   57.78      val (_, lthy) =
   57.79        Local_Theory.abbrev Syntax.mode_default ((Binding.name (dom_name defname), NoSyn), mk_acc domT R) lthy
   57.80  
   57.81 -    val newthy = ProofContext.theory_of lthy
   57.82 +    val newthy = Proof_Context.theory_of lthy
   57.83      val clauses = map (transfer_clause_ctx newthy) clauses
   57.84  
   57.85 -    val cert = cterm_of (ProofContext.theory_of lthy)
   57.86 +    val cert = cterm_of (Proof_Context.theory_of lthy)
   57.87  
   57.88      val xclauses = PROFILE "xclauses"
   57.89        (map7 (mk_clause_info globals G f) (1 upto n) clauses abstract_qglrs trees
    58.1 --- a/src/HOL/Tools/Function/induction_schema.ML	Sat Apr 16 15:47:52 2011 +0200
    58.2 +++ b/src/HOL/Tools/Function/induction_schema.ML	Sat Apr 16 16:15:37 2011 +0200
    58.3 @@ -124,7 +124,7 @@
    58.4  
    58.5      val allqnames = fold (fn SchemeCase {qs, ...} => fold (insert (op =) o Free) qs) relevant_cases []
    58.6      val (Pbool :: xs') = map Free (Variable.variant_frees ctxt allqnames (("P", HOLogic.boolT) :: xs))
    58.7 -    val Cs' = map (Pattern.rewrite_term (ProofContext.theory_of ctxt) (filter_out (op aconv) (map Free xs ~~ xs')) []) Cs
    58.8 +    val Cs' = map (Pattern.rewrite_term (Proof_Context.theory_of ctxt) (filter_out (op aconv) (map Free xs ~~ xs')) []) Cs
    58.9  
   58.10      fun mk_case (SchemeCase {qs, oqnames, gs, lhs, ...}) =
   58.11        HOLogic.mk_Trueprop Pbool
   58.12 @@ -211,7 +211,7 @@
   58.13        SumTree.mk_inj T n (i + 1) (foldr1 HOLogic.mk_prod ts)
   58.14      val P_of = nth (map (fn (SchemeBranch { P, ... }) => P) branches)
   58.15  
   58.16 -    val thy = ProofContext.theory_of ctxt
   58.17 +    val thy = Proof_Context.theory_of ctxt
   58.18      val cert = cterm_of thy
   58.19  
   58.20      val P_comp = mk_ind_goal thy branches
   58.21 @@ -351,7 +351,7 @@
   58.22      val ([Rn,xn], ctxt'') = Variable.variant_fixes ["R","x"] ctxt'
   58.23      val R = Free (Rn, mk_relT ST)
   58.24      val x = Free (xn, ST)
   58.25 -    val cert = cterm_of (ProofContext.theory_of ctxt)
   58.26 +    val cert = cterm_of (Proof_Context.theory_of ctxt)
   58.27  
   58.28      val ineqss = mk_ineqs R scheme
   58.29        |> map (map (pairself (Thm.assume o cert)))
    59.1 --- a/src/HOL/Tools/Function/lexicographic_order.ML	Sat Apr 16 15:47:52 2011 +0200
    59.2 +++ b/src/HOL/Tools/Function/lexicographic_order.ML	Sat Apr 16 16:15:37 2011 +0200
    59.3 @@ -181,7 +181,7 @@
    59.4  
    59.5  fun lex_order_tac quiet ctxt solve_tac (st: thm) =
    59.6    let
    59.7 -    val thy = ProofContext.theory_of ctxt
    59.8 +    val thy = Proof_Context.theory_of ctxt
    59.9      val ((_ $ (_ $ rel)) :: tl) = prems_of st
   59.10  
   59.11      val (domT, _) = HOLogic.dest_prodT (HOLogic.dest_setT (fastype_of rel))
    60.1 --- a/src/HOL/Tools/Function/measure_functions.ML	Sat Apr 16 15:47:52 2011 +0200
    60.2 +++ b/src/HOL/Tools/Function/measure_functions.ML	Sat Apr 16 16:15:37 2011 +0200
    60.3 @@ -29,7 +29,7 @@
    60.4  fun find_measures ctxt T =
    60.5    DEPTH_SOLVE (resolve_tac (Measure_Heuristic_Rules.get ctxt) 1)
    60.6      (HOLogic.mk_Trueprop (mk_is_measure (Var (("f",0), T --> HOLogic.natT)))
    60.7 -     |> cterm_of (ProofContext.theory_of ctxt) |> Goal.init)
    60.8 +     |> cterm_of (Proof_Context.theory_of ctxt) |> Goal.init)
    60.9    |> Seq.map (prop_of #> (fn _ $ (_ $ (_ $ f)) => f))
   60.10    |> Seq.list_of
   60.11  
    61.1 --- a/src/HOL/Tools/Function/mutual.ML	Sat Apr 16 15:47:52 2011 +0200
    61.2 +++ b/src/HOL/Tools/Function/mutual.ML	Sat Apr 16 16:15:37 2011 +0200
    61.3 @@ -151,7 +151,7 @@
    61.4  
    61.5  fun in_context ctxt (f, pre_qs, pre_gs, pre_args, pre_rhs) F =
    61.6    let
    61.7 -    val thy = ProofContext.theory_of ctxt
    61.8 +    val thy = Proof_Context.theory_of ctxt
    61.9  
   61.10      val oqnames = map fst pre_qs
   61.11      val (qs, _) = Variable.variant_fixes oqnames ctxt
   61.12 @@ -198,7 +198,7 @@
   61.13  
   61.14  fun mk_applied_form ctxt caTs thm =
   61.15    let
   61.16 -    val thy = ProofContext.theory_of ctxt
   61.17 +    val thy = Proof_Context.theory_of ctxt
   61.18      val xs = map_index (fn (i,T) => cterm_of thy (Free ("x" ^ string_of_int i, T))) caTs (* FIXME: Bind xs properly *)
   61.19    in
   61.20      fold (fn x => fn thm => Thm.combination thm (Thm.reflexive x)) xs thm
   61.21 @@ -209,7 +209,7 @@
   61.22  
   61.23  fun mutual_induct_rules lthy induct all_f_defs (Mutual {n, ST, parts, ...}) =
   61.24    let
   61.25 -    val cert = cterm_of (ProofContext.theory_of lthy)
   61.26 +    val cert = cterm_of (Proof_Context.theory_of lthy)
   61.27      val newPs =
   61.28        map2 (fn Pname => fn MutualPart {cargTs, ...} =>
   61.29            Free (Pname, cargTs ---> HOLogic.boolT))
    62.1 --- a/src/HOL/Tools/Function/partial_function.ML	Sat Apr 16 15:47:52 2011 +0200
    62.2 +++ b/src/HOL/Tools/Function/partial_function.ML	Sat Apr 16 16:15:37 2011 +0200
    62.3 @@ -83,7 +83,7 @@
    62.4  val split_cases_tac = Subgoal.FOCUS_PARAMS (fn {context=ctxt, ...} =>
    62.5    SUBGOAL (fn (t, i) => case t of
    62.6      _ $ (_ $ Abs (_, _, body)) =>
    62.7 -      (case dest_case (ProofContext.theory_of ctxt) body of
    62.8 +      (case dest_case (Proof_Context.theory_of ctxt) body of
    62.9           NONE => no_tac
   62.10         | SOME (arg, conv) =>
   62.11             let open Conv in
   62.12 @@ -122,7 +122,7 @@
   62.13  application type correct*)
   62.14  fun apply_inst ctxt t u =
   62.15    let
   62.16 -    val thy = ProofContext.theory_of ctxt;
   62.17 +    val thy = Proof_Context.theory_of ctxt;
   62.18      val T = domain_type (fastype_of t);
   62.19      val T' = fastype_of u;
   62.20      val subst = Type.typ_match (Sign.tsig_of thy) (T, T') Vartab.empty
   62.21 @@ -170,7 +170,7 @@
   62.22      val ((f_binding, fT), mixfix) = the_single fixes;
   62.23      val fname = Binding.name_of f_binding;
   62.24  
   62.25 -    val cert = cterm_of (ProofContext.theory_of lthy);
   62.26 +    val cert = cterm_of (Proof_Context.theory_of lthy);
   62.27      val (lhs, rhs) = HOLogic.dest_eq (HOLogic.dest_Trueprop plain_eqn);
   62.28      val (head, args) = strip_comb lhs;
   62.29      val F = fold_rev lambda (head :: args) rhs;
    63.1 --- a/src/HOL/Tools/Function/pat_completeness.ML	Sat Apr 16 15:47:52 2011 +0200
    63.2 +++ b/src/HOL/Tools/Function/pat_completeness.ML	Sat Apr 16 16:15:37 2011 +0200
    63.3 @@ -128,7 +128,7 @@
    63.4  
    63.5  fun pat_completeness_tac ctxt = SUBGOAL (fn (subgoal, i) =>
    63.6    let
    63.7 -    val thy = ProofContext.theory_of ctxt
    63.8 +    val thy = Proof_Context.theory_of ctxt
    63.9      val (vs, subgf) = dest_all_all subgoal
   63.10      val (cases, _ $ thesis) = Logic.strip_horn subgf
   63.11        handle Bind => raise COMPLETENESS
    64.1 --- a/src/HOL/Tools/Function/pattern_split.ML	Sat Apr 16 15:47:52 2011 +0200
    64.2 +++ b/src/HOL/Tools/Function/pattern_split.ML	Sat Apr 16 16:15:37 2011 +0200
    64.3 @@ -57,7 +57,7 @@
    64.4              map (fn (vs, subst) => (vs, (v,t)::subst)) substs
    64.5            end
    64.6        in
    64.7 -        maps foo (inst_constrs_of (ProofContext.theory_of ctx) T)
    64.8 +        maps foo (inst_constrs_of (Proof_Context.theory_of ctx) T)
    64.9        end
   64.10       | pattern_subtract_subst_aux vs t t' =
   64.11       let
   64.12 @@ -76,7 +76,7 @@
   64.13  (* p - q *)
   64.14  fun pattern_subtract ctx eq2 eq1 =
   64.15    let
   64.16 -    val thy = ProofContext.theory_of ctx
   64.17 +    val thy = Proof_Context.theory_of ctx
   64.18  
   64.19      val (vs, feq1 as (_ $ (_ $ lhs1 $ _))) = dest_all_all eq1
   64.20      val (_,  _ $ (_ $ lhs2 $ _)) = dest_all_all eq2
    65.1 --- a/src/HOL/Tools/Function/relation.ML	Sat Apr 16 15:47:52 2011 +0200
    65.2 +++ b/src/HOL/Tools/Function/relation.ML	Sat Apr 16 16:15:37 2011 +0200
    65.3 @@ -33,7 +33,7 @@
    65.4    case Term.add_vars (prop_of st) [] of
    65.5      [v as (_, T)] =>
    65.6        let
    65.7 -        val cert = Thm.cterm_of (ProofContext.theory_of ctxt);
    65.8 +        val cert = Thm.cterm_of (Proof_Context.theory_of ctxt);
    65.9          val rel' = singleton (Variable.polymorphic ctxt) rel
   65.10            |> map_types Type_Infer.paramify_vars
   65.11            |> Type.constraint T
    66.1 --- a/src/HOL/Tools/Function/scnp_reconstruct.ML	Sat Apr 16 15:47:52 2011 +0200
    66.2 +++ b/src/HOL/Tools/Function/scnp_reconstruct.ML	Sat Apr 16 16:15:37 2011 +0200
    66.3 @@ -155,7 +155,7 @@
    66.4  
    66.5  fun reconstruct_tac ctxt D cs (GP (_, gs)) certificate =
    66.6    let
    66.7 -    val thy = ProofContext.theory_of ctxt
    66.8 +    val thy = Proof_Context.theory_of ctxt
    66.9      val Multiset
   66.10            { msetT, mk_mset,
   66.11              mset_regroup_conv, mset_pwleq_tac, set_of_simps,
   66.12 @@ -300,7 +300,7 @@
   66.13  
   66.14  fun single_scnp_tac use_tags orders ctxt D = Termination.CALLS (fn (cs, i) =>
   66.15    let
   66.16 -    val ms_configured = is_some (Multiset_Setup.get (ProofContext.theory_of ctxt))
   66.17 +    val ms_configured = is_some (Multiset_Setup.get (Proof_Context.theory_of ctxt))
   66.18      val orders' = if ms_configured then orders
   66.19                    else filter_out (curry op = MS) orders
   66.20      val gp = gen_probl D cs
    67.1 --- a/src/HOL/Tools/Function/size.ML	Sat Apr 16 15:47:52 2011 +0200
    67.2 +++ b/src/HOL/Tools/Function/size.ML	Sat Apr 16 16:15:37 2011 +0200
    67.3 @@ -133,8 +133,8 @@
    67.4          val (thm, lthy') = lthy
    67.5            |> Local_Theory.define ((Binding.name c, NoSyn), ((Binding.name def_name, []), rhs))
    67.6            |-> (fn (t, (_, thm)) => Spec_Rules.add Spec_Rules.Equational ([t], [thm]) #> pair thm);
    67.7 -        val ctxt_thy = ProofContext.init_global (ProofContext.theory_of lthy');
    67.8 -        val thm' = singleton (ProofContext.export lthy' ctxt_thy) thm;
    67.9 +        val ctxt_thy = Proof_Context.init_global (Proof_Context.theory_of lthy');
   67.10 +        val thm' = singleton (Proof_Context.export lthy' ctxt_thy) thm;
   67.11        in (thm', lthy') end;
   67.12  
   67.13      val ((size_def_thms, size_def_thms'), thy') =
   67.14 @@ -152,7 +152,7 @@
   67.15        ||> Class.prove_instantiation_instance (K (Class.intro_classes_tac []))
   67.16        ||> Local_Theory.exit_global;
   67.17  
   67.18 -    val ctxt = ProofContext.init_global thy';
   67.19 +    val ctxt = Proof_Context.init_global thy';
   67.20  
   67.21      val simpset1 = HOL_basic_ss addsimps @{thm Nat.add_0} :: @{thm Nat.add_0_right} ::
   67.22        size_def_thms @ size_def_thms' @ rec_rewrites @ extra_rewrites;
    68.1 --- a/src/HOL/Tools/Function/termination.ML	Sat Apr 16 15:47:52 2011 +0200
    68.2 +++ b/src/HOL/Tools/Function/termination.ML	Sat Apr 16 16:15:37 2011 +0200
    68.3 @@ -197,7 +197,7 @@
    68.4  
    68.5  fun create ctxt chain_tac descent_tac T rel =
    68.6    let
    68.7 -    val thy = ProofContext.theory_of ctxt
    68.8 +    val thy = Proof_Context.theory_of ctxt
    68.9      val sk = mk_sum_skel rel
   68.10      val Ts = node_types sk T
   68.11      val M = Inttab.make (map_index (apsnd (MeasureFunctions.get_measure_functions ctxt)) Ts)
   68.12 @@ -272,7 +272,7 @@
   68.13  
   68.14  fun wf_union_tac ctxt st =
   68.15    let
   68.16 -    val thy = ProofContext.theory_of ctxt
   68.17 +    val thy = Proof_Context.theory_of ctxt
   68.18      val cert = cterm_of (theory_of_thm st)
   68.19      val ((_ $ (_ $ rel)) :: ineqs) = prems_of st
   68.20  
    69.1 --- a/src/HOL/Tools/Meson/meson.ML	Sat Apr 16 15:47:52 2011 +0200
    69.2 +++ b/src/HOL/Tools/Meson/meson.ML	Sat Apr 16 16:15:37 2011 +0200
    69.3 @@ -335,7 +335,7 @@
    69.4  in  
    69.5    fun freeze_spec th ctxt =
    69.6      let
    69.7 -      val cert = Thm.cterm_of (ProofContext.theory_of ctxt);
    69.8 +      val cert = Thm.cterm_of (Proof_Context.theory_of ctxt);
    69.9        val ([x], ctxt') = Variable.variant_fixes [name_of (HOLogic.dest_Trueprop (concl_of th))] ctxt;
   69.10        val spec' = Thm.instantiate ([], [(spec_var, cert (Free (x, spec_varT)))]) spec;
   69.11      in (th RS spec', ctxt') end
   69.12 @@ -600,7 +600,7 @@
   69.13    in aux o make_nnf ctxt end
   69.14  
   69.15  fun skolemize ctxt =
   69.16 -  let val thy = ProofContext.theory_of ctxt in
   69.17 +  let val thy = Proof_Context.theory_of ctxt in
   69.18      skolemize_with_choice_theorems ctxt (choice_theorems thy)
   69.19    end
   69.20  
    70.1 --- a/src/HOL/Tools/Meson/meson_clausify.ML	Sat Apr 16 15:47:52 2011 +0200
    70.2 +++ b/src/HOL/Tools/Meson/meson_clausify.ML	Sat Apr 16 16:15:37 2011 +0200
    70.3 @@ -313,7 +313,7 @@
    70.4  (* Converts an Isabelle theorem into NNF. *)
    70.5  fun nnf_axiom choice_ths new_skolemizer ax_no th ctxt =
    70.6    let
    70.7 -    val thy = ProofContext.theory_of ctxt
    70.8 +    val thy = Proof_Context.theory_of ctxt
    70.9      val th =
   70.10        th |> transform_elim_theorem
   70.11           |> zero_var_indexes
   70.12 @@ -376,7 +376,7 @@
   70.13  (* Convert a theorem to CNF, with additional premises due to skolemization. *)
   70.14  fun cnf_axiom ctxt0 new_skolemizer ax_no th =
   70.15    let
   70.16 -    val thy = ProofContext.theory_of ctxt0
   70.17 +    val thy = Proof_Context.theory_of ctxt0
   70.18      val choice_ths = choice_theorems thy
   70.19      val (opt, (nnf_th, ctxt)) =
   70.20        nnf_axiom choice_ths new_skolemizer ax_no th ctxt0
    71.1 --- a/src/HOL/Tools/Metis/metis_reconstruct.ML	Sat Apr 16 15:47:52 2011 +0200
    71.2 +++ b/src/HOL/Tools/Metis/metis_reconstruct.ML	Sat Apr 16 16:15:37 2011 +0200
    71.3 @@ -63,7 +63,7 @@
    71.4    end;
    71.5  
    71.6  fun infer_types ctxt =
    71.7 -  Syntax.check_terms (ProofContext.set_mode ProofContext.mode_pattern ctxt);
    71.8 +  Syntax.check_terms (Proof_Context.set_mode Proof_Context.mode_pattern ctxt);
    71.9  
   71.10  (*We use 1 rather than 0 because variable references in clauses may otherwise conflict
   71.11    with variable constraints in the goal...at least, type inference often fails otherwise.
   71.12 @@ -96,7 +96,7 @@
   71.13  
   71.14  (*Maps metis terms to isabelle terms*)
   71.15  fun hol_term_from_metis_PT ctxt fol_tm =
   71.16 -  let val thy = ProofContext.theory_of ctxt
   71.17 +  let val thy = Proof_Context.theory_of ctxt
   71.18        val _ = trace_msg ctxt (fn () => "hol_term_from_metis_PT: " ^
   71.19                                         Metis_Term.toString fol_tm)
   71.20        fun tm_to_tt (Metis_Term.Var v) =
   71.21 @@ -260,7 +260,7 @@
   71.22  
   71.23  fun assume_inf ctxt mode skolem_params atm =
   71.24    inst_excluded_middle
   71.25 -      (ProofContext.theory_of ctxt)
   71.26 +      (Proof_Context.theory_of ctxt)
   71.27        (singleton (hol_terms_from_metis ctxt mode skolem_params)
   71.28                   (Metis_Term.Fn atm))
   71.29  
   71.30 @@ -270,7 +270,7 @@
   71.31     can be inferred from terms. *)
   71.32  
   71.33  fun inst_inf ctxt mode old_skolems thpairs fsubst th =
   71.34 -  let val thy = ProofContext.theory_of ctxt
   71.35 +  let val thy = Proof_Context.theory_of ctxt
   71.36        val i_th = lookth thpairs th
   71.37        val i_th_vars = Term.add_vars (prop_of i_th) []
   71.38        fun find_var x = the (List.find (fn ((a,_),_) => a=x) i_th_vars)
   71.39 @@ -396,7 +396,7 @@
   71.40  
   71.41  fun resolve_inf ctxt mode skolem_params thpairs atm th1 th2 =
   71.42    let
   71.43 -    val thy = ProofContext.theory_of ctxt
   71.44 +    val thy = Proof_Context.theory_of ctxt
   71.45      val i_th1 = lookth thpairs th1 and i_th2 = lookth thpairs th2
   71.46      val _ = trace_msg ctxt (fn () => "  isa th1 (pos): " ^ Display.string_of_thm ctxt i_th1)
   71.47      val _ = trace_msg ctxt (fn () => "  isa th2 (neg): " ^ Display.string_of_thm ctxt i_th2)
   71.48 @@ -437,7 +437,7 @@
   71.49  val refl_idx = 1 + Thm.maxidx_of REFL_THM;
   71.50  
   71.51  fun refl_inf ctxt mode skolem_params t =
   71.52 -  let val thy = ProofContext.theory_of ctxt
   71.53 +  let val thy = Proof_Context.theory_of ctxt
   71.54        val i_t = singleton (hol_terms_from_metis ctxt mode skolem_params) t
   71.55        val _ = trace_msg ctxt (fn () => "  term: " ^ Syntax.string_of_term ctxt i_t)
   71.56        val c_t = cterm_incr_types thy refl_idx i_t
   71.57 @@ -455,7 +455,7 @@
   71.58    | get_ty_arg_size _ _ = 0;
   71.59  
   71.60  fun equality_inf ctxt mode skolem_params (pos, atm) fp fr =
   71.61 -  let val thy = ProofContext.theory_of ctxt
   71.62 +  let val thy = Proof_Context.theory_of ctxt
   71.63        val m_tm = Metis_Term.Fn atm
   71.64        val [i_atm,i_tm] = hol_terms_from_metis ctxt mode skolem_params [m_tm, fr]
   71.65        val _ = trace_msg ctxt (fn () => "sign of the literal: " ^ Bool.toString pos)
   71.66 @@ -783,7 +783,7 @@
   71.67      prems_imp_false
   71.68    else
   71.69      let
   71.70 -      val thy = ProofContext.theory_of ctxt
   71.71 +      val thy = Proof_Context.theory_of ctxt
   71.72        fun match_term p =
   71.73          let
   71.74            val (tyenv, tenv) =
    72.1 --- a/src/HOL/Tools/Metis/metis_tactics.ML	Sat Apr 16 15:47:52 2011 +0200
    72.2 +++ b/src/HOL/Tools/Metis/metis_tactics.ML	Sat Apr 16 16:15:37 2011 +0200
    72.3 @@ -55,7 +55,7 @@
    72.4  
    72.5  (* Main function to start Metis proof and reconstruction *)
    72.6  fun FOL_SOLVE mode ctxt cls ths0 =
    72.7 -  let val thy = ProofContext.theory_of ctxt
    72.8 +  let val thy = Proof_Context.theory_of ctxt
    72.9        val type_lits = Config.get ctxt type_lits
   72.10        val new_skolemizer =
   72.11          Config.get ctxt new_skolemizer orelse null (Meson.choice_theorems thy)
    73.1 --- a/src/HOL/Tools/Metis/metis_translate.ML	Sat Apr 16 15:47:52 2011 +0200
    73.2 +++ b/src/HOL/Tools/Metis/metis_translate.ML	Sat Apr 16 16:15:37 2011 +0200
    73.3 @@ -650,7 +650,7 @@
    73.4  
    73.5  fun hol_thm_to_fol is_conjecture ctxt type_lits mode j old_skolems th =
    73.6    let
    73.7 -    val thy = ProofContext.theory_of ctxt
    73.8 +    val thy = Proof_Context.theory_of ctxt
    73.9      val (old_skolems, (mlits, types_sorts)) =
   73.10       th |> prop_of |> Logic.strip_imp_concl
   73.11          |> conceal_old_skolem_terms j old_skolems
   73.12 @@ -766,7 +766,7 @@
   73.13  
   73.14  (* Function to generate metis clauses, including comb and type clauses *)
   73.15  fun prepare_metis_problem mode0 ctxt type_lits cls thss =
   73.16 -  let val thy = ProofContext.theory_of ctxt
   73.17 +  let val thy = Proof_Context.theory_of ctxt
   73.18        (*The modes FO and FT are sticky. HO can be downgraded to FO.*)
   73.19        fun set_mode FO = FO
   73.20          | set_mode HO =
    74.1 --- a/src/HOL/Tools/Nitpick/nitpick.ML	Sat Apr 16 15:47:52 2011 +0200
    74.2 +++ b/src/HOL/Tools/Nitpick/nitpick.ML	Sat Apr 16 16:15:37 2011 +0200
    74.3 @@ -437,7 +437,7 @@
    74.4        exists (exists (curry (op =) name o shortest_name o fst)
    74.5                o datatype_constrs hol_ctxt) deep_dataTs
    74.6      val likely_in_struct_induct_step =
    74.7 -      exists is_struct_induct_step (ProofContext.cases_of ctxt)
    74.8 +      exists is_struct_induct_step (Proof_Context.cases_of ctxt)
    74.9      val _ = if standard andalso likely_in_struct_induct_step then
   74.10                pprint_m (fn () => Pretty.blk (0,
   74.11                    pstrs "Hint: To check that the induction hypothesis is \
    75.1 --- a/src/HOL/Tools/Nitpick/nitpick_hol.ML	Sat Apr 16 15:47:52 2011 +0200
    75.2 +++ b/src/HOL/Tools/Nitpick/nitpick_hol.ML	Sat Apr 16 16:15:37 2011 +0200
    75.3 @@ -577,7 +577,7 @@
    75.4    handle Type.TYPE_MATCH =>
    75.5           raise TYPE ("Nitpick_HOL.instantiate_type", [T1, T1'], [])
    75.6  fun varify_and_instantiate_type ctxt T1 T1' T2 =
    75.7 -  let val thy = ProofContext.theory_of ctxt in
    75.8 +  let val thy = Proof_Context.theory_of ctxt in
    75.9      instantiate_type thy (varify_type ctxt T1) T1' (varify_type ctxt T2)
   75.10    end
   75.11  
   75.12 @@ -639,11 +639,11 @@
   75.13      is_some (Quotient_Info.quotdata_lookup_raw thy s)
   75.14    | is_real_quot_type _ _ = false
   75.15  fun is_quot_type ctxt T =
   75.16 -  let val thy = ProofContext.theory_of ctxt in
   75.17 +  let val thy = Proof_Context.theory_of ctxt in
   75.18      is_real_quot_type thy T andalso not (is_codatatype ctxt T)
   75.19    end
   75.20  fun is_pure_typedef ctxt (T as Type (s, _)) =
   75.21 -    let val thy = ProofContext.theory_of ctxt in
   75.22 +    let val thy = Proof_Context.theory_of ctxt in
   75.23        is_typedef ctxt s andalso
   75.24        not (is_real_datatype thy s orelse is_real_quot_type thy T orelse
   75.25             is_codatatype ctxt T orelse is_record_type T orelse
   75.26 @@ -674,7 +674,7 @@
   75.27       | NONE => false)
   75.28    | is_univ_typedef _ _ = false
   75.29  fun is_datatype ctxt stds (T as Type (s, _)) =
   75.30 -    let val thy = ProofContext.theory_of ctxt in
   75.31 +    let val thy = Proof_Context.theory_of ctxt in
   75.32        (is_typedef ctxt s orelse is_codatatype ctxt T orelse
   75.33         T = @{typ ind} orelse is_real_quot_type thy T) andalso
   75.34        not (is_basic_datatype thy stds s)
   75.35 @@ -765,7 +765,7 @@
   75.36                   @{const_name Quot}, @{const_name Zero_Rep},
   75.37                   @{const_name Suc_Rep}] s orelse
   75.38    let
   75.39 -    val thy = ProofContext.theory_of ctxt
   75.40 +    val thy = Proof_Context.theory_of ctxt
   75.41      val (x as (_, T)) = (s, unarize_unbox_etc_type T)
   75.42    in
   75.43      is_real_constr thy x orelse is_record_constr x orelse
   75.44 @@ -776,7 +776,7 @@
   75.45    is_codatatype ctxt (body_type T) andalso is_constr_like ctxt x andalso
   75.46    not (is_coconstr ctxt x)
   75.47  fun is_constr ctxt stds (x as (_, T)) =
   75.48 -  let val thy = ProofContext.theory_of ctxt in
   75.49 +  let val thy = Proof_Context.theory_of ctxt in
   75.50      is_constr_like ctxt x andalso
   75.51      not (is_basic_datatype thy stds
   75.52                           (fst (dest_Type (unarize_type (body_type T))))) andalso
   75.53 @@ -1135,7 +1135,7 @@
   75.54        in Abs ("x", dataT, aux m (nth arg_Ts n) |> snd) end
   75.55    end
   75.56  fun select_nth_constr_arg ctxt stds x t n res_T =
   75.57 -  let val thy = ProofContext.theory_of ctxt in
   75.58 +  let val thy = Proof_Context.theory_of ctxt in
   75.59      (case strip_comb t of
   75.60         (Const x', args) =>
   75.61         if x = x' then nth args n
   75.62 @@ -1300,7 +1300,7 @@
   75.63  
   75.64  fun all_axioms_of ctxt subst =
   75.65    let
   75.66 -    val thy = ProofContext.theory_of ctxt
   75.67 +    val thy = Proof_Context.theory_of ctxt
   75.68      val axioms_of_thys =
   75.69        maps Thm.axioms_of
   75.70        #> map (apsnd (subst_atomic subst o prop_of))
   75.71 @@ -1441,7 +1441,7 @@
   75.72                 | t => t)
   75.73  
   75.74  fun case_const_names ctxt stds =
   75.75 -  let val thy = ProofContext.theory_of ctxt in
   75.76 +  let val thy = Proof_Context.theory_of ctxt in
   75.77      Symtab.fold (fn (dtype_s, {index, descr, case_name, ...}) =>
   75.78                      if is_basic_datatype thy stds dtype_s then
   75.79                        I
   75.80 @@ -1889,7 +1889,7 @@
   75.81    |> const_nondef_table
   75.82  
   75.83  fun inductive_intro_table ctxt subst def_tables =
   75.84 -  let val thy = ProofContext.theory_of ctxt in
   75.85 +  let val thy = Proof_Context.theory_of ctxt in
   75.86      def_table_for
   75.87          (maps (map (unfold_mutually_inductive_preds thy def_tables o prop_of)
   75.88                 o snd o snd)
   75.89 @@ -1922,7 +1922,7 @@
   75.90  
   75.91  fun inverse_axioms_for_rep_fun ctxt (x as (_, T)) =
   75.92    let
   75.93 -    val thy = ProofContext.theory_of ctxt
   75.94 +    val thy = Proof_Context.theory_of ctxt
   75.95      val abs_T = domain_type T
   75.96    in
   75.97      typedef_info ctxt (fst (dest_Type abs_T)) |> the
   75.98 @@ -1932,7 +1932,7 @@
   75.99    end
  75.100  fun optimized_typedef_axioms ctxt (abs_z as (abs_s, _)) =
  75.101    let
  75.102 -    val thy = ProofContext.theory_of ctxt
  75.103 +    val thy = Proof_Context.theory_of ctxt
  75.104      val abs_T = Type abs_z
  75.105    in
  75.106      if is_univ_typedef ctxt abs_T then
  75.107 @@ -1957,7 +1957,7 @@
  75.108    end
  75.109  fun optimized_quot_type_axioms ctxt stds abs_z =
  75.110    let
  75.111 -    val thy = ProofContext.theory_of ctxt
  75.112 +    val thy = Proof_Context.theory_of ctxt
  75.113      val abs_T = Type abs_z
  75.114      val rep_T = rep_type_for_quot_type thy abs_T
  75.115      val (equiv_rel, partial) = equiv_relation_for_quot_type thy abs_T
    76.1 --- a/src/HOL/Tools/Nitpick/nitpick_isar.ML	Sat Apr 16 15:47:52 2011 +0200
    76.2 +++ b/src/HOL/Tools/Nitpick/nitpick_isar.ML	Sat Apr 16 16:15:37 2011 +0200
    76.3 @@ -303,7 +303,7 @@
    76.4    end
    76.5  
    76.6  fun default_params thy =
    76.7 -  extract_params (ProofContext.init_global thy) false (default_raw_params thy)
    76.8 +  extract_params (Proof_Context.init_global thy) false (default_raw_params thy)
    76.9    o map (apsnd single)
   76.10  
   76.11  val parse_key = Scan.repeat1 Parse.typ_group >> space_implode " "
    77.1 --- a/src/HOL/Tools/Nitpick/nitpick_model.ML	Sat Apr 16 15:47:52 2011 +0200
    77.2 +++ b/src/HOL/Tools/Nitpick/nitpick_model.ML	Sat Apr 16 16:15:37 2011 +0200
    77.3 @@ -94,7 +94,7 @@
    77.4  fun add_wacky_syntax ctxt =
    77.5    let
    77.6      val name_of = fst o dest_Const
    77.7 -    val thy = ProofContext.theory_of ctxt |> Context.reject_draft
    77.8 +    val thy = Proof_Context.theory_of ctxt |> Context.reject_draft
    77.9      val (maybe_t, thy) =
   77.10        Sign.declare_const ((@{binding nitpick_maybe}, @{typ "'a => 'a"}),
   77.11                            Mixfix (maybe_mixfix (), [1000], 1000)) thy
   77.12 @@ -109,7 +109,7 @@
   77.13                            Mixfix (step_mixfix (), [1000], 1000)) thy
   77.14    in
   77.15      (pairself (pairself name_of) ((maybe_t, abs_t), (base_t, step_t)),
   77.16 -     ProofContext.transfer_syntax thy ctxt)
   77.17 +     Proof_Context.transfer_syntax thy ctxt)
   77.18    end
   77.19  
   77.20  (** Term reconstruction **)
   77.21 @@ -329,7 +329,7 @@
   77.22    | mk_tuple T [] = raise TYPE ("Nitpick_Model.mk_tuple", [T], [])
   77.23  
   77.24  fun varified_type_match ctxt (candid_T, pat_T) =
   77.25 -  let val thy = ProofContext.theory_of ctxt in
   77.26 +  let val thy = Proof_Context.theory_of ctxt in
   77.27      strict_type_match thy (candid_T, varify_type ctxt pat_T)
   77.28    end
   77.29  
    78.1 --- a/src/HOL/Tools/Nitpick/nitpick_preproc.ML	Sat Apr 16 15:47:52 2011 +0200
    78.2 +++ b/src/HOL/Tools/Nitpick/nitpick_preproc.ML	Sat Apr 16 16:15:37 2011 +0200
    78.3 @@ -69,7 +69,7 @@
    78.4  
    78.5  fun add_to_uncurry_table ctxt t =
    78.6    let
    78.7 -    val thy = ProofContext.theory_of ctxt
    78.8 +    val thy = Proof_Context.theory_of ctxt
    78.9      fun aux (t1 $ t2) args table =
   78.10          let val table = aux t2 [] table in aux t1 (t2 :: args) table end
   78.11        | aux (Abs (_, _, t')) _ table = aux t' [] table
    79.1 --- a/src/HOL/Tools/Predicate_Compile/code_prolog.ML	Sat Apr 16 15:47:52 2011 +0200
    79.2 +++ b/src/HOL/Tools/Predicate_Compile/code_prolog.ML	Sat Apr 16 16:15:37 2011 +0200
    79.3 @@ -312,7 +312,7 @@
    79.4  
    79.5  fun translate_intros ensure_groundness ctxt gr const constant_table =
    79.6    let
    79.7 -    val intros = map (preprocess_intro (ProofContext.theory_of ctxt)) (Graph.get_node gr const)
    79.8 +    val intros = map (preprocess_intro (Proof_Context.theory_of ctxt)) (Graph.get_node gr const)
    79.9      val (intros', ctxt') = Variable.import_terms true (map prop_of intros) ctxt
   79.10      val constant_table' = declare_consts (fold Term.add_const_names intros' []) constant_table
   79.11      fun translate_intro intro =
   79.12 @@ -550,7 +550,7 @@
   79.13          in
   79.14            (clause :: flat rec_clauses, (seen', constant_table''))
   79.15          end
   79.16 -      val constrs = inst_constrs_of (ProofContext.theory_of ctxt) T
   79.17 +      val constrs = inst_constrs_of (Proof_Context.theory_of ctxt) T
   79.18        val constrs' = (constrs ~~ map (is_recursive_constr T) constrs)
   79.19          |> (fn cs => filter_out snd cs @ filter snd cs)
   79.20        val (clauses, constant_table') =
   79.21 @@ -873,7 +873,7 @@
   79.22    | restore_term ctxt constant_table (Cons s, T) = Const (restore_const constant_table s, T)
   79.23    | restore_term ctxt constant_table (AppF (f, args), T) =
   79.24      let
   79.25 -      val thy = ProofContext.theory_of ctxt
   79.26 +      val thy = Proof_Context.theory_of ctxt
   79.27        val c = restore_const constant_table f
   79.28        val cT = Sign.the_const_type thy c
   79.29        val (argsT, resT) = strip_type cT
   79.30 @@ -923,7 +923,7 @@
   79.31  
   79.32  fun values ctxt soln t_compr =
   79.33    let
   79.34 -    val options = code_options_of (ProofContext.theory_of ctxt)
   79.35 +    val options = code_options_of (Proof_Context.theory_of ctxt)
   79.36      val split = case t_compr of (Const (@{const_name Collect}, _) $ t) => t
   79.37        | _ => error ("Not a set comprehension: " ^ Syntax.string_of_term ctxt t_compr);
   79.38      val (body, Ts, fp) = HOLogic.strip_psplits split;
   79.39 @@ -936,12 +936,12 @@
   79.40          (Const (name, T), all_args) => (Const (name, T), all_args)
   79.41        | (head, _) => error ("Not a constant: " ^ Syntax.string_of_term ctxt head)
   79.42      val _ = tracing "Preprocessing specification..."
   79.43 -    val T = Sign.the_const_type (ProofContext.theory_of ctxt) name
   79.44 +    val T = Sign.the_const_type (Proof_Context.theory_of ctxt) name
   79.45      val t = Const (name, T)
   79.46      val thy' =
   79.47 -      Theory.copy (ProofContext.theory_of ctxt)
   79.48 +      Theory.copy (Proof_Context.theory_of ctxt)
   79.49        |> Predicate_Compile.preprocess preprocess_options t
   79.50 -    val ctxt' = ProofContext.init_global thy'
   79.51 +    val ctxt' = Proof_Context.init_global thy'
   79.52      val _ = tracing "Generating prolog program..."
   79.53      val (p, constant_table) = generate (NONE, #ensure_groundness options) ctxt' name (* FIXME *)
   79.54        |> post_process ctxt' options name
   79.55 @@ -1012,13 +1012,13 @@
   79.56  fun quickcheck ctxt [(t, [])] [_, size] =
   79.57    let
   79.58      val t' = list_abs_free (Term.add_frees t [], t)
   79.59 -    val options = code_options_of (ProofContext.theory_of ctxt)
   79.60 -    val thy = Theory.copy (ProofContext.theory_of ctxt)
   79.61 +    val options = code_options_of (Proof_Context.theory_of ctxt)
   79.62 +    val thy = Theory.copy (Proof_Context.theory_of ctxt)
   79.63      val ((((full_constname, constT), vs'), intro), thy1) =
   79.64        Predicate_Compile_Aux.define_quickcheck_predicate t' thy
   79.65      val thy2 = Context.theory_map (Predicate_Compile_Alternative_Defs.add_thm intro) thy1
   79.66      val thy3 = Predicate_Compile.preprocess preprocess_options (Const (full_constname, constT)) thy2
   79.67 -    val ctxt' = ProofContext.init_global thy3
   79.68 +    val ctxt' = Proof_Context.init_global thy3
   79.69      val _ = tracing "Generating prolog program..."
   79.70      val (p, constant_table) = generate (NONE, true) ctxt' full_constname
   79.71        |> post_process ctxt' (set_ensure_groundness options) full_constname
    80.1 --- a/src/HOL/Tools/Predicate_Compile/core_data.ML	Sat Apr 16 15:47:52 2011 +0200
    80.2 +++ b/src/HOL/Tools/Predicate_Compile/core_data.ML	Sat Apr 16 16:15:37 2011 +0200
    80.3 @@ -136,7 +136,7 @@
    80.4  (* queries *)
    80.5  
    80.6  fun lookup_pred_data ctxt name =
    80.7 -  Option.map rep_pred_data (try (Graph.get_node (PredData.get (ProofContext.theory_of ctxt))) name)
    80.8 +  Option.map rep_pred_data (try (Graph.get_node (PredData.get (Proof_Context.theory_of ctxt))) name)
    80.9  
   80.10  fun the_pred_data ctxt name = case lookup_pred_data ctxt name
   80.11   of NONE => error ("No such predicate " ^ quote name)  
   80.12 @@ -144,7 +144,7 @@
   80.13  
   80.14  val is_registered = is_some oo lookup_pred_data
   80.15  
   80.16 -val all_preds_of = Graph.keys o PredData.get o ProofContext.theory_of
   80.17 +val all_preds_of = Graph.keys o PredData.get o Proof_Context.theory_of
   80.18  
   80.19  val intros_of = map snd o #intros oo the_pred_data
   80.20  
   80.21 @@ -203,11 +203,11 @@
   80.22  val predfun_neg_intro_of = #neg_intro ooo the_predfun_data
   80.23  
   80.24  val intros_graph_of =
   80.25 -  Graph.map (K (map snd o #intros o rep_pred_data)) o PredData.get o ProofContext.theory_of
   80.26 +  Graph.map (K (map snd o #intros o rep_pred_data)) o PredData.get o Proof_Context.theory_of
   80.27  
   80.28  fun prove_casesrule ctxt (pred, (pre_cases_rule, nparams)) cases_rule =
   80.29    let
   80.30 -    val thy = ProofContext.theory_of ctxt
   80.31 +    val thy = Proof_Context.theory_of ctxt
   80.32      val nargs = length (binder_types (fastype_of pred))
   80.33      fun PEEK f dependent_tactic st = dependent_tactic (f st) st
   80.34      fun meta_eq_of th = th RS @{thm eq_reflection}
   80.35 @@ -257,7 +257,7 @@
   80.36            let
   80.37              val (const, _) = strip_comb (HOLogic.dest_Trueprop (concl_of intro))
   80.38            in (fst (dest_Const const) = name) end;
   80.39 -        val thy = ProofContext.theory_of ctxt
   80.40 +        val thy = Proof_Context.theory_of ctxt
   80.41          val intros = map (preprocess_intro thy) (filter is_intro_of (#intrs result))
   80.42          val index = find_index (fn s => s = name) (#names (fst info))
   80.43          val pre_elim = nth (#elims result) index
   80.44 @@ -330,7 +330,7 @@
   80.45      val pred = Const (constname, T)
   80.46      val pre_elim = 
   80.47        (Drule.export_without_context o Skip_Proof.make_thm thy)
   80.48 -      (mk_casesrule (ProofContext.init_global thy) pred pre_intros)
   80.49 +      (mk_casesrule (Proof_Context.init_global thy) pred pre_intros)
   80.50    in register_predicate (constname, pre_intros, pre_elim) thy end
   80.51  
   80.52  fun defined_function_of compilation pred =
   80.53 @@ -371,7 +371,7 @@
   80.54  
   80.55  fun extend_intro_graph names thy =
   80.56    let
   80.57 -    val ctxt = ProofContext.init_global thy
   80.58 +    val ctxt = Proof_Context.init_global thy
   80.59    in
   80.60      PredData.map (fold (extend (fetch_pred_data ctxt) (depending_preds_of ctxt)) names) thy
   80.61    end
   80.62 @@ -384,7 +384,7 @@
   80.63          val (named_intros, SOME elim) = rules
   80.64          val named_intros' = map (apsnd (preprocess_intro thy)) named_intros
   80.65          val pred = Const (name, Sign.the_const_type thy name)
   80.66 -        val ctxt = ProofContext.init_global thy
   80.67 +        val ctxt = Proof_Context.init_global thy
   80.68          val elim_t = mk_casesrule ctxt pred (map snd named_intros')
   80.69          val nparams = (case try (Inductive.the_inductive ctxt) name of
   80.70              SOME (_, result) => length (Inductive.params_of (#raw_induct result))
   80.71 @@ -410,7 +410,7 @@
   80.72  
   80.73  fun alternative_compilation_of ctxt pred_name mode =
   80.74    AList.lookup eq_mode
   80.75 -    (Symtab.lookup_list (Alt_Compilations_Data.get (ProofContext.theory_of ctxt)) pred_name) mode
   80.76 +    (Symtab.lookup_list (Alt_Compilations_Data.get (Proof_Context.theory_of ctxt)) pred_name) mode
   80.77  
   80.78  fun force_modes_and_compilations pred_name compilations =
   80.79    let
    81.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile.ML	Sat Apr 16 15:47:52 2011 +0200
    81.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile.ML	Sat Apr 16 16:15:37 2011 +0200
    81.3 @@ -76,7 +76,7 @@
    81.4  
    81.5  fun preprocess_strong_conn_constnames options gr ts thy =
    81.6    if forall (fn (Const (c, _)) =>
    81.7 -      Core_Data.is_registered (ProofContext.init_global thy) c) ts then
    81.8 +      Core_Data.is_registered (Proof_Context.init_global thy) c) ts then
    81.9      thy
   81.10    else
   81.11      let
   81.12 @@ -149,7 +149,7 @@
   81.13      val proposed_modes = case proposed_modes of
   81.14            Single_Pred proposed_modes => [(const, proposed_modes)]
   81.15          | Multiple_Preds proposed_modes => map
   81.16 -          (apfst (Code.read_const (ProofContext.theory_of lthy))) proposed_modes
   81.17 +          (apfst (Code.read_const (Proof_Context.theory_of lthy))) proposed_modes
   81.18    in
   81.19      Options {
   81.20        expected_modes = Option.map (pair const) expected_modes,
   81.21 @@ -181,7 +181,7 @@
   81.22  
   81.23  fun code_pred_cmd (((expected_modes, proposed_modes), raw_options), raw_const) lthy =
   81.24    let
   81.25 -     val thy = ProofContext.theory_of lthy
   81.26 +     val thy = Proof_Context.theory_of lthy
   81.27       val const = Code.read_const thy raw_const
   81.28       val T = Sign.the_const_type thy const
   81.29       val t = Const (const, T)
   81.30 @@ -191,7 +191,7 @@
   81.31        let
   81.32          val lthy' = Local_Theory.background_theory (preprocess options t) lthy
   81.33          val const =
   81.34 -          case Predicate_Compile_Fun.pred_of_function (ProofContext.theory_of lthy') const of
   81.35 +          case Predicate_Compile_Fun.pred_of_function (Proof_Context.theory_of lthy') const of
   81.36              SOME c => c
   81.37            | NONE => const
   81.38          val _ = print_step options "Starting Predicate Compile Core..."
    82.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_aux.ML	Sat Apr 16 15:47:52 2011 +0200
    82.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_aux.ML	Sat Apr 16 16:15:37 2011 +0200
    82.3 @@ -530,7 +530,7 @@
    82.4    else false
    82.5  *)
    82.6  
    82.7 -val is_constr = Code.is_constr o ProofContext.theory_of;
    82.8 +val is_constr = Code.is_constr o Proof_Context.theory_of;
    82.9  
   82.10  fun strip_all t = (Term.strip_all_vars t, Term.strip_all_body t)
   82.11  
   82.12 @@ -830,7 +830,7 @@
   82.13            (args, (pats, intro_t, ctxt)) = rewrite_arg' (t2, T2) (args, (pats, intro_t, ctxt))
   82.14            | rewrite_arg' (t, Type (@{type_name Product_Type.prod}, [T1, T2])) (args, (pats, intro_t, ctxt)) =
   82.15              let
   82.16 -              val thy = ProofContext.theory_of ctxt
   82.17 +              val thy = Proof_Context.theory_of ctxt
   82.18                val ([x, y], ctxt') = Variable.variant_fixes ["x", "y"] ctxt
   82.19                val pat = (t, HOLogic.mk_prod (Free (x, T1), Free (y, T2)))
   82.20                val intro_t' = Pattern.rewrite_term thy [pat] [] intro_t
   82.21 @@ -873,7 +873,7 @@
   82.22  
   82.23  fun expand_tuples thy intro =
   82.24    let
   82.25 -    val ctxt = ProofContext.init_global thy
   82.26 +    val ctxt = Proof_Context.init_global thy
   82.27      val (((T_insts, t_insts), [intro']), ctxt1) = Variable.import false [intro] ctxt
   82.28      val intro_t = prop_of intro'
   82.29      val concl = Logic.strip_imp_concl intro_t
   82.30 @@ -942,7 +942,7 @@
   82.31  fun instantiated_case_rewrites thy Tcon =
   82.32    let
   82.33      val rew_ths = case_rewrites thy Tcon
   82.34 -    val ctxt = ProofContext.init_global thy
   82.35 +    val ctxt = Proof_Context.init_global thy
   82.36      fun instantiate th =
   82.37      let
   82.38        val f = (fst (strip_comb (fst (HOLogic.dest_eq (HOLogic.dest_Trueprop (prop_of th))))))
   82.39 @@ -1045,7 +1045,7 @@
   82.40  fun peephole_optimisation thy intro =
   82.41    let
   82.42      val process =
   82.43 -      Raw_Simplifier.rewrite_rule (Predicate_Compile_Simps.get (ProofContext.init_global thy))
   82.44 +      Raw_Simplifier.rewrite_rule (Predicate_Compile_Simps.get (Proof_Context.init_global thy))
   82.45      fun process_False intro_t =
   82.46        if member (op =) (Logic.strip_imp_prems intro_t) @{prop "False"} then NONE else SOME intro_t
   82.47      fun process_True intro_t =
   82.48 @@ -1072,7 +1072,7 @@
   82.49    | import_intros inp_pred (th :: ths) ctxt =
   82.50      let
   82.51        val ((_, [th']), ctxt') = Variable.import true [th] ctxt
   82.52 -      val thy = ProofContext.theory_of ctxt'
   82.53 +      val thy = Proof_Context.theory_of ctxt'
   82.54        val (pred, args) = strip_intro_concl th'
   82.55        val T = fastype_of pred
   82.56        val ho_args = ho_args_of_typ T args
   82.57 @@ -1206,7 +1206,7 @@
   82.58  fun define_quickcheck_predicate t thy =
   82.59    let
   82.60      val (vs, t') = strip_abs t
   82.61 -    val vs' = Variable.variant_frees (ProofContext.init_global thy) [] vs
   82.62 +    val vs' = Variable.variant_frees (Proof_Context.init_global thy) [] vs
   82.63      val t'' = subst_bounds (map Free (rev vs'), t')
   82.64      val (prems, concl) = strip_horn t''
   82.65      val constname = "quickcheck"
   82.66 @@ -1218,7 +1218,7 @@
   82.67        (map HOLogic.mk_Trueprop (prems @ [HOLogic.mk_not concl]),
   82.68         HOLogic.mk_Trueprop (list_comb (const, map Free vs')))
   82.69      val tac = fn _ => Skip_Proof.cheat_tac thy1
   82.70 -    val intro = Goal.prove (ProofContext.init_global thy1) (map fst vs') [] t tac
   82.71 +    val intro = Goal.prove (Proof_Context.init_global thy1) (map fst vs') [] t tac
   82.72    in
   82.73      ((((full_constname, constT), vs'), intro), thy1)
   82.74    end
    83.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_core.ML	Sat Apr 16 15:47:52 2011 +0200
    83.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_core.ML	Sat Apr 16 16:15:37 2011 +0200
    83.3 @@ -128,7 +128,7 @@
    83.4  
    83.5  fun print_stored_rules ctxt =
    83.6    let
    83.7 -    val preds = Graph.keys (PredData.get (ProofContext.theory_of ctxt))
    83.8 +    val preds = Graph.keys (PredData.get (Proof_Context.theory_of ctxt))
    83.9      fun print pred () = let
   83.10        val _ = writeln ("predicate: " ^ pred)
   83.11        val _ = writeln ("introrules: ")
   83.12 @@ -818,7 +818,7 @@
   83.13      case T of
   83.14        TFree _ => NONE
   83.15      | Type (Tcon, _) =>
   83.16 -      (case Datatype_Data.get_constrs (ProofContext.theory_of ctxt) Tcon of
   83.17 +      (case Datatype_Data.get_constrs (Proof_Context.theory_of ctxt) Tcon of
   83.18          NONE => NONE
   83.19        | SOME cs =>
   83.20          (case strip_comb t of
   83.21 @@ -881,7 +881,7 @@
   83.22    in_ts' outTs switch_tree =
   83.23    let
   83.24      val compfuns = Comp_Mod.compfuns compilation_modifiers
   83.25 -    val thy = ProofContext.theory_of ctxt
   83.26 +    val thy = Proof_Context.theory_of ctxt
   83.27      fun compile_switch_tree _ _ (Atom []) = NONE
   83.28        | compile_switch_tree all_vs ctxt_eqs (Atom moded_clauses) =
   83.29          let
   83.30 @@ -1125,7 +1125,7 @@
   83.31          val ([definition], thy') = thy |>
   83.32            Sign.add_consts_i [(Binding.name mode_cbasename, funT, NoSyn)] |>
   83.33            Global_Theory.add_defs false [((Binding.name (mode_cbasename ^ "_def"), def), [])]
   83.34 -        val ctxt' = ProofContext.init_global thy'
   83.35 +        val ctxt' = Proof_Context.init_global thy'
   83.36          val rules as ((intro, elim), _) =
   83.37            create_intro_elim_rule ctxt' mode definition mode_cname funT (Const (name, T))
   83.38          in thy'
   83.39 @@ -1202,7 +1202,7 @@
   83.40  
   83.41  fun prepare_intrs options ctxt prednames intros =
   83.42    let
   83.43 -    val thy = ProofContext.theory_of ctxt
   83.44 +    val thy = Proof_Context.theory_of ctxt
   83.45      val intrs = map prop_of intros
   83.46      val preds = map (fn c => Const (c, Sign.the_const_type thy c)) prednames
   83.47      val (preds, intrs) = unify_consts thy preds intrs
   83.48 @@ -1289,7 +1289,7 @@
   83.49          val nparams = nparams_of thy predname
   83.50          val elim' =
   83.51            (Drule.export_without_context o Skip_Proof.make_thm thy)
   83.52 -          (mk_casesrule (ProofContext.init_global thy) nparams intros)
   83.53 +          (mk_casesrule (Proof_Context.init_global thy) nparams intros)
   83.54        in
   83.55          if not (Thm.equiv_thm (elim, elim')) then
   83.56            error "Introduction and elimination rules do not match!"
   83.57 @@ -1349,7 +1349,7 @@
   83.58    let
   83.59      fun dest_steps (Steps s) = s
   83.60      val compilation = Comp_Mod.compilation (#comp_modifiers (dest_steps steps))
   83.61 -    val ctxt = ProofContext.init_global thy
   83.62 +    val ctxt = Proof_Context.init_global thy
   83.63      val _ = print_step options
   83.64        ("Starting predicate compiler (compilation: " ^ string_of_compilation compilation
   83.65          ^ ") for predicates " ^ commas prednames ^ "...")
   83.66 @@ -1378,7 +1378,7 @@
   83.67        cond_timeit (Config.get ctxt Quickcheck.timing) "Defining executable functions..."
   83.68        (fn _ => fold (#define_functions (dest_steps steps) options preds) modes thy'
   83.69        |> Theory.checkpoint)
   83.70 -    val ctxt'' = ProofContext.init_global thy''
   83.71 +    val ctxt'' = Proof_Context.init_global thy''
   83.72      val _ = print_step options "Compiling equations..."
   83.73      val compiled_terms =
   83.74        cond_timeit (Config.get ctxt Quickcheck.timing) "Compiling equations...." (fn _ =>
   83.75 @@ -1415,7 +1415,7 @@
   83.76      val thy'' = fold preprocess_intros (flat scc) thy'
   83.77      val thy''' = fold_rev
   83.78        (fn preds => fn thy =>
   83.79 -        if not (forall (defined (ProofContext.init_global thy)) preds) then
   83.80 +        if not (forall (defined (Proof_Context.init_global thy)) preds) then
   83.81            let
   83.82              val mode_analysis_options = {use_generators = #use_generators (dest_steps steps),
   83.83                reorder_premises =
   83.84 @@ -1581,11 +1581,11 @@
   83.85  (* FIXME ... this is important to avoid changing the background theory below *)
   83.86  fun generic_code_pred prep_const options raw_const lthy =
   83.87    let
   83.88 -    val thy = ProofContext.theory_of lthy
   83.89 +    val thy = Proof_Context.theory_of lthy
   83.90      val const = prep_const thy raw_const
   83.91      val lthy' = Local_Theory.background_theory (extend_intro_graph [const]) lthy
   83.92 -    val thy' = ProofContext.theory_of lthy'
   83.93 -    val ctxt' = ProofContext.init_global thy'
   83.94 +    val thy' = Proof_Context.theory_of lthy'
   83.95 +    val ctxt' = Proof_Context.init_global thy'
   83.96      val preds = Graph.all_succs (PredData.get thy') [const] |> filter_out (has_elim ctxt')
   83.97      fun mk_cases const =
   83.98        let
   83.99 @@ -1603,11 +1603,11 @@
  83.100      val case_env = map2 (fn p => fn c => (Long_Name.base_name p, SOME c)) preds cases
  83.101      val lthy'' = lthy'
  83.102        |> fold Variable.auto_fixes cases_rules
  83.103 -      |> ProofContext.add_cases true case_env
  83.104 +      |> Proof_Context.add_cases true case_env
  83.105      fun after_qed thms goal_ctxt =
  83.106        let
  83.107 -        val global_thms = ProofContext.export goal_ctxt
  83.108 -          (ProofContext.init_global (ProofContext.theory_of goal_ctxt)) (map the_single thms)
  83.109 +        val global_thms = Proof_Context.export goal_ctxt
  83.110 +          (Proof_Context.init_global (Proof_Context.theory_of goal_ctxt)) (map the_single thms)
  83.111        in
  83.112          goal_ctxt |> Local_Theory.background_theory (fold set_elim global_thms #>
  83.113            ((case compilation options of
  83.114 @@ -1834,7 +1834,7 @@
  83.115              @{term Code_Numeral.of_nat} $ (HOLogic.size_const T $ Bound 0)))) t
  83.116        else
  83.117          mk_map compfuns T HOLogic.termT (HOLogic.term_of_const T) t
  83.118 -    val thy = ProofContext.theory_of ctxt
  83.119 +    val thy = Proof_Context.theory_of ctxt
  83.120      val time_limit = seconds (Config.get ctxt values_timeout)
  83.121      val (ts, statistics) =
  83.122        (case compilation of
    84.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_data.ML	Sat Apr 16 15:47:52 2011 +0200
    84.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_data.ML	Sat Apr 16 16:15:37 2011 +0200
    84.3 @@ -134,7 +134,7 @@
    84.4    
    84.5  fun split_all_pairs thy th =
    84.6    let
    84.7 -    val ctxt = ProofContext.init_global thy
    84.8 +    val ctxt = Proof_Context.init_global thy
    84.9      val ((_, [th']), ctxt') = Variable.import true [th] ctxt
   84.10      val t = prop_of th'
   84.11      val frees = Term.add_frees t [] 
   84.12 @@ -158,7 +158,7 @@
   84.13  
   84.14  fun inline_equations thy th =
   84.15    let
   84.16 -    val inline_defs = Predicate_Compile_Inline_Defs.get (ProofContext.init_global thy)
   84.17 +    val inline_defs = Predicate_Compile_Inline_Defs.get (Proof_Context.init_global thy)
   84.18      val th' = (Simplifier.full_simplify (HOL_basic_ss addsimps inline_defs)) th
   84.19      (*val _ = print_step options 
   84.20        ("Inlining " ^ (Syntax.string_of_term_global thy (prop_of th))
   84.21 @@ -193,7 +193,7 @@
   84.22          tracing ("getting specification of " ^ Syntax.string_of_term_global thy t ^
   84.23            " with type " ^ Syntax.string_of_typ_global thy (fastype_of t))
   84.24        else ()
   84.25 -    val ctxt = ProofContext.init_global thy
   84.26 +    val ctxt = Proof_Context.init_global thy
   84.27      fun filtering th =
   84.28        if is_equationlike th andalso
   84.29          defining_const_of_equation (normalize_equation thy th) = fst (dest_Const t) then
   84.30 @@ -259,7 +259,7 @@
   84.31  
   84.32  fun obtain_specification_graph options thy t =
   84.33    let
   84.34 -    val ctxt = ProofContext.init_global thy
   84.35 +    val ctxt = Proof_Context.init_global thy
   84.36      fun is_nondefining_const (c, T) = member (op =) logic_operator_names c
   84.37      fun has_code_pred_intros (c, T) = can (Core_Data.intros_of ctxt) c
   84.38      fun case_consts (c, T) = is_some (Datatype.info_of_case thy c)
    85.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_fun.ML	Sat Apr 16 15:47:52 2011 +0200
    85.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_fun.ML	Sat Apr 16 16:15:37 2011 +0200
    85.3 @@ -183,7 +183,7 @@
    85.4            SOME raw_split_thm =>
    85.5            let
    85.6              val (f, args) = strip_comb t
    85.7 -            val split_thm = prepare_split_thm (ProofContext.init_global thy) raw_split_thm
    85.8 +            val split_thm = prepare_split_thm (Proof_Context.init_global thy) raw_split_thm
    85.9              val (assms, concl) = Logic.strip_horn (prop_of split_thm)
   85.10              val (P, [split_t]) = strip_comb (HOLogic.dest_Trueprop concl)
   85.11              val t' = case_betapply thy t
    86.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_pred.ML	Sat Apr 16 15:47:52 2011 +0200
    86.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_pred.ML	Sat Apr 16 16:15:37 2011 +0200
    86.3 @@ -32,10 +32,10 @@
    86.4      NONE => NONE
    86.5    | SOME raw_split_thm =>
    86.6      let
    86.7 -      val split_thm = prepare_split_thm (ProofContext.init_global thy) raw_split_thm
    86.8 +      val split_thm = prepare_split_thm (Proof_Context.init_global thy) raw_split_thm
    86.9        (* TODO: contextify things - this line is to unvarify the split_thm *)
   86.10        (*val ((_, [isplit_thm]), _) =
   86.11 -        Variable.import true [split_thm] (ProofContext.init_global thy)*)
   86.12 +        Variable.import true [split_thm] (Proof_Context.init_global thy)*)
   86.13        val (assms, concl) = Logic.strip_horn (prop_of split_thm)
   86.14        val (P, [split_t]) = strip_comb (HOLogic.dest_Trueprop concl) 
   86.15        val atom' = case_betapply thy atom
   86.16 @@ -127,11 +127,11 @@
   86.17  
   86.18  fun flatten_intros constname intros thy =
   86.19    let
   86.20 -    val ctxt = ProofContext.init_global thy
   86.21 +    val ctxt = Proof_Context.init_global thy
   86.22      val ((_, intros), ctxt') = Variable.import true intros ctxt
   86.23      val (intros', (local_defs, thy')) = (fold_map o fold_map_atoms)
   86.24        (flatten constname) (map prop_of intros) ([], thy)
   86.25 -    val ctxt'' = ProofContext.transfer thy' ctxt'
   86.26 +    val ctxt'' = Proof_Context.transfer thy' ctxt'
   86.27      val tac = fn _ => Skip_Proof.cheat_tac thy'
   86.28      val intros'' = map (fn t => Goal.prove ctxt'' [] [] t tac) intros'
   86.29        |> Variable.export ctxt'' ctxt
   86.30 @@ -146,7 +146,7 @@
   86.31  
   86.32  fun introrulify thy ths = 
   86.33    let
   86.34 -    val ctxt = ProofContext.init_global thy
   86.35 +    val ctxt = Proof_Context.init_global thy
   86.36      val ((_, ths'), ctxt') = Variable.import true ths ctxt
   86.37      fun introrulify' th =
   86.38        let
   86.39 @@ -189,7 +189,7 @@
   86.40    Simplifier.full_simplify (HOL_basic_ss addsimps [@{thm all_not_ex}])
   86.41    #> Simplifier.full_simplify
   86.42      (HOL_basic_ss addsimps (tl @{thms bool_simps}) addsimps @{thms nnf_simps})
   86.43 -  #> split_conjuncts_in_assms (ProofContext.init_global thy)
   86.44 +  #> split_conjuncts_in_assms (Proof_Context.init_global thy)
   86.45  
   86.46  fun print_specs options thy msg ths =
   86.47    if show_intermediate_results options then
   86.48 @@ -202,7 +202,7 @@
   86.49      SOME specss => (specss, thy)
   86.50    | NONE =>*)
   86.51      let
   86.52 -      val ctxt = ProofContext.init_global thy
   86.53 +      val ctxt = Proof_Context.init_global thy
   86.54        val intros =
   86.55          if forall is_pred_equation specs then 
   86.56            map (split_conjuncts_in_assms ctxt) (introrulify thy (map rewrite specs))
    87.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_proof.ML	Sat Apr 16 15:47:52 2011 +0200
    87.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_proof.ML	Sat Apr 16 16:15:37 2011 +0200
    87.3 @@ -157,7 +157,7 @@
    87.4  
    87.5  fun prove_match options ctxt nargs out_ts =
    87.6    let
    87.7 -    val thy = ProofContext.theory_of ctxt
    87.8 +    val thy = Proof_Context.theory_of ctxt
    87.9      val eval_if_P =
   87.10        @{lemma "P ==> Predicate.eval x z ==> Predicate.eval (if P then x else y) z" by simp} 
   87.11      fun get_case_rewrite t =
   87.12 @@ -324,7 +324,7 @@
   87.13  
   87.14  fun prove_match2 options ctxt out_ts =
   87.15    let
   87.16 -    val thy = ProofContext.theory_of ctxt
   87.17 +    val thy = Proof_Context.theory_of ctxt
   87.18      fun split_term_tac (Free _) = all_tac
   87.19        | split_term_tac t =
   87.20          if (is_constructor thy t) then
   87.21 @@ -507,7 +507,7 @@
   87.22  
   87.23  fun prove_pred options thy clauses preds pred (pol, mode) (moded_clauses, compiled_term) =
   87.24    let
   87.25 -    val ctxt = ProofContext.init_global thy
   87.26 +    val ctxt = Proof_Context.init_global thy
   87.27      val clauses = case AList.lookup (op =) clauses pred of SOME rs => rs | NONE => []
   87.28    in
   87.29      Goal.prove ctxt (Term.add_free_names compiled_term []) [] compiled_term
    88.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_quickcheck.ML	Sat Apr 16 15:47:52 2011 +0200
    88.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_quickcheck.ML	Sat Apr 16 16:15:37 2011 +0200
    88.3 @@ -218,7 +218,7 @@
    88.4  fun compile_term compilation options ctxt [(t, eval_terms)] =
    88.5    let
    88.6      val t' = list_abs_free (Term.add_frees t [], t)
    88.7 -    val thy = Theory.copy (ProofContext.theory_of ctxt)
    88.8 +    val thy = Theory.copy (Proof_Context.theory_of ctxt)
    88.9      val ((((full_constname, constT), vs'), intro), thy1) =
   88.10        Predicate_Compile_Aux.define_quickcheck_predicate t' thy
   88.11      val thy2 = Context.theory_map (Predicate_Compile_Alternative_Defs.add_thm intro) thy1
   88.12 @@ -238,7 +238,7 @@
   88.13      (*val _ = Predicate_Compile_Core.print_all_modes compilation thy4*)
   88.14      val _ = Output.tracing ("Preprocessing time: " ^ string_of_int (snd preproc_time))
   88.15      val _ = Output.tracing ("Core compilation time: " ^ string_of_int (snd core_comp_time))
   88.16 -    val ctxt4 = ProofContext.init_global thy4
   88.17 +    val ctxt4 = Proof_Context.init_global thy4
   88.18      val modes = Core_Data.modes_of compilation ctxt4 full_constname
   88.19      val output_mode = fold_rev (curry Fun) (map (K Output) (binder_types constT)) Bool
   88.20      val prog =
    89.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_specialisation.ML	Sat Apr 16 15:47:52 2011 +0200
    89.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_specialisation.ML	Sat Apr 16 16:15:37 2011 +0200
    89.3 @@ -33,7 +33,7 @@
    89.4  
    89.5  fun import (pred, intros) args ctxt =
    89.6    let
    89.7 -    val thy = ProofContext.theory_of ctxt
    89.8 +    val thy = Proof_Context.theory_of ctxt
    89.9      val ((Tinst, intros'), ctxt') = Variable.importT intros ctxt
   89.10      val pred' = fst (strip_comb (HOLogic.dest_Trueprop (Logic.strip_imp_concl (prop_of (hd intros')))))
   89.11      val Ts = binder_types (fastype_of pred')
   89.12 @@ -64,7 +64,7 @@
   89.13  
   89.14  fun specialise_intros black_list (pred, intros) pats thy =
   89.15    let
   89.16 -    val ctxt = ProofContext.init_global thy
   89.17 +    val ctxt = Proof_Context.init_global thy
   89.18      val maxidx = fold (Term.maxidx_term o prop_of) intros ~1
   89.19      val pats = map (Logic.incr_indexes ([],  maxidx + 1)) pats
   89.20      val (((pred, intros), pats), ctxt') = import (pred, intros) pats ctxt
   89.21 @@ -180,7 +180,7 @@
   89.22                      if member (op =) ((map fst specs) @ black_list) pred_name then
   89.23                        thy
   89.24                      else
   89.25 -                      (case try (Core_Data.intros_of (ProofContext.init_global thy)) pred_name of
   89.26 +                      (case try (Core_Data.intros_of (Proof_Context.init_global thy)) pred_name of
   89.27                          NONE => thy
   89.28                        | SOME [] => thy
   89.29                        | SOME intros =>
    90.1 --- a/src/HOL/Tools/Qelim/cooper.ML	Sat Apr 16 15:47:52 2011 +0200
    90.2 +++ b/src/HOL/Tools/Qelim/cooper.ML	Sat Apr 16 16:15:37 2011 +0200
    90.3 @@ -682,7 +682,7 @@
    90.4  val (_, oracle) = Context.>>> (Context.map_theory_result
    90.5    (Thm.add_oracle (@{binding cooper},
    90.6      (fn (ctxt, t) =>
    90.7 -      (Thm.cterm_of (ProofContext.theory_of ctxt) o Logic.mk_equals o pairself HOLogic.mk_Trueprop)
    90.8 +      (Thm.cterm_of (Proof_Context.theory_of ctxt) o Logic.mk_equals o pairself HOLogic.mk_Trueprop)
    90.9          (t, procedure t)))));
   90.10  
   90.11  val comp_ss = HOL_ss addsimps @{thms semiring_norm};
    91.1 --- a/src/HOL/Tools/Quickcheck/exhaustive_generators.ML	Sat Apr 16 15:47:52 2011 +0200
    91.2 +++ b/src/HOL/Tools/Quickcheck/exhaustive_generators.ML	Sat Apr 16 16:15:37 2011 +0200
    91.3 @@ -289,7 +289,7 @@
    91.4  
    91.5  fun mk_fast_generator_expr ctxt (t, eval_terms) =
    91.6    let
    91.7 -    val thy = ProofContext.theory_of ctxt
    91.8 +    val thy = Proof_Context.theory_of ctxt
    91.9      val ctxt' = Variable.auto_fixes t ctxt
   91.10      val names = Term.add_free_names t []
   91.11      val frees = map Free (Term.add_frees t [])
   91.12 @@ -329,7 +329,7 @@
   91.13  
   91.14  fun mk_generator_expr ctxt (t, eval_terms) =
   91.15    let
   91.16 -    val thy = ProofContext.theory_of ctxt
   91.17 +    val thy = Proof_Context.theory_of ctxt
   91.18      val ctxt' = Variable.auto_fixes t ctxt
   91.19      val names = Term.add_free_names t []
   91.20      val frees = map Free (Term.add_frees t [])
   91.21 @@ -371,7 +371,7 @@
   91.22  
   91.23  fun mk_full_generator_expr ctxt (t, eval_terms) =
   91.24    let
   91.25 -    val thy = ProofContext.theory_of ctxt
   91.26 +    val thy = Proof_Context.theory_of ctxt
   91.27      val ctxt' = Variable.auto_fixes t ctxt
   91.28      val names = Term.add_free_names t []
   91.29      val frees = map Free (Term.add_frees t [])
   91.30 @@ -428,7 +428,7 @@
   91.31  fun mk_validator_expr ctxt t =
   91.32    let
   91.33      fun bounded_forallT T = (T --> @{typ bool}) --> @{typ code_numeral} --> @{typ bool}
   91.34 -    val thy = ProofContext.theory_of ctxt
   91.35 +    val thy = Proof_Context.theory_of ctxt
   91.36      val ctxt' = Variable.auto_fixes t ctxt
   91.37      val ([depth_name], ctxt'') = Variable.variant_fixes ["depth"] ctxt'
   91.38      val depth = Free (depth_name, @{typ code_numeral})
   91.39 @@ -490,7 +490,7 @@
   91.40    
   91.41  fun compile_generator_expr ctxt ts =
   91.42    let
   91.43 -    val thy = ProofContext.theory_of ctxt
   91.44 +    val thy = Proof_Context.theory_of ctxt
   91.45      val mk_generator_expr = 
   91.46        if Config.get ctxt fast then mk_fast_generator_expr
   91.47        else if Config.get ctxt full_support then mk_full_generator_expr else mk_generator_expr
   91.48 @@ -507,7 +507,7 @@
   91.49   
   91.50  fun compile_generator_exprs ctxt ts =
   91.51    let
   91.52 -    val thy = ProofContext.theory_of ctxt
   91.53 +    val thy = Proof_Context.theory_of ctxt
   91.54      val ts' = map (fn t => mk_generator_expr ctxt (t, [])) ts;
   91.55      val compiles = Code_Runtime.dynamic_value_strict
   91.56        (Counterexample_Batch.get, put_counterexample_batch,
   91.57 @@ -521,7 +521,7 @@
   91.58  
   91.59  fun compile_validator_exprs ctxt ts =
   91.60    let
   91.61 -    val thy = ProofContext.theory_of ctxt
   91.62 +    val thy = Proof_Context.theory_of ctxt
   91.63      val ts' = map (mk_validator_expr ctxt) ts
   91.64    in
   91.65      Code_Runtime.dynamic_value_strict
    92.1 --- a/src/HOL/Tools/Quickcheck/narrowing_generators.ML	Sat Apr 16 15:47:52 2011 +0200
    92.2 +++ b/src/HOL/Tools/Quickcheck/narrowing_generators.ML	Sat Apr 16 16:15:37 2011 +0200
    92.3 @@ -141,7 +141,7 @@
    92.4  
    92.5  fun evaluation cookie thy evaluator vs_t args size =
    92.6    let
    92.7 -    val ctxt = ProofContext.init_global thy;
    92.8 +    val ctxt = Proof_Context.init_global thy;
    92.9      val (program_code, value_name) = evaluator vs_t;
   92.10      val value_code = space_implode " "
   92.11        (value_name :: "()" :: map (enclose "(" ")") args);
   92.12 @@ -192,7 +192,7 @@
   92.13  
   92.14  fun compile_generator_expr ctxt [(t, eval_terms)] [_, size] =
   92.15    let
   92.16 -    val thy = ProofContext.theory_of ctxt
   92.17 +    val thy = Proof_Context.theory_of ctxt
   92.18      val t' = list_abs_free (Term.add_frees t [], t)
   92.19      val t'' = if Config.get ctxt finite_functions then finitize_functions t' else t'
   92.20      fun ensure_testable t =
    93.1 --- a/src/HOL/Tools/Quickcheck/quickcheck_common.ML	Sat Apr 16 15:47:52 2011 +0200
    93.2 +++ b/src/HOL/Tools/Quickcheck/quickcheck_common.ML	Sat Apr 16 16:15:37 2011 +0200
    93.3 @@ -65,7 +65,7 @@
    93.4        let
    93.5          val eqs_t = mk_equations consts
    93.6          val eqs = map (fn eq => Goal.prove lthy argnames [] eq
    93.7 -          (fn _ => Skip_Proof.cheat_tac (ProofContext.theory_of lthy))) eqs_t
    93.8 +          (fn _ => Skip_Proof.cheat_tac (Proof_Context.theory_of lthy))) eqs_t
    93.9        in
   93.10          fold (fn (name, eq) => Local_Theory.note
   93.11          ((Binding.conceal (Binding.qualify true prfx
    94.1 --- a/src/HOL/Tools/Quickcheck/random_generators.ML	Sat Apr 16 15:47:52 2011 +0200
    94.2 +++ b/src/HOL/Tools/Quickcheck/random_generators.ML	Sat Apr 16 16:15:37 2011 +0200
    94.3 @@ -83,7 +83,7 @@
    94.4  
    94.5  fun random_aux_primrec eq lthy =
    94.6    let
    94.7 -    val thy = ProofContext.theory_of lthy;
    94.8 +    val thy = Proof_Context.theory_of lthy;
    94.9      val ((t_random_aux as Free (random_aux, T)) $ (t_k as Free (v, _)), proto_t_rhs) =
   94.10        (HOLogic.dest_eq o HOLogic.dest_Trueprop) eq;
   94.11      val Type (_, [_, iT]) = T;
   94.12 @@ -104,7 +104,7 @@
   94.13             [(cT_random_aux, cert t_random_aux), (cT_rhs, cert t_rhs)]);
   94.14      val tac = ALLGOALS (rtac rule)
   94.15        THEN ALLGOALS (simp_tac rew_ss)
   94.16 -      THEN (ALLGOALS (ProofContext.fact_tac eqs2))
   94.17 +      THEN (ALLGOALS (Proof_Context.fact_tac eqs2))
   94.18      val simp = Skip_Proof.prove lthy' [v] [] eq (K tac);
   94.19    in (simp, lthy') end;
   94.20  
   94.21 @@ -116,7 +116,7 @@
   94.22        |>> (fn simp => [simp])
   94.23    | random_aux_primrec_multi auxname (eqs as _ :: _ :: _) lthy =
   94.24        let
   94.25 -        val thy = ProofContext.theory_of lthy;
   94.26 +        val thy = Proof_Context.theory_of lthy;
   94.27          val (lhss, rhss) = map_split (HOLogic.dest_eq o HOLogic.dest_Trueprop) eqs;
   94.28          val (vs, (arg as Free (v, _)) :: _) = map_split (fn (t1 $ t2) => (t1, t2)) lhss;
   94.29          val Ts = map fastype_of lhss;
   94.30 @@ -162,7 +162,7 @@
   94.31      fun prove_simps proto_simps lthy =
   94.32        let
   94.33          val ext_simps = map (fn thm => fun_cong OF [fun_cong OF [thm]]) proto_simps;
   94.34 -        val tac = ALLGOALS (ProofContext.fact_tac ext_simps);
   94.35 +        val tac = ALLGOALS (Proof_Context.fact_tac ext_simps);
   94.36        in (map (fn prop => Skip_Proof.prove lthy vs [] prop (K tac)) eqs, lthy) end;
   94.37      val b = Binding.conceal (Binding.qualify true prfx
   94.38        (Binding.qualify true name (Binding.name "simps")));
   94.39 @@ -290,7 +290,7 @@
   94.40  
   94.41  fun mk_generator_expr ctxt (t, eval_terms) =
   94.42    let  
   94.43 -    val thy = ProofContext.theory_of ctxt
   94.44 +    val thy = Proof_Context.theory_of ctxt
   94.45      val prop = list_abs_free (Term.add_frees t [], t)
   94.46      val Ts = (map snd o fst o strip_abs) prop
   94.47      val bound_max = length Ts - 1;
   94.48 @@ -316,7 +316,7 @@
   94.49  
   94.50  fun mk_reporting_generator_expr ctxt (t, eval_terms) =
   94.51    let
   94.52 -    val thy = ProofContext.theory_of ctxt
   94.53 +    val thy = Proof_Context.theory_of ctxt
   94.54      val prop = list_abs_free (Term.add_frees t [], t)
   94.55      val Ts = (map snd o fst o strip_abs) prop
   94.56      val bound_max = length Ts - 1
   94.57 @@ -393,7 +393,7 @@
   94.58      
   94.59  fun compile_generator_expr ctxt ts =
   94.60    let
   94.61 -    val thy = ProofContext.theory_of ctxt
   94.62 +    val thy = Proof_Context.theory_of ctxt
   94.63      val iterations = Config.get ctxt Quickcheck.iterations
   94.64    in
   94.65      if Config.get ctxt Quickcheck.report then
    95.1 --- a/src/HOL/Tools/Quotient/quotient_info.ML	Sat Apr 16 15:47:52 2011 +0200
    95.2 +++ b/src/HOL/Tools/Quotient/quotient_info.ML	Sat Apr 16 16:15:37 2011 +0200
    95.3 @@ -77,7 +77,7 @@
    95.4    | NONE => raise NotFound)
    95.5  
    95.6  fun maps_update_thy k minfo = MapsData.map (Symtab.update (k, minfo))
    95.7 -fun maps_update k minfo = ProofContext.background_theory (maps_update_thy k minfo)  (* FIXME *)
    95.8 +fun maps_update k minfo = Proof_Context.background_theory (maps_update_thy k minfo)  (* FIXME *)
    95.9  
   95.10  fun maps_attribute_aux s minfo = Thm.declaration_attribute
   95.11    (fn _ => Context.mapping (maps_update_thy s minfo) (maps_update s minfo))
   95.12 @@ -85,7 +85,7 @@
   95.13  (* attribute to be used in declare statements *)
   95.14  fun maps_attribute (ctxt, (tystr, (mapstr, relstr))) =
   95.15    let
   95.16 -    val thy = ProofContext.theory_of ctxt
   95.17 +    val thy = Proof_Context.theory_of ctxt
   95.18      val tyname = Sign.intern_type thy tystr
   95.19      val mapname = Sign.intern_const thy mapstr
   95.20      val relname = Sign.intern_const thy relstr
   95.21 @@ -111,7 +111,7 @@
   95.22            "map:", mapfun,
   95.23            "relation map:", relmap]))
   95.24    in
   95.25 -    MapsData.get (ProofContext.theory_of ctxt)
   95.26 +    MapsData.get (Proof_Context.theory_of ctxt)
   95.27      |> Symtab.dest
   95.28      |> map (prt_map)
   95.29      |> Pretty.big_list "maps for type constructors:"
   95.30 @@ -147,7 +147,7 @@
   95.31  fun quotdata_update_gen str qinfo = Context.mapping (quotdata_update_thy str qinfo) I
   95.32  
   95.33  fun quotdata_dest lthy =
   95.34 -  map snd (Symtab.dest (QuotData.get (ProofContext.theory_of lthy)))
   95.35 +  map snd (Symtab.dest (QuotData.get (Proof_Context.theory_of lthy)))
   95.36  
   95.37  fun print_quotinfo ctxt =
   95.38    let
   95.39 @@ -162,7 +162,7 @@
   95.40          Pretty.str "equiv. thm:",
   95.41          Syntax.pretty_term ctxt (prop_of equiv_thm)])
   95.42    in
   95.43 -    QuotData.get (ProofContext.theory_of ctxt)
   95.44 +    QuotData.get (Proof_Context.theory_of ctxt)
   95.45      |> Symtab.dest
   95.46      |> map (prt_quot o snd)
   95.47      |> Pretty.big_list "quotients:"
   95.48 @@ -195,7 +195,7 @@
   95.49  fun qconsts_update_gen name qcinfo = Context.mapping (qconsts_update_thy name qcinfo) I
   95.50  
   95.51  fun qconsts_dest lthy =
   95.52 -  flat (map snd (Symtab.dest (QConstsData.get (ProofContext.theory_of lthy))))
   95.53 +  flat (map snd (Symtab.dest (QConstsData.get (Proof_Context.theory_of lthy))))
   95.54  
   95.55  fun qconsts_lookup thy t =
   95.56    let
   95.57 @@ -225,7 +225,7 @@
   95.58          Pretty.str "as",
   95.59          Syntax.pretty_term ctxt (prop_of def)])
   95.60    in
   95.61 -    QConstsData.get (ProofContext.theory_of ctxt)
   95.62 +    QConstsData.get (Proof_Context.theory_of ctxt)
   95.63      |> Symtab.dest
   95.64      |> map snd
   95.65      |> flat
    96.1 --- a/src/HOL/Tools/Quotient/quotient_tacs.ML	Sat Apr 16 15:47:52 2011 +0200
    96.2 +++ b/src/HOL/Tools/Quotient/quotient_tacs.ML	Sat Apr 16 16:15:37 2011 +0200
    96.3 @@ -98,7 +98,7 @@
    96.4  *)
    96.5  fun calculate_inst ctxt ball_bex_thm redex R1 R2 =
    96.6    let
    96.7 -    val thy = ProofContext.theory_of ctxt
    96.8 +    val thy = Proof_Context.theory_of ctxt
    96.9      fun get_lhs thm = fst (Logic.dest_equals (Thm.concl_of thm))
   96.10      val ty_inst = map (SOME o ctyp_of thy) [domain_type (fastype_of R2)]
   96.11      val trm_inst = map (SOME o cterm_of thy) [R2, R1]
   96.12 @@ -156,7 +156,7 @@
   96.13  
   96.14  fun regularize_tac ctxt =
   96.15    let
   96.16 -    val thy = ProofContext.theory_of ctxt
   96.17 +    val thy = Proof_Context.theory_of ctxt
   96.18      val ball_pat = @{term "Ball (Respects (R1 ===> R2)) P"}
   96.19      val bex_pat = @{term "Bex (Respects (R1 ===> R2)) P"}
   96.20      val simproc =
   96.21 @@ -201,7 +201,7 @@
   96.22      (Const (@{const_name Quot_True}, _) $ x) =>
   96.23        let
   96.24          val fx = fnctn x;
   96.25 -        val thy = ProofContext.theory_of ctxt;
   96.26 +        val thy = Proof_Context.theory_of ctxt;
   96.27          val cx = cterm_of thy x;
   96.28          val cfx = cterm_of thy fx;
   96.29          val cxt = ctyp_of thy (fastype_of x);
   96.30 @@ -253,7 +253,7 @@
   96.31                val ty_x = fastype_of x
   96.32                val ty_b = fastype_of qt_arg
   96.33                val ty_f = range_type (fastype_of f)
   96.34 -              val thy = ProofContext.theory_of context
   96.35 +              val thy = Proof_Context.theory_of context
   96.36                val ty_inst = map (SOME o (ctyp_of thy)) [ty_x, ty_b, ty_f]
   96.37                val t_inst = map (SOME o (cterm_of thy)) [R2, f, g, x, y];
   96.38                val inst_thm = Drule.instantiate' ty_inst
   96.39 @@ -269,7 +269,7 @@
   96.40  *)
   96.41  fun equals_rsp_tac R ctxt =
   96.42    let
   96.43 -    val thy = ProofContext.theory_of ctxt
   96.44 +    val thy = Proof_Context.theory_of ctxt
   96.45    in
   96.46      case try (cterm_of thy) R of (* There can be loose bounds in R *)
   96.47        SOME ctm =>
   96.48 @@ -290,7 +290,7 @@
   96.49        SOME (rel $ _ $ (rep $ (Bound _ $ _))) => no_tac
   96.50      | SOME (rel $ _ $ (rep $ (abs $ _))) =>
   96.51          let
   96.52 -          val thy = ProofContext.theory_of ctxt;
   96.53 +          val thy = Proof_Context.theory_of ctxt;
   96.54            val (ty_a, ty_b) = dest_funT (fastype_of abs);
   96.55            val ty_inst = map (SOME o (ctyp_of thy)) [ty_a, ty_b];
   96.56          in
   96.57 @@ -478,7 +478,7 @@
   96.58    (case term_of ctrm of
   96.59      (Const (@{const_name map_fun}, _) $ r1 $ a2) $ (Abs _) =>
   96.60        let
   96.61 -        val thy = ProofContext.theory_of ctxt
   96.62 +        val thy = Proof_Context.theory_of ctxt
   96.63          val (ty_b, ty_a) = dest_funT (fastype_of r1)
   96.64          val (ty_c, ty_d) = dest_funT (fastype_of a2)
   96.65          val tyinst = map (SOME o (ctyp_of thy)) [ty_a, ty_b, ty_c, ty_d]
   96.66 @@ -556,7 +556,7 @@
   96.67  fun gen_frees_tac ctxt =
   96.68    SUBGOAL (fn (concl, i) =>
   96.69      let
   96.70 -      val thy = ProofContext.theory_of ctxt
   96.71 +      val thy = Proof_Context.theory_of ctxt
   96.72        val vrs = Term.add_frees concl []
   96.73        val cvrs = map (cterm_of thy o Free) vrs
   96.74        val concl' = apply_under_Trueprop (all_list vrs) concl
   96.75 @@ -600,7 +600,7 @@
   96.76  
   96.77  fun procedure_inst ctxt rtrm qtrm =
   96.78    let
   96.79 -    val thy = ProofContext.theory_of ctxt
   96.80 +    val thy = Proof_Context.theory_of ctxt
   96.81      val rtrm' = HOLogic.dest_Trueprop rtrm
   96.82      val qtrm' = HOLogic.dest_Trueprop qtrm
   96.83      val reg_goal = Quotient_Term.regularize_trm_chk ctxt (rtrm', qtrm')
   96.84 @@ -704,7 +704,7 @@
   96.85    in
   96.86      Goal.prove ctxt' [] [] goal
   96.87        (K (HEADGOAL (lift_single_tac ctxt' simps rthm')))
   96.88 -    |> singleton (ProofContext.export ctxt' ctxt)
   96.89 +    |> singleton (Proof_Context.export ctxt' ctxt)
   96.90    end
   96.91  
   96.92  
    97.1 --- a/src/HOL/Tools/Quotient/quotient_term.ML	Sat Apr 16 15:47:52 2011 +0200
    97.2 +++ b/src/HOL/Tools/Quotient/quotient_term.ML	Sat Apr 16 16:15:37 2011 +0200
    97.3 @@ -64,7 +64,7 @@
    97.4  
    97.5  fun get_mapfun ctxt s =
    97.6    let
    97.7 -    val thy = ProofContext.theory_of ctxt
    97.8 +    val thy = Proof_Context.theory_of ctxt
    97.9      val mapfun = #mapfun (Quotient_Info.maps_lookup thy s) handle Quotient_Info.NotFound =>
   97.10        raise LIFT_MATCH ("No map function for type " ^ quote s ^ " found.")
   97.11    in
   97.12 @@ -101,7 +101,7 @@
   97.13  *)
   97.14  fun get_rty_qty ctxt s =
   97.15    let
   97.16 -    val thy = ProofContext.theory_of ctxt
   97.17 +    val thy = Proof_Context.theory_of ctxt
   97.18      val qdata = Quotient_Info.quotdata_lookup thy s handle Quotient_Info.NotFound =>
   97.19        raise LIFT_MATCH ("No quotient type " ^ quote s ^ " found.")
   97.20    in
   97.21 @@ -122,7 +122,7 @@
   97.22  (* matches a type pattern with a type *)
   97.23  fun match ctxt err ty_pat ty =
   97.24    let
   97.25 -    val thy = ProofContext.theory_of ctxt
   97.26 +    val thy = Proof_Context.theory_of ctxt
   97.27    in
   97.28      Sign.typ_match thy (ty_pat, ty) Vartab.empty
   97.29        handle Type.TYPE_MATCH => err ctxt ty_pat ty
   97.30 @@ -258,7 +258,7 @@
   97.31  (* instantiates TVars so that the term is of type ty *)
   97.32  fun force_typ ctxt trm ty =
   97.33    let
   97.34 -    val thy = ProofContext.theory_of ctxt
   97.35 +    val thy = Proof_Context.theory_of ctxt
   97.36      val trm_ty = fastype_of trm
   97.37      val ty_inst = Sign.typ_match thy (trm_ty, ty) Vartab.empty
   97.38    in
   97.39 @@ -273,7 +273,7 @@
   97.40  
   97.41  fun get_relmap ctxt s =
   97.42    let
   97.43 -    val thy = ProofContext.theory_of ctxt
   97.44 +    val thy = Proof_Context.theory_of ctxt
   97.45      val relmap = #relmap (Quotient_Info.maps_lookup thy s) handle Quotient_Info.NotFound =>
   97.46        raise LIFT_MATCH ("get_relmap (no relation map function found for type " ^ s ^ ")")
   97.47    in
   97.48 @@ -296,7 +296,7 @@
   97.49  
   97.50  fun get_equiv_rel ctxt s =
   97.51    let
   97.52 -    val thy = ProofContext.theory_of ctxt
   97.53 +    val thy = Proof_Context.theory_of ctxt
   97.54    in
   97.55      #equiv_rel (Quotient_Info.quotdata_lookup thy s) handle Quotient_Info.NotFound =>
   97.56        raise LIFT_MATCH ("get_quotdata (no quotient found for type " ^ s ^ ")")
   97.57 @@ -554,7 +554,7 @@
   97.58  
   97.59    | (_, Const _) =>
   97.60        let
   97.61 -        val thy = ProofContext.theory_of ctxt
   97.62 +        val thy = Proof_Context.theory_of ctxt
   97.63          fun same_const (Const (s, T)) (Const (s', T')) = (s = s') andalso matches_typ thy T T'
   97.64            | same_const _ _ = false
   97.65        in
   97.66 @@ -707,7 +707,7 @@
   97.67    case rty of
   97.68      Type (s, rtys) =>
   97.69        let
   97.70 -        val thy = ProofContext.theory_of ctxt
   97.71 +        val thy = Proof_Context.theory_of ctxt
   97.72          val rty' = Type (s, map (subst_typ ctxt ty_subst) rtys)
   97.73  
   97.74          fun matches [] = rty'
   97.75 @@ -729,7 +729,7 @@
   97.76    | Bound i => Bound i
   97.77    | Const (a, ty) =>
   97.78        let
   97.79 -        val thy = ProofContext.theory_of ctxt
   97.80 +        val thy = Proof_Context.theory_of ctxt
   97.81  
   97.82          fun matches [] = Const (a, subst_typ ctxt ty_subst ty)
   97.83            | matches ((rconst, qconst)::tail) =
   97.84 @@ -749,7 +749,7 @@
   97.85  *)
   97.86  fun mk_ty_subst qtys direction ctxt =
   97.87    let
   97.88 -    val thy = ProofContext.theory_of ctxt
   97.89 +    val thy = Proof_Context.theory_of ctxt
   97.90    in
   97.91      Quotient_Info.quotdata_dest ctxt
   97.92      |> map (fn x => (#rtyp x, #qtyp x))
    98.1 --- a/src/HOL/Tools/Quotient/quotient_typ.ML	Sat Apr 16 15:47:52 2011 +0200
    98.2 +++ b/src/HOL/Tools/Quotient/quotient_typ.ML	Sat Apr 16 16:15:37 2011 +0200
    98.3 @@ -215,7 +215,7 @@
    98.4  (* check for existence of map functions *)
    98.5  fun map_check ctxt (_, (rty, _, _)) =
    98.6    let
    98.7 -    val thy = ProofContext.theory_of ctxt
    98.8 +    val thy = Proof_Context.theory_of ctxt
    98.9  
   98.10      fun map_check_aux rty warns =
   98.11        case rty of
    99.1 --- a/src/HOL/Tools/SMT/smt_builtin.ML	Sat Apr 16 15:47:52 2011 +0200
    99.2 +++ b/src/HOL/Tools/SMT/smt_builtin.ML	Sat Apr 16 16:15:37 2011 +0200
    99.3 @@ -73,7 +73,7 @@
    99.4    SMT_Utils.dict_merge (Ord_List.merge typ_ord) ttabp
    99.5  
    99.6  fun lookup_ttab ctxt ttab T =
    99.7 -  let fun match (U, _) = Sign.typ_instance (ProofContext.theory_of ctxt) (T, U)
    99.8 +  let fun match (U, _) = Sign.typ_instance (Proof_Context.theory_of ctxt) (T, U)
    99.9    in
   99.10      get_first (find_first match)
   99.11        (SMT_Utils.dict_lookup ttab (SMT_Config.solver_class_of ctxt))
   100.1 --- a/src/HOL/Tools/SMT/smt_datatypes.ML	Sat Apr 16 15:47:52 2011 +0200
   100.2 +++ b/src/HOL/Tools/SMT/smt_datatypes.ML	Sat Apr 16 16:15:37 2011 +0200
   100.3 @@ -62,7 +62,7 @@
   100.4  fun get_record_decl ({ext_def, ...} : Record.info) T ctxt =
   100.5    let
   100.6      val (con, _) = Term.dest_Const (lhs_head_of ext_def)
   100.7 -    val (fields, more) = Record.get_extT_fields (ProofContext.theory_of ctxt) T
   100.8 +    val (fields, more) = Record.get_extT_fields (Proof_Context.theory_of ctxt) T
   100.9      val fieldTs = map snd fields @ [snd more]
  100.10  
  100.11      val constr = Const (con, fieldTs ---> T)
  100.12 @@ -89,7 +89,7 @@
  100.13  fun declared declss T = exists (exists (equal T o fst)) declss
  100.14  
  100.15  fun get_decls T n Ts ctxt =
  100.16 -  let val thy = ProofContext.theory_of ctxt
  100.17 +  let val thy = Proof_Context.theory_of ctxt
  100.18    in
  100.19      (case Datatype.get_info thy n of
  100.20        SOME info => get_datatype_decl info n Ts ctxt
   101.1 --- a/src/HOL/Tools/SMT/smt_monomorph.ML	Sat Apr 16 15:47:52 2011 +0200
   101.2 +++ b/src/HOL/Tools/SMT/smt_monomorph.ML	Sat Apr 16 16:15:37 2011 +0200
   101.3 @@ -121,7 +121,7 @@
   101.4  
   101.5  fun search_substitutions ctxt limit instances all_grounds new_grounds scss =
   101.6    let
   101.7 -    val thy = ProofContext.theory_of ctxt
   101.8 +    val thy = Proof_Context.theory_of ctxt
   101.9      val all_grounds' = Symtab.merge_list (op =) (all_grounds, new_grounds)
  101.10      val spec = specialize thy limit all_grounds' new_grounds
  101.11      val (scss', (new_grounds', instances')) =
  101.12 @@ -162,7 +162,7 @@
  101.13  
  101.14  fun instantiate full (i, thm) substs (ithms, ctxt) =
  101.15    let
  101.16 -    val thy = ProofContext.theory_of ctxt
  101.17 +    val thy = Proof_Context.theory_of ctxt
  101.18  
  101.19      val (vs, Ss) = split_list (Term.add_tvars (Thm.prop_of thm) [])
  101.20      val (Tenv, ctxt') =
  101.21 @@ -215,7 +215,7 @@
  101.22    in
  101.23      scss
  101.24      |> search_substitutions ctxt limit instances Symtab.empty grounds
  101.25 -    |> map (filter_most_specific (ProofContext.theory_of ctxt))
  101.26 +    |> map (filter_most_specific (Proof_Context.theory_of ctxt))
  101.27      |> rpair (monos, ctxt)
  101.28      |-> fold2 (instantiate full) polys
  101.29    end
   102.1 --- a/src/HOL/Tools/SMT/smt_normalize.ML	Sat Apr 16 15:47:52 2011 +0200
   102.2 +++ b/src/HOL/Tools/SMT/smt_normalize.ML	Sat Apr 16 16:15:37 2011 +0200
   102.3 @@ -170,7 +170,7 @@
   102.4      (case Term.strip_comb t of
   102.5        (Const c, ts as _ :: _) =>
   102.6          not (SMT_Builtin.is_builtin_fun_ext ctxt c ts) andalso
   102.7 -        forall (is_constr_pat (ProofContext.theory_of ctxt)) ts
   102.8 +        forall (is_constr_pat (Proof_Context.theory_of ctxt)) ts
   102.9      | _ => false)
  102.10  
  102.11    fun has_all_vars vs t =
  102.12 @@ -218,7 +218,7 @@
  102.13        val (lhs, rhs) = dest_cond_eq ct
  102.14  
  102.15        val vs = map Thm.term_of cvs
  102.16 -      val thy = ProofContext.theory_of ctxt
  102.17 +      val thy = Proof_Context.theory_of ctxt
  102.18  
  102.19        fun get_mpats ct =
  102.20          if is_simp_lhs ctxt (Thm.term_of ct) then minimal_pats vs ct
   103.1 --- a/src/HOL/Tools/SMT/smt_utils.ML	Sat Apr 16 15:47:52 2011 +0200
   103.2 +++ b/src/HOL/Tools/SMT/smt_utils.ML	Sat Apr 16 16:15:37 2011 +0200
   103.3 @@ -162,7 +162,7 @@
   103.4  
   103.5  (* certified terms *)
   103.6  
   103.7 -fun certify ctxt = Thm.cterm_of (ProofContext.theory_of ctxt)
   103.8 +fun certify ctxt = Thm.cterm_of (Proof_Context.theory_of ctxt)
   103.9  
  103.10  fun typ_of ct = #T (Thm.rep_cterm ct) 
  103.11  
   104.1 --- a/src/HOL/Tools/SMT/z3_interface.ML	Sat Apr 16 15:47:52 2011 +0200
   104.2 +++ b/src/HOL/Tools/SMT/z3_interface.ML	Sat Apr 16 16:15:37 2011 +0200
   104.3 @@ -102,11 +102,11 @@
   104.4    chained (fn {mk_builtin_typ=mk, ...} : mk_builtins => mk sym) bs
   104.5  
   104.6  fun chained_mk_builtin_num ctxt bs i T =
   104.7 -  let val thy = ProofContext.theory_of ctxt
   104.8 +  let val thy = Proof_Context.theory_of ctxt
   104.9    in chained (fn {mk_builtin_num=mk, ...} : mk_builtins => mk thy i T) bs end
  104.10  
  104.11  fun chained_mk_builtin_fun ctxt bs s cts =
  104.12 -  let val thy = ProofContext.theory_of ctxt
  104.13 +  let val thy = Proof_Context.theory_of ctxt
  104.14    in chained (fn {mk_builtin_fun=mk, ...} : mk_builtins => mk thy s cts) bs end
  104.15  
  104.16  fun fst_int_ord ((i1, _), (i2, _)) = int_ord (i1, i2)
   105.1 --- a/src/HOL/Tools/SMT/z3_proof_reconstruction.ML	Sat Apr 16 15:47:52 2011 +0200
   105.2 +++ b/src/HOL/Tools/SMT/z3_proof_reconstruction.ML	Sat Apr 16 16:15:37 2011 +0200
   105.3 @@ -833,7 +833,7 @@
   105.4  
   105.5    fun discharge rules outer_ctxt (p, (inner_ctxt, _)) =
   105.6      thm_of p
   105.7 -    |> singleton (ProofContext.export inner_ctxt outer_ctxt)
   105.8 +    |> singleton (Proof_Context.export inner_ctxt outer_ctxt)
   105.9      |> discharge_assms (make_discharge_rules rules)
  105.10  in
  105.11  
   106.1 --- a/src/HOL/Tools/Sledgehammer/sledgehammer_atp_reconstruct.ML	Sat Apr 16 15:47:52 2011 +0200
   106.2 +++ b/src/HOL/Tools/Sledgehammer/sledgehammer_atp_reconstruct.ML	Sat Apr 16 16:15:37 2011 +0200
   106.3 @@ -457,7 +457,7 @@
   106.4  
   106.5  fun check_formula ctxt =
   106.6    Type.constraint HOLogic.boolT
   106.7 -  #> Syntax.check_term (ProofContext.set_mode ProofContext.mode_schematic ctxt)
   106.8 +  #> Syntax.check_term (Proof_Context.set_mode Proof_Context.mode_schematic ctxt)
   106.9  
  106.10  
  106.11  (**** Translation of TSTP files to Isar Proofs ****)
  106.12 @@ -467,7 +467,7 @@
  106.13  
  106.14  fun decode_line type_sys tfrees (Definition (name, phi1, phi2)) ctxt =
  106.15      let
  106.16 -      val thy = ProofContext.theory_of ctxt
  106.17 +      val thy = Proof_Context.theory_of ctxt
  106.18        val t1 = prop_from_formula thy type_sys tfrees phi1
  106.19        val vars = snd (strip_comb t1)
  106.20        val frees = map unvarify_term vars
  106.21 @@ -483,7 +483,7 @@
  106.22      end
  106.23    | decode_line type_sys tfrees (Inference (name, u, deps)) ctxt =
  106.24      let
  106.25 -      val thy = ProofContext.theory_of ctxt
  106.26 +      val thy = Proof_Context.theory_of ctxt
  106.27        val t = u |> prop_from_formula thy type_sys tfrees
  106.28                  |> uncombine_term |> check_formula ctxt
  106.29      in
   107.1 --- a/src/HOL/Tools/Sledgehammer/sledgehammer_atp_translate.ML	Sat Apr 16 15:47:52 2011 +0200
   107.2 +++ b/src/HOL/Tools/Sledgehammer/sledgehammer_atp_translate.ML	Sat Apr 16 16:15:37 2011 +0200
   107.3 @@ -188,7 +188,7 @@
   107.4    in aux (maxidx_of_term t + 1) t end
   107.5  
   107.6  fun introduce_combinators_in_term ctxt kind t =
   107.7 -  let val thy = ProofContext.theory_of ctxt in
   107.8 +  let val thy = Proof_Context.theory_of ctxt in
   107.9      if Meson.is_fol_term thy t then
  107.10        t
  107.11      else
  107.12 @@ -241,7 +241,7 @@
  107.13  (* making fact and conjecture formulas *)
  107.14  fun make_formula ctxt eq_as_iff presimp name kind t =
  107.15    let
  107.16 -    val thy = ProofContext.theory_of ctxt
  107.17 +    val thy = Proof_Context.theory_of ctxt
  107.18      val t = t |> Envir.beta_eta_contract
  107.19                |> transform_elim_term
  107.20                |> Object_Logic.atomize_term thy
  107.21 @@ -324,7 +324,7 @@
  107.22  
  107.23  fun translate_formulas ctxt type_sys hyp_ts concl_t rich_facts =
  107.24    let
  107.25 -    val thy = ProofContext.theory_of ctxt
  107.26 +    val thy = Proof_Context.theory_of ctxt
  107.27      val fact_ts = map (prop_of o snd o snd) rich_facts
  107.28      val (facts, fact_names) =
  107.29        rich_facts
  107.30 @@ -375,7 +375,7 @@
  107.31      is_type_constr_dangerous ctxt s andalso forall (is_type_dangerous ctxt) Ts
  107.32    | is_type_dangerous _ _ = false
  107.33  and is_type_constr_dangerous ctxt s =
  107.34 -  let val thy = ProofContext.theory_of ctxt in
  107.35 +  let val thy = Proof_Context.theory_of ctxt in
  107.36      case Datatype_Data.get_info thy s of
  107.37        SOME {descr, ...} =>
  107.38        forall (fn (_, (_, _, constrs)) =>
  107.39 @@ -444,7 +444,7 @@
  107.40  
  107.41  fun fo_term_for_combterm ctxt type_sys =
  107.42    let
  107.43 -    val thy = ProofContext.theory_of ctxt
  107.44 +    val thy = Proof_Context.theory_of ctxt
  107.45      fun aux top_level u =
  107.46        let
  107.47          val (head, args) = strip_combterm_comb u
  107.48 @@ -681,7 +681,7 @@
  107.49  fun prepare_atp_problem ctxt readable_names explicit_forall type_sys
  107.50                          explicit_apply hyp_ts concl_t facts =
  107.51    let
  107.52 -    val thy = ProofContext.theory_of ctxt
  107.53 +    val thy = Proof_Context.theory_of ctxt
  107.54      val (fact_names, (conjs, facts, class_rel_clauses, arity_clauses)) =
  107.55        translate_formulas ctxt type_sys hyp_ts concl_t facts
  107.56      (* Reordering these might or might not confuse the proof reconstruction
   108.1 --- a/src/HOL/Tools/Sledgehammer/sledgehammer_filter.ML	Sat Apr 16 15:47:52 2011 +0200
   108.2 +++ b/src/HOL/Tools/Sledgehammer/sledgehammer_filter.ML	Sat Apr 16 16:15:37 2011 +0200
   108.3 @@ -199,7 +199,7 @@
   108.4  fun instantiate_if_induct_rule ctxt stmt stmt_xs (ax as (_, (_, th))) =
   108.5    case struct_induct_rule_on th of
   108.6      SOME (p_name, ind_T) =>
   108.7 -    let val thy = ProofContext.theory_of ctxt in
   108.8 +    let val thy = Proof_Context.theory_of ctxt in
   108.9        stmt_xs |> filter (fn (_, T) => type_match thy (T, ind_T))
  108.10                |> map_filter (try (instantiate_induct_rule ctxt stmt p_name ax))
  108.11      end
  108.12 @@ -542,7 +542,7 @@
  108.13          (fudge as {threshold_divisor, ridiculous_threshold, ...})
  108.14          ({add, del, ...} : relevance_override) facts goal_ts =
  108.15    let
  108.16 -    val thy = ProofContext.theory_of ctxt
  108.17 +    val thy = Proof_Context.theory_of ctxt
  108.18      val const_tab = fold (count_fact_consts thy fudge) facts Symtab.empty
  108.19      val goal_const_tab =
  108.20        pconsts_in_terms thy is_built_in_const false (SOME false) goal_ts
  108.21 @@ -797,9 +797,9 @@
  108.22                ({intro_bonus, elim_bonus, simp_bonus, ...} : relevance_fudge)
  108.23                add_ths chained_ths =
  108.24    let
  108.25 -    val thy = ProofContext.theory_of ctxt
  108.26 +    val thy = Proof_Context.theory_of ctxt
  108.27      val global_facts = Global_Theory.facts_of thy
  108.28 -    val local_facts = ProofContext.facts_of ctxt
  108.29 +    val local_facts = Proof_Context.facts_of ctxt
  108.30      val named_locals = local_facts |> Facts.dest_static []
  108.31      val assms = Assumption.all_assms_of ctxt
  108.32      fun is_assum th = exists (fn ct => prop_of th aconv term_of ct) assms
  108.33 @@ -832,7 +832,7 @@
  108.34              val backquote_thm =
  108.35                backquote o string_for_term ctxt o close_form o prop_of
  108.36              fun check_thms a =
  108.37 -              case try (ProofContext.get_thms ctxt) a of
  108.38 +              case try (Proof_Context.get_thms ctxt) a of
  108.39                  NONE => false
  108.40                | SOME ths' => Thm.eq_thms (ths, ths')
  108.41            in
  108.42 @@ -887,7 +887,7 @@
  108.43                     max_relevant is_built_in_const fudge
  108.44                     (override as {add, only, ...}) chained_ths hyp_ts concl_t =
  108.45    let
  108.46 -    val thy = ProofContext.theory_of ctxt
  108.47 +    val thy = Proof_Context.theory_of ctxt
  108.48      val decay = Math.pow ((1.0 - threshold1) / (1.0 - threshold0),
  108.49                            1.0 / Real.fromInt (max_relevant + 1))
  108.50      val add_ths = Attrib.eval_thms ctxt add
   109.1 --- a/src/HOL/Tools/Sledgehammer/sledgehammer_isar.ML	Sat Apr 16 15:47:52 2011 +0200
   109.2 +++ b/src/HOL/Tools/Sledgehammer/sledgehammer_isar.ML	Sat Apr 16 16:15:37 2011 +0200
   109.3 @@ -177,7 +177,7 @@
   109.4  
   109.5  val set_default_raw_param = Data.map o AList.update (op =) o unalias_raw_param
   109.6  fun default_raw_params ctxt =
   109.7 -  let val thy = ProofContext.theory_of ctxt in
   109.8 +  let val thy = Proof_Context.theory_of ctxt in
   109.9      Data.get thy
  109.10      |> fold (AList.default (op =))
  109.11              [("provers", [case !provers of
  109.12 @@ -332,7 +332,7 @@
  109.13    Toplevel.theory
  109.14        (fold set_default_raw_param params
  109.15         #> tap (fn thy =>
  109.16 -                  let val ctxt = ProofContext.init_global thy in
  109.17 +                  let val ctxt = Proof_Context.init_global thy in
  109.18                      writeln ("Default parameters for Sledgehammer:\n" ^
  109.19                               (case default_raw_params ctxt |> rev of
  109.20                                  [] => "none"
   110.1 --- a/src/HOL/Tools/Sledgehammer/sledgehammer_provers.ML	Sat Apr 16 15:47:52 2011 +0200
   110.2 +++ b/src/HOL/Tools/Sledgehammer/sledgehammer_provers.ML	Sat Apr 16 16:15:37 2011 +0200
   110.3 @@ -123,15 +123,15 @@
   110.4    member (op =) (SMT_Solver.available_solvers_of ctxt) name
   110.5  
   110.6  fun is_prover_supported ctxt name =
   110.7 -  let val thy = ProofContext.theory_of ctxt in
   110.8 +  let val thy = Proof_Context.theory_of ctxt in
   110.9      is_smt_prover ctxt name orelse member (op =) (supported_atps thy) name
  110.10    end
  110.11  
  110.12  fun is_prover_installed ctxt =
  110.13 -  is_smt_prover ctxt orf is_atp_installed (ProofContext.theory_of ctxt)
  110.14 +  is_smt_prover ctxt orf is_atp_installed (Proof_Context.theory_of ctxt)
  110.15  
  110.16  fun default_max_relevant_for_prover ctxt name =
  110.17 -  let val thy = ProofContext.theory_of ctxt in
  110.18 +  let val thy = Proof_Context.theory_of ctxt in
  110.19      if is_smt_prover ctxt name then
  110.20        SMT_Solver.default_max_relevant ctxt name
  110.21      else
  110.22 @@ -208,7 +208,7 @@
  110.23  
  110.24  fun supported_provers ctxt =
  110.25    let
  110.26 -    val thy = ProofContext.theory_of ctxt
  110.27 +    val thy = Proof_Context.theory_of ctxt
  110.28      val (remote_provers, local_provers) =
  110.29        sort_strings (supported_atps thy) @
  110.30        sort_strings (SMT_Solver.available_solvers_of ctxt)
  110.31 @@ -695,7 +695,7 @@
  110.32    end
  110.33  
  110.34  fun get_prover ctxt auto name =
  110.35 -  let val thy = ProofContext.theory_of ctxt in
  110.36 +  let val thy = Proof_Context.theory_of ctxt in
  110.37      if is_smt_prover ctxt name then
  110.38        run_smt_solver auto name
  110.39      else if member (op =) (supported_atps thy) name then
   111.1 --- a/src/HOL/Tools/Sledgehammer/sledgehammer_run.ML	Sat Apr 16 15:47:52 2011 +0200
   111.2 +++ b/src/HOL/Tools/Sledgehammer/sledgehammer_run.ML	Sat Apr 16 16:15:37 2011 +0200
   111.3 @@ -180,7 +180,7 @@
   111.4        val state =
   111.5          state |> Proof.map_context (Config.put SMT_Config.verbose debug)
   111.6        val ctxt = Proof.context_of state
   111.7 -      val thy = ProofContext.theory_of ctxt
   111.8 +      val thy = Proof_Context.theory_of ctxt
   111.9        val {facts = chained_ths, goal, ...} = Proof.goal state
  111.10        val (_, hyp_ts, concl_t) = strip_subgoal goal i
  111.11        val no_dangerous_types = types_dangerous_types type_sys
   112.1 --- a/src/HOL/Tools/TFL/post.ML	Sat Apr 16 15:47:52 2011 +0200
   112.2 +++ b/src/HOL/Tools/TFL/post.ML	Sat Apr 16 16:15:37 2011 +0200
   112.3 @@ -136,7 +136,7 @@
   112.4  
   112.5  fun simplify_defn strict thy cs ss congs wfs id pats def0 =
   112.6     let
   112.7 -       val ctxt = ProofContext.init_global thy
   112.8 +       val ctxt = Proof_Context.init_global thy
   112.9         val def = Thm.unvarify_global def0 RS meta_eq_to_obj_eq
  112.10         val {rules,rows,TCs,full_pats_TCs} =
  112.11             Prim.post_definition congs (thy, (def,pats))
   113.1 --- a/src/HOL/Tools/TFL/rules.ML	Sat Apr 16 15:47:52 2011 +0200
   113.2 +++ b/src/HOL/Tools/TFL/rules.ML	Sat Apr 16 16:15:37 2011 +0200
   113.3 @@ -795,7 +795,7 @@
   113.4    let
   113.5      val thy = Thm.theory_of_cterm ptm;
   113.6      val t = Thm.term_of ptm;
   113.7 -    val ctxt = ProofContext.init_global thy |> Variable.auto_fixes t;
   113.8 +    val ctxt = Proof_Context.init_global thy |> Variable.auto_fixes t;
   113.9    in
  113.10      if strict then Goal.prove ctxt [] [] t (K tac)
  113.11      else Goal.prove ctxt [] [] t (K tac)
   114.1 --- a/src/HOL/Tools/TFL/tfl.ML	Sat Apr 16 15:47:52 2011 +0200
   114.2 +++ b/src/HOL/Tools/TFL/tfl.ML	Sat Apr 16 16:15:37 2011 +0200
   114.3 @@ -357,7 +357,7 @@
   114.4  
   114.5  (*For Isabelle, the lhs of a definition must be a constant.*)
   114.6  fun const_def sign (c, Ty, rhs) =
   114.7 -  singleton (Syntax.check_terms (ProofContext.init_global sign))
   114.8 +  singleton (Syntax.check_terms (Proof_Context.init_global sign))
   114.9      (Const("==",dummyT) $ Const(c,Ty) $ rhs);
  114.10  
  114.11  (*Make all TVars available for instantiation by adding a ? to the front*)
   115.1 --- a/src/HOL/Tools/arith_data.ML	Sat Apr 16 15:47:52 2011 +0200
   115.2 +++ b/src/HOL/Tools/arith_data.ML	Sat Apr 16 16:15:37 2011 +0200
   115.3 @@ -53,7 +53,7 @@
   115.4  
   115.5  fun gen_arith_tac verbose ctxt =
   115.6    let
   115.7 -    val tactics = Arith_Tactics.get (ProofContext.theory_of ctxt);
   115.8 +    val tactics = Arith_Tactics.get (Proof_Context.theory_of ctxt);
   115.9      fun invoke (_, (name, tac)) k st = tac verbose ctxt k st;
  115.10    in FIRST' (map invoke (rev tactics)) end;
  115.11  
   116.1 --- a/src/HOL/Tools/choice_specification.ML	Sat Apr 16 15:47:52 2011 +0200
   116.2 +++ b/src/HOL/Tools/choice_specification.ML	Sat Apr 16 16:15:37 2011 +0200
   116.3 @@ -220,11 +220,11 @@
   116.4                      |> process_all (zip3 alt_names rew_imps frees)
   116.5              end
   116.6  
   116.7 -      fun after_qed [[thm]] = ProofContext.background_theory (fn thy =>
   116.8 +      fun after_qed [[thm]] = Proof_Context.background_theory (fn thy =>
   116.9          #1 (post_process (add_specification axiomatic (zip3 names cnames overloaded) (thy, thm))));
  116.10      in
  116.11        thy
  116.12 -      |> ProofContext.init_global
  116.13 +      |> Proof_Context.init_global
  116.14        |> Variable.declare_term ex_prop
  116.15        |> Proof.theorem NONE after_qed [[(HOLogic.mk_Trueprop ex_prop, [])]]
  116.16      end;
   117.1 --- a/src/HOL/Tools/cnf_funcs.ML	Sat Apr 16 15:47:52 2011 +0200
   117.2 +++ b/src/HOL/Tools/cnf_funcs.ML	Sat Apr 16 16:15:37 2011 +0200
   117.3 @@ -258,7 +258,7 @@
   117.4  
   117.5  fun make_under_quantifiers ctxt make t =
   117.6    let
   117.7 -    val thy = ProofContext.theory_of ctxt
   117.8 +    val thy = Proof_Context.theory_of ctxt
   117.9      fun conv ctxt ct =
  117.10        case term_of ct of
  117.11          (t1 as Const _) $ (t2 as Abs _) =>
  117.12 @@ -269,7 +269,7 @@
  117.13    in conv ctxt (cterm_of thy t) RS meta_eq_to_obj_eq end
  117.14  
  117.15  fun make_nnf_thm_under_quantifiers ctxt =
  117.16 -  make_under_quantifiers ctxt (make_nnf_thm (ProofContext.theory_of ctxt))
  117.17 +  make_under_quantifiers ctxt (make_nnf_thm (Proof_Context.theory_of ctxt))
  117.18  
  117.19  (* ------------------------------------------------------------------------- *)
  117.20  (* simp_True_False_thm: produces a theorem t = t', where t' is equivalent to *)
  117.21 @@ -344,7 +344,7 @@
  117.22  
  117.23  fun make_cnf_thm ctxt t =
  117.24    let
  117.25 -    val thy = ProofContext.theory_of ctxt
  117.26 +    val thy = Proof_Context.theory_of ctxt
  117.27      fun make_cnf_thm_from_nnf (Const (@{const_name HOL.conj}, _) $ x $ y) =
  117.28            let
  117.29              val thm1 = make_cnf_thm_from_nnf x
  117.30 @@ -414,7 +414,7 @@
  117.31  
  117.32  fun make_cnfx_thm ctxt t =
  117.33    let
  117.34 -    val thy = ProofContext.theory_of ctxt
  117.35 +    val thy = Proof_Context.theory_of ctxt
  117.36      val var_id = Unsynchronized.ref 0  (* properly initialized below *)
  117.37      fun new_free () =
  117.38        Free ("cnfx_" ^ string_of_int (Unsynchronized.inc var_id), HOLogic.boolT)
   118.1 --- a/src/HOL/Tools/code_evaluation.ML	Sat Apr 16 15:47:52 2011 +0200
   118.2 +++ b/src/HOL/Tools/code_evaluation.ML	Sat Apr 16 16:15:37 2011 +0200
   118.3 @@ -223,6 +223,6 @@
   118.4    #> Code.datatype_interpretation ensure_term_of_code
   118.5    #> Code.abstype_interpretation ensure_abs_term_of_code
   118.6    #> Context.theory_map (Syntax.add_term_check 0 "termify" check_termify)
   118.7 -  #> Value.add_evaluator ("code", dynamic_value_strict o ProofContext.theory_of);
   118.8 +  #> Value.add_evaluator ("code", dynamic_value_strict o Proof_Context.theory_of);
   118.9  
  118.10  end;
   119.1 --- a/src/HOL/Tools/enriched_type.ML	Sat Apr 16 15:47:52 2011 +0200
   119.2 +++ b/src/HOL/Tools/enriched_type.ML	Sat Apr 16 16:15:37 2011 +0200
   119.3 @@ -41,7 +41,7 @@
   119.4  (* type analysis *)
   119.5  
   119.6  fun term_with_typ ctxt T t = Envir.subst_term_types
   119.7 -  (Type.typ_match (ProofContext.tsig_of ctxt) (fastype_of t, T) Vartab.empty) t;
   119.8 +  (Type.typ_match (Proof_Context.tsig_of ctxt) (fastype_of t, T) Vartab.empty) t;
   119.9  
  119.10  fun find_atomic ctxt T =
  119.11    let
  119.12 @@ -186,7 +186,7 @@
  119.13        let
  119.14          val coT = TFree var1 --> TFree var2;
  119.15          val contraT = TFree var2 --> TFree var1;
  119.16 -        val sort = Sign.inter_sort (ProofContext.theory_of ctxt) (sort1, sort2);
  119.17 +        val sort = Sign.inter_sort (Proof_Context.theory_of ctxt) (sort1, sort2);
  119.18        in
  119.19          consume (op =) coT
  119.20          ##>> consume (op =) contraT
  119.21 @@ -218,7 +218,7 @@
  119.22      val qualify = Binding.qualify true prfx o Binding.name;
  119.23      fun mapper_declaration comp_thm id_thm phi context =
  119.24        let
  119.25 -        val typ_instance = Type.typ_instance (ProofContext.tsig_of (Context.proof_of context));
  119.26 +        val typ_instance = Type.typ_instance (Proof_Context.tsig_of (Context.proof_of context));
  119.27          val mapper' = Morphism.term phi mapper;
  119.28          val T_T' = pairself fastype_of (mapper, mapper');
  119.29        in if typ_instance T_T' andalso typ_instance (swap T_T')
   120.1 --- a/src/HOL/Tools/inductive.ML	Sat Apr 16 15:47:52 2011 +0200
   120.2 +++ b/src/HOL/Tools/inductive.ML	Sat Apr 16 16:15:37 2011 +0200
   120.3 @@ -149,7 +149,7 @@
   120.4  fun print_inductives ctxt =
   120.5    let
   120.6      val (tab, monos) = get_inductives ctxt;
   120.7 -    val space = Consts.space_of (ProofContext.consts_of ctxt);
   120.8 +    val space = Consts.space_of (Proof_Context.consts_of ctxt);
   120.9    in
  120.10      [Pretty.strs ("(co)inductives:" :: map #1 (Name_Space.extern_table ctxt (space, tab))),
  120.11       Pretty.big_list "monotonicity rules:" (map (Display.pretty_thm ctxt) monos)]
  120.12 @@ -294,7 +294,7 @@
  120.13      val concl = subst_bounds (frees, Logic.strip_assums_concl rule);
  120.14      val prems = map (curry subst_bounds frees) (Logic.strip_assums_hyp rule);
  120.15      val rule' = Logic.list_implies (prems, concl);
  120.16 -    val aprems = map (atomize_term (ProofContext.theory_of ctxt)) prems;
  120.17 +    val aprems = map (atomize_term (Proof_Context.theory_of ctxt)) prems;
  120.18      val arule = list_all_free (params', Logic.list_implies (aprems, concl));
  120.19  
  120.20      fun check_ind err t = case dest_predicate cs params t of
  120.21 @@ -375,7 +375,7 @@
  120.22          (*Not ares_tac, since refl must be tried before any equality assumptions;
  120.23            backtracking may occur if the premises have extra variables!*)
  120.24          DEPTH_SOLVE_1 (resolve_tac rules 1 APPEND assume_tac 1)])
  120.25 -       |> singleton (ProofContext.export ctxt ctxt')) intr_ts
  120.26 +       |> singleton (Proof_Context.export ctxt ctxt')) intr_ts
  120.27  
  120.28    in (intrs, unfold) end;
  120.29  
  120.30 @@ -421,7 +421,7 @@
  120.31               REPEAT (FIRSTGOAL (eresolve_tac rules2)),
  120.32               EVERY (map (fn prem =>
  120.33                 DEPTH_SOLVE_1 (ares_tac [rewrite_rule rec_preds_defs prem, conjI] 1)) (tl prems))])
  120.34 -          |> singleton (ProofContext.export ctxt'' ctxt'''),
  120.35 +          |> singleton (Proof_Context.export ctxt'' ctxt'''),
  120.36           map #2 c_intrs, length Ts)
  120.37        end
  120.38  
  120.39 @@ -487,7 +487,7 @@
  120.40                THEN prove_intr2 last_c_intr
  120.41              end))
  120.42          |> rulify
  120.43 -        |> singleton (ProofContext.export ctxt' ctxt'')
  120.44 +        |> singleton (Proof_Context.export ctxt' ctxt'')
  120.45        end;  
  120.46    in
  120.47      map2 prove_eq cs elims
  120.48 @@ -510,7 +510,7 @@
  120.49  
  120.50  fun mk_cases ctxt prop =
  120.51    let
  120.52 -    val thy = ProofContext.theory_of ctxt;
  120.53 +    val thy = Proof_Context.theory_of ctxt;
  120.54      val ss = simpset_of ctxt;
  120.55  
  120.56      fun err msg =
  120.57 @@ -536,7 +536,7 @@
  120.58  
  120.59  fun gen_inductive_cases prep_att prep_prop args lthy =
  120.60    let
  120.61 -    val thy = ProofContext.theory_of lthy;
  120.62 +    val thy = Proof_Context.theory_of lthy;
  120.63      val facts = args |> Par_List.map (fn ((a, atts), props) =>
  120.64        ((a, map (prep_att thy) atts),
  120.65          Par_List.map (Thm.no_attributes o single o mk_cases lthy o prep_prop lthy) props));
  120.66 @@ -555,7 +555,7 @@
  120.67            val (_, ctxt') = Variable.add_fixes fixes ctxt;
  120.68            val props = Syntax.read_props ctxt' raw_props;
  120.69            val ctxt'' = fold Variable.declare_term props ctxt';
  120.70 -          val rules = ProofContext.export ctxt'' ctxt (map (mk_cases ctxt'') props)
  120.71 +          val rules = Proof_Context.export ctxt'' ctxt (map (mk_cases ctxt'') props)
  120.72          in Method.erule 0 rules end))
  120.73      "dynamic case analysis on predicates";
  120.74  
  120.75 @@ -563,7 +563,7 @@
  120.76  
  120.77  fun mk_simp_eq ctxt prop =
  120.78    let
  120.79 -    val thy = ProofContext.theory_of ctxt
  120.80 +    val thy = Proof_Context.theory_of ctxt
  120.81      val ctxt' = Variable.auto_fixes prop ctxt
  120.82      val lhs_of = fst o HOLogic.dest_eq o HOLogic.dest_Trueprop o Thm.prop_of
  120.83      val substs = Item_Net.retrieve (Equation_Data.get (Context.Proof ctxt)) (HOLogic.dest_Trueprop prop) 
  120.84 @@ -588,7 +588,7 @@
  120.85  
  120.86  fun gen_inductive_simps prep_att prep_prop args lthy =
  120.87    let
  120.88 -    val thy = ProofContext.theory_of lthy;
  120.89 +    val thy = Proof_Context.theory_of lthy;
  120.90      val facts = args |> map (fn ((a, atts), props) =>
  120.91        ((a, map (prep_att thy) atts),
  120.92          map (Thm.no_attributes o single o mk_simp_eq lthy o prep_prop lthy) props));
  120.93 @@ -603,7 +603,7 @@
  120.94      fp_def rec_preds_defs ctxt ctxt''' =
  120.95    let
  120.96      val _ = clean_message quiet_mode "  Proving the induction rule ...";
  120.97 -    val thy = ProofContext.theory_of ctxt;
  120.98 +    val thy = Proof_Context.theory_of ctxt;
  120.99  
 120.100      (* predicates for induction rule *)
 120.101  
 120.102 @@ -702,7 +702,7 @@
 120.103              rewrite_goals_tac simp_thms',
 120.104              atac 1])])
 120.105  
 120.106 -  in singleton (ProofContext.export ctxt'' ctxt''') (induct RS lemma) end;
 120.107 +  in singleton (Proof_Context.export ctxt'' ctxt''') (induct RS lemma) end;
 120.108  
 120.109  
 120.110  
 120.111 @@ -779,7 +779,7 @@
 120.112             (Const (fp_name, (predT --> predT) --> predT) $ fp_fun)))
 120.113        ||> Local_Theory.restore_naming lthy;
 120.114      val fp_def' = Simplifier.rewrite (HOL_basic_ss addsimps [fp_def])
 120.115 -      (cterm_of (ProofContext.theory_of lthy') (list_comb (rec_const, params)));
 120.116 +      (cterm_of (Proof_Context.theory_of lthy') (list_comb (rec_const, params)));
 120.117      val specs =
 120.118        if length cs < 2 then []
 120.119        else
 120.120 @@ -801,7 +801,7 @@
 120.121      val mono = prove_mono quiet_mode skip_mono fork_mono predT fp_fun monos lthy''';
 120.122      val (_, lthy'''') =
 120.123        Local_Theory.note (apfst Binding.conceal Attrib.empty_binding,
 120.124 -        ProofContext.export lthy''' lthy'' [mono]) lthy'';
 120.125 +        Proof_Context.export lthy''' lthy'' [mono]) lthy'';
 120.126  
 120.127    in (lthy'''', lthy''', rec_name, mono, fp_def', map (#2 o #2) consts_defs,
 120.128      list_comb (rec_const, params), preds, argTs, bs, xs)
 120.129 @@ -903,7 +903,7 @@
 120.130      val raw_induct = zero_var_indexes
 120.131        (if no_ind then Drule.asm_rl
 120.132         else if coind then
 120.133 -         singleton (ProofContext.export lthy2 lthy1)
 120.134 +         singleton (Proof_Context.export lthy2 lthy1)
 120.135             (rotate_prems ~1 (Object_Logic.rulify
 120.136               (fold_rule rec_preds_defs
 120.137                 (rewrite_rule simp_thms'''
 120.138 @@ -942,7 +942,7 @@
 120.139      (flags as {quiet_mode, verbose, alt_name, coind, no_elim, no_ind, skip_mono, fork_mono})
 120.140      cnames_syn pnames spec monos lthy =
 120.141    let
 120.142 -    val thy = ProofContext.theory_of lthy;
 120.143 +    val thy = Proof_Context.theory_of lthy;
 120.144      val _ = Theory.requires thy "Inductive" (coind_prefix coind ^ "inductive definitions");
 120.145  
 120.146  
 120.147 @@ -979,7 +979,7 @@
 120.148      val (_, ctxt2) = lthy |> Variable.add_fixes (map (Binding.name_of o fst o fst) cnames_syn');
 120.149      val _ = map (fn abbr => Local_Defs.fixed_abbrev abbr ctxt2) abbrevs;
 120.150      val ctxt3 = ctxt2 |> fold (snd oo Local_Defs.fixed_abbrev) abbrevs;
 120.151 -    val expand = Assumption.export_term ctxt3 lthy #> ProofContext.cert_term lthy;
 120.152 +    val expand = Assumption.export_term ctxt3 lthy #> Proof_Context.cert_term lthy;
 120.153  
 120.154      fun close_rule r = list_all_free (rev (fold_aterms
 120.155        (fn t as Free (v as (s, _)) =>
 120.156 @@ -998,7 +998,7 @@
 120.157  fun gen_add_inductive mk_def verbose coind cnames_syn pnames_syn intro_srcs raw_monos int lthy =
 120.158    let
 120.159      val ((vars, intrs), _) = lthy
 120.160 -      |> ProofContext.set_mode ProofContext.mode_abbrev
 120.161 +      |> Proof_Context.set_mode Proof_Context.mode_abbrev
 120.162        |> Specification.read_spec (cnames_syn @ pnames_syn) intro_srcs;
 120.163      val (cs, ps) = chop (length cnames_syn) vars;
 120.164      val monos = Attrib.eval_thms lthy raw_monos;
 120.165 @@ -1020,7 +1020,7 @@
 120.166        |> add_inductive_i flags cnames_syn pnames pre_intros monos |> snd
 120.167        |> Local_Theory.exit;
 120.168      val info = #2 (the_inductive ctxt' name);
 120.169 -  in (info, ProofContext.theory_of ctxt') end;
 120.170 +  in (info, Proof_Context.theory_of ctxt') end;
 120.171  
 120.172  
 120.173  (* read off arities of inductive predicates from raw induction rule *)
   121.1 --- a/src/HOL/Tools/inductive_codegen.ML	Sat Apr 16 15:47:52 2011 +0200
   121.2 +++ b/src/HOL/Tools/inductive_codegen.ML	Sat Apr 16 16:15:37 2011 +0200
   121.3 @@ -68,7 +68,7 @@
   121.4              | NONE =>
   121.5                  (case rules of
   121.6                    [] =>
   121.7 -                    (case try (Inductive.the_inductive (ProofContext.init_global thy)) s of
   121.8 +                    (case try (Inductive.the_inductive (Proof_Context.init_global thy)) s of
   121.9                        SOME (_, {raw_induct, ...}) =>
  121.10                          length (Inductive.params_of raw_induct)
  121.11                      | NONE => 0)
  121.12 @@ -86,7 +86,7 @@
  121.13  fun get_clauses thy s =
  121.14    let val {intros, graph, ...} = CodegenData.get thy
  121.15    in case Symtab.lookup intros s of
  121.16 -      NONE => (case try (Inductive.the_inductive (ProofContext.init_global thy)) s of
  121.17 +      NONE => (case try (Inductive.the_inductive (Proof_Context.init_global thy)) s of
  121.18          NONE => NONE
  121.19        | SOME ({names, ...}, {intrs, raw_induct, ...}) =>
  121.20            SOME (names, Codegen.thyname_of_const thy s,
  121.21 @@ -811,7 +811,7 @@
  121.22  fun test_term ctxt [(t, [])] =
  121.23    let
  121.24      val t' = list_abs_free (Term.add_frees t [], t)
  121.25 -    val thy = ProofContext.theory_of ctxt;
  121.26 +    val thy = Proof_Context.theory_of ctxt;
  121.27      val (xs, p) = strip_abs t';
  121.28      val args' = map_index (fn (i, (_, T)) => ("arg" ^ string_of_int i, T)) xs;
  121.29      val args = map Free args';
   122.1 --- a/src/HOL/Tools/inductive_realizer.ML	Sat Apr 16 15:47:52 2011 +0200
   122.2 +++ b/src/HOL/Tools/inductive_realizer.ML	Sat Apr 16 16:15:37 2011 +0200
   122.3 @@ -136,7 +136,7 @@
   122.4  
   122.5  fun fun_of_prem thy rsets vs params rule ivs intr =
   122.6    let
   122.7 -    val ctxt = ProofContext.init_global thy
   122.8 +    val ctxt = Proof_Context.init_global thy
   122.9      val args = map (Free o apfst fst o dest_Var) ivs;
  122.10      val args' = map (Free o apfst fst)
  122.11        (subtract (op =) params (Term.add_vars (prop_of intr) []));
  122.12 @@ -483,7 +483,7 @@
  122.13  fun add_ind_realizers name rsets thy =
  122.14    let
  122.15      val (_, {intrs, induct, raw_induct, elims, ...}) =
  122.16 -      Inductive.the_inductive (ProofContext.init_global thy) name;
  122.17 +      Inductive.the_inductive (Proof_Context.init_global thy) name;
  122.18      val vss = sort (int_ord o pairself length)
  122.19        (subsets (map fst (relevant_vars (concl_of (hd intrs)))))
  122.20    in
   123.1 --- a/src/HOL/Tools/inductive_set.ML	Sat Apr 16 15:47:52 2011 +0200
   123.2 +++ b/src/HOL/Tools/inductive_set.ML	Sat Apr 16 16:15:37 2011 +0200
   123.3 @@ -410,7 +410,7 @@
   123.4      {quiet_mode, verbose, alt_name, coind, no_elim, no_ind, skip_mono, fork_mono}
   123.5      cs intros monos params cnames_syn lthy =
   123.6    let
   123.7 -    val thy = ProofContext.theory_of lthy;
   123.8 +    val thy = Proof_Context.theory_of lthy;
   123.9      val {set_arities, pred_arities, to_pred_simps, ...} =
  123.10        PredSetConvData.get (Context.Proof lthy);
  123.11      fun infer (Abs (_, _, t)) = infer t
   124.1 --- a/src/HOL/Tools/lin_arith.ML	Sat Apr 16 15:47:52 2011 +0200
   124.2 +++ b/src/HOL/Tools/lin_arith.ML	Sat Apr 16 16:15:37 2011 +0200
   124.3 @@ -267,7 +267,7 @@
   124.4  
   124.5  fun decomp ctxt : term -> decomp option =
   124.6    let
   124.7 -    val thy = ProofContext.theory_of ctxt
   124.8 +    val thy = Proof_Context.theory_of ctxt
   124.9      val {discrete, inj_consts, ...} = get_arith_data ctxt
  124.10    in decomp_negation (thy, discrete, inj_consts) end;
  124.11  
  124.12 @@ -336,7 +336,7 @@
  124.13  fun split_once_items ctxt (Ts : typ list, terms : term list) :
  124.14                       (typ list * term list) list option =
  124.15  let
  124.16 -  val thy = ProofContext.theory_of ctxt
  124.17 +  val thy = Proof_Context.theory_of ctxt
  124.18    (* takes a list  [t1, ..., tn]  to the term                                *)
  124.19    (*   tn' --> ... --> t1' --> False  ,                                      *)
  124.20    (* where ti' = HOLogic.dest_Trueprop ti                                    *)
  124.21 @@ -709,7 +709,7 @@
  124.22  fun split_once_tac ss split_thms =
  124.23    let
  124.24      val ctxt = Simplifier.the_context ss
  124.25 -    val thy = ProofContext.theory_of ctxt
  124.26 +    val thy = Proof_Context.theory_of ctxt
  124.27      val cond_split_tac = SUBGOAL (fn (subgoal, i) =>
  124.28        let
  124.29          val Ts = rev (map snd (Logic.strip_params subgoal))
   125.1 --- a/src/HOL/Tools/list_to_set_comprehension.ML	Sat Apr 16 15:47:52 2011 +0200
   125.2 +++ b/src/HOL/Tools/list_to_set_comprehension.ML	Sat Apr 16 16:15:37 2011 +0200
   125.3 @@ -65,7 +65,7 @@
   125.4  fun simproc ss redex =
   125.5    let
   125.6      val ctxt = Simplifier.the_context ss
   125.7 -    val thy = ProofContext.theory_of ctxt
   125.8 +    val thy = Proof_Context.theory_of ctxt
   125.9      val set_Nil_I = @{thm trans} OF [@{thm set.simps(1)}, @{thm empty_def}]
  125.10      val set_singleton = @{lemma "set [a] = {x. x = a}" by simp}
  125.11      val inst_Collect_mem_eq = @{lemma "set A = {x. x : set A}" by simp}
   126.1 --- a/src/HOL/Tools/primrec.ML	Sat Apr 16 15:47:52 2011 +0200
   126.2 +++ b/src/HOL/Tools/primrec.ML	Sat Apr 16 16:15:37 2011 +0200
   126.3 @@ -225,7 +225,7 @@
   126.4      val eqns = fold_rev (process_eqn (fn v => Variable.is_fixed lthy v
   126.5        orelse exists (fn ((w, _), _) => v = Binding.name_of w) fixes)) eqs [];
   126.6      val tnames = distinct (op =) (map (#1 o snd) eqns);
   126.7 -    val dts = find_dts (Datatype_Data.get_all (ProofContext.theory_of lthy)) tnames tnames;
   126.8 +    val dts = find_dts (Datatype_Data.get_all (Proof_Context.theory_of lthy)) tnames tnames;
   126.9      val main_fns = map (fn (tname, {index, ...}) =>
  126.10        (index, (fst o the o find_first (fn (_, x) => #1 x = tname)) eqns)) dts;
  126.11      val {descr, rec_names, rec_rewrites, ...} =
  126.12 @@ -300,14 +300,14 @@
  126.13    let
  126.14      val lthy = Named_Target.theory_init thy;
  126.15      val ((ts, simps), lthy') = add_primrec fixes specs lthy;
  126.16 -    val simps' = ProofContext.export lthy' lthy simps;
  126.17 +    val simps' = Proof_Context.export lthy' lthy simps;
  126.18    in ((ts, simps'), Local_Theory.exit_global lthy') end;
  126.19  
  126.20  fun add_primrec_overloaded ops fixes specs thy =
  126.21    let
  126.22      val lthy = Overloading.overloading ops thy;
  126.23      val ((ts, simps), lthy') = add_primrec fixes specs lthy;
  126.24 -    val simps' = ProofContext.export lthy' lthy simps;
  126.25 +    val simps' = Proof_Context.export lthy' lthy simps;
  126.26    in ((ts, simps'), Local_Theory.exit_global lthy') end;
  126.27  
  126.28  
   127.1 --- a/src/HOL/Tools/recdef.ML	Sat Apr 16 15:47:52 2011 +0200
   127.2 +++ b/src/HOL/Tools/recdef.ML	Sat Apr 16 16:15:37 2011 +0200
   127.3 @@ -160,7 +160,7 @@
   127.4  
   127.5  fun prepare_hints thy opt_src =
   127.6    let
   127.7 -    val ctxt0 = ProofContext.init_global thy;
   127.8 +    val ctxt0 = Proof_Context.init_global thy;
   127.9      val ctxt =
  127.10        (case opt_src of
  127.11          NONE => ctxt0
  127.12 @@ -172,7 +172,7 @@
  127.13  
  127.14  fun prepare_hints_i thy () =
  127.15    let
  127.16 -    val ctxt0 = ProofContext.init_global thy;
  127.17 +    val ctxt0 = Proof_Context.init_global thy;
  127.18      val {simps, congs, wfs} = get_global_hints thy;
  127.19    in (claset_of ctxt0, simpset_of ctxt0 addsimps simps, rev (map snd congs), wfs) end;
  127.20  
  127.21 @@ -234,7 +234,7 @@
  127.22      val _ = requires_recdef thy;
  127.23      val _ = writeln ("Deferred recursive function " ^ quote name ^ " ...");
  127.24  
  127.25 -    val congs = eval_thms (ProofContext.init_global thy) raw_congs;
  127.26 +    val congs = eval_thms (Proof_Context.init_global thy) raw_congs;
  127.27      val (thy2, induct_rules) = tfl_fn thy congs name eqs;
  127.28      val ([induct_rules'], thy3) =
  127.29        thy2
  127.30 @@ -252,7 +252,7 @@
  127.31  
  127.32  fun gen_recdef_tc prep_att prep_name (bname, raw_atts) raw_name opt_i int lthy =
  127.33    let
  127.34 -    val thy = ProofContext.theory_of lthy;
  127.35 +    val thy = Proof_Context.theory_of lthy;
  127.36      val name = prep_name thy raw_name;
  127.37      val atts = map (prep_att thy) raw_atts;
  127.38      val tcs =
   128.1 --- a/src/HOL/Tools/record.ML	Sat Apr 16 15:47:52 2011 +0200
   128.2 +++ b/src/HOL/Tools/record.ML	Sat Apr 16 16:15:37 2011 +0200
   128.3 @@ -109,8 +109,8 @@
   128.4  
   128.5  fun do_typedef raw_tyco repT raw_vs thy =
   128.6    let
   128.7 -    val ctxt = ProofContext.init_global thy |> Variable.declare_typ repT;
   128.8 -    val vs = map (ProofContext.check_tfree ctxt) raw_vs;
   128.9 +    val ctxt = Proof_Context.init_global thy |> Variable.declare_typ repT;
  128.10 +    val vs = map (Proof_Context.check_tfree ctxt) raw_vs;
  128.11      val tac = Tactic.rtac UNIV_witness 1;
  128.12    in
  128.13      thy
  128.14 @@ -680,7 +680,7 @@
  128.15  
  128.16  fun record_field_types_tr more ctxt t =
  128.17    let
  128.18 -    val thy = ProofContext.theory_of ctxt;
  128.19 +    val thy = Proof_Context.theory_of ctxt;
  128.20      fun err msg = raise TERM ("Error in record-type input: " ^ msg, [t]);
  128.21  
  128.22      fun split_args (field :: fields) ((name, arg) :: fargs) =
  128.23 @@ -693,7 +693,7 @@
  128.24        | split_args _ _ = ([], []);
  128.25  
  128.26      fun mk_ext (fargs as (name, _) :: _) =
  128.27 -          (case get_fieldext thy (ProofContext.intern_const ctxt name) of
  128.28 +          (case get_fieldext thy (Proof_Context.intern_const ctxt name) of
  128.29              SOME (ext, alphas) =>
  128.30                (case get_extfields thy ext of
  128.31                  SOME fields =>
  128.32 @@ -739,7 +739,7 @@
  128.33  
  128.34  fun record_fields_tr more ctxt t =
  128.35    let
  128.36 -    val thy = ProofContext.theory_of ctxt;
  128.37 +    val thy = Proof_Context.theory_of ctxt;
  128.38      fun err msg = raise TERM ("Error in record input: " ^ msg, [t]);
  128.39  
  128.40      fun split_args (field :: fields) ((name, arg) :: fargs) =
  128.41 @@ -753,7 +753,7 @@
  128.42        | split_args _ _ = ([], []);
  128.43  
  128.44      fun mk_ext (fargs as (name, _) :: _) =
  128.45 -          (case get_fieldext thy (ProofContext.intern_const ctxt name) of
  128.46 +          (case get_fieldext thy (Proof_Context.intern_const ctxt name) of
  128.47              SOME (ext, _) =>
  128.48                (case get_extfields thy ext of
  128.49                  SOME fields =>
  128.50 @@ -814,7 +814,7 @@
  128.51  
  128.52  fun record_type_tr' ctxt t =
  128.53    let
  128.54 -    val thy = ProofContext.theory_of ctxt;
  128.55 +    val thy = Proof_Context.theory_of ctxt;
  128.56  
  128.57      val T = decode_type thy t;
  128.58      val varifyT = varifyT (Term.maxidx_of_typ T);
  128.59 @@ -831,7 +831,7 @@
  128.60                       (let
  128.61                          val (f :: fs, _) = split_last fields;
  128.62                          val fields' =
  128.63 -                          apfst (ProofContext.extern_const ctxt) f ::
  128.64 +                          apfst (Proof_Context.extern_const ctxt) f ::
  128.65                              map (apfst Long_Name.base_name) fs;
  128.66                          val (args', more) = split_last args;
  128.67                          val alphavars = map varifyT (#1 (split_last alphas));
  128.68 @@ -861,7 +861,7 @@
  128.69    the (nested) extension types*)
  128.70  fun record_type_abbr_tr' abbr alphas zeta last_ext schemeT ctxt tm =
  128.71    let
  128.72 -    val thy = ProofContext.theory_of ctxt;
  128.73 +    val thy = Proof_Context.theory_of ctxt;
  128.74      val T = decode_type thy tm;
  128.75      val midx = maxidx_of_typ T;
  128.76      val varifyT = varifyT midx;
  128.77 @@ -914,7 +914,7 @@
  128.78  
  128.79  fun record_tr' ctxt t =
  128.80    let
  128.81 -    val thy = ProofContext.theory_of ctxt;
  128.82 +    val thy = Proof_Context.theory_of ctxt;
  128.83  
  128.84      fun strip_fields t =
  128.85        (case strip_comb t of
  128.86 @@ -925,7 +925,7 @@
  128.87                  SOME fields =>
  128.88                   (let
  128.89                      val (f :: fs, _) = split_last (map fst fields);
  128.90 -                    val fields' = ProofContext.extern_const ctxt f :: map Long_Name.base_name fs;
  128.91 +                    val fields' = Proof_Context.extern_const ctxt f :: map Long_Name.base_name fs;
  128.92                      val (args', more) = split_last args;
  128.93                    in (fields' ~~ args') @ strip_fields more end
  128.94                    handle ListPair.UnequalLengths => [("", t)])
  128.95 @@ -957,7 +957,7 @@
  128.96  
  128.97  fun dest_update ctxt c =
  128.98    (case try Lexicon.unmark_const c of
  128.99 -    SOME d => try (unsuffix updateN) (ProofContext.extern_const ctxt d)
 128.100 +    SOME d => try (unsuffix updateN) (Proof_Context.extern_const ctxt d)
 128.101    | NONE => NONE);
 128.102  
 128.103  fun field_updates_tr' ctxt (tm as Const (c, _) $ k $ u) =
 128.104 @@ -997,7 +997,7 @@
 128.105    let val thm =
 128.106      if ! quick_and_dirty then Skip_Proof.make_thm thy prop
 128.107      else if Goal.future_enabled () then
 128.108 -      Goal.future_result (ProofContext.init_global thy) (Goal.fork prf) prop
 128.109 +      Goal.future_result (Proof_Context.init_global thy) (Goal.fork prf) prop
 128.110      else prf ()
 128.111    in Drule.export_without_context thm end;
 128.112  
 128.113 @@ -1007,7 +1007,7 @@
 128.114        if ! quick_and_dirty then Skip_Proof.prove
 128.115        else if immediate orelse not (Goal.future_enabled ()) then Goal.prove
 128.116        else Goal.prove_future;
 128.117 -    val prf = prv (ProofContext.init_global thy) [] asms prop tac;
 128.118 +    val prf = prv (Proof_Context.init_global thy) [] asms prop tac;
 128.119    in if stndrd then Drule.export_without_context prf else prf end;
 128.120  
 128.121  val prove_future_global = prove_common false;
 128.122 @@ -1040,7 +1040,7 @@
 128.123            else mk_comp_id acc;
 128.124          val prop = lhs === rhs;
 128.125          val othm =
 128.126 -          Goal.prove (ProofContext.init_global thy) [] [] prop
 128.127 +          Goal.prove (Proof_Context.init_global thy) [] [] prop
 128.128              (fn _ =>
 128.129                simp_tac defset 1 THEN
 128.130                REPEAT_DETERM (Iso_Tuple_Support.iso_tuple_intros_tac 1) THEN
 128.131 @@ -1064,7 +1064,7 @@
 128.132        else HOLogic.mk_comp (u' $ f', u $ f);
 128.133      val prop = lhs === rhs;
 128.134      val othm =
 128.135 -      Goal.prove (ProofContext.init_global thy) [] [] prop
 128.136 +      Goal.prove (Proof_Context.init_global thy) [] [] prop
 128.137          (fn _ =>
 128.138            simp_tac defset 1 THEN
 128.139            REPEAT_DETERM (Iso_Tuple_Support.iso_tuple_intros_tac 1) THEN
 128.140 @@ -1105,7 +1105,7 @@
 128.141      val (_, args) = strip_comb lhs;
 128.142      val simps = (if length args = 1 then get_accupd_simps else get_updupd_simps) thy lhs defset;
 128.143    in
 128.144 -    Goal.prove (ProofContext.init_global thy) [] [] prop'
 128.145 +    Goal.prove (Proof_Context.init_global thy) [] [] prop'
 128.146        (fn _ =>
 128.147          simp_tac (HOL_basic_ss addsimps (simps @ [K_record_comp])) 1 THEN
 128.148          TRY (simp_tac (HOL_basic_ss addsimps ex_simps addsimprocs ex_simprs) 1))
 128.149 @@ -1197,7 +1197,7 @@
 128.150      val insts = [("upd", cterm_of thy upd), ("ac", cterm_of thy acc)];
 128.151      val prop = Thm.concl_of (named_cterm_instantiate insts updacc_cong_triv);
 128.152    in
 128.153 -    Goal.prove (ProofContext.init_global thy) [] [] prop
 128.154 +    Goal.prove (Proof_Context.init_global thy) [] [] prop
 128.155        (fn _ =>
 128.156          simp_tac simpset 1 THEN
 128.157          REPEAT_DETERM (Iso_Tuple_Support.iso_tuple_intros_tac 1) THEN
 128.158 @@ -1525,7 +1525,7 @@
 128.159  
 128.160  fun cert_typ ctxt raw_T env =
 128.161    let
 128.162 -    val thy = ProofContext.theory_of ctxt;
 128.163 +    val thy = Proof_Context.theory_of ctxt;
 128.164      val T = Type.no_tvars (Sign.certify_typ thy raw_T)
 128.165        handle TYPE (msg, _, _) => error msg;
 128.166      val env' = OldTerm.add_typ_tfrees (T, env);
 128.167 @@ -2392,7 +2392,7 @@
 128.168  
 128.169  fun read_parent NONE ctxt = (NONE, ctxt)
 128.170    | read_parent (SOME raw_T) ctxt =
 128.171 -      (case ProofContext.read_typ_abbrev ctxt raw_T of
 128.172 +      (case Proof_Context.read_typ_abbrev ctxt raw_T of
 128.173          Type (name, Ts) => (SOME (Ts, name), fold Variable.declare_typ Ts ctxt)
 128.174        | T => error ("Bad parent record specification: " ^ Syntax.string_of_typ ctxt T));
 128.175  
 128.176 @@ -2413,8 +2413,8 @@
 128.177        if quiet_mode then ()
 128.178        else writeln ("Defining record " ^ quote (Binding.str_of binding) ^ " ...");
 128.179  
 128.180 -    val ctxt = ProofContext.init_global thy;
 128.181 -    fun cert_typ T = Type.no_tvars (ProofContext.cert_typ ctxt T)
 128.182 +    val ctxt = Proof_Context.init_global thy;
 128.183 +    fun cert_typ T = Type.no_tvars (Proof_Context.cert_typ ctxt T)
 128.184        handle TYPE (msg, _, _) => error msg;
 128.185  
 128.186  
 128.187 @@ -2463,12 +2463,12 @@
 128.188  
 128.189  fun add_record_cmd quiet_mode (raw_params, binding) raw_parent raw_fields thy =
 128.190    let
 128.191 -    val ctxt = ProofContext.init_global thy;
 128.192 +    val ctxt = Proof_Context.init_global thy;
 128.193      val params = map (apsnd (Typedecl.read_constraint ctxt)) raw_params;
 128.194      val ctxt1 = fold (Variable.declare_typ o TFree) params ctxt;
 128.195      val (parent, ctxt2) = read_parent raw_parent ctxt1;
 128.196      val (fields, ctxt3) = fold_map read_field raw_fields ctxt2;
 128.197 -    val params' = map (ProofContext.check_tfree ctxt3) params;
 128.198 +    val params' = map (Proof_Context.check_tfree ctxt3) params;
 128.199    in thy |> add_record quiet_mode (params', binding) parent fields end;
 128.200  
 128.201  end;
   129.1 --- a/src/HOL/Tools/refute.ML	Sat Apr 16 15:47:52 2011 +0200
   129.2 +++ b/src/HOL/Tools/refute.ML	Sat Apr 16 16:15:37 2011 +0200
   129.3 @@ -224,7 +224,7 @@
   129.4       parameters = Symtab.merge (op =) (pa1, pa2)};
   129.5  );
   129.6  
   129.7 -val get_data = Data.get o ProofContext.theory_of;
   129.8 +val get_data = Data.get o Proof_Context.theory_of;
   129.9  
  129.10  
  129.11  (* ------------------------------------------------------------------------- *)
  129.12 @@ -683,7 +683,7 @@
  129.13  
  129.14  fun collect_axioms ctxt t =
  129.15    let
  129.16 -    val thy = ProofContext.theory_of ctxt
  129.17 +    val thy = Proof_Context.theory_of ctxt
  129.18      val _ = tracing "Adding axioms..."
  129.19      val axioms = Theory.all_axioms_of thy
  129.20      fun collect_this_axiom (axname, ax) axs =
  129.21 @@ -858,7 +858,7 @@
  129.22  
  129.23  fun ground_types ctxt t =
  129.24    let
  129.25 -    val thy = ProofContext.theory_of ctxt
  129.26 +    val thy = Proof_Context.theory_of ctxt
  129.27      fun collect_types T acc =
  129.28        (case T of
  129.29          Type ("fun", [T1, T2]) => collect_types T1 (collect_types T2 acc)
  129.30 @@ -1049,7 +1049,7 @@
  129.31      {sizes, minsize, maxsize, maxvars, maxtime, satsolver, no_assms, expect}
  129.32      assm_ts t negate =
  129.33    let
  129.34 -    val thy = ProofContext.theory_of ctxt
  129.35 +    val thy = Proof_Context.theory_of ctxt
  129.36      (* string -> unit *)
  129.37      fun check_expect outcome_code =
  129.38        if expect = "" orelse outcome_code = expect then ()
  129.39 @@ -1548,7 +1548,7 @@
  129.40  
  129.41  fun stlc_interpreter ctxt model args t =
  129.42    let
  129.43 -    val thy = ProofContext.theory_of ctxt
  129.44 +    val thy = Proof_Context.theory_of ctxt
  129.45      val (typs, terms) = model
  129.46      val {maxvars, def_eq, next_idx, bounds, wellformed} = args
  129.47      (* Term.typ -> (interpretation * model * arguments) option *)
  129.48 @@ -1836,7 +1836,7 @@
  129.49  
  129.50  fun IDT_interpreter ctxt model args t =
  129.51    let
  129.52 -    val thy = ProofContext.theory_of ctxt
  129.53 +    val thy = Proof_Context.theory_of ctxt
  129.54      val (typs, terms) = model
  129.55      (* Term.typ -> (interpretation * model * arguments) option *)
  129.56      fun interpret_term (Type (s, Ts)) =
  129.57 @@ -1929,7 +1929,7 @@
  129.58  
  129.59  fun IDT_constructor_interpreter ctxt model args t =
  129.60    let
  129.61 -    val thy = ProofContext.theory_of ctxt
  129.62 +    val thy = Proof_Context.theory_of ctxt
  129.63      (* returns a list of canonical representations for terms of the type 'T' *)
  129.64      (* It would be nice if we could just use 'print' for this, but 'print'   *)
  129.65      (* for IDTs calls 'IDT_constructor_interpreter' again, and this could    *)
  129.66 @@ -2194,7 +2194,7 @@
  129.67  
  129.68  fun IDT_recursion_interpreter ctxt model args t =
  129.69    let
  129.70 -    val thy = ProofContext.theory_of ctxt
  129.71 +    val thy = Proof_Context.theory_of ctxt
  129.72    in
  129.73      (* careful: here we descend arbitrarily deep into 't', possibly before *)
  129.74      (* any other interpreter for atomic terms has had a chance to look at  *)
  129.75 @@ -3022,7 +3022,7 @@
  129.76  
  129.77  fun IDT_printer ctxt model T intr assignment =
  129.78    let
  129.79 -    val thy = ProofContext.theory_of ctxt
  129.80 +    val thy = Proof_Context.theory_of ctxt
  129.81    in
  129.82      (case T of
  129.83        Type (s, Ts) =>
  129.84 @@ -3189,7 +3189,7 @@
  129.85          let
  129.86            val thy' = fold set_default_param parms thy;
  129.87            val output =
  129.88 -            (case get_default_params (ProofContext.init_global thy') of
  129.89 +            (case get_default_params (Proof_Context.init_global thy') of
  129.90                [] => "none"
  129.91              | new_defaults => cat_lines (map (fn (x, y) => x ^ "=" ^ y) new_defaults));
  129.92            val _ = writeln ("Default parameters for 'refute':\n" ^ output);
   130.1 --- a/src/HOL/Tools/transfer.ML	Sat Apr 16 15:47:52 2011 +0200
   130.2 +++ b/src/HOL/Tools/transfer.ML	Sat Apr 16 16:15:37 2011 +0200
   130.3 @@ -118,7 +118,7 @@
   130.4        |> Variable.declare_thm thm
   130.5        |> Variable.declare_term (term_of a)
   130.6        |> Variable.declare_term (term_of D);
   130.7 -    val certify = Thm.cterm_of (ProofContext.theory_of ctxt3);
   130.8 +    val certify = Thm.cterm_of (Proof_Context.theory_of ctxt3);
   130.9      val vars = filter (fn ((v, _), T) => Type.could_unify (T, aT) andalso
  130.10        not (member (op =) leave v)) (Term.add_vars (Thm.prop_of thm) []);
  130.11      val c_vars = map (certify o Var) vars;
   131.1 --- a/src/HOL/Tools/typedef.ML	Sat Apr 16 15:47:52 2011 +0200
   131.2 +++ b/src/HOL/Tools/typedef.ML	Sat Apr 16 16:15:37 2011 +0200
   131.3 @@ -149,7 +149,7 @@
   131.4  
   131.5      (* lhs *)
   131.6  
   131.7 -    val args = map (ProofContext.check_tfree tmp_ctxt') raw_args;
   131.8 +    val args = map (Proof_Context.check_tfree tmp_ctxt') raw_args;
   131.9      val (newT, typedecl_lthy) = lthy
  131.10        |> Typedecl.typedecl (tname, args, mx)
  131.11        ||> Variable.declare_term set;
  131.12 @@ -179,17 +179,17 @@
  131.13  
  131.14      val ((RepC, AbsC, axiom_name, typedef), typedef_lthy) =
  131.15        let
  131.16 -        val thy = ProofContext.theory_of set_lthy;
  131.17 +        val thy = Proof_Context.theory_of set_lthy;
  131.18          val cert = Thm.cterm_of thy;
  131.19          val (defs, A) =
  131.20 -          Local_Defs.export_cterm set_lthy (ProofContext.init_global thy) (cert set')
  131.21 +          Local_Defs.export_cterm set_lthy (Proof_Context.init_global thy) (cert set')
  131.22            ||> Thm.term_of;
  131.23  
  131.24          val ((RepC, AbsC, axiom_name, axiom), axiom_lthy) = set_lthy |>
  131.25            Local_Theory.background_theory_result
  131.26              (primitive_typedef typedef_name newT oldT Rep_name Abs_name A);
  131.27  
  131.28 -        val cert = Thm.cterm_of (ProofContext.theory_of axiom_lthy);
  131.29 +        val cert = Thm.cterm_of (Proof_Context.theory_of axiom_lthy);
  131.30          val typedef =
  131.31            Local_Defs.contract axiom_lthy defs (cert (mk_typedef newT oldT RepC AbsC set')) axiom;
  131.32        in ((RepC, AbsC, axiom_name, typedef), axiom_lthy) end;
  131.33 @@ -207,7 +207,7 @@
  131.34  
  131.35      fun typedef_result inhabited lthy1 =
  131.36        let
  131.37 -        val cert = Thm.cterm_of (ProofContext.theory_of lthy1);
  131.38 +        val cert = Thm.cterm_of (Proof_Context.theory_of lthy1);
  131.39          val inhabited' =
  131.40            Local_Defs.contract lthy1 (the_list set_def) (cert (mk_inhabited set')) inhabited;
  131.41          val typedef' = inhabited' RS typedef;
   132.1 --- a/src/HOL/ex/Iff_Oracle.thy	Sat Apr 16 15:47:52 2011 +0200
   132.2 +++ b/src/HOL/ex/Iff_Oracle.thy	Sat Apr 16 16:15:37 2011 +0200
   132.3 @@ -54,7 +54,7 @@
   132.4  method_setup iff = {*
   132.5    Scan.lift Parse.nat >> (fn n => fn ctxt =>
   132.6      SIMPLE_METHOD
   132.7 -      (HEADGOAL (rtac (iff_oracle (ProofContext.theory_of ctxt, n)))
   132.8 +      (HEADGOAL (rtac (iff_oracle (Proof_Context.theory_of ctxt, n)))
   132.9          handle Fail _ => no_tac))
  132.10  *} "iff oracle"
  132.11  
   133.1 --- a/src/HOL/ex/sledgehammer_tactics.ML	Sat Apr 16 15:47:52 2011 +0200
   133.2 +++ b/src/HOL/ex/sledgehammer_tactics.ML	Sat Apr 16 16:15:37 2011 +0200
   133.3 @@ -55,7 +55,7 @@
   133.4  fun thms_of_name ctxt name =
   133.5    let
   133.6      val lex = Keyword.get_lexicons
   133.7 -    val get = maps (ProofContext.get_fact ctxt o fst)
   133.8 +    val get = maps (Proof_Context.get_fact ctxt o fst)
   133.9    in
  133.10      Source.of_string name
  133.11      |> Symbol.source
  133.12 @@ -77,7 +77,7 @@
  133.13  
  133.14  fun generic_sledgehammer_as_oracle_tac force_full_types ctxt i th =
  133.15    let
  133.16 -    val thy = ProofContext.theory_of ctxt
  133.17 +    val thy = Proof_Context.theory_of ctxt
  133.18      val timeout = Time.fromSeconds 30
  133.19      val xs = run_atp force_full_types timeout i i ctxt th atp
  133.20    in if is_some xs then Skip_Proof.cheat_tac thy th else Seq.empty end
   134.1 --- a/src/Provers/Arith/cancel_sums.ML	Sat Apr 16 15:47:52 2011 +0200
   134.2 +++ b/src/Provers/Arith/cancel_sums.ML	Sat Apr 16 16:15:37 2011 +0200
   134.3 @@ -61,7 +61,7 @@
   134.4      NONE => NONE
   134.5    | SOME bal =>
   134.6        let
   134.7 -        val thy = ProofContext.theory_of (Simplifier.the_context ss);
   134.8 +        val thy = Proof_Context.theory_of (Simplifier.the_context ss);
   134.9          val (ts, us) = pairself (sort Term_Ord.term_ord o Data.dest_sum) bal;
  134.10          val (ts', us', vs) = cancel ts us [];
  134.11        in
   135.1 --- a/src/Provers/Arith/fast_lin_arith.ML	Sat Apr 16 15:47:52 2011 +0200
   135.2 +++ b/src/Provers/Arith/fast_lin_arith.ML	Sat Apr 16 16:15:37 2011 +0200
   135.3 @@ -168,7 +168,7 @@
   135.4  
   135.5  fun number_of ctxt =
   135.6    (case Data.get (Context.Proof ctxt) of
   135.7 -    {number_of = SOME f, ...} => f (ProofContext.theory_of ctxt)
   135.8 +    {number_of = SOME f, ...} => f (Proof_Context.theory_of ctxt)
   135.9    | _ => fn _ => fn _ => raise CTERM ("number_of", []));
  135.10  
  135.11  
  135.12 @@ -474,7 +474,7 @@
  135.13  fun mkthm ss asms (just: injust) =
  135.14    let
  135.15      val ctxt = Simplifier.the_context ss;
  135.16 -    val thy = ProofContext.theory_of ctxt;
  135.17 +    val thy = Proof_Context.theory_of ctxt;
  135.18      val {add_mono_thms, mult_mono_thms, inj_thms, lessD, simpset, ...} = get_data ctxt;
  135.19      val number_of = number_of ctxt;
  135.20      val simpset' = Simplifier.inherit_context ss simpset;
  135.21 @@ -895,7 +895,7 @@
  135.22  fun prover ss thms Tconcl (js : injust list) split_neq pos : thm option =
  135.23    let
  135.24      val ctxt = Simplifier.the_context ss
  135.25 -    val thy = ProofContext.theory_of ctxt
  135.26 +    val thy = Proof_Context.theory_of ctxt
  135.27      val nTconcl = LA_Logic.neg_prop Tconcl
  135.28      val cnTconcl = cterm_of thy nTconcl
  135.29      val nTconclthm = Thm.assume cnTconcl
   136.1 --- a/src/Provers/classical.ML	Sat Apr 16 15:47:52 2011 +0200
   136.2 +++ b/src/Provers/classical.ML	Sat Apr 16 16:15:37 2011 +0200
   136.3 @@ -210,7 +210,7 @@
   136.4  fun dup_elim th =
   136.5    let
   136.6      val rl = (th RSN (2, revcut_rl)) |> Thm.assumption 2 |> Seq.hd;
   136.7 -    val ctxt = ProofContext.init_global (Thm.theory_of_thm rl);
   136.8 +    val ctxt = Proof_Context.init_global (Thm.theory_of_thm rl);
   136.9    in rule_by_tactic ctxt (TRYALL (etac revcut_rl)) rl end;
  136.10  
  136.11  
  136.12 @@ -850,13 +850,13 @@
  136.13  val get_global_claset = #1 o GlobalClaset.get;
  136.14  val map_global_claset = GlobalClaset.map o apfst;
  136.15  
  136.16 -val get_context_cs = #2 o GlobalClaset.get o ProofContext.theory_of;
  136.17 +val get_context_cs = #2 o GlobalClaset.get o Proof_Context.theory_of;
  136.18  fun map_context_cs f = GlobalClaset.map (apsnd
  136.19    (fn ContextCS {swrappers, uwrappers} => make_context_cs (f (swrappers, uwrappers))));
  136.20  
  136.21  fun global_claset_of thy =
  136.22    let val (cs, ctxt_cs) = GlobalClaset.get thy
  136.23 -  in context_cs (ProofContext.init_global thy) cs (ctxt_cs) end;
  136.24 +  in context_cs (Proof_Context.init_global thy) cs (ctxt_cs) end;
  136.25  
  136.26  
  136.27  (* context dependent components *)
   137.1 --- a/src/Provers/order.ML	Sat Apr 16 15:47:52 2011 +0200
   137.2 +++ b/src/Provers/order.ML	Sat Apr 16 16:15:37 2011 +0200
   137.3 @@ -1225,7 +1225,7 @@
   137.4  in
   137.5   SUBGOAL (fn (A, n) => fn st =>
   137.6    let
   137.7 -   val thy = ProofContext.theory_of ctxt;
   137.8 +   val thy = Proof_Context.theory_of ctxt;
   137.9     val rfrees = map Free (Term.rename_wrt_term A (Logic.strip_params A));
  137.10     val Hs = map prop_of prems @ map (fn H => subst_bounds (rfrees, H)) (Logic.strip_assums_hyp A)
  137.11     val C = subst_bounds (rfrees, Logic.strip_assums_concl A)
   138.1 --- a/src/Provers/quantifier1.ML	Sat Apr 16 15:47:52 2011 +0200
   138.2 +++ b/src/Provers/quantifier1.ML	Sat Apr 16 16:15:37 2011 +0200
   138.3 @@ -113,7 +113,7 @@
   138.4    in exqu [] end;
   138.5  
   138.6  fun prove_conv tac thy tu =
   138.7 -  let val ctxt = ProofContext.init_global thy;
   138.8 +  let val ctxt = Proof_Context.init_global thy;
   138.9        val eq_tu = Logic.mk_equals tu;
  138.10        val ([fixed_goal], ctxt') = Variable.import_terms true [eq_tu] ctxt;
  138.11        val thm = Goal.prove ctxt' [] [] fixed_goal
   139.1 --- a/src/Provers/quasi.ML	Sat Apr 16 15:47:52 2011 +0200
   139.2 +++ b/src/Provers/quasi.ML	Sat Apr 16 16:15:37 2011 +0200
   139.3 @@ -553,7 +553,7 @@
   139.4  
   139.5  fun trans_tac ctxt = SUBGOAL (fn (A, n) => fn st =>
   139.6   let
   139.7 -  val thy = ProofContext.theory_of ctxt;
   139.8 +  val thy = Proof_Context.theory_of ctxt;
   139.9    val rfrees = map Free (Term.rename_wrt_term A (Logic.strip_params A));
  139.10    val Hs = map (fn H => subst_bounds (rfrees, H)) (Logic.strip_assums_hyp A);
  139.11    val C = subst_bounds (rfrees, Logic.strip_assums_concl A);
  139.12 @@ -574,7 +574,7 @@
  139.13  
  139.14  fun quasi_tac ctxt = SUBGOAL (fn (A, n) => fn st =>
  139.15   let
  139.16 -  val thy = ProofContext.theory_of ctxt
  139.17 +  val thy = Proof_Context.theory_of ctxt
  139.18    val rfrees = map Free (Term.rename_wrt_term A (Logic.strip_params A));
  139.19    val Hs = map (fn H => subst_bounds (rfrees, H)) (Logic.strip_assums_hyp A);
  139.20    val C = subst_bounds (rfrees, Logic.strip_assums_concl A);
   140.1 --- a/src/Provers/trancl.ML	Sat Apr 16 15:47:52 2011 +0200
   140.2 +++ b/src/Provers/trancl.ML	Sat Apr 16 16:15:37 2011 +0200
   140.3 @@ -534,7 +534,7 @@
   140.4  
   140.5  fun trancl_tac ctxt = SUBGOAL (fn (A, n) => fn st =>
   140.6   let
   140.7 -  val thy = ProofContext.theory_of ctxt;
   140.8 +  val thy = Proof_Context.theory_of ctxt;
   140.9    val Hs = Logic.strip_assums_hyp A;
  140.10    val C = Logic.strip_assums_concl A;
  140.11    val (rel, subgoals, prf) = mkconcl_trancl C;
  140.12 @@ -553,7 +553,7 @@
  140.13  
  140.14  fun rtrancl_tac ctxt = SUBGOAL (fn (A, n) => fn st =>
  140.15   let
  140.16 -  val thy = ProofContext.theory_of ctxt;
  140.17 +  val thy = Proof_Context.theory_of ctxt;
  140.18    val Hs = Logic.strip_assums_hyp A;
  140.19    val C = Logic.strip_assums_concl A;
  140.20    val (rel, subgoals, prf) = mkconcl_rtrancl C;
   141.1 --- a/src/Tools/Code/code_preproc.ML	Sat Apr 16 15:47:52 2011 +0200
   141.2 +++ b/src/Tools/Code/code_preproc.ML	Sat Apr 16 16:15:37 2011 +0200
   141.3 @@ -90,7 +90,7 @@
   141.4  
   141.5  fun add_unfold_post raw_thm thy =
   141.6    let
   141.7 -    val thm = Local_Defs.meta_rewrite_rule (ProofContext.init_global thy) raw_thm;
   141.8 +    val thm = Local_Defs.meta_rewrite_rule (Proof_Context.init_global thy) raw_thm;
   141.9      val thm_sym = Thm.symmetric thm;
  141.10    in
  141.11      thy |> map_pre_post (fn (pre, post) =>
  141.12 @@ -165,7 +165,7 @@
  141.13  
  141.14  fun preprocess_conv thy =
  141.15    let
  141.16 -    val ctxt = ProofContext.init_global thy;
  141.17 +    val ctxt = Proof_Context.init_global thy;
  141.18      val pre = (Simplifier.global_context thy o #pre o the_thmproc) thy;
  141.19    in
  141.20      Simplifier.rewrite pre
  141.21 @@ -186,7 +186,7 @@
  141.22  
  141.23  fun print_codeproc thy =
  141.24    let
  141.25 -    val ctxt = ProofContext.init_global thy;
  141.26 +    val ctxt = Proof_Context.init_global thy;
  141.27      val pre = (#pre o the_thmproc) thy;
  141.28      val post = (#post o the_thmproc) thy;
  141.29      val functrans = (map fst o #functrans o the_thmproc) thy;
   142.1 --- a/src/Tools/Code/code_runtime.ML	Sat Apr 16 15:47:52 2011 +0200
   142.2 +++ b/src/Tools/Code/code_runtime.ML	Sat Apr 16 16:15:37 2011 +0200
   142.3 @@ -83,14 +83,14 @@
   142.4  
   142.5  fun reject_vars thy t =
   142.6    let
   142.7 -    val ctxt = ProofContext.init_global thy;
   142.8 +    val ctxt = Proof_Context.init_global thy;
   142.9    in ((Sign.no_frees ctxt o Sign.no_vars ctxt o map_types (K dummyT)) t; t) end;
  142.10  
  142.11  fun obtain_evaluator thy some_target = Code_Target.evaluator thy (the_default target some_target);
  142.12  
  142.13  fun evaluation cookie thy evaluator vs_t args =
  142.14    let
  142.15 -    val ctxt = ProofContext.init_global thy;
  142.16 +    val ctxt = Proof_Context.init_global thy;
  142.17      val (program_code, value_name) = evaluator vs_t;
  142.18      val value_code = space_implode " "
  142.19        (value_name :: "()" :: map (enclose "(" ")") args);
  142.20 @@ -188,7 +188,7 @@
  142.21  
  142.22  fun evaluation_code thy module_name tycos consts =
  142.23    let
  142.24 -    val ctxt = ProofContext.init_global thy;
  142.25 +    val ctxt = Proof_Context.init_global thy;
  142.26      val (consts', (naming, program)) = Code_Thingol.consts_program thy false consts;
  142.27      val tycos' = map (the o Code_Thingol.lookup_tyco naming) tycos;
  142.28      val (ml_code, target_names) =
  142.29 @@ -202,7 +202,7 @@
  142.30         | SOME const'' => (const, const'')) consts consts''
  142.31      val tycos_map = map2 (fn tyco =>
  142.32        fn NONE =>
  142.33 -          error ("Type " ^ quote (ProofContext.extern_type ctxt tyco) ^
  142.34 +          error ("Type " ^ quote (Proof_Context.extern_type ctxt tyco) ^
  142.35              "\nhas a user-defined serialization")
  142.36          | SOME tyco'' => (tyco, tyco'')) tycos tycos'';
  142.37    in (ml_code, (tycos_map, consts_map)) end;
  142.38 @@ -227,7 +227,7 @@
  142.39      val tycos' = fold (insert (op =)) new_tycos tycos;
  142.40      val consts' = fold (insert (op =)) new_consts consts;
  142.41      val acc_code = Lazy.lazy (fn () =>
  142.42 -      evaluation_code (ProofContext.theory_of ctxt) "Code" tycos' consts'
  142.43 +      evaluation_code (Proof_Context.theory_of ctxt) "Code" tycos' consts'
  142.44        |> apsnd snd);
  142.45    in Code_Antiq_Data.put ((tycos', consts'), (false, acc_code)) ctxt end;
  142.46  
  142.47 @@ -245,7 +245,7 @@
  142.48  
  142.49  fun ml_code_antiq raw_const background =
  142.50    let
  142.51 -    val const = Code.check_const (ProofContext.theory_of background) raw_const;
  142.52 +    val const = Code.check_const (Proof_Context.theory_of background) raw_const;
  142.53      val is_first = is_first_occ background;
  142.54      val background' = register_const const background;
  142.55    in (print_code is_first const, background') end;
   143.1 --- a/src/Tools/Code/code_simp.ML	Sat Apr 16 15:47:52 2011 +0200
   143.2 +++ b/src/Tools/Code/code_simp.ML	Sat Apr 16 16:15:37 2011 +0200
   143.3 @@ -59,9 +59,9 @@
   143.4  fun dynamic_value thy = snd o Logic.dest_equals o Thm.prop_of o dynamic_conv thy o Thm.cterm_of thy;
   143.5  
   143.6  val setup = Method.setup (Binding.name "code_simp")
   143.7 -  (Scan.succeed (SIMPLE_METHOD' o (CHANGED_PROP oo dynamic_tac o ProofContext.theory_of)))
   143.8 +  (Scan.succeed (SIMPLE_METHOD' o (CHANGED_PROP oo dynamic_tac o Proof_Context.theory_of)))
   143.9    "simplification with code equations"
  143.10 -  #> Value.add_evaluator ("simp", dynamic_value o ProofContext.theory_of);
  143.11 +  #> Value.add_evaluator ("simp", dynamic_value o Proof_Context.theory_of);
  143.12  
  143.13  
  143.14  (* evaluation with static code context *)
   144.1 --- a/src/Tools/Code/code_target.ML	Sat Apr 16 15:47:52 2011 +0200
   144.2 +++ b/src/Tools/Code/code_target.ML	Sat Apr 16 16:15:37 2011 +0200
   144.3 @@ -307,7 +307,7 @@
   144.4  
   144.5  fun project_program thy abortable names_hidden names1 program2 =
   144.6    let
   144.7 -    val ctxt = ProofContext.init_global thy;
   144.8 +    val ctxt = Proof_Context.init_global thy;
   144.9      val names2 = subtract (op =) names_hidden names1;
  144.10      val program3 = Graph.subgraph (not o member (op =) names_hidden) program2;
  144.11      val names4 = Graph.all_succs program3 names2;
  144.12 @@ -316,7 +316,7 @@
  144.13      val _ =
  144.14        if null empty_funs then ()
  144.15        else error ("No code equations for " ^
  144.16 -        commas (map (ProofContext.extern_const ctxt) empty_funs));
  144.17 +        commas (map (Proof_Context.extern_const ctxt) empty_funs));
  144.18      val program4 = Graph.subgraph (member (op =) names4) program3;
  144.19    in (names4, program4) end;
  144.20  
  144.21 @@ -515,7 +515,7 @@
  144.22    (parse_const_terms -- Scan.repeat (parse_consts || parse_types || parse_classes || parse_instances)
  144.23      -- Scan.lift (Args.parens (Args.name -- Scan.option Parse.int)))
  144.24    (fn {context = ctxt, ...} => fn ((mk_cs, mk_stmtss), (target, some_width)) =>
  144.25 -    let val thy = ProofContext.theory_of ctxt in
  144.26 +    let val thy = Proof_Context.theory_of ctxt in
  144.27        present_code thy (mk_cs thy)
  144.28          (fn naming => maps (fn f => f thy naming) mk_stmtss)
  144.29          target some_width "Example" []
   145.1 --- a/src/Tools/Code/code_thingol.ML	Sat Apr 16 15:47:52 2011 +0200
   145.2 +++ b/src/Tools/Code/code_thingol.ML	Sat Apr 16 16:15:37 2011 +0200
   145.3 @@ -490,18 +490,18 @@
   145.4    | _ => [];
   145.5  
   145.6  fun labelled_name thy program name =
   145.7 -  let val ctxt = ProofContext.init_global thy in
   145.8 +  let val ctxt = Proof_Context.init_global thy in
   145.9      case Graph.get_node program name of
  145.10        Fun (c, _) => quote (Code.string_of_const thy c)
  145.11 -    | Datatype (tyco, _) => "type " ^ quote (ProofContext.extern_type ctxt tyco)
  145.12 +    | Datatype (tyco, _) => "type " ^ quote (Proof_Context.extern_type ctxt tyco)
  145.13      | Datatypecons (c, _) => quote (Code.string_of_const thy c)
  145.14 -    | Class (class, _) => "class " ^ quote (ProofContext.extern_class ctxt class)
  145.15 +    | Class (class, _) => "class " ^ quote (Proof_Context.extern_class ctxt class)
  145.16      | Classrel (sub, super) =>
  145.17          let
  145.18            val Class (sub, _) = Graph.get_node program sub;
  145.19            val Class (super, _) = Graph.get_node program super;
  145.20          in
  145.21 -          quote (ProofContext.extern_class ctxt sub ^ " < " ^ ProofContext.extern_class ctxt super)
  145.22 +          quote (Proof_Context.extern_class ctxt sub ^ " < " ^ Proof_Context.extern_class ctxt super)
  145.23          end
  145.24      | Classparam (c, _) => quote (Code.string_of_const thy c)
  145.25      | Classinst ((class, (tyco, _)), _) =>
  145.26 @@ -509,7 +509,7 @@
  145.27            val Class (class, _) = Graph.get_node program class;
  145.28            val Datatype (tyco, _) = Graph.get_node program tyco;
  145.29          in
  145.30 -          quote (ProofContext.extern_type ctxt tyco ^ " :: " ^ ProofContext.extern_class ctxt class)
  145.31 +          quote (Proof_Context.extern_type ctxt tyco ^ " :: " ^ Proof_Context.extern_class ctxt class)
  145.32          end
  145.33    end;
  145.34  
   146.1 --- a/src/Tools/WWW_Find/find_theorems.ML	Sat Apr 16 15:47:52 2011 +0200
   146.2 +++ b/src/Tools/WWW_Find/find_theorems.ML	Sat Apr 16 16:15:37 2011 +0200
   146.3 @@ -207,7 +207,7 @@
   146.4  
   146.5      fun do_find () =
   146.6        let
   146.7 -        val ctxt = ProofContext.init_global (Thy_Info.get_theory thy_name);
   146.8 +        val ctxt = Proof_Context.init_global (Thy_Info.get_theory thy_name);
   146.9          val query = get_query ();
  146.10          val (othmslen, thms) = apsnd rev
  146.11            (Find_Theorems.find_theorems ctxt NONE (SOME limit) with_dups query);
   147.1 --- a/src/Tools/adhoc_overloading.ML	Sat Apr 16 15:47:52 2011 +0200
   147.2 +++ b/src/Tools/adhoc_overloading.ML	Sat Apr 16 16:15:37 2011 +0200
   147.3 @@ -89,7 +89,7 @@
   147.4  
   147.5  fun unifiable_with ctxt T1 (c, T2) =
   147.6    let
   147.7 -    val thy = ProofContext.theory_of ctxt;
   147.8 +    val thy = Proof_Context.theory_of ctxt;
   147.9      val maxidx1 = Term.maxidx_of_typ T1;
  147.10      val T2' = Logic.incr_tvar (maxidx1 + 1) T2;
  147.11      val maxidx2 = Int.max (maxidx1, Term.maxidx_of_typ T2');
  147.12 @@ -100,14 +100,14 @@
  147.13  
  147.14  fun insert_internal_same ctxt t (Const (c, T)) =
  147.15    (case map_filter (unifiable_with ctxt T) 
  147.16 -     (Same.function (get_variants (ProofContext.theory_of ctxt)) c) of
  147.17 +     (Same.function (get_variants (Proof_Context.theory_of ctxt)) c) of
  147.18        [] => unresolved_err ctxt (c, T) t "no instances"
  147.19      | [c'] => Const (c', dummyT)
  147.20      | _ => raise Same.SAME)
  147.21    | insert_internal_same _ _ _ = raise Same.SAME;
  147.22  
  147.23  fun insert_external_same ctxt _ (Const (c, T)) =
  147.24 -    Const (Same.function (get_external (ProofContext.theory_of ctxt)) c, T)
  147.25 +    Const (Same.function (get_external (Proof_Context.theory_of ctxt)) c, T)
  147.26    | insert_external_same _ _ _ = raise Same.SAME;
  147.27  
  147.28  fun gen_check_uncheck replace ts ctxt =
  147.29 @@ -121,7 +121,7 @@
  147.30  
  147.31  fun reject_unresolved ts ctxt =
  147.32    let
  147.33 -    val thy = ProofContext.theory_of ctxt;
  147.34 +    val thy = Proof_Context.theory_of ctxt;
  147.35      fun check_unresolved t =
  147.36        case filter (is_overloaded thy o fst) (Term.add_consts t []) of
  147.37            [] => ()
   148.1 --- a/src/Tools/atomize_elim.ML	Sat Apr 16 15:47:52 2011 +0200
   148.2 +++ b/src/Tools/atomize_elim.ML	Sat Apr 16 16:15:37 2011 +0200
   148.3 @@ -115,7 +115,7 @@
   148.4  
   148.5  fun atomize_elim_tac ctxt = SUBGOAL (fn (subg, i) =>
   148.6      let
   148.7 -      val thy = ProofContext.theory_of ctxt
   148.8 +      val thy = Proof_Context.theory_of ctxt
   148.9        val _ $ thesis = Logic.strip_assums_concl subg
  148.10                         
  148.11        (* Introduce a quantifier first if the thesis is not bound *)
   149.1 --- a/src/Tools/case_product.ML	Sat Apr 16 15:47:52 2011 +0200
   149.2 +++ b/src/Tools/case_product.ML	Sat Apr 16 16:15:37 2011 +0200
   149.3 @@ -74,7 +74,7 @@
   149.4      (Tactic.rtac (thm1 OF p_cons1)
   149.5       THEN' EVERY' (map (fn p =>
   149.6         Tactic.rtac thm2'
   149.7 -       THEN' EVERY' (map (ProofContext.fact_tac o single) p)) premss)
   149.8 +       THEN' EVERY' (map (Proof_Context.fact_tac o single) p)) premss)
   149.9      )
  149.10    end
  149.11  
   150.1 --- a/src/Tools/coherent.ML	Sat Apr 16 15:47:52 2011 +0200
   150.2 +++ b/src/Tools/coherent.ML	Sat Apr 16 16:15:37 2011 +0200
   150.3 @@ -82,7 +82,7 @@
   150.4    | valid_conj ctxt facts env (t :: ts) =
   150.5        Seq.maps (fn (u, x) => Seq.map (apsnd (cons x))
   150.6          (valid_conj ctxt facts
   150.7 -           (Pattern.match (ProofContext.theory_of ctxt) (t, u) env) ts
   150.8 +           (Pattern.match (Proof_Context.theory_of ctxt) (t, u) env) ts
   150.9           handle Pattern.MATCH => Seq.empty))
  150.10            (Seq.of_list (sort (int_ord o pairself snd) (Net.unify_term facts t)));
  150.11  
  150.12 @@ -219,7 +219,7 @@
  150.13             (mk_dom xs) Net.empty 0 0 of
  150.14           NONE => no_tac
  150.15         | SOME prf =>
  150.16 -           rtac (thm_of_cl_prf (ProofContext.theory_of context) concl [] prf) 1
  150.17 +           rtac (thm_of_cl_prf (Proof_Context.theory_of context) concl [] prf) 1
  150.18      end) context 1) ctxt;
  150.19  
  150.20  val setup = Method.setup @{binding coherent}
   151.1 --- a/src/Tools/induct.ML	Sat Apr 16 15:47:52 2011 +0200
   151.2 +++ b/src/Tools/induct.ML	Sat Apr 16 16:15:37 2011 +0200
   151.3 @@ -128,7 +128,7 @@
   151.4        Conv.implies_concl_conv (swap_prems_conv (i - 1)) then_conv
   151.5        Conv.rewr_conv Drule.swap_prems_eq
   151.6  
   151.7 -fun drop_judgment ctxt = Object_Logic.drop_judgment (ProofContext.theory_of ctxt);
   151.8 +fun drop_judgment ctxt = Object_Logic.drop_judgment (Proof_Context.theory_of ctxt);
   151.9  
  151.10  fun find_eq ctxt t =
  151.11    let
  151.12 @@ -386,7 +386,7 @@
  151.13  
  151.14  fun prep_inst ctxt align tune (tm, ts) =
  151.15    let
  151.16 -    val cert = Thm.cterm_of (ProofContext.theory_of ctxt);
  151.17 +    val cert = Thm.cterm_of (Proof_Context.theory_of ctxt);
  151.18      fun prep_var (x, SOME t) =
  151.19            let
  151.20              val cx = cert x;
  151.21 @@ -470,7 +470,7 @@
  151.22  
  151.23  fun cases_tac ctxt simp insts opt_rule facts =
  151.24    let
  151.25 -    val thy = ProofContext.theory_of ctxt;
  151.26 +    val thy = Proof_Context.theory_of ctxt;
  151.27  
  151.28      fun inst_rule r =
  151.29        (if null insts then r
  151.30 @@ -573,7 +573,7 @@
  151.31  
  151.32  fun guess_instance ctxt rule i st =
  151.33    let
  151.34 -    val thy = ProofContext.theory_of ctxt;
  151.35 +    val thy = Proof_Context.theory_of ctxt;
  151.36      val maxidx = Thm.maxidx_of st;
  151.37      val goal = Thm.term_of (Thm.cprem_of st i);  (*exception Subscript*)
  151.38      val params = rev (Term.rename_wrt_term goal (Logic.strip_params goal));
  151.39 @@ -599,7 +599,7 @@
  151.40  
  151.41  fun special_rename_params ctxt [[SOME (Free (z, Type (T, _)))]] [thm] =
  151.42        let
  151.43 -        val x = Name.clean (ProofContext.revert_skolem ctxt z);
  151.44 +        val x = Name.clean (Proof_Context.revert_skolem ctxt z);
  151.45          fun index i [] = []
  151.46            | index i (y :: ys) =
  151.47                if x = y then x ^ string_of_int i :: index (i + 1) ys
  151.48 @@ -640,13 +640,13 @@
  151.49  
  151.50  fun meta_spec_tac ctxt n (x, T) = SUBGOAL (fn (goal, i) =>
  151.51    let
  151.52 -    val thy = ProofContext.theory_of ctxt;
  151.53 +    val thy = Proof_Context.theory_of ctxt;
  151.54      val cert = Thm.cterm_of thy;
  151.55  
  151.56      val v = Free (x, T);
  151.57      fun spec_rule prfx (xs, body) =
  151.58        @{thm Pure.meta_spec}
  151.59 -      |> Thm.rename_params_rule ([Name.clean (ProofContext.revert_skolem ctxt x)], 1)
  151.60 +      |> Thm.rename_params_rule ([Name.clean (Proof_Context.revert_skolem ctxt x)], 1)
  151.61        |> Thm.lift_rule (cert prfx)
  151.62        |> `(Thm.prop_of #> Logic.strip_assums_concl)
  151.63        |-> (fn pred $ arg =>
  151.64 @@ -722,7 +722,7 @@
  151.65  
  151.66  fun induct_tac ctxt simp def_insts arbitrary taking opt_rule facts =
  151.67    let
  151.68 -    val thy = ProofContext.theory_of ctxt;
  151.69 +    val thy = Proof_Context.theory_of ctxt;
  151.70  
  151.71      val ((insts, defs), defs_ctxt) = fold_map add_defs def_insts ctxt |>> split_list;
  151.72      val atomized_defs = map (map (Conv.fconv_rule atomize_cterm)) defs;
  151.73 @@ -777,7 +777,7 @@
  151.74              |> Seq.maps (fn rule' =>
  151.75                CASES (rule_cases ctxt rule' cases)
  151.76                  (Tactic.rtac rule' i THEN
  151.77 -                  PRIMITIVE (singleton (ProofContext.export defs_ctxt ctxt))) st'))))
  151.78 +                  PRIMITIVE (singleton (Proof_Context.export defs_ctxt ctxt))) st'))))
  151.79      THEN_ALL_NEW_CASES
  151.80        ((if simp then simplify_tac ctxt THEN' (TRY o trivial_tac)
  151.81          else K all_tac)
  151.82 @@ -809,7 +809,7 @@
  151.83  
  151.84  fun coinduct_tac ctxt inst taking opt_rule facts =
  151.85    let
  151.86 -    val thy = ProofContext.theory_of ctxt;
  151.87 +    val thy = Proof_Context.theory_of ctxt;
  151.88  
  151.89      fun inst_rule r =
  151.90        if null inst then `Rule_Cases.get r
   152.1 --- a/src/Tools/induct_tacs.ML	Sat Apr 16 15:47:52 2011 +0200
   152.2 +++ b/src/Tools/induct_tacs.ML	Sat Apr 16 16:15:37 2011 +0200
   152.3 @@ -34,7 +34,7 @@
   152.4          SOME rule => rule
   152.5        | NONE =>
   152.6            (case Induct.find_casesT ctxt
   152.7 -              (#2 (check_type ctxt (ProofContext.read_term_schematic ctxt s))) of
   152.8 +              (#2 (check_type ctxt (Proof_Context.read_term_schematic ctxt s))) of
   152.9              rule :: _ => rule
  152.10            | [] => @{thm case_split}));
  152.11      val _ = Method.trace ctxt [rule];
   153.1 --- a/src/Tools/interpretation_with_defs.ML	Sat Apr 16 15:47:52 2011 +0200
   153.2 +++ b/src/Tools/interpretation_with_defs.ML	Sat Apr 16 16:15:37 2011 +0200
   153.3 @@ -42,7 +42,7 @@
   153.4      expression raw_defs raw_eqns theory =
   153.5    let
   153.6      val (_, (_, defs_ctxt)) =
   153.7 -      prep_decl expression I [] (ProofContext.init_global theory);
   153.8 +      prep_decl expression I [] (Proof_Context.init_global theory);
   153.9  
  153.10      val rhss = map (parse_term defs_ctxt o snd o snd) raw_defs
  153.11        |> Syntax.check_terms defs_ctxt;
  153.12 @@ -56,7 +56,7 @@
  153.13        |> Local_Theory.exit_result_global (map o Morphism.thm);
  153.14  
  153.15      val ((propss, deps, export), expr_ctxt) = theory'
  153.16 -      |> ProofContext.init_global
  153.17 +      |> Proof_Context.init_global
  153.18        |> prep_expr expression;
  153.19  
  153.20      val eqns = map (parse_prop expr_ctxt o snd) raw_eqns
  153.21 @@ -66,7 +66,7 @@
  153.22      val export' = Variable.export_morphism goal_ctxt expr_ctxt;
  153.23  
  153.24      fun after_qed witss eqns =
  153.25 -      (ProofContext.background_theory o Context.theory_map)
  153.26 +      (Proof_Context.background_theory o Context.theory_map)
  153.27          (note_eqns_register deps witss def_eqns attrss eqns export export');
  153.28  
  153.29    in Element.witness_proof_eqs after_qed propss eqns goal_ctxt end;
   154.1 --- a/src/Tools/misc_legacy.ML	Sat Apr 16 15:47:52 2011 +0200
   154.2 +++ b/src/Tools/misc_legacy.ML	Sat Apr 16 16:15:37 2011 +0200
   154.3 @@ -26,9 +26,9 @@
   154.4  
   154.5  fun simple_read_term thy T s =
   154.6    let
   154.7 -    val ctxt = ProofContext.init_global thy
   154.8 -      |> ProofContext.allow_dummies
   154.9 -      |> ProofContext.set_mode ProofContext.mode_schematic;
  154.10 +    val ctxt = Proof_Context.init_global thy
  154.11 +      |> Proof_Context.allow_dummies
  154.12 +      |> Proof_Context.set_mode Proof_Context.mode_schematic;
  154.13      val parse = if T = propT then Syntax.parse_prop else Syntax.parse_term;
  154.14    in parse ctxt s |> Type.constraint T |> Syntax.check_term ctxt end;
  154.15  
   155.1 --- a/src/Tools/nbe.ML	Sat Apr 16 15:47:52 2011 +0200
   155.2 +++ b/src/Tools/nbe.ML	Sat Apr 16 16:15:37 2011 +0200
   155.3 @@ -389,7 +389,7 @@
   155.4  fun compile_eqnss thy nbe_program raw_deps [] = []
   155.5    | compile_eqnss thy nbe_program raw_deps eqnss =
   155.6        let
   155.7 -        val ctxt = ProofContext.init_global thy;
   155.8 +        val ctxt = Proof_Context.init_global thy;
   155.9          val (deps, deps_vals) = split_list (map_filter
  155.10            (fn dep => Option.map (fn univ => (dep, univ)) (fst ((Graph.get_node nbe_program dep)))) raw_deps);
  155.11          val idx_of = raw_deps
  155.12 @@ -615,7 +615,7 @@
  155.13  
  155.14  (** setup **)
  155.15  
  155.16 -val setup = Value.add_evaluator ("nbe", dynamic_value o ProofContext.theory_of);
  155.17 +val setup = Value.add_evaluator ("nbe", dynamic_value o Proof_Context.theory_of);
  155.18  
  155.19  end;
  155.20   
  155.21 \ No newline at end of file
   156.1 --- a/src/Tools/quickcheck.ML	Sat Apr 16 15:47:52 2011 +0200
   156.2 +++ b/src/Tools/quickcheck.ML	Sat Apr 16 16:15:37 2011 +0200
   156.3 @@ -329,7 +329,7 @@
   156.4  
   156.5  fun test_term_with_increasing_cardinality ctxt (limit_time, is_interactive) ts =
   156.6    let
   156.7 -    val thy = ProofContext.theory_of ctxt
   156.8 +    val thy = Proof_Context.theory_of ctxt
   156.9      fun message s = if Config.get ctxt quiet then () else Output.urgent_message s
  156.10      val (ts', eval_terms) = split_list ts
  156.11      val _ = map check_test_term ts'
  156.12 @@ -400,7 +400,7 @@
  156.13  fun test_goal_terms lthy (limit_time, is_interactive) insts check_goals =
  156.14    let
  156.15      fun map_goal_and_eval_terms f (check_goal, eval_terms) = (f check_goal, map f eval_terms)
  156.16 -    val thy = ProofContext.theory_of lthy
  156.17 +    val thy = Proof_Context.theory_of lthy
  156.18      val default_insts =
  156.19        if Config.get lthy finite_types then (get_finite_types lthy) else (default_type lthy)
  156.20      val inst_goals =
  156.21 @@ -568,7 +568,7 @@
  156.22    | parse_test_param ("iterations", [arg]) = Config.put_generic iterations (read_nat arg)
  156.23    | parse_test_param ("default_type", arg) = (fn gen_ctxt =>
  156.24      map_test_params
  156.25 -      ((apfst o K) (map (ProofContext.read_typ (Context.proof_of gen_ctxt)) arg)) gen_ctxt)
  156.26 +      ((apfst o K) (map (Proof_Context.read_typ (Context.proof_of gen_ctxt)) arg)) gen_ctxt)
  156.27    | parse_test_param ("no_assms", [arg]) = Config.put_generic no_assms (read_bool arg)
  156.28    | parse_test_param ("expect", [arg]) = map_test_params ((apsnd o K) (read_expectation arg))
  156.29    | parse_test_param ("report", [arg]) = Config.put_generic report (read_bool arg)
  156.30 @@ -583,9 +583,9 @@
  156.31      else error ("Unknown tester or test parameter: " ^ name);
  156.32  
  156.33  fun parse_test_param_inst (name, arg) ((insts, eval_terms), ctxt) =
  156.34 -      case try (ProofContext.read_typ ctxt) name
  156.35 +      case try (Proof_Context.read_typ ctxt) name
  156.36         of SOME (TFree (v, _)) =>
  156.37 -         ((AList.update (op =) (v, ProofContext.read_typ ctxt (the_single arg)) insts, eval_terms), ctxt)
  156.38 +         ((AList.update (op =) (v, Proof_Context.read_typ ctxt (the_single arg)) insts, eval_terms), ctxt)
  156.39          | NONE => (case name of
  156.40              "eval" => ((insts, eval_terms @ map (Syntax.read_term ctxt) arg), ctxt)
  156.41            | _ => ((insts, eval_terms), Context.proof_map (parse_test_param (name, arg)) ctxt));
   157.1 --- a/src/Tools/subtyping.ML	Sat Apr 16 15:47:52 2011 +0200
   157.2 +++ b/src/Tools/subtyping.ML	Sat Apr 16 16:15:37 2011 +0200
   157.3 @@ -97,7 +97,7 @@
   157.4  
   157.5  fun unify weak ctxt =
   157.6    let
   157.7 -    val thy = ProofContext.theory_of ctxt;
   157.8 +    val thy = Proof_Context.theory_of ctxt;
   157.9      val pp = Syntax.pp ctxt;
  157.10      val arity_sorts = Type.arity_sorts pp (Sign.tsig_of thy);
  157.11  
  157.12 @@ -279,7 +279,7 @@
  157.13    let
  157.14      val coes_graph = coes_graph_of ctxt;
  157.15      val tmaps = tmaps_of ctxt;
  157.16 -    val tsig = Sign.tsig_of (ProofContext.theory_of ctxt);
  157.17 +    val tsig = Sign.tsig_of (Proof_Context.theory_of ctxt);
  157.18      val pp = Syntax.pp ctxt;
  157.19      val arity_sorts = Type.arity_sorts pp tsig;
  157.20      val subsort = Type.subsort tsig;
  157.21 @@ -718,8 +718,8 @@
  157.22  
  157.23  fun coercion_infer_types ctxt =
  157.24    infer_types ctxt
  157.25 -    (try (Consts.the_constraint (ProofContext.consts_of ctxt)))
  157.26 -    (ProofContext.def_type ctxt);
  157.27 +    (try (Consts.the_constraint (Proof_Context.consts_of ctxt)))
  157.28 +    (Proof_Context.def_type ctxt);
  157.29  
  157.30  val (coercion_enabled, coercion_enabled_setup) = Attrib.config_bool "coercion_enabled" (K false);
  157.31  
   158.1 --- a/src/Tools/value.ML	Sat Apr 16 15:47:52 2011 +0200
   158.2 +++ b/src/Tools/value.ML	Sat Apr 16 16:15:37 2011 +0200
   158.3 @@ -26,11 +26,11 @@
   158.4  val add_evaluator = Evaluator.map o AList.update (op =);
   158.5  
   158.6  fun value_select name ctxt =
   158.7 -  case AList.lookup (op =) (Evaluator.get (ProofContext.theory_of ctxt)) name
   158.8 +  case AList.lookup (op =) (Evaluator.get (Proof_Context.theory_of ctxt)) name
   158.9     of NONE => error ("No such evaluator: " ^ name)
  158.10      | SOME f => f ctxt;
  158.11  
  158.12 -fun value ctxt t = let val evaluators = Evaluator.get (ProofContext.theory_of ctxt)
  158.13 +fun value ctxt t = let val evaluators = Evaluator.get (Proof_Context.theory_of ctxt)
  158.14    in if null evaluators then error "No evaluators"
  158.15    else let val (evaluators, (_, evaluator)) = split_last evaluators
  158.16      in case get_first (fn (_, f) => try (f ctxt) t) evaluators
   159.1 --- a/src/ZF/Tools/datatype_package.ML	Sat Apr 16 15:47:52 2011 +0200
   159.2 +++ b/src/ZF/Tools/datatype_package.ML	Sat Apr 16 16:15:37 2011 +0200
   159.3 @@ -402,7 +402,7 @@
   159.4  
   159.5  fun add_datatype (sdom, srec_tms) scon_ty_lists (raw_monos, raw_type_intrs, raw_type_elims) thy =
   159.6    let
   159.7 -    val ctxt = ProofContext.init_global thy;
   159.8 +    val ctxt = Proof_Context.init_global thy;
   159.9      fun read_is strs =
  159.10        map (Syntax.parse_term ctxt #> Type.constraint @{typ i}) strs
  159.11        |> Syntax.check_terms ctxt;
   160.1 --- a/src/ZF/Tools/ind_cases.ML	Sat Apr 16 15:47:52 2011 +0200
   160.2 +++ b/src/ZF/Tools/ind_cases.ML	Sat Apr 16 16:15:37 2011 +0200
   160.3 @@ -30,7 +30,7 @@
   160.4  
   160.5  fun smart_cases ctxt s =
   160.6    let
   160.7 -    val thy = ProofContext.theory_of ctxt;
   160.8 +    val thy = Proof_Context.theory_of ctxt;
   160.9      fun err msg = cat_error msg ("Malformed set membership statement: " ^ s);
  160.10      val A = Syntax.read_prop ctxt s handle ERROR msg => err msg;
  160.11      val c = #1 (Term.dest_Const (Term.head_of (#2 (Ind_Syntax.dest_mem (FOLogic.dest_Trueprop
  160.12 @@ -46,7 +46,7 @@
  160.13  
  160.14  fun inductive_cases args thy =
  160.15    let
  160.16 -    val ctxt = ProofContext.init_global thy;
  160.17 +    val ctxt = Proof_Context.init_global thy;
  160.18      val facts = args |> map (fn ((name, srcs), props) =>
  160.19        ((name, map (Attrib.attribute thy) srcs),
  160.20          map (Thm.no_attributes o single o smart_cases ctxt) props));
   161.1 --- a/src/ZF/Tools/induct_tacs.ML	Sat Apr 16 15:47:52 2011 +0200
   161.2 +++ b/src/ZF/Tools/induct_tacs.ML	Sat Apr 16 16:15:37 2011 +0200
   161.3 @@ -91,7 +91,7 @@
   161.4  
   161.5  fun exhaust_induct_tac exh ctxt var i state =
   161.6    let
   161.7 -    val thy = ProofContext.theory_of ctxt
   161.8 +    val thy = Proof_Context.theory_of ctxt
   161.9      val ({context = ctxt', asms, ...}, _) = Subgoal.focus ctxt i state
  161.10      val tn = find_tname ctxt' var (map term_of asms)
  161.11      val rule =
  161.12 @@ -166,7 +166,7 @@
  161.13  
  161.14  fun rep_datatype raw_elim raw_induct raw_case_eqns raw_recursor_eqns thy =
  161.15    let
  161.16 -    val ctxt = ProofContext.init_global thy;
  161.17 +    val ctxt = Proof_Context.init_global thy;
  161.18      val elim = Facts.the_single "elimination" (Attrib.eval_thms ctxt [raw_elim]);
  161.19      val induct = Facts.the_single "induction" (Attrib.eval_thms ctxt [raw_induct]);
  161.20      val case_eqns = Attrib.eval_thms ctxt raw_case_eqns;
   162.1 --- a/src/ZF/Tools/inductive_package.ML	Sat Apr 16 15:47:52 2011 +0200
   162.2 +++ b/src/ZF/Tools/inductive_package.ML	Sat Apr 16 16:15:37 2011 +0200
   162.3 @@ -60,7 +60,7 @@
   162.4    raw_intr_specs (monos, con_defs, type_intrs, type_elims) thy =
   162.5  let
   162.6    val _ = Theory.requires thy "Inductive_ZF" "(co)inductive definitions";
   162.7 -  val ctxt = ProofContext.init_global thy;
   162.8 +  val ctxt = Proof_Context.init_global thy;
   162.9  
  162.10    val intr_specs = map (apfst (apfst Binding.name_of)) raw_intr_specs;
  162.11    val (intr_names, intr_tms) = split_list (map fst intr_specs);
  162.12 @@ -143,7 +143,7 @@
  162.13      If no mutual recursion then it equals the one recursive set.
  162.14      If mutual recursion then it differs from all the recursive sets. *)
  162.15    val big_rec_base_name = space_implode "_" rec_base_names;
  162.16 -  val big_rec_name = ProofContext.intern_const ctxt big_rec_base_name;
  162.17 +  val big_rec_name = Proof_Context.intern_const ctxt big_rec_base_name;
  162.18  
  162.19  
  162.20    val _ =
  162.21 @@ -173,7 +173,7 @@
  162.22      |> Sign.add_path big_rec_base_name
  162.23      |> Global_Theory.add_defs false (map (Thm.no_attributes o apfst Binding.name) axpairs);
  162.24  
  162.25 -  val ctxt1 = ProofContext.init_global thy1;
  162.26 +  val ctxt1 = Proof_Context.init_global thy1;
  162.27  
  162.28  
  162.29    (*fetch fp definitions from the theory*)
  162.30 @@ -260,7 +260,7 @@
  162.31        THEN (PRIMITIVE (fold_rule part_rec_defs));
  162.32  
  162.33    (*Elimination*)
  162.34 -  val elim = rule_by_tactic (ProofContext.init_global thy1) basic_elim_tac
  162.35 +  val elim = rule_by_tactic (Proof_Context.init_global thy1) basic_elim_tac
  162.36                   (unfold RS Ind_Syntax.equals_CollectD)
  162.37  
  162.38    (*Applies freeness of the given constructors, which *must* be unfolded by
  162.39 @@ -553,7 +553,7 @@
  162.40  fun add_inductive (srec_tms, sdom_sum) intr_srcs
  162.41      (raw_monos, raw_con_defs, raw_type_intrs, raw_type_elims) thy =
  162.42    let
  162.43 -    val ctxt = ProofContext.init_global thy;
  162.44 +    val ctxt = Proof_Context.init_global thy;
  162.45      val read_terms = map (Syntax.parse_term ctxt #> Type.constraint Ind_Syntax.iT)
  162.46        #> Syntax.check_terms ctxt;
  162.47