tuned signature -- prefer qualified names;
authorwenzelm
Wed Mar 04 19:53:18 2015 +0100 (2015-03-04)
changeset 595820fbed69ff081
parent 59580 cbc38731d42f
child 59583 3c94c44dfc0f
tuned signature -- prefer qualified names;
NEWS
src/CCL/Wfd.thy
src/Doc/Isar_Ref/Generic.thy
src/FOL/simpdata.ML
src/FOLP/simp.ML
src/FOLP/simpdata.ML
src/HOL/Decision_Procs/Approximation.thy
src/HOL/Decision_Procs/Dense_Linear_Order.thy
src/HOL/Decision_Procs/MIR.thy
src/HOL/Decision_Procs/Parametric_Ferrante_Rackoff.thy
src/HOL/Decision_Procs/approximation.ML
src/HOL/Decision_Procs/approximation_generator.ML
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/ferrante_rackoff.ML
src/HOL/Decision_Procs/langford.ML
src/HOL/Decision_Procs/mir_tac.ML
src/HOL/Enum.thy
src/HOL/HOL.thy
src/HOL/HOLCF/Cfun.thy
src/HOL/HOLCF/Tools/Domain/domain_constructors.ML
src/HOL/HOLCF/Tools/cont_proc.ML
src/HOL/HOLCF/Tools/fixrec.ML
src/HOL/Import/import_data.ML
src/HOL/Import/import_rule.ML
src/HOL/Int.thy
src/HOL/Library/Code_Abstract_Nat.thy
src/HOL/Library/Countable.thy
src/HOL/Library/Extended_Nat.thy
src/HOL/Library/Reflection.thy
src/HOL/Library/Sum_of_Squares/positivstellensatz_tools.ML
src/HOL/Library/Sum_of_Squares/sum_of_squares.ML
src/HOL/Library/positivstellensatz.ML
src/HOL/Library/refute.ML
src/HOL/Library/simps_case_conv.ML
src/HOL/List.thy
src/HOL/Matrix_LP/ComputeHOL.thy
src/HOL/Matrix_LP/Compute_Oracle/compute.ML
src/HOL/Matrix_LP/Compute_Oracle/linker.ML
src/HOL/Matrix_LP/matrixlp.ML
src/HOL/Mirabelle/Tools/mirabelle_sledgehammer.ML
src/HOL/Multivariate_Analysis/normarith.ML
src/HOL/Mutabelle/mutabelle_extra.ML
src/HOL/NSA/HyperDef.thy
src/HOL/NSA/NSA.thy
src/HOL/NSA/transfer.ML
src/HOL/Nat.thy
src/HOL/Nitpick_Examples/Mono_Nits.thy
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_permeq.ML
src/HOL/Nominal/nominal_primrec.ML
src/HOL/Nominal/nominal_thmdecls.ML
src/HOL/Orderings.thy
src/HOL/Probability/Giry_Monad.thy
src/HOL/Probability/measurable.ML
src/HOL/Product_Type.thy
src/HOL/Prolog/prolog.ML
src/HOL/Proofs/Lambda/WeakNorm.thy
src/HOL/Statespace/distinct_tree_prover.ML
src/HOL/Statespace/state_fun.ML
src/HOL/Statespace/state_space.ML
src/HOL/TLA/Action.thy
src/HOL/TLA/Intensional.thy
src/HOL/TLA/TLA.thy
src/HOL/TPTP/TPTP_Parser/tptp_reconstruct.ML
src/HOL/TPTP/TPTP_Parser/tptp_reconstruct_library.ML
src/HOL/TPTP/TPTP_Proof_Reconstruction.thy
src/HOL/TPTP/atp_theory_export.ML
src/HOL/TPTP/mash_export.ML
src/HOL/Tools/ATP/atp_problem_generate.ML
src/HOL/Tools/ATP/atp_proof_reconstruct.ML
src/HOL/Tools/ATP/atp_util.ML
src/HOL/Tools/ATP/atp_waldmeister.ML
src/HOL/Tools/BNF/bnf_fp_def_sugar.ML
src/HOL/Tools/BNF/bnf_fp_def_sugar_tactics.ML
src/HOL/Tools/BNF/bnf_fp_util.ML
src/HOL/Tools/BNF/bnf_gfp_rec_sugar.ML
src/HOL/Tools/BNF/bnf_gfp_rec_sugar_tactics.ML
src/HOL/Tools/BNF/bnf_lfp_size.ML
src/HOL/Tools/BNF/bnf_tactics.ML
src/HOL/Tools/Ctr_Sugar/ctr_sugar.ML
src/HOL/Tools/Ctr_Sugar/ctr_sugar_code.ML
src/HOL/Tools/Ctr_Sugar/ctr_sugar_util.ML
src/HOL/Tools/Function/fun_cases.ML
src/HOL/Tools/Function/function.ML
src/HOL/Tools/Function/function_common.ML
src/HOL/Tools/Function/function_context_tree.ML
src/HOL/Tools/Function/function_core.ML
src/HOL/Tools/Function/function_elims.ML
src/HOL/Tools/Function/function_lib.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/relation.ML
src/HOL/Tools/Function/scnp_reconstruct.ML
src/HOL/Tools/Function/termination.ML
src/HOL/Tools/Lifting/lifting_bnf.ML
src/HOL/Tools/Lifting/lifting_def.ML
src/HOL/Tools/Lifting/lifting_info.ML
src/HOL/Tools/Lifting/lifting_setup.ML
src/HOL/Tools/Lifting/lifting_term.ML
src/HOL/Tools/Lifting/lifting_util.ML
src/HOL/Tools/Meson/meson.ML
src/HOL/Tools/Meson/meson_clausify.ML
src/HOL/Tools/Metis/metis_generate.ML
src/HOL/Tools/Metis/metis_reconstruct.ML
src/HOL/Tools/Metis/metis_tactic.ML
src/HOL/Tools/Nitpick/nitpick.ML
src/HOL/Tools/Nitpick/nitpick_hol.ML
src/HOL/Tools/Nitpick/nitpick_model.ML
src/HOL/Tools/Nitpick/nitpick_preproc.ML
src/HOL/Tools/Nitpick/nitpick_util.ML
src/HOL/Tools/Old_Datatype/old_datatype.ML
src/HOL/Tools/Old_Datatype/old_datatype_aux.ML
src/HOL/Tools/Old_Datatype/old_datatype_data.ML
src/HOL/Tools/Old_Datatype/old_rep_datatype.ML
src/HOL/Tools/Predicate_Compile/code_prolog.ML
src/HOL/Tools/Predicate_Compile/core_data.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_specialisation.ML
src/HOL/Tools/Qelim/cooper.ML
src/HOL/Tools/Qelim/qelim.ML
src/HOL/Tools/Quickcheck/find_unused_assms.ML
src/HOL/Tools/Quotient/quotient_def.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_type.ML
src/HOL/Tools/SMT/verit_proof_parse.ML
src/HOL/Tools/SMT/z3_replay.ML
src/HOL/Tools/Sledgehammer/sledgehammer.ML
src/HOL/Tools/Sledgehammer/sledgehammer_fact.ML
src/HOL/Tools/Sledgehammer/sledgehammer_mash.ML
src/HOL/Tools/Sledgehammer/sledgehammer_mepo.ML
src/HOL/Tools/Sledgehammer/sledgehammer_prover_atp.ML
src/HOL/Tools/Sledgehammer/sledgehammer_util.ML
src/HOL/Tools/TFL/dcterm.ML
src/HOL/Tools/TFL/post.ML
src/HOL/Tools/TFL/rules.ML
src/HOL/Tools/Transfer/transfer.ML
src/HOL/Tools/Transfer/transfer_bnf.ML
src/HOL/Tools/choice_specification.ML
src/HOL/Tools/cnf.ML
src/HOL/Tools/coinduction.ML
src/HOL/Tools/datatype_realizer.ML
src/HOL/Tools/groebner.ML
src/HOL/Tools/inductive.ML
src/HOL/Tools/inductive_realizer.ML
src/HOL/Tools/inductive_set.ML
src/HOL/Tools/int_arith.ML
src/HOL/Tools/legacy_transfer.ML
src/HOL/Tools/lin_arith.ML
src/HOL/Tools/nat_numeral_simprocs.ML
src/HOL/Tools/numeral_simprocs.ML
src/HOL/Tools/record.ML
src/HOL/Tools/reification.ML
src/HOL/Tools/sat.ML
src/HOL/Tools/semiring_normalizer.ML
src/HOL/Tools/set_comprehension_pointfree.ML
src/HOL/Tools/simpdata.ML
src/HOL/Tools/split_rule.ML
src/HOL/Tools/try0.ML
src/HOL/Topological_Spaces.thy
src/HOL/Word/WordBitwise.thy
src/Provers/Arith/cancel_div_mod.ML
src/Provers/Arith/fast_lin_arith.ML
src/Provers/clasimp.ML
src/Provers/classical.ML
src/Provers/hypsubst.ML
src/Provers/order.ML
src/Provers/quantifier1.ML
src/Provers/splitter.ML
src/Provers/trancl.ML
src/Pure/Isar/expression.ML
src/Pure/Isar/proof.ML
src/Pure/Isar/rule_cases.ML
src/Pure/Isar/runtime.ML
src/Pure/Proof/extraction.ML
src/Pure/Proof/proof_checker.ML
src/Pure/Proof/proof_rewrite_rules.ML
src/Pure/Proof/proof_syntax.ML
src/Pure/Tools/rule_insts.ML
src/Pure/axclass.ML
src/Pure/drule.ML
src/Pure/goal.ML
src/Pure/more_thm.ML
src/Pure/raw_simplifier.ML
src/Pure/search.ML
src/Pure/tactic.ML
src/Pure/tactical.ML
src/Pure/thm.ML
src/Sequents/modal.ML
src/Sequents/prover.ML
src/Sequents/simpdata.ML
src/Tools/Code/code_preproc.ML
src/Tools/IsaPlanner/isand.ML
src/Tools/atomize_elim.ML
src/Tools/coherent.ML
src/Tools/induct.ML
src/Tools/induction.ML
src/Tools/misc_legacy.ML
src/Tools/nbe.ML
src/Tools/quickcheck.ML
src/Tools/try.ML
src/ZF/Tools/datatype_package.ML
src/ZF/Tools/induct_tacs.ML
src/ZF/Tools/inductive_package.ML
src/ZF/Tools/primrec_package.ML
src/ZF/arith_data.ML
src/ZF/simpdata.ML
     1.1 --- a/NEWS	Tue Mar 03 19:08:04 2015 +0100
     1.2 +++ b/NEWS	Wed Mar 04 19:53:18 2015 +0100
     1.3 @@ -258,6 +258,10 @@
     1.4  
     1.5  *** ML ***
     1.6  
     1.7 +* Elementary operations in module Thm are no longer pervasive.
     1.8 +INCOMPATIBILITY, need to use qualified Thm.prop_of, Thm.cterm_of,
     1.9 +Thm.term_of etc.
    1.10 +
    1.11  * Former combinators NAMED_CRITICAL and CRITICAL for central critical
    1.12  sections have been discontinued, in favour of the more elementary
    1.13  Multithreading.synchronized and its high-level derivative
     2.1 --- a/src/CCL/Wfd.thy	Tue Mar 03 19:08:04 2015 +0100
     2.2 +++ b/src/CCL/Wfd.thy	Wed Mar 04 19:53:18 2015 +0100
     2.3 @@ -423,9 +423,9 @@
     2.4    | get_bno l n (Bound m) = (m-length(l),n)
     2.5  
     2.6  (* Not a great way of identifying induction hypothesis! *)
     2.7 -fun could_IH x = Term.could_unify(x,hd (prems_of @{thm rcallT})) orelse
     2.8 -                 Term.could_unify(x,hd (prems_of @{thm rcall2T})) orelse
     2.9 -                 Term.could_unify(x,hd (prems_of @{thm rcall3T}))
    2.10 +fun could_IH x = Term.could_unify(x,hd (Thm.prems_of @{thm rcallT})) orelse
    2.11 +                 Term.could_unify(x,hd (Thm.prems_of @{thm rcall2T})) orelse
    2.12 +                 Term.could_unify(x,hd (Thm.prems_of @{thm rcall3T}))
    2.13  
    2.14  fun IHinst tac rls = SUBGOAL (fn (Bi,i) =>
    2.15    let val bvs = bvars Bi []
     3.1 --- a/src/Doc/Isar_Ref/Generic.thy	Tue Mar 03 19:08:04 2015 +0100
     3.2 +++ b/src/Doc/Isar_Ref/Generic.thy	Wed Mar 04 19:53:18 2015 +0100
     3.3 @@ -999,7 +999,7 @@
     3.4  
     3.5  simproc_setup unit ("x::unit") = \<open>
     3.6    fn _ => fn _ => fn ct =>
     3.7 -    if HOLogic.is_unit (term_of ct) then NONE
     3.8 +    if HOLogic.is_unit (Thm.term_of ct) then NONE
     3.9      else SOME (mk_meta_eq @{thm unit_eq})
    3.10  \<close>
    3.11  
     4.1 --- a/src/FOL/simpdata.ML	Tue Mar 03 19:08:04 2015 +0100
     4.2 +++ b/src/FOL/simpdata.ML	Wed Mar 04 19:53:18 2015 +0100
     4.3 @@ -7,18 +7,19 @@
     4.4  
     4.5  (*Make meta-equalities.  The operator below is Trueprop*)
     4.6  
     4.7 -fun mk_meta_eq th = case concl_of th of
     4.8 +fun mk_meta_eq th =
     4.9 +  (case Thm.concl_of th of
    4.10      _ $ (Const(@{const_name eq},_)$_$_)   => th RS @{thm eq_reflection}
    4.11    | _ $ (Const(@{const_name iff},_)$_$_) => th RS @{thm iff_reflection}
    4.12 -  | _                           =>
    4.13 -  error("conclusion must be a =-equality or <->");;
    4.14 +  | _ => error "conclusion must be a =-equality or <->");
    4.15  
    4.16 -fun mk_eq th = case concl_of th of
    4.17 +fun mk_eq th =
    4.18 +  (case Thm.concl_of th of
    4.19      Const(@{const_name Pure.eq},_)$_$_ => th
    4.20    | _ $ (Const(@{const_name eq},_)$_$_)   => mk_meta_eq th
    4.21    | _ $ (Const(@{const_name iff},_)$_$_) => mk_meta_eq th
    4.22    | _ $ (Const(@{const_name Not},_)$_)      => th RS @{thm iff_reflection_F}
    4.23 -  | _                           => th RS @{thm iff_reflection_T};
    4.24 +  | _  => th RS @{thm iff_reflection_T});
    4.25  
    4.26  (*Replace premises x=y, X<->Y by X==Y*)
    4.27  fun mk_meta_prems ctxt =
    4.28 @@ -36,16 +37,17 @@
    4.29     (@{const_name All}, [@{thm spec}]), (@{const_name True}, []), (@{const_name False}, [])];
    4.30  
    4.31  fun mk_atomize pairs =
    4.32 -  let fun atoms th =
    4.33 -        (case concl_of th of
    4.34 -           Const(@{const_name Trueprop},_) $ p =>
    4.35 -             (case head_of p of
    4.36 -                Const(a,_) =>
    4.37 -                  (case AList.lookup (op =) pairs a of
    4.38 -                     SOME(rls) => maps atoms ([th] RL rls)
    4.39 -                   | NONE => [th])
    4.40 -              | _ => [th])
    4.41 -         | _ => [th])
    4.42 +  let
    4.43 +    fun atoms th =
    4.44 +      (case Thm.concl_of th of
    4.45 +         Const(@{const_name Trueprop},_) $ p =>
    4.46 +           (case head_of p of
    4.47 +              Const(a,_) =>
    4.48 +                (case AList.lookup (op =) pairs a of
    4.49 +                   SOME(rls) => maps atoms ([th] RL rls)
    4.50 +                 | NONE => [th])
    4.51 +            | _ => [th])
    4.52 +       | _ => [th])
    4.53    in atoms end;
    4.54  
    4.55  fun mksimps pairs (_: Proof.context) = map mk_eq o mk_atomize pairs o gen_all;
     5.1 --- a/src/FOLP/simp.ML	Tue Mar 03 19:08:04 2015 +0100
     5.2 +++ b/src/FOLP/simp.ML	Wed Mar 04 19:53:18 2015 +0100
     5.3 @@ -67,7 +67,7 @@
     5.4  
     5.5  (*insert a thm in a discrimination net by its lhs*)
     5.6  fun lhs_insert_thm th net =
     5.7 -    Net.insert_term eq_brl (lhs_of (concl_of th), (false,th)) net
     5.8 +    Net.insert_term eq_brl (lhs_of (Thm.concl_of th), (false,th)) net
     5.9      handle  Net.INSERT => net;
    5.10  
    5.11  (*match subgoal i against possible theorems in the net.
    5.12 @@ -83,7 +83,7 @@
    5.13            biresolve0_tac (Net.unify_term net
    5.14                         (lhs_of (Logic.strip_assums_concl prem))) i);
    5.15  
    5.16 -fun nth_subgoal i thm = nth (prems_of thm) (i - 1);
    5.17 +fun nth_subgoal i thm = nth (Thm.prems_of thm) (i - 1);
    5.18  
    5.19  fun goal_concl i thm = Logic.strip_assums_concl (nth_subgoal i thm);
    5.20  
    5.21 @@ -111,7 +111,7 @@
    5.22  (*Get the norm constants from norm_thms*)
    5.23  val norms =
    5.24    let fun norm thm =
    5.25 -      case lhs_of(concl_of thm) of
    5.26 +      case lhs_of (Thm.concl_of thm) of
    5.27            Const(n,_)$_ => n
    5.28          | _ => error "No constant in lhs of a norm_thm"
    5.29    in map norm normE_thms end;
    5.30 @@ -145,7 +145,7 @@
    5.31  
    5.32  (*get name of the constant from conclusion of a congruence rule*)
    5.33  fun cong_const cong =
    5.34 -    case head_of (lhs_of (concl_of cong)) of
    5.35 +    case head_of (lhs_of (Thm.concl_of cong)) of
    5.36          Const(c,_) => c
    5.37        | _ => ""                 (*a placeholder distinct from const names*);
    5.38  
    5.39 @@ -189,10 +189,10 @@
    5.40  fun add_norms(congs,ccs,new_asms) thm =
    5.41  let val thm' = mk_trans2 thm;
    5.42  (* thm': [?z -> l; Prems; r -> ?t] ==> ?z -> ?t *)
    5.43 -    val nops = nprems_of thm'
    5.44 +    val nops = Thm.nprems_of thm'
    5.45      val lhs = rhs_of_eq 1 thm'
    5.46      val rhs = lhs_of_eq nops thm'
    5.47 -    val asms = tl(rev(tl(prems_of thm')))
    5.48 +    val asms = tl(rev(tl(Thm.prems_of thm')))
    5.49      val hvars = fold_rev (add_hidden_vars ccs) (lhs::rhs::asms) []
    5.50      val hvars = add_new_asm_vars new_asms (rhs,hvars)
    5.51      fun it_asms asm hvars =
    5.52 @@ -216,7 +216,7 @@
    5.53  fun add_norm_tags congs =
    5.54      let val ccs = map cong_const congs
    5.55          val new_asms = filter (exists not o #2)
    5.56 -                (ccs ~~ (map (map atomic o prems_of) congs));
    5.57 +                (ccs ~~ (map (map atomic o Thm.prems_of) congs));
    5.58      in add_norms(congs,ccs,new_asms) end;
    5.59  
    5.60  fun normed_rews congs =
    5.61 @@ -252,7 +252,7 @@
    5.62  
    5.63  (*insert a thm in a thm net*)
    5.64  fun insert_thm_warn th net =
    5.65 -  Net.insert_term Thm.eq_thm_prop (concl_of th, th) net
    5.66 +  Net.insert_term Thm.eq_thm_prop (Thm.concl_of th, th) net
    5.67    handle Net.INSERT =>
    5.68      (writeln ("Duplicate rewrite or congruence rule:\n" ^
    5.69          Display.string_of_thm_without_context th); net);
    5.70 @@ -278,7 +278,7 @@
    5.71  
    5.72  (*delete a thm from a thm net*)
    5.73  fun delete_thm_warn th net =
    5.74 -  Net.delete_term Thm.eq_thm_prop (concl_of th, th) net
    5.75 +  Net.delete_term Thm.eq_thm_prop (Thm.concl_of th, th) net
    5.76    handle Net.DELETE =>
    5.77      (writeln ("No such rewrite or congruence rule:\n" ^
    5.78          Display.string_of_thm_without_context th); net);
    5.79 @@ -348,7 +348,7 @@
    5.80                | seq_try([],_) thm = no_tac thm
    5.81          and try_rew thm = (seq_try(case_rews,case_consts) ORELSE one_subt) thm
    5.82          and one_subt thm =
    5.83 -                let val test = has_fewer_prems (nprems_of thm + 1)
    5.84 +                let val test = has_fewer_prems (Thm.nprems_of thm + 1)
    5.85                      fun loop thm =
    5.86                          COND test no_tac
    5.87                            ((try_rew THEN DEPTH_FIRST test (refl_tac i))
    5.88 @@ -424,8 +424,8 @@
    5.89      if lhs_is_NORM(thm,i) then (ss, res1(thm,trans_norms,i), anet,ats,cs)
    5.90      else case Seq.pull(cong_tac i thm) of
    5.91              SOME(thm',_) =>
    5.92 -                    let val ps = prems_of thm
    5.93 -                        and ps' = prems_of thm';
    5.94 +                    let val ps = Thm.prems_of thm
    5.95 +                        and ps' = Thm.prems_of thm';
    5.96                          val n = length(ps')-length(ps);
    5.97                          val a = length(Logic.strip_assums_hyp(nth ps (i - 1)))
    5.98                          val l = map (length o Logic.strip_assums_hyp) (take n (drop (i-1) ps'));
    5.99 @@ -436,7 +436,7 @@
   5.100        are represented by rules, generalized over their parameters*)
   5.101  fun add_asms(ss,thm,a,anet,ats,cs) =
   5.102      let val As = strip_varify(nth_subgoal i thm, a, []);
   5.103 -        val thms = map (Thm.trivial o cterm_of(Thm.theory_of_thm thm)) As;
   5.104 +        val thms = map (Thm.trivial o Thm.cterm_of(Thm.theory_of_thm thm)) As;
   5.105          val new_rws = maps mk_rew_rules thms;
   5.106          val rwrls = map mk_trans (maps mk_rew_rules thms);
   5.107          val anet' = fold_rev lhs_insert_thm rwrls anet;
   5.108 @@ -449,7 +449,7 @@
   5.109  
   5.110  fun rew(seq,thm,ss,anet,ats,cs, more) = case Seq.pull seq of
   5.111        SOME(thm',seq') =>
   5.112 -            let val n = (nprems_of thm') - (nprems_of thm)
   5.113 +            let val n = (Thm.nprems_of thm') - (Thm.nprems_of thm)
   5.114              in pr_rew(i,n,thm,thm',more);
   5.115                 if n=0 then (SIMP_LHS::ss, thm', anet, ats, cs)
   5.116                 else ((replicate n PROVE) @ (POP_CS::SIMP_LHS::ss),
   5.117 @@ -499,7 +499,7 @@
   5.118  let val cong_tac = net_tac cong_net
   5.119  in fn i =>
   5.120      (fn thm =>
   5.121 -     if i <= 0 orelse nprems_of thm < i then Seq.empty
   5.122 +     if i <= 0 orelse Thm.nprems_of thm < i then Seq.empty
   5.123       else Seq.single(execute(ss,fl,auto_tac,cong_tac,simp_net,i,thm)))
   5.124      THEN TRY(auto_tac i)
   5.125  end;
   5.126 @@ -547,8 +547,8 @@
   5.127  
   5.128  fun find_subst sg T =
   5.129  let fun find (thm::thms) =
   5.130 -        let val (Const(_,cT), va, vb) = dest_red(hd(prems_of thm));
   5.131 -            val [P] = subtract (op =) [va, vb] (Misc_Legacy.add_term_vars (concl_of thm, []));
   5.132 +        let val (Const(_,cT), va, vb) = dest_red(hd(Thm.prems_of thm));
   5.133 +            val [P] = subtract (op =) [va, vb] (Misc_Legacy.add_term_vars (Thm.concl_of thm, []));
   5.134              val eqT::_ = binder_types cT
   5.135          in if Sign.typ_instance sg (T,eqT) then SOME(thm,va,vb,P)
   5.136             else find thms
   5.137 @@ -559,12 +559,12 @@
   5.138  fun mk_cong sg (f,aTs,rT) (refl,eq) =
   5.139  let val k = length aTs;
   5.140      fun ri((subst,va as Var(_,Ta),vb as Var(_,Tb),P),i,si,T,yik) =
   5.141 -        let val ca = cterm_of sg va
   5.142 -            and cx = cterm_of sg (eta_Var(("X"^si,0),T))
   5.143 -            val cb = cterm_of sg vb
   5.144 -            and cy = cterm_of sg (eta_Var(("Y"^si,0),T))
   5.145 -            val cP = cterm_of sg P
   5.146 -            and cp = cterm_of sg (Pinst(f,rT,eq,k,i,T,yik,aTs))
   5.147 +        let val ca = Thm.cterm_of sg va
   5.148 +            and cx = Thm.cterm_of sg (eta_Var(("X"^si,0),T))
   5.149 +            val cb = Thm.cterm_of sg vb
   5.150 +            and cy = Thm.cterm_of sg (eta_Var(("Y"^si,0),T))
   5.151 +            val cP = Thm.cterm_of sg P
   5.152 +            and cp = Thm.cterm_of sg (Pinst(f,rT,eq,k,i,T,yik,aTs))
   5.153          in cterm_instantiate [(ca,cx),(cb,cy),(cP,cp)] subst end;
   5.154      fun mk(c,T::Ts,i,yik) =
   5.155          let val si = radixstring(26,"a",i)
   5.156 @@ -579,7 +579,7 @@
   5.157  fun mk_cong_type sg (f,T) =
   5.158  let val (aTs,rT) = strip_type T;
   5.159      fun find_refl(r::rs) =
   5.160 -        let val (Const(eq,eqT),_,_) = dest_red(concl_of r)
   5.161 +        let val (Const(eq,eqT),_,_) = dest_red(Thm.concl_of r)
   5.162          in if Sign.typ_instance sg (rT, hd(binder_types eqT))
   5.163             then SOME(r,(eq,body_type eqT)) else find_refl rs
   5.164          end
     6.1 --- a/src/FOLP/simpdata.ML	Tue Mar 03 19:08:04 2015 +0100
     6.2 +++ b/src/FOLP/simpdata.ML	Wed Mar 04 19:53:18 2015 +0100
     6.3 @@ -16,7 +16,7 @@
     6.4  
     6.5  (* Conversion into rewrite rules *)
     6.6  
     6.7 -fun mk_eq th = case concl_of th of
     6.8 +fun mk_eq th = case Thm.concl_of th of
     6.9        _ $ (Const (@{const_name iff}, _) $ _ $ _) $ _ => th
    6.10      | _ $ (Const (@{const_name eq}, _) $ _ $ _) $ _ => th
    6.11      | _ $ (Const (@{const_name Not}, _) $ _) $ _ => th RS @{thm not_P_imp_P_iff_F}
    6.12 @@ -32,7 +32,7 @@
    6.13  
    6.14  fun mk_atomize pairs =
    6.15    let fun atoms th =
    6.16 -        (case concl_of th of
    6.17 +        (case Thm.concl_of th of
    6.18             Const ("Trueprop", _) $ p =>
    6.19               (case head_of p of
    6.20                  Const(a,_) =>
     7.1 --- a/src/HOL/Decision_Procs/Approximation.thy	Tue Mar 03 19:08:04 2015 +0100
     7.2 +++ b/src/HOL/Decision_Procs/Approximation.thy	Wed Mar 04 19:53:18 2015 +0100
     7.3 @@ -3597,11 +3597,11 @@
     7.4          | variable_of_bound t = raise TERM ("variable_of_bound", [t])
     7.5  
     7.6        val variable_bounds
     7.7 -        = map (` (variable_of_bound o prop_of)) prems
     7.8 +        = map (`(variable_of_bound o Thm.prop_of)) prems
     7.9  
    7.10        fun add_deps (name, bnds)
    7.11          = Graph.add_deps_acyclic (name,
    7.12 -            remove (op =) name (Term.add_free_names (prop_of bnds) []))
    7.13 +            remove (op =) name (Term.add_free_names (Thm.prop_of bnds) []))
    7.14  
    7.15        val order = Graph.empty
    7.16                    |> fold Graph.new_node variable_bounds
    7.17 @@ -3634,7 +3634,7 @@
    7.18          = case AList.lookup (op =) splitting name
    7.19            of SOME s => HOLogic.mk_number @{typ nat} s
    7.20             | NONE => @{term "0 :: nat"}
    7.21 -      val vs = nth (prems_of st) (i - 1)
    7.22 +      val vs = nth (Thm.prems_of st) (i - 1)
    7.23                 |> Logic.strip_imp_concl
    7.24                 |> HOLogic.dest_Trueprop
    7.25                 |> Term.strip_comb |> snd |> List.last
    7.26 @@ -3659,7 +3659,9 @@
    7.27            THEN simp_tac (put_simpset (simpset_of @{context}) ctxt) i) st
    7.28         end
    7.29  
    7.30 -     | SOME t => if length vs <> 1 then raise (TERM ("More than one variable used for taylor series expansion", [prop_of st]))
    7.31 +     | SOME t =>
    7.32 +       if length vs <> 1
    7.33 +       then raise (TERM ("More than one variable used for taylor series expansion", [Thm.prop_of st]))
    7.34         else let
    7.35           val t = t
    7.36                |> HOLogic.mk_number @{typ nat}
     8.1 --- a/src/HOL/Decision_Procs/Dense_Linear_Order.thy	Tue Mar 03 19:08:04 2015 +0100
     8.2 +++ b/src/HOL/Decision_Procs/Dense_Linear_Order.thy	Wed Mar 04 19:53:18 2015 +0100
     8.3 @@ -558,20 +558,20 @@
     8.4      let
     8.5        val [lt, le] = map (Morphism.term phi) [@{term "op \<sqsubset>"}, @{term "op \<sqsubseteq>"}]
     8.6        fun h x t =
     8.7 -        case term_of t of
     8.8 +        case Thm.term_of t of
     8.9            Const(@{const_name HOL.eq}, _)$y$z =>
    8.10 -            if term_of x aconv y then Ferrante_Rackoff_Data.Eq
    8.11 +            if Thm.term_of x aconv y then Ferrante_Rackoff_Data.Eq
    8.12              else Ferrante_Rackoff_Data.Nox
    8.13         | @{term "Not"}$(Const(@{const_name HOL.eq}, _)$y$z) =>
    8.14 -            if term_of x aconv y then Ferrante_Rackoff_Data.NEq
    8.15 +            if Thm.term_of x aconv y then Ferrante_Rackoff_Data.NEq
    8.16              else Ferrante_Rackoff_Data.Nox
    8.17         | b$y$z => if Term.could_unify (b, lt) then
    8.18 -                     if term_of x aconv y then Ferrante_Rackoff_Data.Lt
    8.19 -                     else if term_of x aconv z then Ferrante_Rackoff_Data.Gt
    8.20 +                     if Thm.term_of x aconv y then Ferrante_Rackoff_Data.Lt
    8.21 +                     else if Thm.term_of x aconv z then Ferrante_Rackoff_Data.Gt
    8.22                       else Ferrante_Rackoff_Data.Nox
    8.23                   else if Term.could_unify (b, le) then
    8.24 -                     if term_of x aconv y then Ferrante_Rackoff_Data.Le
    8.25 -                     else if term_of x aconv z then Ferrante_Rackoff_Data.Ge
    8.26 +                     if Thm.term_of x aconv y then Ferrante_Rackoff_Data.Le
    8.27 +                     else if Thm.term_of x aconv z then Ferrante_Rackoff_Data.Ge
    8.28                       else Ferrante_Rackoff_Data.Nox
    8.29                   else Ferrante_Rackoff_Data.Nox
    8.30         | _ => Ferrante_Rackoff_Data.Nox
    8.31 @@ -709,7 +709,7 @@
    8.32          if h aconvc y then false else if h aconvc x then true else earlier t x y;
    8.33  
    8.34  fun dest_frac ct =
    8.35 -  case term_of ct of
    8.36 +  case Thm.term_of ct of
    8.37      Const (@{const_name Fields.divide},_) $ a $ b=>
    8.38        Rat.rat_of_quotient (snd (HOLogic.dest_number a), snd (HOLogic.dest_number b))
    8.39    | Const(@{const_name inverse}, _)$a => Rat.rat_of_quotient(1, HOLogic.dest_number a |> snd)
    8.40 @@ -724,21 +724,21 @@
    8.41           (Numeral.mk_cnumber cT b)
    8.42   end
    8.43  
    8.44 -fun whatis x ct = case term_of ct of
    8.45 +fun whatis x ct = case Thm.term_of ct of
    8.46    Const(@{const_name Groups.plus}, _)$(Const(@{const_name Groups.times},_)$_$y)$_ =>
    8.47 -     if y aconv term_of x then ("c*x+t",[(funpow 2 Thm.dest_arg1) ct, Thm.dest_arg ct])
    8.48 +     if y aconv Thm.term_of x then ("c*x+t",[(funpow 2 Thm.dest_arg1) ct, Thm.dest_arg ct])
    8.49       else ("Nox",[])
    8.50  | Const(@{const_name Groups.plus}, _)$y$_ =>
    8.51 -     if y aconv term_of x then ("x+t",[Thm.dest_arg ct])
    8.52 +     if y aconv Thm.term_of x then ("x+t",[Thm.dest_arg ct])
    8.53       else ("Nox",[])
    8.54  | Const(@{const_name Groups.times}, _)$_$y =>
    8.55 -     if y aconv term_of x then ("c*x",[Thm.dest_arg1 ct])
    8.56 +     if y aconv Thm.term_of x then ("c*x",[Thm.dest_arg1 ct])
    8.57       else ("Nox",[])
    8.58 -| t => if t aconv term_of x then ("x",[]) else ("Nox",[]);
    8.59 +| t => if t aconv Thm.term_of x then ("x",[]) else ("Nox",[]);
    8.60  
    8.61  fun xnormalize_conv ctxt [] ct = Thm.reflexive ct
    8.62  | xnormalize_conv ctxt (vs as (x::_)) ct =
    8.63 -   case term_of ct of
    8.64 +   case Thm.term_of ct of
    8.65     Const(@{const_name Orderings.less},_)$_$Const(@{const_name Groups.zero},_) =>
    8.66      (case whatis x (Thm.dest_arg1 ct) of
    8.67      ("c*x+t",[c,t]) =>
    8.68 @@ -752,14 +752,14 @@
    8.69                    (if neg then Thm.apply (Thm.apply clt c) cz
    8.70                      else Thm.apply (Thm.apply clt cz) c))
    8.71          val cth = Thm.equal_elim (Thm.symmetric cthp) TrueI
    8.72 -        val th = Thm.implies_elim (instantiate' [SOME (ctyp_of_term x)] (map SOME [c,x,t])
    8.73 +        val th = Thm.implies_elim (instantiate' [SOME (Thm.ctyp_of_term x)] (map SOME [c,x,t])
    8.74               (if neg then @{thm neg_prod_sum_lt} else @{thm pos_prod_sum_lt})) cth
    8.75          val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
    8.76                     (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
    8.77        in rth end
    8.78      | ("x+t",[t]) =>
    8.79         let
    8.80 -        val T = ctyp_of_term x
    8.81 +        val T = Thm.ctyp_of_term x
    8.82          val th = instantiate' [SOME T] [SOME x, SOME t] @{thm "sum_lt"}
    8.83          val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
    8.84                (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
    8.85 @@ -775,7 +775,7 @@
    8.86                    (if neg then Thm.apply (Thm.apply clt c) cz
    8.87                      else Thm.apply (Thm.apply clt cz) c))
    8.88          val cth = Thm.equal_elim (Thm.symmetric cthp) TrueI
    8.89 -        val th = Thm.implies_elim (instantiate' [SOME (ctyp_of_term x)] (map SOME [c,x])
    8.90 +        val th = Thm.implies_elim (instantiate' [SOME (Thm.ctyp_of_term x)] (map SOME [c,x])
    8.91               (if neg then @{thm neg_prod_lt} else @{thm pos_prod_lt})) cth
    8.92          val rth = th
    8.93        in rth end
    8.94 @@ -786,7 +786,7 @@
    8.95     (case whatis x (Thm.dest_arg1 ct) of
    8.96      ("c*x+t",[c,t]) =>
    8.97         let
    8.98 -        val T = ctyp_of_term x
    8.99 +        val T = Thm.ctyp_of_term x
   8.100          val cr = dest_frac c
   8.101          val clt = Drule.cterm_rule (instantiate' [SOME T] []) @{cpat "op <"}
   8.102          val cz = Thm.dest_arg ct
   8.103 @@ -803,14 +803,14 @@
   8.104        in rth end
   8.105      | ("x+t",[t]) =>
   8.106         let
   8.107 -        val T = ctyp_of_term x
   8.108 +        val T = Thm.ctyp_of_term x
   8.109          val th = instantiate' [SOME T] [SOME x, SOME t] @{thm "sum_le"}
   8.110          val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   8.111                (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   8.112         in  rth end
   8.113      | ("c*x",[c]) =>
   8.114         let
   8.115 -        val T = ctyp_of_term x
   8.116 +        val T = Thm.ctyp_of_term x
   8.117          val cr = dest_frac c
   8.118          val clt = Drule.cterm_rule (instantiate' [SOME T] []) @{cpat "op <"}
   8.119          val cz = Thm.dest_arg ct
   8.120 @@ -820,7 +820,7 @@
   8.121                    (if neg then Thm.apply (Thm.apply clt c) cz
   8.122                      else Thm.apply (Thm.apply clt cz) c))
   8.123          val cth = Thm.equal_elim (Thm.symmetric cthp) TrueI
   8.124 -        val th = Thm.implies_elim (instantiate' [SOME (ctyp_of_term x)] (map SOME [c,x])
   8.125 +        val th = Thm.implies_elim (instantiate' [SOME (Thm.ctyp_of_term x)] (map SOME [c,x])
   8.126               (if neg then @{thm neg_prod_le} else @{thm pos_prod_le})) cth
   8.127          val rth = th
   8.128        in rth end
   8.129 @@ -830,7 +830,7 @@
   8.130     (case whatis x (Thm.dest_arg1 ct) of
   8.131      ("c*x+t",[c,t]) =>
   8.132         let
   8.133 -        val T = ctyp_of_term x
   8.134 +        val T = Thm.ctyp_of_term x
   8.135          val cr = dest_frac c
   8.136          val ceq = Thm.dest_fun2 ct
   8.137          val cz = Thm.dest_arg ct
   8.138 @@ -845,14 +845,14 @@
   8.139        in rth end
   8.140      | ("x+t",[t]) =>
   8.141         let
   8.142 -        val T = ctyp_of_term x
   8.143 +        val T = Thm.ctyp_of_term x
   8.144          val th = instantiate' [SOME T] [SOME x, SOME t] @{thm "sum_eq"}
   8.145          val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   8.146                (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   8.147         in  rth end
   8.148      | ("c*x",[c]) =>
   8.149         let
   8.150 -        val T = ctyp_of_term x
   8.151 +        val T = Thm.ctyp_of_term x
   8.152          val cr = dest_frac c
   8.153          val ceq = Thm.dest_fun2 ct
   8.154          val cz = Thm.dest_arg ct
   8.155 @@ -871,10 +871,10 @@
   8.156    val eq_iff_diff_eq_0 = mk_meta_eq @{thm "eq_iff_diff_eq_0"}
   8.157    val ss = simpset_of @{context}
   8.158  in
   8.159 -fun field_isolate_conv phi ctxt vs ct = case term_of ct of
   8.160 +fun field_isolate_conv phi ctxt vs ct = case Thm.term_of ct of
   8.161    Const(@{const_name Orderings.less},_)$a$b =>
   8.162     let val (ca,cb) = Thm.dest_binop ct
   8.163 -       val T = ctyp_of_term ca
   8.164 +       val T = Thm.ctyp_of_term ca
   8.165         val th = instantiate' [SOME T] [SOME ca, SOME cb] less_iff_diff_less_0
   8.166         val nth = Conv.fconv_rule
   8.167           (Conv.arg_conv (Conv.arg1_conv
   8.168 @@ -883,7 +883,7 @@
   8.169     in rth end
   8.170  | Const(@{const_name Orderings.less_eq},_)$a$b =>
   8.171     let val (ca,cb) = Thm.dest_binop ct
   8.172 -       val T = ctyp_of_term ca
   8.173 +       val T = Thm.ctyp_of_term ca
   8.174         val th = instantiate' [SOME T] [SOME ca, SOME cb] le_iff_diff_le_0
   8.175         val nth = Conv.fconv_rule
   8.176           (Conv.arg_conv (Conv.arg1_conv
   8.177 @@ -893,7 +893,7 @@
   8.178  
   8.179  | Const(@{const_name HOL.eq},_)$a$b =>
   8.180     let val (ca,cb) = Thm.dest_binop ct
   8.181 -       val T = ctyp_of_term ca
   8.182 +       val T = Thm.ctyp_of_term ca
   8.183         val th = instantiate' [SOME T] [SOME ca, SOME cb] eq_iff_diff_eq_0
   8.184         val nth = Conv.fconv_rule
   8.185           (Conv.arg_conv (Conv.arg1_conv
   8.186 @@ -907,19 +907,21 @@
   8.187  fun classfield_whatis phi =
   8.188   let
   8.189    fun h x t =
   8.190 -   case term_of t of
   8.191 -     Const(@{const_name HOL.eq}, _)$y$z => if term_of x aconv y then Ferrante_Rackoff_Data.Eq
   8.192 -                            else Ferrante_Rackoff_Data.Nox
   8.193 -   | @{term "Not"}$(Const(@{const_name HOL.eq}, _)$y$z) => if term_of x aconv y then Ferrante_Rackoff_Data.NEq
   8.194 -                            else Ferrante_Rackoff_Data.Nox
   8.195 +   case Thm.term_of t of
   8.196 +     Const(@{const_name HOL.eq}, _)$y$z =>
   8.197 +      if Thm.term_of x aconv y then Ferrante_Rackoff_Data.Eq
   8.198 +      else Ferrante_Rackoff_Data.Nox
   8.199 +   | @{term "Not"}$(Const(@{const_name HOL.eq}, _)$y$z) =>
   8.200 +      if Thm.term_of x aconv y then Ferrante_Rackoff_Data.NEq
   8.201 +      else Ferrante_Rackoff_Data.Nox
   8.202     | Const(@{const_name Orderings.less},_)$y$z =>
   8.203 -       if term_of x aconv y then Ferrante_Rackoff_Data.Lt
   8.204 -        else if term_of x aconv z then Ferrante_Rackoff_Data.Gt
   8.205 -        else Ferrante_Rackoff_Data.Nox
   8.206 +       if Thm.term_of x aconv y then Ferrante_Rackoff_Data.Lt
   8.207 +       else if Thm.term_of x aconv z then Ferrante_Rackoff_Data.Gt
   8.208 +       else Ferrante_Rackoff_Data.Nox
   8.209     | Const (@{const_name Orderings.less_eq},_)$y$z =>
   8.210 -         if term_of x aconv y then Ferrante_Rackoff_Data.Le
   8.211 -         else if term_of x aconv z then Ferrante_Rackoff_Data.Ge
   8.212 -         else Ferrante_Rackoff_Data.Nox
   8.213 +       if Thm.term_of x aconv y then Ferrante_Rackoff_Data.Le
   8.214 +       else if Thm.term_of x aconv z then Ferrante_Rackoff_Data.Ge
   8.215 +       else Ferrante_Rackoff_Data.Nox
   8.216     | _ => Ferrante_Rackoff_Data.Nox
   8.217   in h end;
   8.218  fun class_field_ss phi =
     9.1 --- a/src/HOL/Decision_Procs/MIR.thy	Tue Mar 03 19:08:04 2015 +0100
     9.2 +++ b/src/HOL/Decision_Procs/MIR.thy	Wed Mar 04 19:53:18 2015 +0100
     9.3 @@ -5655,7 +5655,7 @@
     9.4      val vs = map_index swap fs;
     9.5      val qe = if proofs then @{code mirlfrqe} else @{code mircfrqe};
     9.6      val t' = (term_of_fm vs o qe o fm_of_term vs) t;
     9.7 -  in (cterm_of thy o HOLogic.mk_Trueprop o HOLogic.mk_eq) (t, t') end
     9.8 +  in (Thm.cterm_of thy o HOLogic.mk_Trueprop o HOLogic.mk_eq) (t, t') end
     9.9  end;
    9.10  *}
    9.11  
    10.1 --- a/src/HOL/Decision_Procs/Parametric_Ferrante_Rackoff.thy	Tue Mar 03 19:08:04 2015 +0100
    10.2 +++ b/src/HOL/Decision_Procs/Parametric_Ferrante_Rackoff.thy	Wed Mar 04 19:53:18 2015 +0100
    10.3 @@ -4156,7 +4156,7 @@
    10.4  
    10.5    fn (ctxt, alternative, ty, ps, ct) =>
    10.6      Proof_Context.cterm_of ctxt
    10.7 -      (frpar_procedure alternative ty ps (term_of ct))
    10.8 +      (frpar_procedure alternative ty ps (Thm.term_of ct))
    10.9  
   10.10  end
   10.11  *}
    11.1 --- a/src/HOL/Decision_Procs/approximation.ML	Tue Mar 03 19:08:04 2015 +0100
    11.2 +++ b/src/HOL/Decision_Procs/approximation.ML	Wed Mar 04 19:53:18 2015 +0100
    11.3 @@ -95,7 +95,7 @@
    11.4    Proof_Context.cterm_of ctxt term
    11.5    |> Goal.init
    11.6    |> SINGLE tactic
    11.7 -  |> the |> prems_of |> hd
    11.8 +  |> the |> Thm.prems_of |> hd
    11.9  
   11.10  fun prepare_form ctxt term = apply_tactic ctxt term (
   11.11      REPEAT (FIRST' [etac @{thm intervalE}, etac @{thm meta_eqE}, rtac @{thm impI}] 1)
   11.12 @@ -122,7 +122,7 @@
   11.13  fun approx_arith prec ctxt t = realify t
   11.14       |> Proof_Context.cterm_of ctxt
   11.15       |> Reification.conv ctxt form_equations
   11.16 -     |> prop_of
   11.17 +     |> Thm.prop_of
   11.18       |> Logic.dest_equals |> snd
   11.19       |> dest_interpret |> fst
   11.20       |> mk_approx' prec
    12.1 --- a/src/HOL/Decision_Procs/approximation_generator.ML	Tue Mar 03 19:08:04 2015 +0100
    12.2 +++ b/src/HOL/Decision_Procs/approximation_generator.ML	Wed Mar 04 19:53:18 2015 +0100
    12.3 @@ -117,7 +117,7 @@
    12.4    }
    12.5  
    12.6  fun rewrite_with ctxt thms = Simplifier.rewrite (put_simpset HOL_basic_ss ctxt addsimps thms)
    12.7 -fun conv_term thy conv r = cterm_of thy r |> conv |> Thm.prop_of |> Logic.dest_equals |> snd
    12.8 +fun conv_term thy conv r = Thm.cterm_of thy r |> conv |> Thm.prop_of |> Logic.dest_equals |> snd
    12.9  
   12.10  fun approx_random ctxt prec eps frees e xs genuine_only size seed =
   12.11    let
    13.1 --- a/src/HOL/Decision_Procs/commutative_ring_tac.ML	Tue Mar 03 19:08:04 2015 +0100
    13.2 +++ b/src/HOL/Decision_Procs/commutative_ring_tac.ML	Wed Mar 04 19:53:18 2015 +0100
    13.3 @@ -78,10 +78,10 @@
    13.4          let
    13.5            val thy = Proof_Context.theory_of ctxt;
    13.6            val fs = Misc_Legacy.term_frees eq;
    13.7 -          val cvs = cterm_of thy (HOLogic.mk_list T fs);
    13.8 -          val clhs = cterm_of thy (reif_polex T fs lhs);
    13.9 -          val crhs = cterm_of thy (reif_polex T fs rhs);
   13.10 -          val ca = ctyp_of thy T;
   13.11 +          val cvs = Thm.cterm_of thy (HOLogic.mk_list T fs);
   13.12 +          val clhs = Thm.cterm_of thy (reif_polex T fs lhs);
   13.13 +          val crhs = Thm.cterm_of thy (reif_polex T fs rhs);
   13.14 +          val ca = Thm.ctyp_of thy T;
   13.15          in (ca, cvs, clhs, crhs) end
   13.16        else error ("reif_eq: not an equation over " ^ Syntax.string_of_sort ctxt cr_sort)
   13.17    | reif_eq _ _ = error "reif_eq: not an equation";
    14.1 --- a/src/HOL/Decision_Procs/cooper_tac.ML	Tue Mar 03 19:08:04 2015 +0100
    14.2 +++ b/src/HOL/Decision_Procs/cooper_tac.ML	Wed Mar 04 19:53:18 2015 +0100
    14.3 @@ -73,7 +73,7 @@
    14.4        |> fold Simplifier.add_cong @{thms conj_le_cong imp_le_cong}
    14.5      (* simp rules for elimination of abs *)
    14.6      val simpset3 = put_simpset HOL_basic_ss ctxt |> Splitter.add_split @{thm abs_split}
    14.7 -    val ct = cterm_of thy (HOLogic.mk_Trueprop t)
    14.8 +    val ct = Thm.cterm_of thy (HOLogic.mk_Trueprop t)
    14.9      (* Theorem for the nat --> int transformation *)
   14.10      val pre_thm = Seq.hd (EVERY
   14.11        [simp_tac mod_div_simpset 1, simp_tac simpset0 1,
   14.12 @@ -83,10 +83,10 @@
   14.13      fun assm_tac i = REPEAT_DETERM_N nh (assume_tac ctxt i)
   14.14      (* The result of the quantifier elimination *)
   14.15      val (th, tac) =
   14.16 -      (case (prop_of pre_thm) of
   14.17 +      (case Thm.prop_of pre_thm of
   14.18          Const (@{const_name Pure.imp}, _) $ (Const (@{const_name Trueprop}, _) $ t1) $ _ =>
   14.19            let
   14.20 -            val pth = linzqe_oracle (cterm_of thy (Envir.eta_long [] t1))
   14.21 +            val pth = linzqe_oracle (Thm.cterm_of thy (Envir.eta_long [] t1))
   14.22            in
   14.23              ((pth RS iffD2) RS pre_thm,
   14.24                assm_tac (i + 1) THEN (if q then I else TRY) (rtac TrueI i))
    15.1 --- a/src/HOL/Decision_Procs/ferrack_tac.ML	Tue Mar 03 19:08:04 2015 +0100
    15.2 +++ b/src/HOL/Decision_Procs/ferrack_tac.ML	Wed Mar 04 19:53:18 2015 +0100
    15.3 @@ -55,7 +55,7 @@
    15.4      val (t,np,nh) = prepare_for_linr q g
    15.5      (* Some simpsets for dealing with mod div abs and nat*)
    15.6      val simpset0 = put_simpset HOL_basic_ss ctxt addsimps comp_arith
    15.7 -    val ct = cterm_of thy (HOLogic.mk_Trueprop t)
    15.8 +    val ct = Thm.cterm_of thy (HOLogic.mk_Trueprop t)
    15.9      (* Theorem for the nat --> int transformation *)
   15.10     val pre_thm = Seq.hd (EVERY
   15.11        [simp_tac simpset0 1,
   15.12 @@ -63,7 +63,7 @@
   15.13        (Thm.trivial ct))
   15.14      fun assm_tac i = REPEAT_DETERM_N nh (assume_tac ctxt i)
   15.15      (* The result of the quantifier elimination *)
   15.16 -    val (th, tac) = case prop_of pre_thm of
   15.17 +    val (th, tac) = case Thm.prop_of pre_thm of
   15.18          Const (@{const_name Pure.imp}, _) $ (Const (@{const_name Trueprop}, _) $ t1) $ _ =>
   15.19      let val pth = linr_oracle (ctxt, Envir.eta_long [] t1)
   15.20      in 
    16.1 --- a/src/HOL/Decision_Procs/ferrante_rackoff.ML	Tue Mar 03 19:08:04 2015 +0100
    16.2 +++ b/src/HOL/Decision_Procs/ferrante_rackoff.ML	Wed Mar 04 19:53:18 2015 +0100
    16.3 @@ -25,14 +25,14 @@
    16.4  
    16.5  fun get_p1 th =
    16.6    funpow 2 (Thm.dest_arg o snd o Thm.dest_abs NONE)
    16.7 -    (funpow 2 Thm.dest_arg (cprop_of th)) |> Thm.dest_arg
    16.8 +    (funpow 2 Thm.dest_arg (Thm.cprop_of th)) |> Thm.dest_arg
    16.9  
   16.10  fun ferrack_conv ctxt
   16.11     (entr as ({minf = minf, pinf = pinf, nmi = nmi, npi = npi,
   16.12                ld = ld, qe = qe, atoms = atoms},
   16.13               {isolate_conv = icv, whatis = wi, simpset = simpset}):entry) =
   16.14  let
   16.15 - fun uset (vars as (x::vs)) p = case term_of p of
   16.16 + fun uset (vars as (x::vs)) p = case Thm.term_of p of
   16.17     Const(@{const_name HOL.conj}, _)$ _ $ _ =>
   16.18       let
   16.19         val ((b,l),r) = Thm.dest_comb p |>> Thm.dest_comb
   16.20 @@ -56,7 +56,7 @@
   16.21  
   16.22   val ((p1_v,p2_v),(mp1_v,mp2_v)) =
   16.23     funpow 2 (Thm.dest_arg o snd o Thm.dest_abs NONE)
   16.24 -     (funpow 4 Thm.dest_arg (cprop_of (hd minf)))
   16.25 +     (funpow 4 Thm.dest_arg (Thm.cprop_of (hd minf)))
   16.26     |> Thm.dest_binop |> apply2 Thm.dest_binop |> apfst (apply2 Thm.dest_fun)
   16.27  
   16.28   fun myfwd (th1, th2, th3, th4, th5) p1 p2
   16.29 @@ -73,14 +73,14 @@
   16.30    in (fw true th1 th_1 th_1', fw false th2 th_2 th_2',
   16.31        fw true th3 th_3 th_3', fw false th4 th_4 th_4', fw true th5 th_5 th_5')
   16.32    end
   16.33 - val U_v = (Thm.dest_arg o Thm.dest_arg o Thm.dest_arg1) (cprop_of qe)
   16.34 + val U_v = (Thm.dest_arg o Thm.dest_arg o Thm.dest_arg1) (Thm.cprop_of qe)
   16.35   fun main vs p =
   16.36    let
   16.37 -   val ((xn,ce),(x,fm)) = (case term_of p of
   16.38 +   val ((xn,ce),(x,fm)) = (case Thm.term_of p of
   16.39                     Const(@{const_name Ex},_)$Abs(xn,xT,_) =>
   16.40                          Thm.dest_comb p ||> Thm.dest_abs (SOME xn) |>> pair xn
   16.41                   | _ => raise CTERM ("main QE only treats existential quantifiers!", [p]))
   16.42 -   val cT = ctyp_of_term x
   16.43 +   val cT = Thm.ctyp_of_term x
   16.44     val (u,nth) = uset (x::vs) fm |>> distinct (op aconvc)
   16.45     val nthx = Thm.abstract_rule xn x nth
   16.46     val q = Thm.rhs_of nth
   16.47 @@ -97,18 +97,18 @@
   16.48       val insI2 = instantiate' [SOME cT] [] @{thm "insertI2"}
   16.49     in
   16.50      fun provein x S =
   16.51 -     case term_of S of
   16.52 +     case Thm.term_of S of
   16.53          Const(@{const_name Orderings.bot}, _) => raise CTERM ("provein : not a member!", [S])
   16.54        | Const(@{const_name insert}, _) $ y $_ =>
   16.55           let val (cy,S') = Thm.dest_binop S
   16.56 -         in if term_of x aconv y then instantiate' [] [SOME x, SOME S'] insI1
   16.57 +         in if Thm.term_of x aconv y then instantiate' [] [SOME x, SOME S'] insI1
   16.58           else Thm.implies_elim (instantiate' [] [SOME x, SOME S', SOME cy] insI2)
   16.59                             (provein x S')
   16.60           end
   16.61     end
   16.62 -   val tabU = fold (fn t => fn tab => Termtab.update (term_of t, provein t cU) tab)
   16.63 +   val tabU = fold (fn t => fn tab => Termtab.update (Thm.term_of t, provein t cU) tab)
   16.64                     u Termtab.empty
   16.65 -   val U = the o Termtab.lookup tabU o term_of
   16.66 +   val U = the o Termtab.lookup tabU o Thm.term_of
   16.67     val [minf_conj, minf_disj, minf_eq, minf_neq, minf_lt,
   16.68          minf_le, minf_gt, minf_ge, minf_P] = minf
   16.69     val [pinf_conj, pinf_disj, pinf_eq, pinf_neq, pinf_lt,
   16.70 @@ -121,7 +121,7 @@
   16.71          ld_le, ld_gt, ld_ge, ld_P] = map (Drule.instantiate_normalize ([],[(U_v,cU)])) ld
   16.72  
   16.73     fun decomp_mpinf fm =
   16.74 -     case term_of fm of
   16.75 +     case Thm.term_of fm of
   16.76         Const(@{const_name HOL.conj},_)$_$_ =>
   16.77          let val (p,q) = Thm.dest_binop fm
   16.78          in ([p,q], myfwd (minf_conj,pinf_conj, nmi_conj, npi_conj,ld_conj)
   16.79 @@ -174,7 +174,7 @@
   16.80  val grab_atom_bop =
   16.81   let
   16.82    fun h bounds tm =
   16.83 -   (case term_of tm of
   16.84 +   (case Thm.term_of tm of
   16.85       Const (@{const_name HOL.eq}, T) $ _ $ _ =>
   16.86         if domain_type T = HOLogic.boolT then find_args bounds tm
   16.87         else Thm.dest_fun2 tm
    17.1 --- a/src/HOL/Decision_Procs/langford.ML	Tue Mar 03 19:08:04 2015 +0100
    17.2 +++ b/src/HOL/Decision_Procs/langford.ML	Wed Mar 04 19:53:18 2015 +0100
    17.3 @@ -14,7 +14,7 @@
    17.4  val dest_set =
    17.5    let
    17.6      fun h acc ct =
    17.7 -      (case term_of ct of
    17.8 +      (case Thm.term_of ct of
    17.9          Const (@{const_name Orderings.bot}, _) => acc
   17.10        | Const (@{const_name insert}, _) $ _ $ t => h (Thm.dest_arg1 ct :: acc) (Thm.dest_arg ct));
   17.11    in h [] end;
   17.12 @@ -33,7 +33,7 @@
   17.13        (Simplifier.rewrite (put_simpset HOL_basic_ss ctxt addsimps @{thms ball_simps simp_thms})));
   17.14  
   17.15  fun basic_dloqe ctxt stupid dlo_qeth dlo_qeth_nolb dlo_qeth_noub gather ep =
   17.16 -  (case term_of ep of
   17.17 +  (case Thm.term_of ep of
   17.18      Const (@{const_name Ex}, _) $ _ =>
   17.19        let
   17.20          val p = Thm.dest_arg ep
   17.21 @@ -46,13 +46,13 @@
   17.22          fun proveneF S =
   17.23            let
   17.24              val (a, A) = Thm.dest_comb S |>> Thm.dest_arg
   17.25 -            val cT = ctyp_of_term a
   17.26 +            val cT = Thm.ctyp_of_term a
   17.27              val ne = instantiate' [SOME cT] [SOME a, SOME A] @{thm insert_not_empty}
   17.28              val f = prove_finite cT (dest_set S)
   17.29           in (ne, f) end
   17.30  
   17.31          val qe =
   17.32 -          (case (term_of L, term_of U) of
   17.33 +          (case (Thm.term_of L, Thm.term_of U) of
   17.34              (Const (@{const_name Orderings.bot}, _),_) =>
   17.35                let val (neU, fU) = proveneF U
   17.36                in simp_rule ctxt (Thm.transitive ths (dlo_qeth_nolb OF [neU, fU])) end
   17.37 @@ -70,13 +70,13 @@
   17.38  val all_conjuncts =
   17.39    let
   17.40      fun h acc ct =
   17.41 -      (case term_of ct of
   17.42 +      (case Thm.term_of ct of
   17.43          @{term HOL.conj} $ _ $ _ => h (h acc (Thm.dest_arg ct)) (Thm.dest_arg1 ct)
   17.44        | _ => ct :: acc)
   17.45    in h [] end;
   17.46  
   17.47  fun conjuncts ct =
   17.48 -  (case term_of ct of
   17.49 +  (case Thm.term_of ct of
   17.50      @{term HOL.conj} $ _ $ _ => Thm.dest_arg1 ct :: conjuncts (Thm.dest_arg ct)
   17.51    | _ => [ct]);
   17.52  
   17.53 @@ -88,7 +88,7 @@
   17.54  fun mk_conj_tab th =
   17.55    let
   17.56      fun h acc th =
   17.57 -      (case prop_of th of
   17.58 +      (case Thm.prop_of th of
   17.59          @{term "Trueprop"} $ (@{term HOL.conj} $ p $ q) =>
   17.60            h (h acc (th RS conjunct2)) (th RS conjunct1)
   17.61        | @{term "Trueprop"} $ p => (p, th) :: acc)
   17.62 @@ -100,7 +100,7 @@
   17.63  fun prove_conj tab cjs =
   17.64    (case cjs of
   17.65      [c] =>
   17.66 -      if is_conj (term_of c)
   17.67 +      if is_conj (Thm.term_of c)
   17.68        then prove_conj tab (conjuncts c)
   17.69        else tab c
   17.70    | c :: cs => conjI OF [prove_conj tab [c], prove_conj tab cs]);
   17.71 @@ -108,8 +108,8 @@
   17.72  fun conj_aci_rule eq =
   17.73    let
   17.74      val (l, r) = Thm.dest_equals eq
   17.75 -    fun tabl c = the (Termtab.lookup (mk_conj_tab (Thm.assume l)) (term_of c))
   17.76 -    fun tabr c = the (Termtab.lookup (mk_conj_tab (Thm.assume r)) (term_of c))
   17.77 +    fun tabl c = the (Termtab.lookup (mk_conj_tab (Thm.assume l)) (Thm.term_of c))
   17.78 +    fun tabr c = the (Termtab.lookup (mk_conj_tab (Thm.assume r)) (Thm.term_of c))
   17.79      val ll = Thm.dest_arg l
   17.80      val rr = Thm.dest_arg r
   17.81      val thl  = prove_conj tabl (conjuncts rr) |> Drule.implies_intr_hyps
   17.82 @@ -118,18 +118,18 @@
   17.83    in Thm.implies_elim (Thm.implies_elim eqI thl) thr |> mk_meta_eq end;
   17.84  
   17.85  fun contains x ct =
   17.86 -  member (op aconv) (Misc_Legacy.term_frees (term_of ct)) (term_of x);
   17.87 +  member (op aconv) (Misc_Legacy.term_frees (Thm.term_of ct)) (Thm.term_of x);
   17.88  
   17.89  fun is_eqx x eq =
   17.90 -  (case term_of eq of
   17.91 +  (case Thm.term_of eq of
   17.92      Const (@{const_name HOL.eq}, _) $ l $ r =>
   17.93 -      l aconv term_of x orelse r aconv term_of x
   17.94 +      l aconv Thm.term_of x orelse r aconv Thm.term_of x
   17.95    | _ => false);
   17.96  
   17.97  local
   17.98  
   17.99  fun proc ctxt ct =
  17.100 -  (case term_of ct of
  17.101 +  (case Thm.term_of ct of
  17.102      Const (@{const_name Ex}, _) $ Abs (xn, _, _) =>
  17.103        let
  17.104          val e = Thm.dest_fun ct
  17.105 @@ -198,7 +198,7 @@
  17.106  val grab_atom_bop =
  17.107    let
  17.108      fun h bounds tm =
  17.109 -      (case term_of tm of
  17.110 +      (case Thm.term_of tm of
  17.111          Const (@{const_name HOL.eq}, T) $ _ $ _ =>
  17.112            if domain_type T = HOLogic.boolT then find_args bounds tm
  17.113            else Thm.dest_fun2 tm
  17.114 @@ -231,8 +231,8 @@
  17.115  fun generalize_tac f = CSUBGOAL (fn (p, _) => PRIMITIVE (fn st =>
  17.116    let
  17.117      fun all T = Drule.cterm_rule (instantiate' [SOME T] []) @{cpat "Pure.all"}
  17.118 -    fun gen x t = Thm.apply (all (ctyp_of_term x)) (Thm.lambda x t)
  17.119 -    val ts = sort (fn (a,b) => Term_Ord.fast_term_ord (term_of a, term_of b)) (f p)
  17.120 +    fun gen x t = Thm.apply (all (Thm.ctyp_of_term x)) (Thm.lambda x t)
  17.121 +    val ts = sort (fn (a,b) => Term_Ord.fast_term_ord (Thm.term_of a, Thm.term_of b)) (f p)
  17.122      val p' = fold_rev gen ts p
  17.123    in Thm.implies_intr p' (Thm.implies_elim st (fold Thm.forall_elim ts (Thm.assume p'))) end));
  17.124  
  17.125 @@ -240,7 +240,7 @@
  17.126    let
  17.127      val ins = insert (op aconvc)
  17.128      fun h acc t =
  17.129 -      (case (term_of t) of
  17.130 +      (case Thm.term_of t of
  17.131          _ $ _ $ _ =>
  17.132            if member (op aconvc) ats (Thm.dest_fun2 t)
  17.133            then ins (Thm.dest_arg t) (ins (Thm.dest_arg1 t) acc)
    18.1 --- a/src/HOL/Decision_Procs/mir_tac.ML	Tue Mar 03 19:08:04 2015 +0100
    18.2 +++ b/src/HOL/Decision_Procs/mir_tac.ML	Wed Mar 04 19:53:18 2015 +0100
    18.3 @@ -101,7 +101,7 @@
    18.4                  @{thm "int_0"}, @{thm "int_1"}]
    18.5        |> fold Simplifier.add_cong [@{thm "conj_le_cong"}, @{thm "imp_le_cong"}]
    18.6      (* simp rules for elimination of abs *)
    18.7 -    val ct = cterm_of thy (HOLogic.mk_Trueprop t)
    18.8 +    val ct = Thm.cterm_of thy (HOLogic.mk_Trueprop t)
    18.9      (* Theorem for the nat --> int transformation *)
   18.10      val pre_thm = Seq.hd (EVERY
   18.11        [simp_tac mod_div_simpset 1, simp_tac simpset0 1,
   18.12 @@ -110,13 +110,14 @@
   18.13        (Thm.trivial ct))
   18.14      fun assm_tac i = REPEAT_DETERM_N nh (assume_tac ctxt i)
   18.15      (* The result of the quantifier elimination *)
   18.16 -    val (th, tac) = case (prop_of pre_thm) of
   18.17 +    val (th, tac) =
   18.18 +      case Thm.prop_of pre_thm of
   18.19          Const (@{const_name Pure.imp}, _) $ (Const (@{const_name Trueprop}, _) $ t1) $ _ =>
   18.20      let val pth =
   18.21            (* If quick_and_dirty then run without proof generation as oracle*)
   18.22               if Config.get ctxt quick_and_dirty
   18.23 -             then mirfr_oracle (false, cterm_of thy (Envir.eta_long [] t1))
   18.24 -             else mirfr_oracle (true, cterm_of thy (Envir.eta_long [] t1))
   18.25 +             then mirfr_oracle (false, Thm.cterm_of thy (Envir.eta_long [] t1))
   18.26 +             else mirfr_oracle (true, Thm.cterm_of thy (Envir.eta_long [] t1))
   18.27      in 
   18.28         ((pth RS iffD2) RS pre_thm,
   18.29          assm_tac (i + 1) THEN (if q then I else TRY) (rtac TrueI i))
    19.1 --- a/src/HOL/Enum.thy	Tue Mar 03 19:08:04 2015 +0100
    19.2 +++ b/src/HOL/Enum.thy	Wed Mar 04 19:53:18 2015 +0100
    19.3 @@ -563,12 +563,14 @@
    19.4  by(cases x) simp
    19.5  
    19.6  simproc_setup finite_1_eq ("x::finite_1") = {*
    19.7 -  fn _ => fn _ => fn ct => case term_of ct of
    19.8 -    Const (@{const_name a\<^sub>1}, _) => NONE
    19.9 -  | _ => SOME (mk_meta_eq @{thm finite_1_eq})
   19.10 +  fn _ => fn _ => fn ct =>
   19.11 +    (case Thm.term_of ct of
   19.12 +      Const (@{const_name a\<^sub>1}, _) => NONE
   19.13 +    | _ => SOME (mk_meta_eq @{thm finite_1_eq}))
   19.14  *}
   19.15  
   19.16 -instantiation finite_1 :: complete_boolean_algebra begin
   19.17 +instantiation finite_1 :: complete_boolean_algebra
   19.18 +begin
   19.19  definition [simp]: "op - = (\<lambda>_ _. a\<^sub>1)"
   19.20  definition [simp]: "uminus = (\<lambda>_. a\<^sub>1)"
   19.21  instance by intro_classes simp_all
    20.1 --- a/src/HOL/HOL.thy	Tue Mar 03 19:08:04 2015 +0100
    20.2 +++ b/src/HOL/HOL.thy	Wed Mar 04 19:53:18 2015 +0100
    20.3 @@ -1193,14 +1193,14 @@
    20.4  simproc_setup let_simp ("Let x f") = {*
    20.5  let
    20.6    val (f_Let_unfold, x_Let_unfold) =
    20.7 -    let val [(_ $ (f $ x) $ _)] = prems_of @{thm Let_unfold}
    20.8 -    in (cterm_of @{theory} f, cterm_of @{theory} x) end
    20.9 +    let val [(_ $ (f $ x) $ _)] = Thm.prems_of @{thm Let_unfold}
   20.10 +    in (Thm.cterm_of @{theory} f, Thm.cterm_of @{theory} x) end
   20.11    val (f_Let_folded, x_Let_folded) =
   20.12 -    let val [(_ $ (f $ x) $ _)] = prems_of @{thm Let_folded}
   20.13 -    in (cterm_of @{theory} f, cterm_of @{theory} x) end;
   20.14 +    let val [(_ $ (f $ x) $ _)] = Thm.prems_of @{thm Let_folded}
   20.15 +    in (Thm.cterm_of @{theory} f, Thm.cterm_of @{theory} x) end;
   20.16    val g_Let_folded =
   20.17 -    let val [(_ $ _ $ (g $ _))] = prems_of @{thm Let_folded}
   20.18 -    in cterm_of @{theory} g end;
   20.19 +    let val [(_ $ _ $ (g $ _))] = Thm.prems_of @{thm Let_folded}
   20.20 +    in Thm.cterm_of @{theory} g end;
   20.21    fun count_loose (Bound i) k = if i >= k then 1 else 0
   20.22      | count_loose (s $ t) k = count_loose s k + count_loose t k
   20.23      | count_loose (Abs (_, _, t)) k = count_loose  t (k + 1)
   20.24 @@ -1222,11 +1222,11 @@
   20.25        else
   20.26          let
   20.27            val n = case f of (Abs (x, _, _)) => x | _ => "x";
   20.28 -          val cx = cterm_of thy x;
   20.29 -          val {T = xT, ...} = rep_cterm cx;
   20.30 -          val cf = cterm_of thy f;
   20.31 +          val cx = Thm.cterm_of thy x;
   20.32 +          val {T = xT, ...} = Thm.rep_cterm cx;
   20.33 +          val cf = Thm.cterm_of thy f;
   20.34            val fx_g = Simplifier.rewrite ctxt (Thm.apply cf cx);
   20.35 -          val (_ $ _ $ g) = prop_of fx_g;
   20.36 +          val (_ $ _ $ g) = Thm.prop_of fx_g;
   20.37            val g' = abstract_over (x,g);
   20.38            val abs_g'= Abs (n,xT,g');
   20.39          in (if (g aconv g')
   20.40 @@ -1238,10 +1238,10 @@
   20.41               else if (Envir.beta_eta_contract f) aconv (Envir.beta_eta_contract abs_g') then NONE (*avoid identity conversion*)
   20.42               else let
   20.43                     val g'x = abs_g'$x;
   20.44 -                   val g_g'x = Thm.symmetric (Thm.beta_conversion false (cterm_of thy g'x));
   20.45 +                   val g_g'x = Thm.symmetric (Thm.beta_conversion false (Thm.cterm_of thy g'x));
   20.46                     val rl = cterm_instantiate
   20.47 -                             [(f_Let_folded, cterm_of thy f), (x_Let_folded, cx),
   20.48 -                              (g_Let_folded, cterm_of thy abs_g')]
   20.49 +                             [(f_Let_folded, Thm.cterm_of thy f), (x_Let_folded, cx),
   20.50 +                              (g_Let_folded, Thm.cterm_of thy abs_g')]
   20.51                               @{thm Let_folded};
   20.52                   in SOME (rl OF [Thm.transitive fx_g g_g'x])
   20.53                   end)
    21.1 --- a/src/HOL/HOLCF/Cfun.thy	Tue Mar 03 19:08:04 2015 +0100
    21.2 +++ b/src/HOL/HOLCF/Cfun.thy	Wed Mar 04 19:53:18 2015 +0100
    21.3 @@ -144,7 +144,7 @@
    21.4      let
    21.5        val dest = Thm.dest_comb;
    21.6        val f = (snd o dest o snd o dest) ct;
    21.7 -      val [T, U] = Thm.dest_ctyp (ctyp_of_term f);
    21.8 +      val [T, U] = Thm.dest_ctyp (Thm.ctyp_of_term f);
    21.9        val tr = instantiate' [SOME T, SOME U] [SOME f]
   21.10            (mk_meta_eq @{thm Abs_cfun_inverse2});
   21.11        val rules = Named_Theorems.get ctxt @{named_theorems cont2cont};
    22.1 --- a/src/HOL/HOLCF/Tools/Domain/domain_constructors.ML	Tue Mar 03 19:08:04 2015 +0100
    22.2 +++ b/src/HOL/HOLCF/Tools/Domain/domain_constructors.ML	Wed Mar 04 19:53:18 2015 +0100
    22.3 @@ -135,7 +135,7 @@
    22.4    fun beta_of_def thy def_thm =
    22.5        let
    22.6          val (con, lam) =
    22.7 -          Logic.dest_equals (Logic.unvarify_global (concl_of def_thm))
    22.8 +          Logic.dest_equals (Logic.unvarify_global (Thm.concl_of def_thm))
    22.9          val (args, rhs) = arglist lam
   22.10          val lhs = list_ccomb (con, args)
   22.11          val goal = mk_equals (lhs, rhs)
   22.12 @@ -211,7 +211,7 @@
   22.13              val (n1, t1) = args2typ n (snd con)
   22.14              val (n2, t2) = cons2typ n1 cons
   22.15            in (n2, mk_ssumT (t1, t2)) end
   22.16 -      val ct = ctyp_of thy (snd (cons2typ 1 spec'))
   22.17 +      val ct = Thm.ctyp_of thy (snd (cons2typ 1 spec'))
   22.18        val thm1 = instantiate' [SOME ct] [] @{thm exh_start}
   22.19        val thm2 = rewrite_rule (Proof_Context.init_global thy)
   22.20          (map mk_meta_eq @{thms ex_bottom_iffs}) thm1
    23.1 --- a/src/HOL/HOLCF/Tools/cont_proc.ML	Tue Mar 03 19:08:04 2015 +0100
    23.2 +++ b/src/HOL/HOLCF/Tools/cont_proc.ML	Wed Mar 04 19:53:18 2015 +0100
    23.3 @@ -122,7 +122,7 @@
    23.4    fun solve_cont ctxt t =
    23.5      let
    23.6        val thy = Proof_Context.theory_of ctxt
    23.7 -      val tr = instantiate' [] [SOME (cterm_of thy t)] @{thm Eq_TrueI}
    23.8 +      val tr = instantiate' [] [SOME (Thm.cterm_of thy t)] @{thm Eq_TrueI}
    23.9      in Option.map fst (Seq.pull (cont_tac ctxt 1 tr)) end
   23.10  in
   23.11    fun cont_proc thy =
    24.1 --- a/src/HOL/HOLCF/Tools/fixrec.ML	Tue Mar 03 19:08:04 2015 +0100
    24.2 +++ b/src/HOL/HOLCF/Tools/fixrec.ML	Wed Mar 04 19:53:18 2015 +0100
    24.3 @@ -100,7 +100,7 @@
    24.4    | name_of t = raise TERM ("Fixrec.add_unfold: lhs not a constant", [t])
    24.5  
    24.6  val lhs_name =
    24.7 -  name_of o head_of o fst o HOLogic.dest_eq o HOLogic.dest_Trueprop o prop_of
    24.8 +  name_of o head_of o fst o HOLogic.dest_eq o HOLogic.dest_Trueprop o Thm.prop_of
    24.9  
   24.10  in
   24.11  
    25.1 --- a/src/HOL/Import/import_data.ML	Tue Mar 03 19:08:04 2015 +0100
    25.2 +++ b/src/HOL/Import/import_data.ML	Wed Mar 04 19:53:18 2015 +0100
    25.3 @@ -73,7 +73,7 @@
    25.4      val th = Thm.legacy_freezeT th
    25.5      val name = case name_opt of
    25.6           NONE => (fst o dest_Const o fst o HOLogic.dest_eq o
    25.7 -           HOLogic.dest_Trueprop o prop_of) th
    25.8 +           HOLogic.dest_Trueprop o Thm.prop_of) th
    25.9         | SOME n => n
   25.10      val thy' = add_const_map s name thy
   25.11    in
   25.12 @@ -85,7 +85,7 @@
   25.13  fun add_typ_def tyname absname repname th thy =
   25.14    let
   25.15      val th = Thm.legacy_freezeT th
   25.16 -    val (l, _) = dest_comb (HOLogic.dest_Trueprop (prop_of th))
   25.17 +    val (l, _) = dest_comb (HOLogic.dest_Trueprop (Thm.prop_of th))
   25.18      val (l, abst) = dest_comb l
   25.19      val (_, rept) = dest_comb l
   25.20      val (absn, _) = dest_Const abst
    26.1 --- a/src/HOL/Import/import_rule.ML	Tue Mar 03 19:08:04 2015 +0100
    26.2 +++ b/src/HOL/Import/import_rule.ML	Wed Mar 04 19:53:18 2015 +0100
    26.3 @@ -44,7 +44,7 @@
    26.4  fun meta_mp th1 th2 =
    26.5    let
    26.6      val th1a = implies_elim_all th1
    26.7 -    val th1b = Thm.implies_intr (strip_imp_concl (cprop_of th2)) th1a
    26.8 +    val th1b = Thm.implies_intr (strip_imp_concl (Thm.cprop_of th2)) th1a
    26.9      val th2a = implies_elim_all th2
   26.10      val th3 = Thm.implies_elim th1b th2a
   26.11    in
   26.12 @@ -53,8 +53,8 @@
   26.13  
   26.14  fun meta_eq_to_obj_eq th =
   26.15    let
   26.16 -    val (tml, tmr) = Thm.dest_binop (strip_imp_concl (cprop_of th))
   26.17 -    val cty = ctyp_of_term tml
   26.18 +    val (tml, tmr) = Thm.dest_binop (strip_imp_concl (Thm.cprop_of th))
   26.19 +    val cty = Thm.ctyp_of_term tml
   26.20      val i = Drule.instantiate' [SOME cty] [SOME tml, SOME tmr]
   26.21        @{thm meta_eq_to_obj_eq}
   26.22    in
   26.23 @@ -65,7 +65,7 @@
   26.24  
   26.25  fun eq_mp th1 th2 =
   26.26    let
   26.27 -    val (tm1l, tm1r) = Thm.dest_binop (Thm.dest_arg (strip_imp_concl (cprop_of th1)))
   26.28 +    val (tm1l, tm1r) = Thm.dest_binop (Thm.dest_arg (strip_imp_concl (Thm.cprop_of th1)))
   26.29      val i1 = Drule.instantiate' [] [SOME tm1l, SOME tm1r] @{thm iffD1}
   26.30      val i2 = meta_mp i1 th1
   26.31    in
   26.32 @@ -74,11 +74,11 @@
   26.33  
   26.34  fun comb th1 th2 =
   26.35    let
   26.36 -    val t1c = Thm.dest_arg (strip_imp_concl (cprop_of th1))
   26.37 -    val t2c = Thm.dest_arg (strip_imp_concl (cprop_of th2))
   26.38 +    val t1c = Thm.dest_arg (strip_imp_concl (Thm.cprop_of th1))
   26.39 +    val t2c = Thm.dest_arg (strip_imp_concl (Thm.cprop_of th2))
   26.40      val (cf, cg) = Thm.dest_binop t1c
   26.41      val (cx, cy) = Thm.dest_binop t2c
   26.42 -    val [fd, fr] = Thm.dest_ctyp (ctyp_of_term cf)
   26.43 +    val [fd, fr] = Thm.dest_ctyp (Thm.ctyp_of_term cf)
   26.44      val i1 = Drule.instantiate' [SOME fd, SOME fr]
   26.45        [SOME cf, SOME cg, SOME cx, SOME cy] @{thm cong}
   26.46      val i2 = meta_mp i1 th1
   26.47 @@ -88,11 +88,11 @@
   26.48  
   26.49  fun trans th1 th2 =
   26.50    let
   26.51 -    val t1c = Thm.dest_arg (strip_imp_concl (cprop_of th1))
   26.52 -    val t2c = Thm.dest_arg (strip_imp_concl (cprop_of th2))
   26.53 +    val t1c = Thm.dest_arg (strip_imp_concl (Thm.cprop_of th1))
   26.54 +    val t2c = Thm.dest_arg (strip_imp_concl (Thm.cprop_of th2))
   26.55      val (r, s) = Thm.dest_binop t1c
   26.56      val (_, t) = Thm.dest_binop t2c
   26.57 -    val ty = ctyp_of_term r
   26.58 +    val ty = Thm.ctyp_of_term r
   26.59      val i1 = Drule.instantiate' [SOME ty] [SOME r, SOME s, SOME t] @{thm trans}
   26.60      val i2 = meta_mp i1 th1
   26.61    in
   26.62 @@ -101,17 +101,17 @@
   26.63  
   26.64  fun deduct th1 th2 =
   26.65    let
   26.66 -    val th1c = strip_imp_concl (cprop_of th1)
   26.67 -    val th2c = strip_imp_concl (cprop_of th2)
   26.68 +    val th1c = strip_imp_concl (Thm.cprop_of th1)
   26.69 +    val th2c = strip_imp_concl (Thm.cprop_of th2)
   26.70      val th1a = implies_elim_all th1
   26.71      val th2a = implies_elim_all th2
   26.72      val th1b = Thm.implies_intr th2c th1a
   26.73      val th2b = Thm.implies_intr th1c th2a
   26.74      val i = Drule.instantiate' []
   26.75        [SOME (Thm.dest_arg th1c), SOME (Thm.dest_arg th2c)] @{thm iffI}
   26.76 -    val i1 = Thm.implies_elim i (Thm.assume (cprop_of th2b))
   26.77 +    val i1 = Thm.implies_elim i (Thm.assume (Thm.cprop_of th2b))
   26.78      val i2 = Thm.implies_elim i1 th1b
   26.79 -    val i3 = Thm.implies_intr (cprop_of th2b) i2
   26.80 +    val i3 = Thm.implies_intr (Thm.cprop_of th2b) i2
   26.81      val i4 = Thm.implies_elim i3 th2b
   26.82    in
   26.83      implies_intr_hyps i4
   26.84 @@ -119,7 +119,7 @@
   26.85  
   26.86  fun conj1 th =
   26.87    let
   26.88 -    val (tml, tmr) = Thm.dest_binop (Thm.dest_arg (strip_imp_concl (cprop_of th)))
   26.89 +    val (tml, tmr) = Thm.dest_binop (Thm.dest_arg (strip_imp_concl (Thm.cprop_of th)))
   26.90      val i = Drule.instantiate' [] [SOME tml, SOME tmr] @{thm conjunct1}
   26.91    in
   26.92      meta_mp i th
   26.93 @@ -127,7 +127,7 @@
   26.94  
   26.95  fun conj2 th =
   26.96    let
   26.97 -    val (tml, tmr) = Thm.dest_binop (Thm.dest_arg (strip_imp_concl (cprop_of th)))
   26.98 +    val (tml, tmr) = Thm.dest_binop (Thm.dest_arg (strip_imp_concl (Thm.cprop_of th)))
   26.99      val i = Drule.instantiate' [] [SOME tml, SOME tmr] @{thm conjunct2}
  26.100    in
  26.101      meta_mp i th
  26.102 @@ -143,7 +143,7 @@
  26.103  fun abs cv th =
  26.104    let
  26.105      val th1 = implies_elim_all th
  26.106 -    val (tl, tr) = Thm.dest_binop (Thm.dest_arg (strip_imp_concl (cprop_of th1)))
  26.107 +    val (tl, tr) = Thm.dest_binop (Thm.dest_arg (strip_imp_concl (Thm.cprop_of th1)))
  26.108      val (ll, lr) = (Thm.lambda cv tl, Thm.lambda cv tr)
  26.109      val (al, ar) = (Thm.apply ll cv, Thm.apply lr cv)
  26.110      val bl = beta al
  26.111 @@ -151,7 +151,7 @@
  26.112      val th2 = trans (trans bl th1) br
  26.113      val th3 = implies_elim_all th2
  26.114      val th4 = Thm.forall_intr cv th3
  26.115 -    val i = Drule.instantiate' [SOME (ctyp_of_term cv), SOME (ctyp_of_term tl)]
  26.116 +    val i = Drule.instantiate' [SOME (Thm.ctyp_of_term cv), SOME (Thm.ctyp_of_term tl)]
  26.117        [SOME ll, SOME lr] @{thm ext2}
  26.118    in
  26.119      meta_mp i th4
  26.120 @@ -159,18 +159,18 @@
  26.121  
  26.122  fun freezeT thm =
  26.123    let
  26.124 -    val tvars = Term.add_tvars (prop_of thm) []
  26.125 +    val tvars = Term.add_tvars (Thm.prop_of thm) []
  26.126      val tfrees = map (fn ((t, _), s) => TFree (t, s)) tvars
  26.127      val tvars = map TVar tvars
  26.128      val thy = Thm.theory_of_thm thm
  26.129 -    fun inst ty = ctyp_of thy ty
  26.130 +    fun inst ty = Thm.ctyp_of thy ty
  26.131    in
  26.132      Thm.instantiate ((map inst tvars ~~ map inst tfrees), []) thm
  26.133    end
  26.134  
  26.135  fun def' constname rhs thy =
  26.136    let
  26.137 -    val rhs = term_of rhs
  26.138 +    val rhs = Thm.term_of rhs
  26.139      val typ = type_of rhs
  26.140      val constbinding = Binding.name constname
  26.141      val thy1 = Sign.add_consts [(constbinding, typ, NoSyn)] thy
  26.142 @@ -199,23 +199,24 @@
  26.143  
  26.144  fun typedef_hollight th thy =
  26.145    let
  26.146 -    val (th_s, cn) = Thm.dest_comb (Thm.dest_arg (cprop_of th))
  26.147 +    val (th_s, cn) = Thm.dest_comb (Thm.dest_arg (Thm.cprop_of th))
  26.148      val (th_s, abst) = Thm.dest_comb th_s
  26.149      val rept = Thm.dest_arg th_s
  26.150      val P = Thm.dest_arg cn
  26.151 -    val [nty, oty] = Thm.dest_ctyp (ctyp_of_term rept)
  26.152 +    val [nty, oty] = Thm.dest_ctyp (Thm.ctyp_of_term rept)
  26.153    in
  26.154      Drule.instantiate' [SOME nty, SOME oty] [SOME rept, SOME abst, SOME P,
  26.155 -      SOME (cterm_of thy (Free ("a", typ_of nty))),
  26.156 -      SOME (cterm_of thy (Free ("r", typ_of oty)))] @{thm typedef_hol2hollight}
  26.157 +      SOME (Thm.cterm_of thy (Free ("a", Thm.typ_of nty))),
  26.158 +      SOME (Thm.cterm_of thy (Free ("r", Thm.typ_of oty)))] @{thm typedef_hol2hollight}
  26.159    end
  26.160  
  26.161  fun tydef' tycname abs_name rep_name cP ct td_th thy =
  26.162    let
  26.163 -    val ctT = ctyp_of_term ct
  26.164 +    val ctT = Thm.ctyp_of_term ct
  26.165      val nonempty = Drule.instantiate' [SOME ctT] [SOME cP, SOME ct] @{thm light_ex_imp_nonempty}
  26.166      val th2 = meta_mp nonempty td_th
  26.167 -    val c = case concl_of th2 of
  26.168 +    val c =
  26.169 +      case Thm.concl_of th2 of
  26.170          _ $ (Const(@{const_name Ex},_) $ Abs(_,_,Const(@{const_name Set.member},_) $ _ $ c)) => c
  26.171        | _ => error "type_introduction: bad type definition theorem"
  26.172      val tfrees = Term.add_tfrees c []
  26.173 @@ -225,15 +226,15 @@
  26.174         (SOME (Binding.name rep_name, Binding.name abs_name)) (fn _ => rtac th2 1) thy
  26.175      val aty = #abs_type (#1 typedef_info)
  26.176      val th = freezeT (#type_definition (#2 typedef_info))
  26.177 -    val (th_s, _) = Thm.dest_comb (Thm.dest_arg (cprop_of th))
  26.178 +    val (th_s, _) = Thm.dest_comb (Thm.dest_arg (Thm.cprop_of th))
  26.179      val (th_s, abst) = Thm.dest_comb th_s
  26.180      val rept = Thm.dest_arg th_s
  26.181 -    val [nty, oty] = Thm.dest_ctyp (ctyp_of_term rept)
  26.182 +    val [nty, oty] = Thm.dest_ctyp (Thm.ctyp_of_term rept)
  26.183      val typedef_th =
  26.184         Drule.instantiate'
  26.185            [SOME nty, SOME oty]
  26.186 -          [SOME rept, SOME abst, SOME cP, SOME (cterm_of thy' (Free ("a", aty))),
  26.187 -             SOME (cterm_of thy' (Free ("r", typ_of ctT)))]
  26.188 +          [SOME rept, SOME abst, SOME cP, SOME (Thm.cterm_of thy' (Free ("a", aty))),
  26.189 +             SOME (Thm.cterm_of thy' (Free ("r", Thm.typ_of ctT)))]
  26.190            @{thm typedef_hol2hollight}
  26.191      val th4 = typedef_th OF [#type_definition (#2 typedef_info)]
  26.192    in
  26.193 @@ -259,14 +260,14 @@
  26.194    let
  26.195      fun assoc _ [] = error "assoc"
  26.196        | assoc x ((x',y)::rest) = if x = x' then y else assoc x rest
  26.197 -    val lambda = map (fn (a, b) => (typ_of a, b)) lambda
  26.198 -    val tys_before = Term.add_tfrees (prop_of th) []
  26.199 +    val lambda = map (fn (a, b) => (Thm.typ_of a, b)) lambda
  26.200 +    val tys_before = Term.add_tfrees (Thm.prop_of th) []
  26.201      val th1 = Thm.varifyT_global th
  26.202 -    val tys_after = Term.add_tvars (prop_of th1) []
  26.203 +    val tys_after = Term.add_tvars (Thm.prop_of th1) []
  26.204      val tyinst = map2 (fn bef => fn iS =>
  26.205         (case try (assoc (TFree bef)) lambda of
  26.206 -              SOME cty => (ctyp_of thy (TVar iS), cty)
  26.207 -            | NONE => (ctyp_of thy (TVar iS), ctyp_of thy (TFree bef))
  26.208 +              SOME cty => (Thm.ctyp_of thy (TVar iS), cty)
  26.209 +            | NONE => (Thm.ctyp_of thy (TVar iS), Thm.ctyp_of thy (TFree bef))
  26.210         )) tys_before tys_after
  26.211    in
  26.212      Thm.instantiate (tyinst,[]) th1
  26.213 @@ -328,12 +329,12 @@
  26.214  fun store_thm binding thm thy =
  26.215    let
  26.216      val thm = Drule.export_without_context_open thm
  26.217 -    val tvs = Term.add_tvars (prop_of thm) []
  26.218 +    val tvs = Term.add_tvars (Thm.prop_of thm) []
  26.219      val tns = map (fn (_, _) => "'") tvs
  26.220      val nms = fst (fold_map Name.variant tns (Variable.names_of (Proof_Context.init_global thy)))
  26.221      val vs = map TVar ((nms ~~ (map (snd o fst) tvs)) ~~ (map snd tvs))
  26.222 -    val cvs = map (ctyp_of thy) vs
  26.223 -    val ctvs = map (ctyp_of thy) (map TVar tvs)
  26.224 +    val cvs = map (Thm.ctyp_of thy) vs
  26.225 +    val ctvs = map (Thm.ctyp_of thy) (map TVar tvs)
  26.226      val thm' = Thm.instantiate ((ctvs ~~ cvs), []) thm
  26.227    in
  26.228      snd (Global_Theory.add_thm ((binding, thm'), []) thy)
  26.229 @@ -410,14 +411,14 @@
  26.230            end
  26.231        | process (thy, state) (#"Y", [name, _, _]) = setth (mtydef name thy) (thy, state)
  26.232        | process (thy, state) (#"t", [n]) =
  26.233 -          setty (ctyp_of thy (TFree ("'" ^ (transl_qm n), @{sort type}))) (thy, state)
  26.234 +          setty (Thm.ctyp_of thy (TFree ("'" ^ (transl_qm n), @{sort type}))) (thy, state)
  26.235        | process (thy, state) (#"a", n :: l) =
  26.236            fold_map getty l (thy, state) |>>
  26.237 -            (fn tys => ctyp_of thy (Type (gettyname n thy, map typ_of tys))) |-> setty
  26.238 +            (fn tys => Thm.ctyp_of thy (Type (gettyname n thy, map Thm.typ_of tys))) |-> setty
  26.239        | process (thy, state) (#"v", [n, ty]) =
  26.240 -          getty ty (thy, state) |>> (fn ty => cterm_of thy (Free (transl_dot n, typ_of ty))) |-> settm
  26.241 +          getty ty (thy, state) |>> (fn ty => Thm.cterm_of thy (Free (transl_dot n, Thm.typ_of ty))) |-> settm
  26.242        | process (thy, state) (#"c", [n, ty]) =
  26.243 -          getty ty (thy, state) |>> (fn ty => cterm_of thy (Const (getconstname n thy, typ_of ty))) |-> settm
  26.244 +          getty ty (thy, state) |>> (fn ty => Thm.cterm_of thy (Const (getconstname n thy, Thm.typ_of ty))) |-> settm
  26.245        | process tstate (#"f", [t1, t2]) =
  26.246            gettm t1 tstate ||>> gettm t2 |>> (fn (t1, t2) => Thm.apply t1 t2) |-> settm
  26.247        | process tstate (#"l", [t1, t2]) =
    27.1 --- a/src/HOL/Int.thy	Tue Mar 03 19:08:04 2015 +0100
    27.2 +++ b/src/HOL/Int.thy	Wed Mar 04 19:53:18 2015 +0100
    27.3 @@ -753,7 +753,7 @@
    27.4  simproc_setup fast_arith ("(m::'a::linordered_idom) < n" |
    27.5    "(m::'a::linordered_idom) <= n" |
    27.6    "(m::'a::linordered_idom) = n") =
    27.7 -  {* fn _ => fn ss => fn ct => Lin_Arith.simproc ss (term_of ct) *}
    27.8 +  {* fn _ => fn ss => fn ct => Lin_Arith.simproc ss (Thm.term_of ct) *}
    27.9  
   27.10  
   27.11  subsection{*More Inequality Reasoning*}
    28.1 --- a/src/HOL/Library/Code_Abstract_Nat.thy	Tue Mar 03 19:08:04 2015 +0100
    28.2 +++ b/src/HOL/Library/Code_Abstract_Nat.thy	Wed Mar 04 19:53:18 2015 +0100
    28.3 @@ -59,10 +59,10 @@
    28.4      val thy = Proof_Context.theory_of ctxt;
    28.5      val vname = singleton (Name.variant_list (map fst
    28.6        (fold (Term.add_var_names o Thm.full_prop_of) thms []))) "n";
    28.7 -    val cv = cterm_of thy (Var ((vname, 0), HOLogic.natT));
    28.8 -    val lhs_of = snd o Thm.dest_comb o fst o Thm.dest_comb o cprop_of;
    28.9 -    val rhs_of = snd o Thm.dest_comb o cprop_of;
   28.10 -    fun find_vars ct = (case term_of ct of
   28.11 +    val cv = Thm.cterm_of thy (Var ((vname, 0), HOLogic.natT));
   28.12 +    val lhs_of = snd o Thm.dest_comb o fst o Thm.dest_comb o Thm.cprop_of;
   28.13 +    val rhs_of = snd o Thm.dest_comb o Thm.cprop_of;
   28.14 +    fun find_vars ct = (case Thm.term_of ct of
   28.15          (Const (@{const_name Suc}, _) $ Var _) => [(cv, snd (Thm.dest_comb ct))]
   28.16        | _ $ _ =>
   28.17          let val (ct1, ct2) = Thm.dest_comb ct
   28.18 @@ -79,7 +79,7 @@
   28.19            Thm.implies_elim
   28.20             (Conv.fconv_rule (Thm.beta_conversion true)
   28.21               (Drule.instantiate'
   28.22 -               [SOME (ctyp_of_term ct)] [SOME (Thm.lambda cv ct),
   28.23 +               [SOME (Thm.ctyp_of_term ct)] [SOME (Thm.lambda cv ct),
   28.24                   SOME (Thm.lambda cv' (rhs_of thm)), NONE, SOME cv']
   28.25                 Suc_if_eq)) (Thm.forall_intr cv' thm)
   28.26        in
   28.27 @@ -97,7 +97,7 @@
   28.28  
   28.29  fun eqn_suc_base_preproc ctxt thms =
   28.30    let
   28.31 -    val dest = fst o Logic.dest_equals o prop_of;
   28.32 +    val dest = fst o Logic.dest_equals o Thm.prop_of;
   28.33      val contains_suc = exists_Const (fn (c, _) => c = @{const_name Suc});
   28.34    in
   28.35      if forall (can dest) thms andalso exists (contains_suc o dest) thms
    29.1 --- a/src/HOL/Library/Countable.thy	Tue Mar 03 19:08:04 2015 +0100
    29.2 +++ b/src/HOL/Library/Countable.thy	Wed Mar 04 19:53:18 2015 +0100
    29.3 @@ -171,7 +171,7 @@
    29.4          val typedef_info = hd (Typedef.get_info ctxt ty_name)
    29.5          val typedef_thm = #type_definition (snd typedef_info)
    29.6          val pred_name =
    29.7 -          (case HOLogic.dest_Trueprop (concl_of typedef_thm) of
    29.8 +          (case HOLogic.dest_Trueprop (Thm.concl_of typedef_thm) of
    29.9              (_ $ _ $ _ $ (_ $ Const (n, _))) => n
   29.10            | _ => raise Match)
   29.11          val induct_info = Inductive.the_inductive ctxt pred_name
    30.1 --- a/src/HOL/Library/Extended_Nat.thy	Tue Mar 03 19:08:04 2015 +0100
    30.2 +++ b/src/HOL/Library/Extended_Nat.thy	Wed Mar 04 19:53:18 2015 +0100
    30.3 @@ -561,15 +561,15 @@
    30.4  
    30.5  simproc_setup enat_eq_cancel
    30.6    ("(l::enat) + m = n" | "(l::enat) = m + n") =
    30.7 -  {* fn phi => fn ctxt => fn ct => Eq_Enat_Cancel.proc ctxt (term_of ct) *}
    30.8 +  {* fn phi => fn ctxt => fn ct => Eq_Enat_Cancel.proc ctxt (Thm.term_of ct) *}
    30.9  
   30.10  simproc_setup enat_le_cancel
   30.11    ("(l::enat) + m \<le> n" | "(l::enat) \<le> m + n") =
   30.12 -  {* fn phi => fn ctxt => fn ct => Le_Enat_Cancel.proc ctxt (term_of ct) *}
   30.13 +  {* fn phi => fn ctxt => fn ct => Le_Enat_Cancel.proc ctxt (Thm.term_of ct) *}
   30.14  
   30.15  simproc_setup enat_less_cancel
   30.16    ("(l::enat) + m < n" | "(l::enat) < m + n") =
   30.17 -  {* fn phi => fn ctxt => fn ct => Less_Enat_Cancel.proc ctxt (term_of ct) *}
   30.18 +  {* fn phi => fn ctxt => fn ct => Less_Enat_Cancel.proc ctxt (Thm.term_of ct) *}
   30.19  
   30.20  text {* TODO: add regression tests for these simprocs *}
   30.21  
    31.1 --- a/src/HOL/Library/Reflection.thy	Tue Mar 03 19:08:04 2015 +0100
    31.2 +++ b/src/HOL/Library/Reflection.thy	Wed Mar 04 19:53:18 2015 +0100
    31.3 @@ -23,7 +23,7 @@
    31.4    val rulesN = "rules";
    31.5    val any_keyword = keyword onlyN || keyword rulesN;
    31.6    val thms = Scan.repeat (Scan.unless any_keyword Attrib.multi_thm) >> flat;
    31.7 -  val terms = thms >> map (term_of o Drule.dest_term);
    31.8 +  val terms = thms >> map (Thm.term_of o Drule.dest_term);
    31.9  in
   31.10    thms -- Scan.optional (keyword rulesN |-- thms) [] --
   31.11      Scan.option (keyword onlyN |-- Args.term) >>
    32.1 --- a/src/HOL/Library/Sum_of_Squares/positivstellensatz_tools.ML	Tue Mar 03 19:08:04 2015 +0100
    32.2 +++ b/src/HOL/Library/Sum_of_Squares/positivstellensatz_tools.ML	Wed Mar 04 19:53:18 2015 +0100
    32.3 @@ -31,7 +31,7 @@
    32.4  
    32.5  fun string_of_varpow x k =
    32.6    let
    32.7 -    val term = term_of x
    32.8 +    val term = Thm.term_of x
    32.9      val name =
   32.10        (case term of
   32.11          Free (n, _) => n
    33.1 --- a/src/HOL/Library/Sum_of_Squares/sum_of_squares.ML	Tue Mar 03 19:08:04 2015 +0100
    33.2 +++ b/src/HOL/Library/Sum_of_Squares/sum_of_squares.ML	Wed Mar 04 19:53:18 2015 +0100
    33.3 @@ -234,7 +234,7 @@
    33.4    val div_tm = @{cterm "op / :: real => _"}
    33.5    val pow_tm = @{cterm "op ^ :: real => _"}
    33.6    val zero_tm = @{cterm "0:: real"}
    33.7 -  val is_numeral = can (HOLogic.dest_number o term_of)
    33.8 +  val is_numeral = can (HOLogic.dest_number o Thm.term_of)
    33.9    fun poly_of_term tm =
   33.10      if tm aconvc zero_tm then poly_0
   33.11      else
   33.12 @@ -256,7 +256,7 @@
   33.13                val (opr,l) = Thm.dest_comb lop
   33.14              in
   33.15                if opr aconvc pow_tm andalso is_numeral r
   33.16 -              then poly_pow (poly_of_term l) ((snd o HOLogic.dest_number o term_of) r)
   33.17 +              then poly_pow (poly_of_term l) ((snd o HOLogic.dest_number o Thm.term_of) r)
   33.18                else if opr aconvc add_tm
   33.19                then poly_add (poly_of_term l) (poly_of_term r)
   33.20                else if opr aconvc sub_tm
   33.21 @@ -278,7 +278,7 @@
   33.22          end handle CTERM ("dest_comb",_) => poly_var tm)
   33.23  in
   33.24    val poly_of_term = fn tm =>
   33.25 -    if type_of (term_of tm) = @{typ real}
   33.26 +    if type_of (Thm.term_of tm) = @{typ real}
   33.27      then poly_of_term tm
   33.28      else error "poly_of_term: term does not have real type"
   33.29  end;
   33.30 @@ -779,8 +779,8 @@
   33.31  (* Interface to HOL.                                                         *)
   33.32  local
   33.33    open Conv
   33.34 -  val concl = Thm.dest_arg o cprop_of
   33.35 -  fun simple_cterm_ord t u = Term_Ord.fast_term_ord (term_of t, term_of u) = LESS
   33.36 +  val concl = Thm.dest_arg o Thm.cprop_of
   33.37 +  fun simple_cterm_ord t u = Term_Ord.fast_term_ord (Thm.term_of t, Thm.term_of u) = LESS
   33.38  in
   33.39  (* FIXME: Replace tryfind by get_first !! *)
   33.40  fun real_nonlinear_prover proof_method ctxt =
   33.41 @@ -881,8 +881,8 @@
   33.42  
   33.43  local
   33.44    open Conv
   33.45 -  fun simple_cterm_ord t u = Term_Ord.fast_term_ord (term_of t, term_of u) = LESS
   33.46 -  val concl = Thm.dest_arg o cprop_of
   33.47 +  fun simple_cterm_ord t u = Term_Ord.fast_term_ord (Thm.term_of t, Thm.term_of u) = LESS
   33.48 +  val concl = Thm.dest_arg o Thm.cprop_of
   33.49    val shuffle1 =
   33.50      fconv_rule (rewr_conv @{lemma "(a + x == y) == (x == y - (a::real))"
   33.51        by (atomize (full)) (simp add: field_simps)})
   33.52 @@ -890,7 +890,7 @@
   33.53      fconv_rule (rewr_conv @{lemma "(x + a == y) ==  (x == y - (a::real))"
   33.54        by (atomize (full)) (simp add: field_simps)})
   33.55    fun substitutable_monomial fvs tm =
   33.56 -    (case term_of tm of
   33.57 +    (case Thm.term_of tm of
   33.58        Free (_, @{typ real}) =>
   33.59          if not (member (op aconvc) fvs tm) then (Rat.one, tm)
   33.60          else raise Failure "substitutable_monomial"
   33.61 @@ -907,11 +907,11 @@
   33.62  
   33.63    fun isolate_variable v th =
   33.64      let
   33.65 -      val w = Thm.dest_arg1 (cprop_of th)
   33.66 +      val w = Thm.dest_arg1 (Thm.cprop_of th)
   33.67      in
   33.68        if v aconvc w then th
   33.69        else
   33.70 -        (case term_of w of
   33.71 +        (case Thm.term_of w of
   33.72            @{term "op + :: real => _"} $ _ $ _ =>
   33.73              if Thm.dest_arg1 w aconvc v then shuffle2 th
   33.74              else isolate_variable v (shuffle1 th)
   33.75 @@ -951,7 +951,7 @@
   33.76              in
   33.77                substfirst
   33.78                  (filter_out
   33.79 -                  (fn t => (Thm.dest_arg1 o Thm.dest_arg o cprop_of) t aconvc @{cterm "0::real"})
   33.80 +                  (fn t => (Thm.dest_arg1 o Thm.dest_arg o Thm.cprop_of) t aconvc @{cterm "0::real"})
   33.81                    (map modify eqs),
   33.82                    map modify les,
   33.83                    map modify lts)
   33.84 @@ -986,7 +986,7 @@
   33.85  
   33.86  fun check_sos kcts ct =
   33.87    let
   33.88 -    val t = term_of ct
   33.89 +    val t = Thm.term_of ct
   33.90      val _ =
   33.91        if not (null (Term.add_tfrees t []) andalso null (Term.add_tvars t []))
   33.92        then error "SOS: not sos. Additional type varables"
   33.93 @@ -1022,10 +1022,10 @@
   33.94  
   33.95  
   33.96  local
   33.97 -  val is_numeral = can (HOLogic.dest_number o term_of)
   33.98 +  val is_numeral = can (HOLogic.dest_number o Thm.term_of)
   33.99  in
  33.100    fun get_denom b ct =
  33.101 -    (case term_of ct of
  33.102 +    (case Thm.term_of ct of
  33.103        @{term "op / :: real => _"} $ _ $ _ =>
  33.104          if is_numeral (Thm.dest_arg ct)
  33.105          then get_denom b (Thm.dest_arg1 ct)
    34.1 --- a/src/HOL/Library/positivstellensatz.ML	Tue Mar 03 19:08:04 2015 +0100
    34.2 +++ b/src/HOL/Library/positivstellensatz.ML	Wed Mar 04 19:53:18 2015 +0100
    34.3 @@ -64,7 +64,7 @@
    34.4  structure Symfunc = FuncFun(type key = string val ord = fast_string_ord);
    34.5  structure Termfunc = FuncFun(type key = term val ord = Term_Ord.fast_term_ord);
    34.6  
    34.7 -val cterm_ord = Term_Ord.fast_term_ord o apply2 term_of
    34.8 +val cterm_ord = Term_Ord.fast_term_ord o apply2 Thm.term_of
    34.9  
   34.10  structure Ctermfunc = FuncFun(type key = cterm val ord = cterm_ord);
   34.11  
   34.12 @@ -170,11 +170,11 @@
   34.13  
   34.14      (* Some useful derived rules *)
   34.15  fun deduct_antisym_rule tha thb =
   34.16 -    Thm.equal_intr (Thm.implies_intr (cprop_of thb) tha)
   34.17 -     (Thm.implies_intr (cprop_of tha) thb);
   34.18 +    Thm.equal_intr (Thm.implies_intr (Thm.cprop_of thb) tha)
   34.19 +     (Thm.implies_intr (Thm.cprop_of tha) thb);
   34.20  
   34.21  fun prove_hyp tha thb =
   34.22 -  if exists (curry op aconv (concl_of tha)) (Thm.hyps_of thb)  (* FIXME !? *)
   34.23 +  if exists (curry op aconv (Thm.concl_of tha)) (Thm.hyps_of thb)  (* FIXME !? *)
   34.24    then Thm.equal_elim (Thm.symmetric (deduct_antisym_rule tha thb)) tha else thb;
   34.25  
   34.26  val pth = @{lemma "(((x::real) < y) == (y - x > 0))" and "((x <= y) == (y - x >= 0))" and
   34.27 @@ -279,10 +279,10 @@
   34.28  fun literals_conv bops uops cv =
   34.29    let
   34.30      fun h t =
   34.31 -      case (term_of t) of
   34.32 +      (case Thm.term_of t of
   34.33          b$_$_ => if member (op aconv) bops b then binop_conv h t else cv t
   34.34        | u$_ => if member (op aconv) uops u then arg_conv h t else cv t
   34.35 -      | _ => cv t
   34.36 +      | _ => cv t)
   34.37    in h end;
   34.38  
   34.39  fun cterm_of_rat x =
   34.40 @@ -296,9 +296,9 @@
   34.41    end;
   34.42  
   34.43  fun dest_ratconst t =
   34.44 -  case term_of t of
   34.45 +  case Thm.term_of t of
   34.46      Const(@{const_name divide}, _)$a$b => Rat.rat_of_quotient(HOLogic.dest_number a |> snd, HOLogic.dest_number b |> snd)
   34.47 -  | _ => Rat.rat_of_int (HOLogic.dest_number (term_of t) |> snd)
   34.48 +  | _ => Rat.rat_of_int (HOLogic.dest_number (Thm.term_of t) |> snd)
   34.49  fun is_ratconst t = can dest_ratconst t
   34.50  
   34.51  (*
   34.52 @@ -311,14 +311,14 @@
   34.53  
   34.54  fun find_cterm p t =
   34.55    if p t then t else
   34.56 -  case term_of t of
   34.57 +  case Thm.term_of t of
   34.58      _$_ => (find_cterm p (Thm.dest_fun t) handle CTERM _ => find_cterm p (Thm.dest_arg t))
   34.59    | Abs (_,_,_) => find_cterm p (Thm.dest_abs NONE t |> snd)
   34.60    | _ => raise CTERM ("find_cterm",[t]);
   34.61  
   34.62      (* Some conversions-related stuff which has been forbidden entrance into Pure/conv.ML*)
   34.63  fun instantiate_cterm' ty tms = Drule.cterm_rule (Drule.instantiate' ty tms)
   34.64 -fun is_comb t = case (term_of t) of _$_ => true | _ => false;
   34.65 +fun is_comb t = (case Thm.term_of t of _ $ _ => true | _ => false);
   34.66  
   34.67  fun is_binop ct ct' = ct aconvc (Thm.dest_fun (Thm.dest_fun ct'))
   34.68    handle CTERM _ => false;
   34.69 @@ -428,7 +428,7 @@
   34.70          nnf_conv ctxt then_conv skolemize_conv then_conv prenex_conv then_conv
   34.71          weak_dnf_conv
   34.72  
   34.73 -    val concl = Thm.dest_arg o cprop_of
   34.74 +    val concl = Thm.dest_arg o Thm.cprop_of
   34.75      fun is_binop opr ct = (Thm.dest_fun2 ct aconvc opr handle CTERM _ => false)
   34.76      val is_req = is_binop @{cterm "op =:: real => _"}
   34.77      val is_ge = is_binop @{cterm "op <=:: real => _"}
   34.78 @@ -501,36 +501,36 @@
   34.79      val strip_exists =
   34.80        let
   34.81          fun h (acc, t) =
   34.82 -          case (term_of t) of
   34.83 +          case Thm.term_of t of
   34.84              Const(@{const_name Ex},_)$Abs(_,_,_) =>
   34.85                h (Thm.dest_abs NONE (Thm.dest_arg t) |>> (fn v => v::acc))
   34.86            | _ => (acc,t)
   34.87        in fn t => h ([],t)
   34.88        end
   34.89      fun name_of x =
   34.90 -      case term_of x of
   34.91 +      case Thm.term_of x of
   34.92          Free(s,_) => s
   34.93        | Var ((s,_),_) => s
   34.94        | _ => "x"
   34.95  
   34.96      fun mk_forall x th =
   34.97        Drule.arg_cong_rule
   34.98 -        (instantiate_cterm' [SOME (ctyp_of_term x)] [] @{cpat "All :: (?'a => bool) => _" })
   34.99 +        (instantiate_cterm' [SOME (Thm.ctyp_of_term x)] [] @{cpat "All :: (?'a => bool) => _" })
  34.100          (Thm.abstract_rule (name_of x) x th)
  34.101  
  34.102      val specl = fold_rev (fn x => fn th => instantiate' [] [SOME x] (th RS spec));
  34.103  
  34.104      fun ext T = Drule.cterm_rule (instantiate' [SOME T] []) @{cpat Ex}
  34.105 -    fun mk_ex v t = Thm.apply (ext (ctyp_of_term v)) (Thm.lambda v t)
  34.106 +    fun mk_ex v t = Thm.apply (ext (Thm.ctyp_of_term v)) (Thm.lambda v t)
  34.107  
  34.108      fun choose v th th' =
  34.109 -      case concl_of th of
  34.110 +      case Thm.concl_of th of
  34.111          @{term Trueprop} $ (Const(@{const_name Ex},_)$_) =>
  34.112          let
  34.113 -          val p = (funpow 2 Thm.dest_arg o cprop_of) th
  34.114 -          val T = (hd o Thm.dest_ctyp o ctyp_of_term) p
  34.115 +          val p = (funpow 2 Thm.dest_arg o Thm.cprop_of) th
  34.116 +          val T = (hd o Thm.dest_ctyp o Thm.ctyp_of_term) p
  34.117            val th0 = fconv_rule (Thm.beta_conversion true)
  34.118 -            (instantiate' [SOME T] [SOME p, (SOME o Thm.dest_arg o cprop_of) th'] exE)
  34.119 +            (instantiate' [SOME T] [SOME p, (SOME o Thm.dest_arg o Thm.cprop_of) th'] exE)
  34.120            val pv = (Thm.rhs_of o Thm.beta_conversion true)
  34.121              (Thm.apply @{cterm Trueprop} (Thm.apply p v))
  34.122            val th1 = Thm.forall_intr v (Thm.implies_intr pv th')
  34.123 @@ -545,7 +545,7 @@
  34.124      val strip_forall =
  34.125        let
  34.126          fun h (acc, t) =
  34.127 -          case (term_of t) of
  34.128 +          case Thm.term_of t of
  34.129              Const(@{const_name All},_)$Abs(_,_,_) =>
  34.130                h (Thm.dest_abs NONE (Thm.dest_arg t) |>> (fn v => v::acc))
  34.131            | _ => (acc,t)
  34.132 @@ -693,15 +693,15 @@
  34.133        end
  34.134  
  34.135    fun is_alien ct =
  34.136 -      case term_of ct of
  34.137 -        Const(@{const_name "real"}, _)$ n =>
  34.138 -        if can HOLogic.dest_number n then false else true
  34.139 -      | _ => false
  34.140 +    case Thm.term_of ct of
  34.141 +      Const(@{const_name "real"}, _)$ n =>
  34.142 +      if can HOLogic.dest_number n then false else true
  34.143 +    | _ => false
  34.144  in
  34.145  fun real_linear_prover translator (eq,le,lt) =
  34.146    let
  34.147 -    val lhs = lin_of_hol o Thm.dest_arg1 o Thm.dest_arg o cprop_of
  34.148 -    val rhs = lin_of_hol o Thm.dest_arg o Thm.dest_arg o cprop_of
  34.149 +    val lhs = lin_of_hol o Thm.dest_arg1 o Thm.dest_arg o Thm.cprop_of
  34.150 +    val rhs = lin_of_hol o Thm.dest_arg o Thm.dest_arg o Thm.cprop_of
  34.151      val eq_pols = map lhs eq
  34.152      val le_pols = map rhs le
  34.153      val lt_pols = map rhs lt
  34.154 @@ -770,7 +770,7 @@
  34.155  
  34.156  fun gen_prover_real_arith ctxt prover =
  34.157    let
  34.158 -    fun simple_cterm_ord t u = Term_Ord.term_ord (term_of t, term_of u) = LESS
  34.159 +    fun simple_cterm_ord t u = Term_Ord.term_ord (Thm.term_of t, Thm.term_of u) = LESS
  34.160      val {add, mul, neg, pow = _, sub = _, main} =
  34.161          Semiring_Normalizer.semiring_normalizers_ord_wrapper ctxt
  34.162          (the (Semiring_Normalizer.match ctxt @{cterm "(0::real) + 1"}))
    35.1 --- a/src/HOL/Library/refute.ML	Tue Mar 03 19:08:04 2015 +0100
    35.2 +++ b/src/HOL/Library/refute.ML	Wed Mar 04 19:53:18 2015 +0100
    35.3 @@ -1202,13 +1202,13 @@
    35.4  
    35.5  fun refute_goal ctxt params th i =
    35.6    let
    35.7 -    val t = th |> prop_of
    35.8 +    val t = th |> Thm.prop_of
    35.9    in
   35.10      if Logic.count_prems t = 0 then
   35.11        (writeln "No subgoal!"; "none")
   35.12      else
   35.13        let
   35.14 -        val assms = map term_of (Assumption.all_assms_of ctxt)
   35.15 +        val assms = map Thm.term_of (Assumption.all_assms_of ctxt)
   35.16          val (t, frees) = Logic.goal_params t i
   35.17        in
   35.18          refute_term ctxt params assms (subst_bounds (frees, t))
    36.1 --- a/src/HOL/Library/simps_case_conv.ML	Tue Mar 03 19:08:04 2015 +0100
    36.2 +++ b/src/HOL/Library/simps_case_conv.ML	Wed Mar 04 19:53:18 2015 +0100
    36.3 @@ -27,7 +27,7 @@
    36.4      #> map_filter (Ctr_Sugar.ctr_sugar_of ctxt)
    36.5      #> map #split
    36.6  
    36.7 -val strip_eq = prop_of #> HOLogic.dest_Trueprop #> HOLogic.dest_eq
    36.8 +val strip_eq = Thm.prop_of #> HOLogic.dest_Trueprop #> HOLogic.dest_eq
    36.9  
   36.10  
   36.11  local
   36.12 @@ -161,7 +161,7 @@
   36.13  
   36.14  fun apply_split ctxt split thm = Seq.of_list
   36.15    let val ((_,thm'), ctxt') = Variable.import false [thm] ctxt in
   36.16 -    (Variable.export ctxt' ctxt) (filter (was_split o prop_of) (thm' RL [split]))
   36.17 +    (Variable.export ctxt' ctxt) (filter (was_split o Thm.prop_of) (thm' RL [split]))
   36.18    end
   36.19  
   36.20  fun forward_tac rules t = Seq.of_list ([t] RL rules)
   36.21 @@ -176,7 +176,7 @@
   36.22  fun do_split ctxt split =
   36.23    let
   36.24      val split' = split RS iffD1;
   36.25 -    val split_rhs = concl_of (hd (snd (fst (Variable.import false [split'] ctxt))))
   36.26 +    val split_rhs = Thm.concl_of (hd (snd (fst (Variable.import false [split'] ctxt))))
   36.27    in if was_split split_rhs
   36.28       then DETERM (apply_split ctxt split') THEN get_rules_once_split
   36.29       else raise TERM ("malformed split rule", [split_rhs])
    37.1 --- a/src/HOL/List.thy	Tue Mar 03 19:08:04 2015 +0100
    37.2 +++ b/src/HOL/List.thy	Wed Mar 04 19:53:18 2015 +0100
    37.3 @@ -708,7 +708,7 @@
    37.4                  val inner_t =
    37.5                    fold (fn (_, T) => fn t => HOLogic.exists_const T $ absdummy T t)
    37.6                      (rev bound_vs) (fold (curry HOLogic.mk_conj) eqs' pat_eq')
    37.7 -                val lhs = term_of redex
    37.8 +                val lhs = Thm.term_of redex
    37.9                  val rhs = HOLogic.mk_Collect ("x", rT, inner_t)
   37.10                  val rewrite_rule_t = HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs, rhs))
   37.11                in
   37.12 @@ -717,7 +717,7 @@
   37.13                      (fn {context, ...} => tac context (rev Tis))) RS @{thm eq_reflection})
   37.14                end))
   37.15    in
   37.16 -    make_inner_eqs [] [] [] (dest_set (term_of redex))
   37.17 +    make_inner_eqs [] [] [] (dest_set (Thm.term_of redex))
   37.18    end
   37.19  
   37.20  end
   37.21 @@ -1043,7 +1043,7 @@
   37.22          else if lastl aconv lastr then rearr @{thm append_same_eq}
   37.23          else NONE
   37.24        end;
   37.25 -  in fn _ => fn ctxt => fn ct => list_eq ctxt (term_of ct) end;
   37.26 +  in fn _ => fn ctxt => fn ct => list_eq ctxt (Thm.term_of ct) end;
   37.27  *}
   37.28  
   37.29  
    38.1 --- a/src/HOL/Matrix_LP/ComputeHOL.thy	Tue Mar 03 19:08:04 2015 +0100
    38.2 +++ b/src/HOL/Matrix_LP/ComputeHOL.thy	Wed Mar 04 19:53:18 2015 +0100
    38.3 @@ -148,7 +148,7 @@
    38.4  struct
    38.5  
    38.6  local
    38.7 -fun lhs_of eq = fst (Thm.dest_equals (cprop_of eq));
    38.8 +fun lhs_of eq = fst (Thm.dest_equals (Thm.cprop_of eq));
    38.9  in
   38.10  fun rewrite_conv [] ct = raise CTERM ("rewrite_conv", [ct])
   38.11    | rewrite_conv (eq :: eqs) ct =
    39.1 --- a/src/HOL/Matrix_LP/Compute_Oracle/compute.ML	Tue Mar 03 19:08:04 2015 +0100
    39.2 +++ b/src/HOL/Matrix_LP/Compute_Oracle/compute.ML	Wed Mar 04 19:53:18 2015 +0100
    39.3 @@ -368,7 +368,7 @@
    39.4  fun export_thm thy hyps shyps prop =
    39.5      let
    39.6          val th = export_oracle (thy, hyps, shyps, prop)
    39.7 -        val hyps = map (fn h => Thm.assume (cterm_of thy h)) hyps
    39.8 +        val hyps = map (fn h => Thm.assume (Thm.cterm_of thy h)) hyps
    39.9      in
   39.10          fold (fn h => fn p => Thm.implies_elim p h) hyps th 
   39.11      end
   39.12 @@ -378,7 +378,7 @@
   39.13  fun rewrite computer ct =
   39.14      let
   39.15          val thy = Thm.theory_of_cterm ct
   39.16 -        val {t=t',T=ty,...} = rep_cterm ct
   39.17 +        val {t=t',T=ty,...} = Thm.rep_cterm ct
   39.18          val _ = super_theory (theory_of computer) thy
   39.19          val naming = naming_of computer
   39.20          val (encoding, t) = remove_types (encoding_of computer) t'
   39.21 @@ -401,7 +401,7 @@
   39.22  
   39.23  fun make_theorem computer th vars =
   39.24  let
   39.25 -    val _ = super_theory (theory_of computer) (theory_of_thm th)
   39.26 +    val _ = super_theory (theory_of computer) (Thm.theory_of_thm th)
   39.27  
   39.28      val (ComputeThm (hyps, shyps, prop)) = thm2cthm th 
   39.29  
   39.30 @@ -452,7 +452,7 @@
   39.31      val (encoding, concl) = remove_types encoding (Logic.strip_imp_concl prop)
   39.32      val _ = set_encoding computer encoding
   39.33  in
   39.34 -    Theorem (theory_of_thm th, stamp_of computer, vartab, varsubst, 
   39.35 +    Theorem (Thm.theory_of_thm th, stamp_of computer, vartab, varsubst, 
   39.36               prems, concl, hyps, shyps)
   39.37  end
   39.38      
   39.39 @@ -506,8 +506,8 @@
   39.40  
   39.41      fun compute_inst (s, ct) vs =
   39.42          let
   39.43 -            val _ = super_theory (theory_of_cterm ct) thy
   39.44 -            val ty = typ_of (ctyp_of_term ct) 
   39.45 +            val _ = super_theory (Thm.theory_of_cterm ct) thy
   39.46 +            val ty = Thm.typ_of (Thm.ctyp_of_term ct) 
   39.47          in          
   39.48              (case Symtab.lookup vartab s of 
   39.49                   NONE => raise Compute ("instantiate: variable '"^s^"' not found in theorem")
   39.50 @@ -519,7 +519,7 @@
   39.51                            raise Compute ("instantiate: wrong type for variable '"^s^"'")
   39.52                        else
   39.53                            let
   39.54 -                              val t = rewrite computer (term_of ct)
   39.55 +                              val t = rewrite computer (Thm.term_of ct)
   39.56                                val _ = assert_varfree vs t 
   39.57                                val _ = assert_closed t
   39.58                            in
   39.59 @@ -611,7 +611,7 @@
   39.60      val thy = 
   39.61          let
   39.62              val thy1 = theory_of_theorem th
   39.63 -            val thy2 = theory_of_thm th'
   39.64 +            val thy2 = Thm.theory_of_thm th'
   39.65          in
   39.66              if Theory.subthy (thy1, thy2) then thy2 
   39.67              else if Theory.subthy (thy2, thy1) then thy1 else
    40.1 --- a/src/HOL/Matrix_LP/Compute_Oracle/linker.ML	Tue Mar 03 19:08:04 2015 +0100
    40.2 +++ b/src/HOL/Matrix_LP/Compute_Oracle/linker.ML	Wed Mar 04 19:53:18 2015 +0100
    40.3 @@ -246,7 +246,7 @@
    40.4  
    40.5  fun collect_consts_of_thm th = 
    40.6      let
    40.7 -        val th = prop_of th
    40.8 +        val th = Thm.prop_of th
    40.9          val (prems, th) = (Logic.strip_imp_prems th, Logic.strip_imp_concl th)
   40.10          val (left, right) = Logic.dest_equals th
   40.11      in
   40.12 @@ -315,7 +315,8 @@
   40.13      end
   40.14  
   40.15  fun conv_subst thy (subst : Type.tyenv) =
   40.16 -    map (fn (iname, (sort, ty)) => (ctyp_of thy (TVar (iname, sort)), ctyp_of thy ty)) (Vartab.dest subst)
   40.17 +    map (fn (iname, (sort, ty)) => (Thm.ctyp_of thy (TVar (iname, sort)), Thm.ctyp_of thy ty))
   40.18 +      (Vartab.dest subst)
   40.19  
   40.20  fun add_monos thy monocs pats ths =
   40.21      let
   40.22 @@ -433,7 +434,7 @@
   40.23  
   40.24  fun rewrite pc cts =
   40.25      let
   40.26 -        val _ = add_instances' pc (map term_of cts)
   40.27 +        val _ = add_instances' pc (map Thm.term_of cts)
   40.28          val computer = (computer_of pc)
   40.29      in
   40.30          map (fn ct => Compute.rewrite computer ct) cts
   40.31 @@ -443,7 +444,7 @@
   40.32  
   40.33  fun make_theorem pc th vars = 
   40.34      let
   40.35 -        val _ = add_instances' pc [prop_of th]
   40.36 +        val _ = add_instances' pc [Thm.prop_of th]
   40.37  
   40.38      in
   40.39          Compute.make_theorem (computer_of pc) th vars
   40.40 @@ -451,7 +452,7 @@
   40.41  
   40.42  fun instantiate pc insts th = 
   40.43      let
   40.44 -        val _ = add_instances' pc (map (term_of o snd) insts)
   40.45 +        val _ = add_instances' pc (map (Thm.term_of o snd) insts)
   40.46      in
   40.47          Compute.instantiate (computer_of pc) insts th
   40.48      end
   40.49 @@ -460,7 +461,7 @@
   40.50  
   40.51  fun modus_ponens pc prem_no th' th =
   40.52      let
   40.53 -        val _ = add_instances' pc [prop_of th']
   40.54 +        val _ = add_instances' pc [Thm.prop_of th']
   40.55      in
   40.56          Compute.modus_ponens (computer_of pc) prem_no th' th
   40.57      end    
    41.1 --- a/src/HOL/Matrix_LP/matrixlp.ML	Tue Mar 03 19:08:04 2015 +0100
    41.2 +++ b/src/HOL/Matrix_LP/matrixlp.ML	Wed Mar 04 19:53:18 2015 +0100
    41.3 @@ -23,7 +23,7 @@
    41.4  
    41.5  fun matrix_simplify th =
    41.6    let
    41.7 -    val simp_th = matrix_compute (cprop_of th)
    41.8 +    val simp_th = matrix_compute (Thm.cprop_of th)
    41.9      val th = Thm.strip_shyps (Thm.equal_elim simp_th th)
   41.10      fun removeTrue th = removeTrue (Thm.implies_elim th TrueI) handle THM _ => th
   41.11    in
    42.1 --- a/src/HOL/Mirabelle/Tools/mirabelle_sledgehammer.ML	Tue Mar 03 19:08:04 2015 +0100
    42.2 +++ b/src/HOL/Mirabelle/Tools/mirabelle_sledgehammer.ML	Wed Mar 04 19:53:18 2015 +0100
    42.3 @@ -310,7 +310,7 @@
    42.4  
    42.5  fun get_prover ctxt name params goal all_facts =
    42.6    let
    42.7 -    val learn = Sledgehammer_MaSh.mash_learn_proof ctxt params (prop_of goal) all_facts
    42.8 +    val learn = Sledgehammer_MaSh.mash_learn_proof ctxt params (Thm.prop_of goal) all_facts
    42.9    in
   42.10      Sledgehammer_Prover_Minimize.get_minimizing_prover ctxt Sledgehammer_Prover.Normal learn name
   42.11    end
    43.1 --- a/src/HOL/Multivariate_Analysis/normarith.ML	Tue Mar 03 19:08:04 2015 +0100
    43.2 +++ b/src/HOL/Multivariate_Analysis/normarith.ML	Wed Mar 04 19:53:18 2015 +0100
    43.3 @@ -15,15 +15,15 @@
    43.4  
    43.5   open Conv;
    43.6   val bool_eq = op = : bool *bool -> bool
    43.7 -  fun dest_ratconst t = case term_of t of
    43.8 +  fun dest_ratconst t = case Thm.term_of t of
    43.9     Const(@{const_name divide}, _)$a$b => Rat.rat_of_quotient(HOLogic.dest_number a |> snd, HOLogic.dest_number b |> snd)
   43.10   | Const(@{const_name inverse}, _)$a => Rat.rat_of_quotient(1, HOLogic.dest_number a |> snd)
   43.11 - | _ => Rat.rat_of_int (HOLogic.dest_number (term_of t) |> snd)
   43.12 + | _ => Rat.rat_of_int (HOLogic.dest_number (Thm.term_of t) |> snd)
   43.13   fun is_ratconst t = can dest_ratconst t
   43.14 - fun augment_norm b t acc = case term_of t of
   43.15 + fun augment_norm b t acc = case Thm.term_of t of
   43.16       Const(@{const_name norm}, _) $ _ => insert (eq_pair bool_eq (op aconvc)) (b,Thm.dest_arg t) acc
   43.17     | _ => acc
   43.18 - fun find_normedterms t acc = case term_of t of
   43.19 + fun find_normedterms t acc = case Thm.term_of t of
   43.20      @{term "op + :: real => _"}$_$_ =>
   43.21              find_normedterms (Thm.dest_arg1 t) (find_normedterms (Thm.dest_arg t) acc)
   43.22        | @{term "op * :: real => _"}$_$_ =>
   43.23 @@ -50,7 +50,7 @@
   43.24   fun int_lincomb_eq l r = FuncUtil.Intfunc.is_empty (int_lincomb_sub l r)
   43.25  *)
   43.26  
   43.27 -fun vector_lincomb t = case term_of t of
   43.28 +fun vector_lincomb t = case Thm.term_of t of
   43.29     Const(@{const_name plus}, _) $ _ $ _ =>
   43.30      cterm_lincomb_add (vector_lincomb (Thm.dest_arg1 t)) (vector_lincomb (Thm.dest_arg t))
   43.31   | Const(@{const_name minus}, _) $ _ $ _ =>
   43.32 @@ -81,7 +81,7 @@
   43.33         end
   43.34     | SOME _ => fns) ts []
   43.35  
   43.36 -fun replacenegnorms cv t = case term_of t of
   43.37 +fun replacenegnorms cv t = case Thm.term_of t of
   43.38    @{term "op + :: real => _"}$_$_ => binop_conv (replacenegnorms cv) t
   43.39  | @{term "op * :: real => _"}$_$_ =>
   43.40      if dest_ratconst (Thm.dest_arg1 t) </ Rat.zero then arg_conv cv t else Thm.reflexive t
   43.41 @@ -203,7 +203,7 @@
   43.42   handle CTERM _ =>
   43.43    (apply_pth8 ctxt ct
   43.44     handle CTERM _ =>
   43.45 -    (case term_of ct of
   43.46 +    (case Thm.term_of ct of
   43.47       Const(@{const_name plus},_)$lt$rt =>
   43.48        let
   43.49         val l = headvector lt
   43.50 @@ -219,7 +219,7 @@
   43.51        end
   43.52       | _ => Thm.reflexive ct))
   43.53  
   43.54 -fun vector_canon_conv ctxt ct = case term_of ct of
   43.55 +fun vector_canon_conv ctxt ct = case Thm.term_of ct of
   43.56   Const(@{const_name plus},_)$_$_ =>
   43.57    let
   43.58     val ((p,l),r) = Thm.dest_comb ct |>> Thm.dest_comb
   43.59 @@ -248,7 +248,7 @@
   43.60  *)
   43.61  | _ => apply_pth1 ct
   43.62  
   43.63 -fun norm_canon_conv ctxt ct = case term_of ct of
   43.64 +fun norm_canon_conv ctxt ct = case Thm.term_of ct of
   43.65    Const(@{const_name norm},_)$_ => arg_conv (vector_canon_conv ctxt) ct
   43.66   | _ => raise CTERM ("norm_canon_conv", [ct])
   43.67  
   43.68 @@ -258,9 +258,9 @@
   43.69  
   43.70  local
   43.71   val pth_zero = @{thm norm_zero}
   43.72 - val tv_n = (ctyp_of_term o Thm.dest_arg o Thm.dest_arg1 o Thm.dest_arg o cprop_of)
   43.73 + val tv_n = (Thm.ctyp_of_term o Thm.dest_arg o Thm.dest_arg1 o Thm.dest_arg o Thm.cprop_of)
   43.74               pth_zero
   43.75 - val concl = Thm.dest_arg o cprop_of
   43.76 + val concl = Thm.dest_arg o Thm.cprop_of
   43.77   fun real_vector_combo_prover ctxt translator (nubs,ges,gts) =
   43.78    let
   43.79     (* FIXME: Should be computed statically!!*)
   43.80 @@ -319,7 +319,7 @@
   43.81          (fn t => null (FuncUtil.Ctermfunc.dom (vector_lincomb t))) (map snd rawdests)
   43.82  
   43.83    in fst (RealArith.real_linear_prover translator
   43.84 -        (map (fn t => Drule.instantiate_normalize ([(tv_n, ctyp_of_term t)],[]) pth_zero)
   43.85 +        (map (fn t => Drule.instantiate_normalize ([(tv_n, Thm.ctyp_of_term t)],[]) pth_zero)
   43.86              zerodests,
   43.87          map (fconv_rule (try_conv (Conv.top_sweep_conv (K (norm_canon_conv ctxt)) ctxt) then_conv
   43.88                         arg_conv (arg_conv real_poly_conv))) ges',
   43.89 @@ -332,7 +332,7 @@
   43.90  local
   43.91   val pth = @{thm norm_imp_pos_and_ge}
   43.92   val norm_mp = match_mp pth
   43.93 - val concl = Thm.dest_arg o cprop_of
   43.94 + val concl = Thm.dest_arg o Thm.cprop_of
   43.95   fun conjunct1 th = th RS @{thm conjunct1}
   43.96   fun conjunct2 th = th RS @{thm conjunct2}
   43.97  fun real_vector_ineq_prover ctxt translator (ges,gts) =
   43.98 @@ -342,8 +342,8 @@
   43.99    val lctab = vector_lincombs (map snd (filter (not o fst) ntms))
  43.100    val (fxns, ctxt') = Variable.variant_fixes (replicate (length lctab) "x") ctxt
  43.101    fun instantiate_cterm' ty tms = Drule.cterm_rule (Drule.instantiate' ty tms)
  43.102 -  fun mk_norm t = Thm.apply (instantiate_cterm' [SOME (ctyp_of_term t)] [] @{cpat "norm :: (?'a :: real_normed_vector) => real"}) t
  43.103 -  fun mk_equals l r = Thm.apply (Thm.apply (instantiate_cterm' [SOME (ctyp_of_term l)] [] @{cpat "op == :: ?'a =>_"}) l) r
  43.104 +  fun mk_norm t = Thm.apply (instantiate_cterm' [SOME (Thm.ctyp_of_term t)] [] @{cpat "norm :: (?'a :: real_normed_vector) => real"}) t
  43.105 +  fun mk_equals l r = Thm.apply (Thm.apply (instantiate_cterm' [SOME (Thm.ctyp_of_term l)] [] @{cpat "op == :: ?'a =>_"}) l) r
  43.106    val asl = map2 (fn (t,_) => fn n => Thm.assume (mk_equals (mk_norm t) (Proof_Context.cterm_of ctxt' (Free(n,@{typ real}))))) lctab fxns
  43.107    val replace_conv = try_conv (rewrs_conv asl)
  43.108    val replace_rule = fconv_rule (funpow 2 arg_conv (replacenegnorms replace_conv))
  43.109 @@ -353,7 +353,7 @@
  43.110    val gts' = map replace_rule gts
  43.111    val nubs = map (conjunct2 o norm_mp) asl
  43.112    val th1 = real_vector_combo_prover ctxt' translator (nubs,ges',gts')
  43.113 -  val shs = filter (member (fn (t,th) => t aconvc cprop_of th) asl) (#hyps (crep_thm th1))
  43.114 +  val shs = filter (member (fn (t,th) => t aconvc Thm.cprop_of th) asl) (#hyps (Thm.crep_thm th1))
  43.115    val th11 = hd (Variable.export ctxt' ctxt [fold Thm.implies_intr shs th1])
  43.116    val cps = map (swap o Thm.dest_equals) (cprems_of th11)
  43.117    val th12 = Drule.instantiate_normalize ([], cps) th11
  43.118 @@ -366,7 +366,7 @@
  43.119  local
  43.120   val rawrule = fconv_rule (arg_conv (rewr_conv @{thm real_eq_0_iff_le_ge_0}))
  43.121   fun conj_pair th = (th RS @{thm conjunct1}, th RS @{thm conjunct2})
  43.122 - fun simple_cterm_ord t u = Term_Ord.term_ord (term_of t, term_of u) = LESS;
  43.123 + fun simple_cterm_ord t u = Term_Ord.term_ord (Thm.term_of t, Thm.term_of u) = LESS;
  43.124    (* FIXME: Lookup in the context every time!!! Fix this !!!*)
  43.125   fun splitequation ctxt th acc =
  43.126    let
  43.127 @@ -391,7 +391,7 @@
  43.128   fun pure ctxt = fst o RealArith.gen_prover_real_arith ctxt (real_vector_prover ctxt);
  43.129   fun norm_arith ctxt ct =
  43.130    let
  43.131 -   val ctxt' = Variable.declare_term (term_of ct) ctxt
  43.132 +   val ctxt' = Variable.declare_term (Thm.term_of ct) ctxt
  43.133     val th = init_conv ctxt' ct
  43.134    in Thm.equal_elim (Drule.arg_cong_rule @{cterm Trueprop} (Thm.symmetric th))
  43.135                  (pure ctxt' (Thm.rhs_of th))
    44.1 --- a/src/HOL/Mutabelle/mutabelle_extra.ML	Tue Mar 03 19:08:04 2015 +0100
    44.2 +++ b/src/HOL/Mutabelle/mutabelle_extra.ML	Wed Mar 04 19:53:18 2015 +0100
    44.3 @@ -236,7 +236,7 @@
    44.4  val forbidden_consts = [@{const_name Pure.type}]
    44.5  
    44.6  fun is_forbidden_theorem (s, th) =
    44.7 -  let val consts = Term.add_const_names (prop_of th) [] in
    44.8 +  let val consts = Term.add_const_names (Thm.prop_of th) [] in
    44.9      exists (member (op =) (Long_Name.explode s)) forbidden_thms orelse
   44.10      exists (member (op =) forbidden_consts) consts orelse
   44.11      length (Long_Name.explode s) <> 2 orelse
   44.12 @@ -325,7 +325,7 @@
   44.13          (fst (Variable.import_terms true [t] ctxt)))
   44.14    end
   44.15  
   44.16 -fun is_executable_thm thy th = is_executable_term thy (prop_of th)
   44.17 +fun is_executable_thm thy th = is_executable_term thy (Thm.prop_of th)
   44.18  
   44.19  val freezeT =
   44.20    map_types (map_type_tvar (fn ((a, i), S) =>
   44.21 @@ -333,7 +333,7 @@
   44.22  
   44.23  fun thms_of all thy =
   44.24    filter
   44.25 -    (fn th => (all orelse Context.theory_name (theory_of_thm th) = Context.theory_name thy)
   44.26 +    (fn th => (all orelse Context.theory_name (Thm.theory_of_thm th) = Context.theory_name thy)
   44.27        (* andalso is_executable_thm thy th *))
   44.28      (map snd (filter_out is_forbidden_theorem (Global_Theory.all_thms_of thy false)))
   44.29  
   44.30 @@ -368,7 +368,7 @@
   44.31        map (fn (mtd_name, invoke_mtd) =>
   44.32          (mtd_name, safe_invoke_mtd thy (mtd_name, invoke_mtd) mutant)) mtds)
   44.33    in
   44.34 -    (Thm.get_name_hint thm, exec, prop_of thm, map create_mutant_subentry mutants)
   44.35 +    (Thm.get_name_hint thm, exec, Thm.prop_of thm, map create_mutant_subentry mutants)
   44.36    end
   44.37  
   44.38  (* (theory -> thm -> bool -> term list -> mtd list -> 'a) -> theory -> mtd list -> thm -> 'a *)
    45.1 --- a/src/HOL/NSA/HyperDef.thy	Tue Mar 03 19:08:04 2015 +0100
    45.2 +++ b/src/HOL/NSA/HyperDef.thy	Wed Mar 04 19:53:18 2015 +0100
    45.3 @@ -338,7 +338,7 @@
    45.4  *}
    45.5  
    45.6  simproc_setup fast_arith_hypreal ("(m::hypreal) < n" | "(m::hypreal) <= n" | "(m::hypreal) = n") =
    45.7 -  {* fn _ => fn ss => fn ct => Lin_Arith.simproc ss (term_of ct) *}
    45.8 +  {* fn _ => fn ss => fn ct => Lin_Arith.simproc ss (Thm.term_of ct) *}
    45.9  
   45.10  
   45.11  subsection {* Exponentials on the Hyperreals *}
    46.1 --- a/src/HOL/NSA/NSA.thy	Tue Mar 03 19:08:04 2015 +0100
    46.2 +++ b/src/HOL/NSA/NSA.thy	Wed Mar 04 19:53:18 2015 +0100
    46.3 @@ -656,7 +656,8 @@
    46.4    ("0 @= x" | "1 @= y" | "numeral w @= z" | "- 1 @= y" | "- numeral w @= r") =
    46.5  {*
    46.6    let val rule = @{thm approx_reorient} RS eq_reflection
    46.7 -      fun proc phi ss ct = case term_of ct of
    46.8 +      fun proc phi ss ct =
    46.9 +        case Thm.term_of ct of
   46.10            _ $ t $ u => if can HOLogic.dest_number u then NONE
   46.11              else if can HOLogic.dest_number t then SOME rule else NONE
   46.12          | _ => NONE
    47.1 --- a/src/HOL/NSA/transfer.ML	Tue Mar 03 19:08:04 2015 +0100
    47.2 +++ b/src/HOL/NSA/transfer.ML	Wed Mar 04 19:53:18 2015 +0100
    47.3 @@ -57,7 +57,7 @@
    47.4      val meta = Local_Defs.meta_rewrite_rule ctxt;
    47.5      val ths' = map meta ths;
    47.6      val unfolds' = map meta unfolds and refolds' = map meta refolds;
    47.7 -    val (_$_$t') = concl_of (Raw_Simplifier.rewrite ctxt true unfolds' (cterm_of thy t))
    47.8 +    val (_$_$t') = Thm.concl_of (Raw_Simplifier.rewrite ctxt true unfolds' (Thm.cterm_of thy t))
    47.9      val u = unstar_term consts t'
   47.10      val tac =
   47.11        rewrite_goals_tac ctxt (ths' @ refolds' @ unfolds') THEN
   47.12 @@ -73,7 +73,7 @@
   47.13          (fn th =>
   47.14              let
   47.15                val tr = transfer_thm_of ctxt ths t
   47.16 -              val (_$l$r) = concl_of tr;
   47.17 +              val (_$l$r) = Thm.concl_of tr;
   47.18                val trs = if l aconv r then [] else [tr];
   47.19              in rewrite_goals_tac ctxt trs th end))
   47.20  
    48.1 --- a/src/HOL/Nat.thy	Tue Mar 03 19:08:04 2015 +0100
    48.2 +++ b/src/HOL/Nat.thy	Wed Mar 04 19:53:18 2015 +0100
    48.3 @@ -1629,7 +1629,7 @@
    48.4  declaration {* K Lin_Arith.setup *}
    48.5  
    48.6  simproc_setup fast_arith_nat ("(m::nat) < n" | "(m::nat) <= n" | "(m::nat) = n") =
    48.7 -  {* fn _ => fn ss => fn ct => Lin_Arith.simproc ss (term_of ct) *}
    48.8 +  {* fn _ => fn ss => fn ct => Lin_Arith.simproc ss (Thm.term_of ct) *}
    48.9  (* Because of this simproc, the arithmetic solver is really only
   48.10  useful to detect inconsistencies among the premises for subgoals which are
   48.11  *not* themselves (in)equalities, because the latter activate
    49.1 --- a/src/HOL/Nitpick_Examples/Mono_Nits.thy	Tue Mar 03 19:08:04 2015 +0100
    49.2 +++ b/src/HOL/Nitpick_Examples/Mono_Nits.thy	Wed Mar 04 19:53:18 2015 +0100
    49.3 @@ -153,7 +153,7 @@
    49.4  fun theorems_of thy =
    49.5    filter (fn (name, th) =>
    49.6               not (is_forbidden_theorem name) andalso
    49.7 -             (theory_of_thm th, thy) |> apply2 Context.theory_name |> op =)
    49.8 +             (Thm.theory_of_thm th, thy) |> apply2 Context.theory_name |> op =)
    49.9           (Global_Theory.all_thms_of thy true)
   49.10  
   49.11  fun check_formulas tsp =
   49.12 @@ -179,7 +179,7 @@
   49.13      val _ = File.write path ""
   49.14      fun check_theorem (name, th) =
   49.15        let
   49.16 -        val t = th |> prop_of |> Type.legacy_freeze |> close_form
   49.17 +        val t = th |> Thm.prop_of |> Type.legacy_freeze |> close_form
   49.18          val neg_t = Logic.mk_implies (t, @{prop False})
   49.19          val (nondef_ts, def_ts, _, _, _, _) =
   49.20            TimeLimit.timeLimit preproc_timeout (preprocess_formulas hol_ctxt [])
    50.1 --- a/src/HOL/Nominal/nominal_datatype.ML	Tue Mar 03 19:08:04 2015 +0100
    50.2 +++ b/src/HOL/Nominal/nominal_datatype.ML	Wed Mar 04 19:53:18 2015 +0100
    50.3 @@ -84,7 +84,7 @@
    50.4  
    50.5  (*******************************)
    50.6  
    50.7 -val (_ $ (_ $ (_ $ (distinct_f $ _) $ _))) = hd (prems_of Old_Datatype.distinct_lemma);
    50.8 +val (_ $ (_ $ (_ $ (distinct_f $ _) $ _))) = hd (Thm.prems_of Old_Datatype.distinct_lemma);
    50.9  
   50.10  
   50.11  (** simplification procedure for sorting permutations **)
   50.12 @@ -108,9 +108,9 @@
   50.13              val cp = cp_inst_of thy a b;
   50.14              val dj = dj_thm_of thy b a;
   50.15              val dj_cp' = [cp, dj] MRS dj_cp;
   50.16 -            val cert = SOME o cterm_of thy
   50.17 +            val cert = SOME o Thm.cterm_of thy
   50.18            in
   50.19 -            SOME (mk_meta_eq (Drule.instantiate' [SOME (ctyp_of thy S)]
   50.20 +            SOME (mk_meta_eq (Drule.instantiate' [SOME (Thm.ctyp_of thy S)]
   50.21                [cert t, cert r, cert s] dj_cp'))
   50.22            end
   50.23          else NONE
   50.24 @@ -152,9 +152,11 @@
   50.25      HOLogic.mk_prod (x, y) $ Const (@{const_name Nil}, pT)
   50.26    end;
   50.27  
   50.28 -fun mk_not_sym ths = maps (fn th => case prop_of th of
   50.29 -    _ $ (Const (@{const_name Not}, _) $ (Const (@{const_name HOL.eq}, _) $ _ $ _)) => [th, th RS not_sym]
   50.30 -  | _ => [th]) ths;
   50.31 +fun mk_not_sym ths = maps (fn th =>
   50.32 +  (case Thm.prop_of th of
   50.33 +    _ $ (Const (@{const_name Not}, _) $ (Const (@{const_name HOL.eq}, _) $ _ $ _)) =>
   50.34 +    [th, th RS not_sym]
   50.35 +  | _ => [th])) ths;
   50.36  
   50.37  fun fresh_const T U = Const (@{const_name Nominal.fresh}, T --> U --> HOLogic.boolT);
   50.38  fun fresh_star_const T U =
   50.39 @@ -775,11 +777,12 @@
   50.40      fun dt_constr_defs ((((((_, (_, _, constrs)),
   50.41          (_, (_, _, constrs'))), tname), T), T'), constr_syntax) (thy, defs, eqns, dist_lemmas) =
   50.42        let
   50.43 -        val rep_const = cterm_of thy
   50.44 +        val rep_const = Thm.cterm_of thy
   50.45            (Const (Sign.intern_const thy ("Rep_" ^ tname), T --> T'));
   50.46          val dist =
   50.47            Drule.export_without_context
   50.48 -            (cterm_instantiate [(cterm_of thy distinct_f, rep_const)] Old_Datatype.distinct_lemma);
   50.49 +            (cterm_instantiate
   50.50 +              [(Thm.cterm_of thy distinct_f, rep_const)] Old_Datatype.distinct_lemma);
   50.51          val (thy', defs', eqns') = fold (make_constr_def tname T T')
   50.52            (constrs ~~ constrs' ~~ constr_syntax) (Sign.add_path tname thy, defs, [])
   50.53        in
   50.54 @@ -815,7 +818,7 @@
   50.55  
   50.56      fun prove_perm_rep_perm (atom, perm_closed_thms) = map (fn th =>
   50.57        let
   50.58 -        val _ $ (_ $ (Rep $ x)) = Logic.unvarify_global (prop_of th);
   50.59 +        val _ $ (_ $ (Rep $ x)) = Logic.unvarify_global (Thm.prop_of th);
   50.60          val Type ("fun", [T, U]) = fastype_of Rep;
   50.61          val permT = mk_permT (Type (atom, []));
   50.62          val pi = Free ("pi", permT);
   50.63 @@ -1044,11 +1047,11 @@
   50.64                 full_simp_tac (put_simpset HOL_basic_ss ctxt addsimps Rep_inverse_thms) 1,
   50.65                 etac mp 1, resolve_tac ctxt Rep_thms 1])]);
   50.66  
   50.67 -    val Ps = map head_of (HOLogic.dest_conj (HOLogic.dest_Trueprop (concl_of indrule_lemma)));
   50.68 +    val Ps = map head_of (HOLogic.dest_conj (HOLogic.dest_Trueprop (Thm.concl_of indrule_lemma)));
   50.69      val frees = if length Ps = 1 then [Free ("P", snd (dest_Var (hd Ps)))] else
   50.70        map (Free o apfst fst o dest_Var) Ps;
   50.71      val indrule_lemma' = cterm_instantiate
   50.72 -      (map (cterm_of thy8) Ps ~~ map (cterm_of thy8) frees) indrule_lemma;
   50.73 +      (map (Thm.cterm_of thy8) Ps ~~ map (Thm.cterm_of thy8) frees) indrule_lemma;
   50.74  
   50.75      val Abs_inverse_thms' = map (fn r => r RS subst) Abs_inverse_thms;
   50.76  
   50.77 @@ -1254,17 +1257,18 @@
   50.78               full_simp_tac (put_simpset HOL_ss ctxt' addsimps (fresh_prod :: fresh_atm)) 1,
   50.79               REPEAT (etac conjE 1)])
   50.80            [ex] ctxt
   50.81 -      in (freshs1 @ [term_of cx], freshs2 @ ths, ctxt') end;
   50.82 +      in (freshs1 @ [Thm.term_of cx], freshs2 @ ths, ctxt') end;
   50.83  
   50.84      fun fresh_fresh_inst thy a b =
   50.85        let
   50.86          val T = fastype_of a;
   50.87 -        val SOME th = find_first (fn th => case prop_of th of
   50.88 +        val SOME th = find_first (fn th =>
   50.89 +          (case Thm.prop_of th of
   50.90              _ $ (_ $ (Const (_, Type (_, [U, _])) $ _ $ _)) $ _ => U = T
   50.91 -          | _ => false) perm_fresh_fresh
   50.92 +          | _ => false)) perm_fresh_fresh
   50.93        in
   50.94          Drule.instantiate' []
   50.95 -          [SOME (cterm_of thy a), NONE, SOME (cterm_of thy b)] th
   50.96 +          [SOME (Thm.cterm_of thy a), NONE, SOME (Thm.cterm_of thy b)] th
   50.97        end;
   50.98  
   50.99      val fs_cp_sort =
  50.100 @@ -1311,11 +1315,11 @@
  50.101                     SUBPROOF (fn {prems = iprems, params, concl,
  50.102                         context = context2, ...} =>
  50.103                       let
  50.104 -                       val concl' = term_of concl;
  50.105 +                       val concl' = Thm.term_of concl;
  50.106                         val _ $ (_ $ _ $ u) = concl';
  50.107                         val U = fastype_of u;
  50.108                         val (xs, params') =
  50.109 -                         chop (length cargs) (map (term_of o #2) params);
  50.110 +                         chop (length cargs) (map (Thm.term_of o #2) params);
  50.111                         val Ts = map fastype_of xs;
  50.112                         val cnstr = Const (cname, Ts ---> U);
  50.113                         val (pis, z) = split_last params';
  50.114 @@ -1378,13 +1382,13 @@
  50.115  
  50.116      val induct_aux' = Thm.instantiate ([],
  50.117        map (fn (s, v as Var (_, T)) =>
  50.118 -        (cterm_of thy9 v, cterm_of thy9 (Free (s, T))))
  50.119 +        (Thm.cterm_of thy9 v, Thm.cterm_of thy9 (Free (s, T))))
  50.120            (pnames ~~ map head_of (HOLogic.dest_conj
  50.121 -             (HOLogic.dest_Trueprop (concl_of induct_aux)))) @
  50.122 +             (HOLogic.dest_Trueprop (Thm.concl_of induct_aux)))) @
  50.123        map (fn (_, f) =>
  50.124          let val f' = Logic.varify_global f
  50.125 -        in (cterm_of thy9 f',
  50.126 -          cterm_of thy9 (Const (@{const_name Nominal.supp}, fastype_of f')))
  50.127 +        in (Thm.cterm_of thy9 f',
  50.128 +          Thm.cterm_of thy9 (Const (@{const_name Nominal.supp}, fastype_of f')))
  50.129          end) fresh_fs) induct_aux;
  50.130  
  50.131      val induct = Goal.prove_global_future thy9 []
  50.132 @@ -1547,8 +1551,8 @@
  50.133              (augment_sort thy1 pt_cp_sort
  50.134                (Logic.mk_implies (HOLogic.mk_Trueprop Q, HOLogic.mk_Trueprop P)))
  50.135              (fn {context = ctxt, ...} => dtac (Thm.instantiate ([],
  50.136 -                 [(cterm_of thy11 (Var (("pi", 0), permT)),
  50.137 -                   cterm_of thy11 (Const (@{const_name rev}, permT --> permT) $ pi))]) th) 1 THEN
  50.138 +                 [(Thm.cterm_of thy11 (Var (("pi", 0), permT)),
  50.139 +                   Thm.cterm_of thy11 (Const (@{const_name rev}, permT --> permT) $ pi))]) th) 1 THEN
  50.140                 NominalPermeq.perm_simp_tac (put_simpset HOL_ss ctxt) 1)) (ps ~~ ths)
  50.141        in (ths, ths') end) dt_atomTs);
  50.142  
  50.143 @@ -1622,12 +1626,12 @@
  50.144                       fresh_prems) = chop (length finite_prems) prems;
  50.145                     val unique_prem' = unique_prem RS spec RS mp;
  50.146                     val unique = [unique_prem', unique_prem' RS sym] MRS trans;
  50.147 -                   val _ $ (_ $ (_ $ S $ _)) $ _ = prop_of supports_fresh;
  50.148 +                   val _ $ (_ $ (_ $ S $ _)) $ _ = Thm.prop_of supports_fresh;
  50.149                     val tuple = foldr1 HOLogic.mk_prod (x :: rec_fns')
  50.150                   in EVERY
  50.151                     [rtac (Drule.cterm_instantiate
  50.152 -                      [(cterm_of thy11 S,
  50.153 -                        cterm_of thy11 (Const (@{const_name Nominal.supp},
  50.154 +                      [(Thm.cterm_of thy11 S,
  50.155 +                        Thm.cterm_of thy11 (Const (@{const_name Nominal.supp},
  50.156                            fastype_of tuple --> HOLogic.mk_setT aT) $ tuple))]
  50.157                        supports_fresh) 1,
  50.158                      simp_tac (put_simpset HOL_basic_ss context addsimps
  50.159 @@ -1638,8 +1642,9 @@
  50.160                      SUBPROOF (fn {prems = prems', params = [(_, a), (_, b)], ...} => EVERY
  50.161                        [cut_facts_tac [rec_prem] 1,
  50.162                         rtac (Thm.instantiate ([],
  50.163 -                         [(cterm_of thy11 (Var (("pi", 0), mk_permT aT)),
  50.164 -                           cterm_of thy11 (perm_of_pair (term_of a, term_of b)))]) eqvt_th) 1,
  50.165 +                         [(Thm.cterm_of thy11 (Var (("pi", 0), mk_permT aT)),
  50.166 +                           Thm.cterm_of thy11
  50.167 +                            (perm_of_pair (Thm.term_of a, Thm.term_of b)))]) eqvt_th) 1,
  50.168                         asm_simp_tac (put_simpset HOL_ss context addsimps
  50.169                           (prems' @ perm_swap @ perm_fresh_fresh)) 1]) context 1,
  50.170                      rtac rec_prem 1,
  50.171 @@ -1666,7 +1671,7 @@
  50.172        (rec_unique_frees ~~ rec_result_Ts ~~ rec_sets);
  50.173  
  50.174      val induct_aux_rec = Drule.cterm_instantiate
  50.175 -      (map (apply2 (cterm_of thy11) o apsnd (augment_sort thy11 fs_cp_sort))
  50.176 +      (map (apply2 (Thm.cterm_of thy11) o apsnd (augment_sort thy11 fs_cp_sort))
  50.177           (map (fn (aT, f) => (Logic.varify_global f, Abs ("z", HOLogic.unitT,
  50.178              Const (@{const_name Nominal.supp}, fun_tupleT --> HOLogic.mk_setT aT) $ fun_tuple)))
  50.179                fresh_fs @
  50.180 @@ -1694,7 +1699,7 @@
  50.181               full_simp_tac (put_simpset HOL_ss ctxt addsimps (fresh_prod :: fresh_atm)) 1,
  50.182               REPEAT (etac conjE 1)])
  50.183            [ex] ctxt
  50.184 -      in (freshs1 @ [term_of cx], freshs2 @ ths, ctxt') end;
  50.185 +      in (freshs1 @ [Thm.term_of cx], freshs2 @ ths, ctxt') end;
  50.186  
  50.187      val finite_ctxt_prems = map (fn aT =>
  50.188        HOLogic.mk_Trueprop
  50.189 @@ -1747,9 +1752,9 @@
  50.190                  SUBPROOF (fn {asms, concl, prems = prems', params, context = context', ...} =>
  50.191                    let
  50.192                      val SOME prem = find_first (can (HOLogic.dest_eq o
  50.193 -                      HOLogic.dest_Trueprop o prop_of)) prems';
  50.194 -                    val _ $ (_ $ lhs $ rhs) = prop_of prem;
  50.195 -                    val _ $ (_ $ lhs' $ rhs') = term_of concl;
  50.196 +                      HOLogic.dest_Trueprop o Thm.prop_of)) prems';
  50.197 +                    val _ $ (_ $ lhs $ rhs) = Thm.prop_of prem;
  50.198 +                    val _ $ (_ $ lhs' $ rhs') = Thm.term_of concl;
  50.199                      val rT = fastype_of lhs';
  50.200                      val (c, cargsl) = strip_comb lhs;
  50.201                      val cargsl' = partition_cargs idxs cargsl;
  50.202 @@ -1758,17 +1763,20 @@
  50.203                      val cargsr' = partition_cargs idxs cargsr;
  50.204                      val boundsr = maps fst cargsr';
  50.205                      val (params1, _ :: params2) =
  50.206 -                      chop (length params div 2) (map (term_of o #2) params);
  50.207 +                      chop (length params div 2) (map (Thm.term_of o #2) params);
  50.208                      val params' = params1 @ params2;
  50.209 -                    val rec_prems = filter (fn th => case prop_of th of
  50.210 -                        _ $ p => (case head_of p of
  50.211 -                          Const (s, _) => member (op =) rec_set_names s
  50.212 -                        | _ => false)
  50.213 -                      | _ => false) prems';
  50.214 -                    val fresh_prems = filter (fn th => case prop_of th of
  50.215 +                    val rec_prems = filter (fn th =>
  50.216 +                        (case Thm.prop_of th of
  50.217 +                          _ $ p =>
  50.218 +                            (case head_of p of
  50.219 +                              Const (s, _) => member (op =) rec_set_names s
  50.220 +                            | _ => false)
  50.221 +                        | _ => false)) prems';
  50.222 +                    val fresh_prems = filter (fn th =>
  50.223 +                      (case Thm.prop_of th of
  50.224                          _ $ (Const (@{const_name Nominal.fresh}, _) $ _ $ _) => true
  50.225                        | _ $ (Const (@{const_name Not}, _) $ _) => true
  50.226 -                      | _ => false) prems';
  50.227 +                      | _ => false)) prems';
  50.228                      val Ts = map fastype_of boundsl;
  50.229  
  50.230                      val _ = warning "step 1: obtaining fresh names";
  50.231 @@ -1842,7 +1850,7 @@
  50.232                      val _ = warning "step 6: (ts, pi1^-1 o pi2 o vs) in rec_set";
  50.233                      val rec_prems' = map (fn th =>
  50.234                        let
  50.235 -                        val _ $ (S $ x $ y) = prop_of th;
  50.236 +                        val _ $ (S $ x $ y) = Thm.prop_of th;
  50.237                          val Const (s, _) = head_of S;
  50.238                          val k = find_index (equal s) rec_set_names;
  50.239                          val pi = rpi1 @ pi2;
  50.240 @@ -1853,8 +1861,8 @@
  50.241                              val l = find_index (equal T) dt_atomTs;
  50.242                              val th = nth (nth rec_equiv_thms' l) k;
  50.243                              val th' = Thm.instantiate ([],
  50.244 -                              [(cterm_of thy11 (Var (("pi", 0), U)),
  50.245 -                                cterm_of thy11 p)]) th;
  50.246 +                              [(Thm.cterm_of thy11 (Var (("pi", 0), U)),
  50.247 +                                Thm.cterm_of thy11 p)]) th;
  50.248                            in rtac th' 1 end;
  50.249                          val th' = Goal.prove context'' [] []
  50.250                            (HOLogic.mk_Trueprop (S $ mk_pi x $ mk_pi y))
  50.251 @@ -1868,15 +1876,17 @@
  50.252                            (put_simpset HOL_basic_ss context'' addsimps rpi1_pi2_eqs) th'
  50.253                        end) rec_prems2;
  50.254  
  50.255 -                    val ihs = filter (fn th => case prop_of th of
  50.256 -                      _ $ (Const (@{const_name All}, _) $ _) => true | _ => false) prems';
  50.257 +                    val ihs = filter (fn th =>
  50.258 +                      (case Thm.prop_of th of
  50.259 +                        _ $ (Const (@{const_name All}, _) $ _) => true
  50.260 +                      | _ => false)) prems';
  50.261  
  50.262                      (** pi1 o rs = pi2 o vs , rs = pi1^-1 o pi2 o vs **)
  50.263                      val _ = warning "step 7: pi1 o rs = pi2 o vs , rs = pi1^-1 o pi2 o vs";
  50.264                      val rec_eqns = map (fn (th, ih) =>
  50.265                        let
  50.266                          val th' = th RS (ih RS spec RS mp) RS sym;
  50.267 -                        val _ $ (_ $ lhs $ rhs) = prop_of th';
  50.268 +                        val _ $ (_ $ lhs $ rhs) = Thm.prop_of th';
  50.269                          fun strip_perm (_ $ _ $ t) = strip_perm t
  50.270                            | strip_perm t = t;
  50.271                        in
  50.272 @@ -1894,7 +1904,7 @@
  50.273                        maps (fn (rec_prem, ih) =>
  50.274                          let
  50.275                            val _ $ (S $ x $ (y as Free (_, T))) =
  50.276 -                            prop_of rec_prem;
  50.277 +                            Thm.prop_of rec_prem;
  50.278                            val k = find_index (equal S) rec_sets;
  50.279                            val atoms = flat (map_filter (fn (bs, z) =>
  50.280                              if z = x then NONE else SOME bs) cargsl')
  50.281 @@ -1981,7 +1991,7 @@
  50.282                             (fresh_prems' @ freshs2' @ calc_atm @ perm_fresh_fresh)) 1));
  50.283  
  50.284                      val _ = warning "final result";
  50.285 -                    val final = Goal.prove context'' [] [] (term_of concl)
  50.286 +                    val final = Goal.prove context'' [] [] (Thm.term_of concl)
  50.287                        (fn _ => cut_facts_tac [pi1_pi2_result RS sym] 1 THEN
  50.288                          full_simp_tac (put_simpset HOL_basic_ss context'' addsimps perm_fresh_fresh @
  50.289                            fresh_results @ fresh_results') 1);
    51.1 --- a/src/HOL/Nominal/nominal_fresh_fun.ML	Tue Mar 03 19:08:04 2015 +0100
    51.2 +++ b/src/HOL/Nominal/nominal_fresh_fun.ML	Wed Mar 04 19:53:18 2015 +0100
    51.3 @@ -12,22 +12,22 @@
    51.4  (* FIXME proper SUBGOAL/CSUBGOAL instead of cprems_of etc. *)
    51.5  fun gen_res_inst_tac_term ctxt instf tyinst tinst elim th i st =
    51.6    let
    51.7 -    val thy = theory_of_thm st;
    51.8 +    val thy = Thm.theory_of_thm st;
    51.9      val cgoal = nth (cprems_of st) (i - 1);
   51.10 -    val {maxidx, ...} = rep_cterm cgoal;
   51.11 +    val {maxidx, ...} = Thm.rep_cterm cgoal;
   51.12      val j = maxidx + 1;
   51.13      val tyinst' = map (apfst (Logic.incr_tvar j)) tyinst;
   51.14 -    val ps = Logic.strip_params (term_of cgoal);
   51.15 +    val ps = Logic.strip_params (Thm.term_of cgoal);
   51.16      val Ts = map snd ps;
   51.17      val tinst' = map (fn (t, u) =>
   51.18        (head_of (Logic.incr_indexes (Ts, j) t),
   51.19         fold_rev Term.abs ps u)) tinst;
   51.20      val th' = instf
   51.21 -      (map (apply2 (ctyp_of thy)) tyinst')
   51.22 -      (map (apply2 (cterm_of thy)) tinst')
   51.23 +      (map (apply2 (Thm.ctyp_of thy)) tyinst')
   51.24 +      (map (apply2 (Thm.cterm_of thy)) tinst')
   51.25        (Thm.lift_rule cgoal th)
   51.26    in
   51.27 -    compose_tac ctxt (elim, th', nprems_of th) i st
   51.28 +    compose_tac ctxt (elim, th', Thm.nprems_of th) i st
   51.29    end handle General.Subscript => Seq.empty;
   51.30  (* FIXME proper SUBGOAL/CSUBGOAL instead of cprems_of etc. *)
   51.31  
   51.32 @@ -73,7 +73,7 @@
   51.33     val at_name_inst_thm = get_dyn_thm thy ("at_"^atom_basename^"_inst") atom_basename;
   51.34     val exists_fresh' = at_name_inst_thm RS at_exists_fresh';
   51.35  (* find the variable we want to instantiate *)
   51.36 -   val x = hd (Misc_Legacy.term_vars (prop_of exists_fresh'));
   51.37 +   val x = hd (Misc_Legacy.term_vars (Thm.prop_of exists_fresh'));
   51.38   in
   51.39     fn st =>
   51.40     (cut_inst_tac_term' ctxt [(x,s)] exists_fresh' 1 THEN
   51.41 @@ -131,7 +131,7 @@
   51.42      val simp_ctxt =
   51.43        ctxt addsimps (fresh_prod :: abs_fresh)
   51.44        addsimps fresh_perm_app;
   51.45 -    val x = hd (tl (Misc_Legacy.term_vars (prop_of exI)));
   51.46 +    val x = hd (tl (Misc_Legacy.term_vars (Thm.prop_of exI)));
   51.47      val atom_name_opt = get_inner_fresh_fun goal;
   51.48      val n = length (Logic.strip_params goal);
   51.49      (* Here we rely on the fact that the variable introduced by generate_fresh_tac *)
   51.50 @@ -145,18 +145,18 @@
   51.51      val pt_name_inst = get_dyn_thm thy ("pt_"^atom_basename^"_inst") atom_basename;
   51.52      val at_name_inst = get_dyn_thm thy ("at_"^atom_basename^"_inst") atom_basename;
   51.53      fun inst_fresh vars params i st =
   51.54 -   let val vars' = Misc_Legacy.term_vars (prop_of st);
   51.55 -       val thy = theory_of_thm st;
   51.56 +   let val vars' = Misc_Legacy.term_vars (Thm.prop_of st);
   51.57 +       val thy = Thm.theory_of_thm st;
   51.58     in case subtract (op =) vars vars' of
   51.59       [x] =>
   51.60 -      Seq.single (Thm.instantiate ([],[(cterm_of thy x,cterm_of thy (fold_rev Term.abs params (Bound 0)))]) st)
   51.61 +      Seq.single (Thm.instantiate ([], [(Thm.cterm_of thy x, Thm.cterm_of thy (fold_rev Term.abs params (Bound 0)))]) st)
   51.62      | _ => error "fresh_fun_simp: Too many variables, please report."
   51.63     end
   51.64    in
   51.65    ((fn st =>
   51.66    let
   51.67 -    val vars = Misc_Legacy.term_vars (prop_of st);
   51.68 -    val params = Logic.strip_params (nth (prems_of st) (i-1))
   51.69 +    val vars = Misc_Legacy.term_vars (Thm.prop_of st);
   51.70 +    val params = Logic.strip_params (nth (Thm.prems_of st) (i-1))
   51.71      (* The tactics which solve the subgoals generated
   51.72         by the conditionnal rewrite rule. *)
   51.73      val post_rewrite_tacs =
    52.1 --- a/src/HOL/Nominal/nominal_induct.ML	Tue Mar 03 19:08:04 2015 +0100
    52.2 +++ b/src/HOL/Nominal/nominal_induct.ML	Wed Mar 04 19:53:18 2015 +0100
    52.3 @@ -107,7 +107,7 @@
    52.4            (CONJUNCTS (ALLGOALS
    52.5              let
    52.6                val adefs = nth_list atomized_defs (j - 1);
    52.7 -              val frees = fold (Term.add_frees o prop_of) adefs [];
    52.8 +              val frees = fold (Term.add_frees o Thm.prop_of) adefs [];
    52.9                val xs = nth_list fixings (j - 1);
   52.10                val k = nth concls (j - 1) + more_consumes
   52.11              in
    53.1 --- a/src/HOL/Nominal/nominal_inductive.ML	Tue Mar 03 19:08:04 2015 +0100
    53.2 +++ b/src/HOL/Nominal/nominal_inductive.ML	Wed Mar 04 19:53:18 2015 +0100
    53.3 @@ -34,13 +34,13 @@
    53.4  val perm_bool = mk_meta_eq @{thm perm_bool_def};
    53.5  val perm_boolI = @{thm perm_boolI};
    53.6  val (_, [perm_boolI_pi, _]) = Drule.strip_comb (snd (Thm.dest_comb
    53.7 -  (Drule.strip_imp_concl (cprop_of perm_boolI))));
    53.8 +  (Drule.strip_imp_concl (Thm.cprop_of perm_boolI))));
    53.9  
   53.10  fun mk_perm_bool pi th = th RS Drule.cterm_instantiate
   53.11    [(perm_boolI_pi, pi)] perm_boolI;
   53.12  
   53.13  fun mk_perm_bool_simproc names = Simplifier.simproc_global_i
   53.14 -  (theory_of_thm perm_bool) "perm_bool" [@{term "perm pi x"}] (fn ctxt =>
   53.15 +  (Thm.theory_of_thm perm_bool) "perm_bool" [@{term "perm pi x"}] (fn ctxt =>
   53.16      fn Const (@{const_name Nominal.perm}, _) $ _ $ t =>
   53.17           if member (op =) names (the_default "" (try (head_of #> dest_Const #> fst) t))
   53.18           then SOME perm_bool else NONE
   53.19 @@ -126,7 +126,7 @@
   53.20  
   53.21  fun map_thm ctxt f tac monos opt th =
   53.22    let
   53.23 -    val prop = prop_of th;
   53.24 +    val prop = Thm.prop_of th;
   53.25      fun prove t =
   53.26        Goal.prove ctxt [] [] t (fn _ =>
   53.27          EVERY [cut_facts_tac [th] 1, etac rev_mp 1,
   53.28 @@ -141,7 +141,7 @@
   53.29     eta_contract_cterm (Conjunction.mk_conjunction_balanced objs));
   53.30  
   53.31  fun first_order_mrs ths th = ths MRS
   53.32 -  Thm.instantiate (first_order_matchs (cprems_of th) (map cprop_of ths)) th;
   53.33 +  Thm.instantiate (first_order_matchs (cprems_of th) (map Thm.cprop_of ths)) th;
   53.34  
   53.35  fun prove_strong_ind s avoids ctxt =
   53.36    let
   53.37 @@ -159,7 +159,7 @@
   53.38            commas_quote xs));
   53.39      val induct_cases = map (fst o fst) (fst (Rule_Cases.get (the
   53.40        (Induct.lookup_inductP ctxt (hd names)))));
   53.41 -    val ([raw_induct'], ctxt') = Variable.import_terms false [prop_of raw_induct] ctxt;
   53.42 +    val ([raw_induct'], ctxt') = Variable.import_terms false [Thm.prop_of raw_induct] ctxt;
   53.43      val concls = raw_induct' |> Logic.strip_imp_concl |> HOLogic.dest_Trueprop |>
   53.44        HOLogic.dest_conj |> map (HOLogic.dest_imp ##> strip_comb);
   53.45      val ps = map (fst o snd) concls;
   53.46 @@ -204,7 +204,7 @@
   53.47      val fsT = TFree (fs_ctxt_tyname, ind_sort);
   53.48  
   53.49      val inductive_forall_def' = Drule.instantiate'
   53.50 -      [SOME (ctyp_of thy fsT)] [] inductive_forall_def;
   53.51 +      [SOME (Thm.ctyp_of thy fsT)] [] inductive_forall_def;
   53.52  
   53.53      fun lift_pred' t (Free (s, T)) ts =
   53.54        list_comb (Free (s, fsT --> T), t :: ts);
   53.55 @@ -305,7 +305,7 @@
   53.56               full_simp_tac (put_simpset HOL_basic_ss ctxt' addsimps [@{thm id_apply}]) 1,
   53.57               REPEAT (etac conjE 1)])
   53.58            [ex] ctxt
   53.59 -      in (freshs1 @ [term_of cx], freshs2 @ ths, ctxt') end;
   53.60 +      in (freshs1 @ [Thm.term_of cx], freshs2 @ ths, ctxt') end;
   53.61  
   53.62      fun mk_ind_proof ctxt' thss =
   53.63        Goal.prove ctxt' [] prems' concl' (fn {prems = ihyps, context = ctxt} =>
   53.64 @@ -316,14 +316,14 @@
   53.65               SUBPROOF (fn {prems = gprems, params, concl, context = ctxt', ...} =>
   53.66                 let
   53.67                   val (params', (pis, z)) =
   53.68 -                   chop (length params - length atomTs - 1) (map (term_of o #2) params) ||>
   53.69 +                   chop (length params - length atomTs - 1) (map (Thm.term_of o #2) params) ||>
   53.70                     split_last;
   53.71                   val bvars' = map
   53.72                     (fn (Bound i, T) => (nth params' (length params' - i), T)
   53.73                       | (t, T) => (t, T)) bvars;
   53.74                   val pi_bvars = map (fn (t, _) =>
   53.75                     fold_rev (NominalDatatype.mk_perm []) pis t) bvars';
   53.76 -                 val (P, ts) = strip_comb (HOLogic.dest_Trueprop (term_of concl));
   53.77 +                 val (P, ts) = strip_comb (HOLogic.dest_Trueprop (Thm.term_of concl));
   53.78                   val (freshs1, freshs2, ctxt'') = fold
   53.79                     (obtain_fresh_name (ts @ pi_bvars))
   53.80                     (map snd bvars') ([], [], ctxt');
   53.81 @@ -336,9 +336,9 @@
   53.82                       else pi2
   53.83                     end;
   53.84                   val pis'' = fold (concat_perm #> map) pis' pis;
   53.85 -                 val env = Pattern.first_order_match thy (ihypt, prop_of ihyp)
   53.86 +                 val env = Pattern.first_order_match thy (ihypt, Thm.prop_of ihyp)
   53.87                     (Vartab.empty, Vartab.empty);
   53.88 -                 val ihyp' = Thm.instantiate ([], map (apply2 (cterm_of thy))
   53.89 +                 val ihyp' = Thm.instantiate ([], map (apply2 (Thm.cterm_of thy))
   53.90                     (map (Envir.subst_term env) vs ~~
   53.91                      map (fold_rev (NominalDatatype.mk_perm [])
   53.92                        (rev pis' @ pis)) params' @ [z])) ihyp;
   53.93 @@ -346,7 +346,7 @@
   53.94                     Simplifier.simplify (put_simpset HOL_basic_ss ctxt' addsimps [@{thm id_apply}]
   53.95                         addsimprocs [NominalDatatype.perm_simproc])
   53.96                       (Simplifier.simplify (put_simpset eqvt_ss ctxt')
   53.97 -                       (fold_rev (mk_perm_bool o cterm_of thy)
   53.98 +                       (fold_rev (mk_perm_bool o Thm.cterm_of thy)
   53.99                           (rev pis' @ pis) th));
  53.100                   val (gprems1, gprems2) = split_list
  53.101                     (map (fn (th, t) =>
  53.102 @@ -360,7 +360,7 @@
  53.103                   val vc_compat_ths' = map (fn th =>
  53.104                     let
  53.105                       val th' = first_order_mrs gprems1 th;
  53.106 -                     val (bop, lhs, rhs) = (case concl_of th' of
  53.107 +                     val (bop, lhs, rhs) = (case Thm.concl_of th' of
  53.108                           _ $ (fresh $ lhs $ rhs) =>
  53.109                             (fn t => fn u => fresh $ t $ u, lhs, rhs)
  53.110                         | _ $ (_ $ (_ $ lhs $ rhs)) =>
  53.111 @@ -382,14 +382,14 @@
  53.112                     (HOLogic.mk_Trueprop (list_comb (P $ hd ts,
  53.113                       map (fold (NominalDatatype.mk_perm []) pis') (tl ts))))
  53.114                     (fn _ => EVERY ([simp_tac (put_simpset eqvt_ss ctxt'') 1, rtac ihyp' 1,
  53.115 -                     REPEAT_DETERM_N (nprems_of ihyp - length gprems)
  53.116 +                     REPEAT_DETERM_N (Thm.nprems_of ihyp - length gprems)
  53.117                         (simp_tac swap_simps_simpset 1),
  53.118                       REPEAT_DETERM_N (length gprems)
  53.119                         (simp_tac (put_simpset HOL_basic_ss ctxt''
  53.120                            addsimps [inductive_forall_def']
  53.121                            addsimprocs [NominalDatatype.perm_simproc]) 1 THEN
  53.122                          resolve_tac ctxt'' gprems2 1)]));
  53.123 -                 val final = Goal.prove ctxt'' [] [] (term_of concl)
  53.124 +                 val final = Goal.prove ctxt'' [] [] (Thm.term_of concl)
  53.125                     (fn _ => cut_facts_tac [th] 1 THEN full_simp_tac (put_simpset HOL_ss ctxt''
  53.126                       addsimps vc_compat_ths'' @ freshs2' @
  53.127                         perm_fresh_fresh @ fresh_atm) 1);
  53.128 @@ -407,7 +407,7 @@
  53.129  
  53.130      val cases_prems = map (fn ((name, avoids), rule) =>
  53.131        let
  53.132 -        val ([rule'], ctxt') = Variable.import_terms false [prop_of rule] ctxt;
  53.133 +        val ([rule'], ctxt') = Variable.import_terms false [Thm.prop_of rule] ctxt;
  53.134          val prem :: prems = Logic.strip_imp_prems rule';
  53.135          val concl = Logic.strip_imp_concl rule'
  53.136        in
  53.137 @@ -472,7 +472,7 @@
  53.138                  rtac (first_order_mrs case_hyps case_hyp) 1
  53.139                else
  53.140                  let
  53.141 -                  val params' = map (term_of o #2 o nth (rev params)) is;
  53.142 +                  val params' = map (Thm.term_of o #2 o nth (rev params)) is;
  53.143                    val tab = params' ~~ map fst qs;
  53.144                    val (hyps1, hyps2) = chop (length args) case_hyps;
  53.145                    (* turns a = t and [x1 # t, ..., xn # t] *)
  53.146 @@ -483,12 +483,12 @@
  53.147                        (map (fn th =>
  53.148                           let
  53.149                             val (cf, ct) =
  53.150 -                             Thm.dest_comb (Thm.dest_arg (cprop_of th));
  53.151 +                             Thm.dest_comb (Thm.dest_arg (Thm.cprop_of th));
  53.152                             val arg_cong' = Drule.instantiate'
  53.153 -                             [SOME (ctyp_of_term ct)]
  53.154 +                             [SOME (Thm.ctyp_of_term ct)]
  53.155                               [NONE, SOME ct, SOME cf] (arg_cong RS iffD2);
  53.156                             val inst = Thm.first_order_match (ct,
  53.157 -                             Thm.dest_arg (Thm.dest_arg (cprop_of th')))
  53.158 +                             Thm.dest_arg (Thm.dest_arg (Thm.cprop_of th')))
  53.159                           in [th', th] MRS Thm.instantiate inst arg_cong'
  53.160                           end) ths1,
  53.161                         ths2)
  53.162 @@ -505,17 +505,17 @@
  53.163                    val freshs2' = NominalDatatype.mk_not_sym freshs2;
  53.164                    val pis = map (NominalDatatype.perm_of_pair)
  53.165                      ((freshs1 ~~ map fst qs) @ (params' ~~ freshs1));
  53.166 -                  val mk_pis = fold_rev mk_perm_bool (map (cterm_of thy) pis);
  53.167 -                  val obj = cterm_of thy (foldr1 HOLogic.mk_conj (map (map_aterms
  53.168 +                  val mk_pis = fold_rev mk_perm_bool (map (Thm.cterm_of thy) pis);
  53.169 +                  val obj = Thm.cterm_of thy (foldr1 HOLogic.mk_conj (map (map_aterms
  53.170                       (fn x as Free _ =>
  53.171                             if member (op =) args x then x
  53.172                             else (case AList.lookup op = tab x of
  53.173                               SOME y => y
  53.174                             | NONE => fold_rev (NominalDatatype.mk_perm []) pis x)
  53.175 -                       | x => x) o HOLogic.dest_Trueprop o prop_of) case_hyps));
  53.176 +                       | x => x) o HOLogic.dest_Trueprop o Thm.prop_of) case_hyps));
  53.177                    val inst = Thm.first_order_match (Thm.dest_arg
  53.178                      (Drule.strip_imp_concl (hd (cprems_of case_hyp))), obj);
  53.179 -                  val th = Goal.prove ctxt3 [] [] (term_of concl)
  53.180 +                  val th = Goal.prove ctxt3 [] [] (Thm.term_of concl)
  53.181                      (fn {context = ctxt4, ...} =>
  53.182                         rtac (Thm.instantiate inst case_hyp) 1 THEN
  53.183                         SUBPROOF (fn {prems = fresh_hyps, ...} =>
  53.184 @@ -610,7 +610,7 @@
  53.185        end;
  53.186      val perm_pi_simp = Global_Theory.get_thms thy "perm_pi_simp";
  53.187      val (([t], [pi]), ctxt') = ctxt |>
  53.188 -      Variable.import_terms false [concl_of raw_induct] ||>>
  53.189 +      Variable.import_terms false [Thm.concl_of raw_induct] ||>>
  53.190        Variable.variant_fixes ["pi"];
  53.191      val eqvt_simpset = put_simpset HOL_basic_ss ctxt' addsimps
  53.192        (NominalThmDecls.get_eqvt_thms ctxt' @ perm_pi_simp) addsimprocs
  53.193 @@ -621,7 +621,7 @@
  53.194      fun eqvt_tac pi (intr, vs) st =
  53.195        let
  53.196          fun eqvt_err s =
  53.197 -          let val ([t], ctxt'') = Variable.import_terms true [prop_of intr] ctxt'
  53.198 +          let val ([t], ctxt'') = Variable.import_terms true [Thm.prop_of intr] ctxt'
  53.199            in error ("Could not prove equivariance for introduction rule\n" ^
  53.200              Syntax.string_of_term ctxt'' t ^ "\n" ^ s)
  53.201            end;
  53.202 @@ -630,16 +630,16 @@
  53.203              val prems' = map (fn th => the_default th (map_thm ctxt''
  53.204                (split_conj (K I) names) (etac conjunct2 1) monos NONE th)) prems;
  53.205              val prems'' = map (fn th => Simplifier.simplify eqvt_simpset
  53.206 -              (mk_perm_bool (cterm_of thy pi) th)) prems';
  53.207 -            val intr' = Drule.cterm_instantiate (map (cterm_of thy) vs ~~
  53.208 -               map (cterm_of thy o NominalDatatype.mk_perm [] pi o term_of o #2) params)
  53.209 +              (mk_perm_bool (Thm.cterm_of thy pi) th)) prems';
  53.210 +            val intr' = Drule.cterm_instantiate (map (Thm.cterm_of thy) vs ~~
  53.211 +               map (Thm.cterm_of thy o NominalDatatype.mk_perm [] pi o Thm.term_of o #2) params)
  53.212                 intr
  53.213            in (rtac intr' THEN_ALL_NEW (TRY o resolve_tac ctxt'' prems'')) 1
  53.214            end) ctxt' 1 st
  53.215        in
  53.216          case (Seq.pull res handle THM (s, _, _) => eqvt_err s) of
  53.217            NONE => eqvt_err ("Rule does not match goal\n" ^
  53.218 -            Syntax.string_of_term ctxt' (hd (prems_of st)))
  53.219 +            Syntax.string_of_term ctxt' (hd (Thm.prems_of st)))
  53.220          | SOME (th, _) => Seq.single th
  53.221        end;
  53.222      val thss = map (fn atom =>
    54.1 --- a/src/HOL/Nominal/nominal_inductive2.ML	Tue Mar 03 19:08:04 2015 +0100
    54.2 +++ b/src/HOL/Nominal/nominal_inductive2.ML	Wed Mar 04 19:53:18 2015 +0100
    54.3 @@ -38,13 +38,13 @@
    54.4  val perm_bool = mk_meta_eq @{thm perm_bool_def};
    54.5  val perm_boolI = @{thm perm_boolI};
    54.6  val (_, [perm_boolI_pi, _]) = Drule.strip_comb (snd (Thm.dest_comb
    54.7 -  (Drule.strip_imp_concl (cprop_of perm_boolI))));
    54.8 +  (Drule.strip_imp_concl (Thm.cprop_of perm_boolI))));
    54.9  
   54.10  fun mk_perm_bool pi th = th RS Drule.cterm_instantiate
   54.11    [(perm_boolI_pi, pi)] perm_boolI;
   54.12  
   54.13  fun mk_perm_bool_simproc names = Simplifier.simproc_global_i
   54.14 -  (theory_of_thm perm_bool) "perm_bool" [@{term "perm pi x"}] (fn ctxt =>
   54.15 +  (Thm.theory_of_thm perm_bool) "perm_bool" [@{term "perm pi x"}] (fn ctxt =>
   54.16      fn Const (@{const_name Nominal.perm}, _) $ _ $ t =>
   54.17           if member (op =) names (the_default "" (try (head_of #> dest_Const #> fst) t))
   54.18           then SOME perm_bool else NONE
   54.19 @@ -131,7 +131,7 @@
   54.20  
   54.21  fun map_thm ctxt f tac monos opt th =
   54.22    let
   54.23 -    val prop = prop_of th;
   54.24 +    val prop = Thm.prop_of th;
   54.25      fun prove t =
   54.26        Goal.prove ctxt [] [] t (fn _ =>
   54.27          EVERY [cut_facts_tac [th] 1, etac rev_mp 1,
   54.28 @@ -144,10 +144,10 @@
   54.29    in (Logic.list_all (params, t), (rev vs, subst_bounds (vs, t))) end;
   54.30  
   54.31  fun inst_params thy (vs, p) th cts =
   54.32 -  let val env = Pattern.first_order_match thy (p, prop_of th)
   54.33 +  let val env = Pattern.first_order_match thy (p, Thm.prop_of th)
   54.34      (Vartab.empty, Vartab.empty)
   54.35    in Thm.instantiate ([],
   54.36 -    map (Envir.subst_term env #> cterm_of thy) vs ~~ cts) th
   54.37 +    map (Envir.subst_term env #> Thm.cterm_of thy) vs ~~ cts) th
   54.38    end;
   54.39  
   54.40  fun prove_strong_ind s alt_name avoids ctxt =
   54.41 @@ -168,7 +168,7 @@
   54.42        (Induct.lookup_inductP ctxt (hd names)))));
   54.43      val induct_cases' = if null induct_cases then replicate (length intrs) ""
   54.44        else induct_cases;
   54.45 -    val ([raw_induct'], ctxt') = Variable.import_terms false [prop_of raw_induct] ctxt;
   54.46 +    val ([raw_induct'], ctxt') = Variable.import_terms false [Thm.prop_of raw_induct] ctxt;
   54.47      val concls = raw_induct' |> Logic.strip_imp_concl |> HOLogic.dest_Trueprop |>
   54.48        HOLogic.dest_conj |> map (HOLogic.dest_imp ##> strip_comb);
   54.49      val ps = map (fst o snd) concls;
   54.50 @@ -230,7 +230,7 @@
   54.51      val fsT = TFree (fs_ctxt_tyname, ind_sort);
   54.52  
   54.53      val inductive_forall_def' = Drule.instantiate'
   54.54 -      [SOME (ctyp_of thy fsT)] [] inductive_forall_def;
   54.55 +      [SOME (Thm.ctyp_of thy fsT)] [] inductive_forall_def;
   54.56  
   54.57      fun lift_pred' t (Free (s, T)) ts =
   54.58        list_comb (Free (s, fsT --> T), t :: ts);
   54.59 @@ -319,7 +319,7 @@
   54.60          val fs_atom = Global_Theory.get_thm thy
   54.61            ("fs_" ^ Long_Name.base_name atom ^ "1");
   54.62          val avoid_th = Drule.instantiate'
   54.63 -          [SOME (ctyp_of thy (fastype_of p))] [SOME (cterm_of thy p)]
   54.64 +          [SOME (Thm.ctyp_of thy (fastype_of p))] [SOME (Thm.cterm_of thy p)]
   54.65            ([at_inst, fin, fs_atom] MRS @{thm at_set_avoiding});
   54.66          val (([(_, cx)], th1 :: th2 :: ths), ctxt') = Obtain.result
   54.67            (fn ctxt' => EVERY
   54.68 @@ -333,7 +333,7 @@
   54.69          val pTs = map NominalAtoms.mk_permT (Ts1 @ Ts2);
   54.70          val (pis1, pis2) = chop (length Ts1)
   54.71            (map Bound (length pTs - 1 downto 0));
   54.72 -        val _ $ (f $ (_ $ pi $ l) $ r) = prop_of th2
   54.73 +        val _ $ (f $ (_ $ pi $ l) $ r) = Thm.prop_of th2
   54.74          val th2' =
   54.75            Goal.prove ctxt' [] []
   54.76              (Logic.list_all (map (pair "pi") pTs, HOLogic.mk_Trueprop
   54.77 @@ -343,7 +343,7 @@
   54.78                 full_simp_tac (put_simpset HOL_basic_ss ctxt' addsimps perm_set_forget) 1) |>
   54.79            Simplifier.simplify (put_simpset eqvt_ss ctxt')
   54.80        in
   54.81 -        (freshs @ [term_of cx],
   54.82 +        (freshs @ [Thm.term_of cx],
   54.83           ths1 @ ths, ths2 @ [th1], ths3 @ [th2'], ctxt')
   54.84        end;
   54.85  
   54.86 @@ -358,12 +358,12 @@
   54.87                 let
   54.88                   val (cparams', (pis, z)) =
   54.89                     chop (length params - length atomTs - 1) (map #2 params) ||>
   54.90 -                   (map term_of #> split_last);
   54.91 -                 val params' = map term_of cparams'
   54.92 +                   (map Thm.term_of #> split_last);
   54.93 +                 val params' = map Thm.term_of cparams'
   54.94                   val sets' = map (apfst (curry subst_bounds (rev params'))) sets;
   54.95                   val pi_sets = map (fn (t, _) =>
   54.96                     fold_rev (NominalDatatype.mk_perm []) pis t) sets';
   54.97 -                 val (P, ts) = strip_comb (HOLogic.dest_Trueprop (term_of concl));
   54.98 +                 val (P, ts) = strip_comb (HOLogic.dest_Trueprop (Thm.term_of concl));
   54.99                   val gprems1 = map_filter (fn (th, t) =>
  54.100                     if null (preds_of ps t) then SOME th
  54.101                     else
  54.102 @@ -374,7 +374,7 @@
  54.103                     let
  54.104                       val th' = gprems1 MRS inst_params thy p th cparams';
  54.105                       val (h, ts) =
  54.106 -                       strip_comb (HOLogic.dest_Trueprop (concl_of th'))
  54.107 +                       strip_comb (HOLogic.dest_Trueprop (Thm.concl_of th'))
  54.108                     in
  54.109                       Goal.prove ctxt' [] []
  54.110                         (HOLogic.mk_Trueprop (list_comb (h,
  54.111 @@ -399,12 +399,12 @@
  54.112                   val pis'' = fold_rev (concat_perm #> map) pis' pis;
  54.113                   val ihyp' = inst_params thy vs_ihypt ihyp
  54.114                     (map (fold_rev (NominalDatatype.mk_perm [])
  54.115 -                      (pis' @ pis) #> cterm_of thy) params' @ [cterm_of thy z]);
  54.116 +                      (pis' @ pis) #> Thm.cterm_of thy) params' @ [Thm.cterm_of thy z]);
  54.117                   fun mk_pi th =
  54.118                     Simplifier.simplify (put_simpset HOL_basic_ss ctxt' addsimps [@{thm id_apply}]
  54.119                         addsimprocs [NominalDatatype.perm_simproc])
  54.120                       (Simplifier.simplify (put_simpset eqvt_ss ctxt')
  54.121 -                       (fold_rev (mk_perm_bool o cterm_of thy)
  54.122 +                       (fold_rev (mk_perm_bool o Thm.cterm_of thy)
  54.123                           (pis' @ pis) th));
  54.124                   val gprems2 = map (fn (th, t) =>
  54.125                     if null (preds_of ps t) then mk_pi th
  54.126 @@ -425,7 +425,7 @@
  54.127                            addsimps [inductive_forall_def']
  54.128                            addsimprocs [NominalDatatype.perm_simproc]) 1 THEN
  54.129                          resolve_tac ctxt'' gprems2 1)]));
  54.130 -                 val final = Goal.prove ctxt'' [] [] (term_of concl)
  54.131 +                 val final = Goal.prove ctxt'' [] [] (Thm.term_of concl)
  54.132                     (fn _ => cut_facts_tac [th] 1 THEN full_simp_tac (put_simpset HOL_ss ctxt''
  54.133                       addsimps vc_compat_ths1' @ fresh_ths1 @
  54.134                         perm_freshs_freshs') 1);
    55.1 --- a/src/HOL/Nominal/nominal_permeq.ML	Tue Mar 03 19:08:04 2015 +0100
    55.2 +++ b/src/HOL/Nominal/nominal_permeq.ML	Wed Mar 04 19:53:18 2015 +0100
    55.3 @@ -71,8 +71,8 @@
    55.4  val supports_fresh_rule = @{thm "supports_fresh"};
    55.5  
    55.6  (* pulls out dynamically a thm via the proof state *)
    55.7 -fun dynamic_thms st name = Global_Theory.get_thms (theory_of_thm st) name;
    55.8 -fun dynamic_thm  st name = Global_Theory.get_thm  (theory_of_thm st) name;
    55.9 +fun dynamic_thms st name = Global_Theory.get_thms (Thm.theory_of_thm st) name;
   55.10 +fun dynamic_thm  st name = Global_Theory.get_thm  (Thm.theory_of_thm st) name;
   55.11  
   55.12  
   55.13  (* needed in the process of fully simplifying permutations *)
   55.14 @@ -203,14 +203,14 @@
   55.15        if pi1 <> pi2 then  (* only apply the composition rule in this case *)
   55.16          if T = U then    
   55.17            SOME (Drule.instantiate'
   55.18 -            [SOME (ctyp_of thy (fastype_of t))]
   55.19 -            [SOME (cterm_of thy pi1), SOME (cterm_of thy pi2), SOME (cterm_of thy t)]
   55.20 +            [SOME (Thm.ctyp_of thy (fastype_of t))]
   55.21 +            [SOME (Thm.cterm_of thy pi1), SOME (Thm.cterm_of thy pi2), SOME (Thm.cterm_of thy t)]
   55.22              (mk_meta_eq ([Global_Theory.get_thm thy ("pt_"^tname'^"_inst"),
   55.23               Global_Theory.get_thm thy ("at_"^tname'^"_inst")] MRS pt_perm_compose_aux)))
   55.24          else
   55.25            SOME (Drule.instantiate'
   55.26 -            [SOME (ctyp_of thy (fastype_of t))]
   55.27 -            [SOME (cterm_of thy pi1), SOME (cterm_of thy pi2), SOME (cterm_of thy t)]
   55.28 +            [SOME (Thm.ctyp_of thy (fastype_of t))]
   55.29 +            [SOME (Thm.cterm_of thy pi1), SOME (Thm.cterm_of thy pi2), SOME (Thm.cterm_of thy t)]
   55.30              (mk_meta_eq (Global_Theory.get_thm thy ("cp_"^tname'^"_"^uname'^"_inst") RS 
   55.31               cp1_aux)))
   55.32        else NONE
   55.33 @@ -293,11 +293,11 @@
   55.34  fun finite_guess_tac_i tactical ctxt i st =
   55.35      let val goal = nth (cprems_of st) (i - 1)
   55.36      in
   55.37 -      case Envir.eta_contract (Logic.strip_assums_concl (term_of goal)) of
   55.38 +      case Envir.eta_contract (Logic.strip_assums_concl (Thm.term_of goal)) of
   55.39            _ $ (Const (@{const_name finite}, _) $ (Const (@{const_name Nominal.supp}, T) $ x)) =>
   55.40            let
   55.41              val cert = Thm.cterm_of (Thm.theory_of_thm st);
   55.42 -            val ps = Logic.strip_params (term_of goal);
   55.43 +            val ps = Logic.strip_params (Thm.term_of goal);
   55.44              val Ts = rev (map snd ps);
   55.45              val vs = collect_vars 0 x [];
   55.46              val s = fold_rev (fn v => fn s =>
   55.47 @@ -308,7 +308,7 @@
   55.48                  Term.range_type T) $ s);
   55.49              val supports_rule' = Thm.lift_rule goal supports_rule;
   55.50              val _ $ (_ $ S $ _) =
   55.51 -              Logic.strip_assums_concl (hd (prems_of supports_rule'));
   55.52 +              Logic.strip_assums_concl (hd (Thm.prems_of supports_rule'));
   55.53              val supports_rule'' = Drule.cterm_instantiate
   55.54                [(cert (head_of S), cert s')] supports_rule'
   55.55              val fin_supp = dynamic_thms st ("fin_supp")
   55.56 @@ -337,11 +337,11 @@
   55.57          val ctxt1 = ctxt addsimps [Thm.symmetric fresh_def,fresh_prod,fresh_unit,conj_absorb,not_false]@fresh_atm
   55.58          val ctxt2 = ctxt addsimps [supp_prod,supp_unit,finite_Un,finite_emptyI,conj_absorb]@fin_supp
   55.59      in
   55.60 -      case Logic.strip_assums_concl (term_of goal) of
   55.61 +      case Logic.strip_assums_concl (Thm.term_of goal) of
   55.62            _ $ (Const (@{const_name Nominal.fresh}, Type ("fun", [T, _])) $ _ $ t) => 
   55.63            let
   55.64              val cert = Thm.cterm_of (Thm.theory_of_thm st);
   55.65 -            val ps = Logic.strip_params (term_of goal);
   55.66 +            val ps = Logic.strip_params (Thm.term_of goal);
   55.67              val Ts = rev (map snd ps);
   55.68              val vs = collect_vars 0 t [];
   55.69              val s = fold_rev (fn v => fn s =>
   55.70 @@ -352,7 +352,7 @@
   55.71                  (Const (@{const_name Nominal.supp}, fastype_of1 (Ts, s) --> HOLogic.mk_setT T) $ s);
   55.72              val supports_fresh_rule' = Thm.lift_rule goal supports_fresh_rule;
   55.73              val _ $ (_ $ S $ _) =
   55.74 -              Logic.strip_assums_concl (hd (prems_of supports_fresh_rule'));
   55.75 +              Logic.strip_assums_concl (hd (Thm.prems_of supports_fresh_rule'));
   55.76              val supports_fresh_rule'' = Drule.cterm_instantiate
   55.77                [(cert (head_of S), cert s')] supports_fresh_rule'
   55.78            in
    56.1 --- a/src/HOL/Nominal/nominal_primrec.ML	Tue Mar 03 19:08:04 2015 +0100
    56.2 +++ b/src/HOL/Nominal/nominal_primrec.ML	Wed Mar 04 19:53:18 2015 +0100
    56.3 @@ -296,14 +296,14 @@
    56.4  
    56.5      val rec_rewritess =
    56.6        unflat (map (fn (_, (_, _, constrs)) => constrs) descr) rec_rewrites;
    56.7 -    val fvars = rec_rewrites |> hd |> concl_of |> HOLogic.dest_Trueprop |>
    56.8 +    val fvars = rec_rewrites |> hd |> Thm.concl_of |> HOLogic.dest_Trueprop |>
    56.9        HOLogic.dest_eq |> fst |> strip_comb |> snd |> take_prefix is_Var |> fst;
   56.10      val (pvars, ctxtvars) = List.partition
   56.11        (equal HOLogic.boolT o body_type o snd)
   56.12        (subtract (op =)
   56.13 -        (Term.add_vars (concl_of (hd rec_rewrites)) [])
   56.14 +        (Term.add_vars (Thm.concl_of (hd rec_rewrites)) [])
   56.15          (fold_rev (Term.add_vars o Logic.strip_assums_concl)
   56.16 -           (prems_of (hd rec_rewrites)) []));
   56.17 +           (Thm.prems_of (hd rec_rewrites)) []));
   56.18      val cfs = defs' |> hd |> snd |> strip_comb |> snd |>
   56.19        curry (List.take o swap) (length fvars) |> map cert;
   56.20      val invs' = (case invs of
   56.21 @@ -320,7 +320,7 @@
   56.22        let
   56.23          val (i, j, cargs) = mk_idx eq
   56.24          val th = nth (nth rec_rewritess i) j;
   56.25 -        val cargs' = th |> concl_of |> HOLogic.dest_Trueprop |>
   56.26 +        val cargs' = th |> Thm.concl_of |> HOLogic.dest_Trueprop |>
   56.27            HOLogic.dest_eq |> fst |> strip_comb |> snd |> List.last |>
   56.28            strip_comb |> snd
   56.29        in (cargs, Logic.strip_imp_prems eq,
   56.30 @@ -328,12 +328,12 @@
   56.31            (map cert cargs' ~~ map (cert o Free) cargs)) th)
   56.32        end) eqns';
   56.33  
   56.34 -    val prems = foldr1 (common_prefix op aconv) (map (prems_of o #3) rec_rewrites');
   56.35 +    val prems = foldr1 (common_prefix op aconv) (map (Thm.prems_of o #3) rec_rewrites');
   56.36      val cprems = map cert prems;
   56.37      val asms = map Thm.assume cprems;
   56.38      val premss = map (fn (cargs, eprems, eqn) =>
   56.39        map (fn t => fold_rev (Logic.all o Free) cargs (Logic.list_implies (eprems, t)))
   56.40 -        (List.drop (prems_of eqn, length prems))) rec_rewrites';
   56.41 +        (List.drop (Thm.prems_of eqn, length prems))) rec_rewrites';
   56.42      val cpremss = map (map cert) premss;
   56.43      val asmss = map (map Thm.assume) cpremss;
   56.44  
    57.1 --- a/src/HOL/Nominal/nominal_thmdecls.ML	Tue Mar 03 19:08:04 2015 +0100
    57.2 +++ b/src/HOL/Nominal/nominal_thmdecls.ML	Wed Mar 04 19:53:18 2015 +0100
    57.3 @@ -132,7 +132,8 @@
    57.4  fun eqvt_add_del_aux flag orig_thm context = 
    57.5    let
    57.6      val thy = Context.theory_of context
    57.7 -    val thms_to_be_added = (case (prop_of orig_thm) of
    57.8 +    val thms_to_be_added =
    57.9 +      (case Thm.prop_of orig_thm of
   57.10          (* case: eqvt-lemma is of the implicational form *)
   57.11          (Const(@{const_name Pure.imp}, _) $ (Const (@{const_name Trueprop},_) $ hyp) $ (Const (@{const_name Trueprop},_) $ concl)) =>
   57.12            let
    58.1 --- a/src/HOL/Orderings.thy	Tue Mar 03 19:08:04 2015 +0100
    58.2 +++ b/src/HOL/Orderings.thy	Wed Mar 04 19:53:18 2015 +0100
    58.3 @@ -608,7 +608,7 @@
    58.4  in
    58.5  
    58.6  fun antisym_le_simproc ctxt ct =
    58.7 -  (case term_of ct of
    58.8 +  (case Thm.term_of ct of
    58.9      (le as Const (_, T)) $ r $ s =>
   58.10       (let
   58.11          val prems = Simplifier.prems_of ctxt;
   58.12 @@ -627,7 +627,7 @@
   58.13    | _ => NONE);
   58.14  
   58.15  fun antisym_less_simproc ctxt ct =
   58.16 -  (case term_of ct of
   58.17 +  (case Thm.term_of ct of
   58.18      NotC $ ((less as Const(_,T)) $ r $ s) =>
   58.19       (let
   58.20         val prems = Simplifier.prems_of ctxt;
    59.1 --- a/src/HOL/Probability/Giry_Monad.thy	Tue Mar 03 19:08:04 2015 +0100
    59.2 +++ b/src/HOL/Probability/Giry_Monad.thy	Wed Mar 04 19:53:18 2015 +0100
    59.3 @@ -184,7 +184,7 @@
    59.4  fun subprob_cong thm ctxt = (
    59.5    let
    59.6      val thm' = Thm.transfer (Proof_Context.theory_of ctxt) thm
    59.7 -    val free = thm' |> concl_of |> HOLogic.dest_Trueprop |> dest_comb |> fst |>
    59.8 +    val free = thm' |> Thm.concl_of |> HOLogic.dest_Trueprop |> dest_comb |> fst |>
    59.9        dest_comb |> snd |> strip_abs_body |> head_of |> is_Free
   59.10    in
   59.11      if free then ([], Measurable.add_local_cong (thm' RS @{thm subprob_measurableD(2)}) ctxt)
    60.1 --- a/src/HOL/Probability/measurable.ML	Tue Mar 03 19:08:04 2015 +0100
    60.2 +++ b/src/HOL/Probability/measurable.ML	Wed Mar 04 19:53:18 2015 +0100
    60.3 @@ -114,7 +114,7 @@
    60.4  
    60.5  fun is_too_generic thm =
    60.6    let 
    60.7 -    val concl = concl_of thm
    60.8 +    val concl = Thm.concl_of thm
    60.9      val concl' = HOLogic.dest_Trueprop concl handle TERM _ => concl
   60.10    in is_Var (head_of concl') end
   60.11  
   60.12 @@ -126,19 +126,21 @@
   60.13    if Config.get ctxt debug then print_tac ctxt (msg ()) THEN f else f
   60.14  
   60.15  fun nth_hol_goal thm i =
   60.16 -  HOLogic.dest_Trueprop (Logic.strip_imp_concl (strip_all_body (nth (prems_of thm) (i - 1))))
   60.17 +  HOLogic.dest_Trueprop (Logic.strip_imp_concl (strip_all_body (nth (Thm.prems_of thm) (i - 1))))
   60.18  
   60.19  fun dest_measurable_fun t =
   60.20    (case t of
   60.21      (Const (@{const_name "Set.member"}, _) $ f $ (Const (@{const_name "measurable"}, _) $ _ $ _)) => f
   60.22    | _ => raise (TERM ("not a measurability predicate", [t])))
   60.23  
   60.24 -fun not_measurable_prop n thm = if length (prems_of thm) < n then false else
   60.25 -  (case nth_hol_goal thm n of
   60.26 -    (Const (@{const_name "Set.member"}, _) $ _ $ (Const (@{const_name "sets"}, _) $ _)) => false
   60.27 -  | (Const (@{const_name "Set.member"}, _) $ _ $ (Const (@{const_name "measurable"}, _) $ _ $ _)) => false
   60.28 -  | _ => true)
   60.29 -  handle TERM _ => true;
   60.30 +fun not_measurable_prop n thm =
   60.31 +  if length (Thm.prems_of thm) < n then false
   60.32 +  else
   60.33 +    (case nth_hol_goal thm n of
   60.34 +      (Const (@{const_name "Set.member"}, _) $ _ $ (Const (@{const_name "sets"}, _) $ _)) => false
   60.35 +    | (Const (@{const_name "Set.member"}, _) $ _ $ (Const (@{const_name "measurable"}, _) $ _ $ _)) => false
   60.36 +    | _ => true)
   60.37 +    handle TERM _ => true;
   60.38  
   60.39  fun indep (Bound i) t b = i < b orelse t <= i
   60.40    | indep (f $ t) top bot = indep f top bot andalso indep t top bot
   60.41 @@ -201,7 +203,7 @@
   60.42  fun measurable_tac ctxt facts =
   60.43    let
   60.44      fun debug_fact msg thm () =
   60.45 -      msg ^ " " ^ Pretty.str_of (Syntax.pretty_term ctxt (prop_of thm))
   60.46 +      msg ^ " " ^ Pretty.str_of (Syntax.pretty_term ctxt (Thm.prop_of thm))
   60.47  
   60.48      fun IF' c t i = COND (c i) (t i) no_tac
   60.49  
   60.50 @@ -225,7 +227,7 @@
   60.51        | is_sets_eq _ = false
   60.52  
   60.53      val cong_thms = get_cong (Context.Proof ctxt) @
   60.54 -      filter (fn thm => concl_of thm |> HOLogic.dest_Trueprop |> is_sets_eq handle TERM _ => false) facts
   60.55 +      filter (fn thm => Thm.concl_of thm |> HOLogic.dest_Trueprop |> is_sets_eq handle TERM _ => false) facts
   60.56  
   60.57      fun sets_cong_tac i =
   60.58        Subgoal.FOCUS (fn {context = ctxt', prems = prems, ...} => (
   60.59 @@ -235,7 +237,7 @@
   60.60            r_tac "cong intro" [elem_congI]
   60.61            THEN' SOLVED' (fn i => REPEAT_DETERM (
   60.62                ((r_tac "cong solve" (cong_thms @ [@{thm refl}])
   60.63 -                ORELSE' IF' (fn i => fn thm => nprems_of thm > i)
   60.64 +                ORELSE' IF' (fn i => fn thm => Thm.nprems_of thm > i)
   60.65                    (SOLVED' (asm_full_simp_tac ctxt''))) i)))
   60.66          end) 1) ctxt i
   60.67          THEN flexflex_tac ctxt
   60.68 @@ -249,7 +251,7 @@
   60.69            val f = dest_measurable_fun (HOLogic.dest_Trueprop t)
   60.70            fun cert f = map (Option.map (f (Proof_Context.theory_of ctxt)))
   60.71            fun inst (ts, Ts) =
   60.72 -            Drule.instantiate' (cert ctyp_of Ts) (cert cterm_of ts)
   60.73 +            Drule.instantiate' (cert Thm.ctyp_of Ts) (cert Thm.cterm_of ts)
   60.74                @{thm measurable_compose_countable}
   60.75          in r_tac "split countable" (cnt_prefixes ctxt f |> map inst) i end
   60.76          handle TERM _ => no_tac) 1)
   60.77 @@ -267,7 +269,7 @@
   60.78  
   60.79  fun simproc ctxt redex =
   60.80    let
   60.81 -    val t = HOLogic.mk_Trueprop (term_of redex);
   60.82 +    val t = HOLogic.mk_Trueprop (Thm.term_of redex);
   60.83      fun tac {context = ctxt, prems = _ } =
   60.84        SOLVE (measurable_tac ctxt (Simplifier.prems_of ctxt));
   60.85    in try (fn () => Goal.prove ctxt [] [] t tac RS @{thm Eq_TrueI}) () end;
    61.1 --- a/src/HOL/Product_Type.thy	Tue Mar 03 19:08:04 2015 +0100
    61.2 +++ b/src/HOL/Product_Type.thy	Wed Mar 04 19:53:18 2015 +0100
    61.3 @@ -75,7 +75,7 @@
    61.4  
    61.5  simproc_setup unit_eq ("x::unit") = {*
    61.6    fn _ => fn _ => fn ct =>
    61.7 -    if HOLogic.is_unit (term_of ct) then NONE
    61.8 +    if HOLogic.is_unit (Thm.term_of ct) then NONE
    61.9      else SOME (mk_meta_eq @{thm unit_eq})
   61.10  *}
   61.11  
   61.12 @@ -579,8 +579,10 @@
   61.13      | eta_proc _ _ = NONE;
   61.14  end;
   61.15  *}
   61.16 -simproc_setup split_beta ("split f z") = {* fn _ => fn ctxt => fn ct => beta_proc ctxt (term_of ct) *}
   61.17 -simproc_setup split_eta ("split f") = {* fn _ => fn ctxt => fn ct => eta_proc ctxt (term_of ct) *}
   61.18 +simproc_setup split_beta ("split f z") =
   61.19 +  {* fn _ => fn ctxt => fn ct => beta_proc ctxt (Thm.term_of ct) *}
   61.20 +simproc_setup split_eta ("split f") =
   61.21 +  {* fn _ => fn ctxt => fn ct => eta_proc ctxt (Thm.term_of ct) *}
   61.22  
   61.23  lemmas split_beta [mono] = prod.case_eq_if
   61.24  
   61.25 @@ -1309,7 +1311,7 @@
   61.26  (* simplify {(x1, ..., xn). (x1, ..., xn) : S} to S *)
   61.27  simproc_setup Collect_mem ("Collect t") = {*
   61.28    fn _ => fn ctxt => fn ct =>
   61.29 -    (case term_of ct of
   61.30 +    (case Thm.term_of ct of
   61.31        S as Const (@{const_name Collect}, Type (@{type_name fun}, [_, T])) $ t =>
   61.32          let val (u, _, ps) = HOLogic.strip_psplits t in
   61.33            (case u of
    62.1 --- a/src/HOL/Prolog/prolog.ML	Tue Mar 03 19:08:04 2015 +0100
    62.2 +++ b/src/HOL/Prolog/prolog.ML	Wed Mar 04 19:53:18 2015 +0100
    62.3 @@ -43,15 +43,15 @@
    62.4    | _ (* atom *)              => true;
    62.5  
    62.6  val check_HOHH_tac1 = PRIMITIVE (fn thm =>
    62.7 -        if isG (concl_of thm) then thm else raise not_HOHH);
    62.8 +        if isG (Thm.concl_of thm) then thm else raise not_HOHH);
    62.9  val check_HOHH_tac2 = PRIMITIVE (fn thm =>
   62.10 -        if forall isG (prems_of thm) then thm else raise not_HOHH);
   62.11 -fun check_HOHH thm  = (if isD (concl_of thm) andalso forall isG (prems_of thm)
   62.12 +        if forall isG (Thm.prems_of thm) then thm else raise not_HOHH);
   62.13 +fun check_HOHH thm  = (if isD (Thm.concl_of thm) andalso forall isG (Thm.prems_of thm)
   62.14                          then thm else raise not_HOHH);
   62.15  
   62.16  fun atomizeD ctxt thm =
   62.17    let
   62.18 -    fun at  thm = case concl_of thm of
   62.19 +    fun at  thm = case Thm.concl_of thm of
   62.20        _$(Const(@{const_name All} ,_)$Abs(s,_,_))=>
   62.21          let val s' = if s="P" then "PP" else s
   62.22          in at(thm RS (Rule_Insts.read_instantiate ctxt [(("x", 0), s')] [s'] spec)) end
    63.1 --- a/src/HOL/Proofs/Lambda/WeakNorm.thy	Tue Mar 03 19:08:04 2015 +0100
    63.2 +++ b/src/HOL/Proofs/Lambda/WeakNorm.thy	Wed Mar 04 19:53:18 2015 +0100
    63.3 @@ -432,12 +432,12 @@
    63.4  fun dummyf _ = error "dummy";
    63.5  
    63.6  val ct1 = @{cterm "%f. ((%f x. f (f (f x))) ((%f x. f (f (f (f x)))) f))"};
    63.7 -val (dB1, _) = @{code type_NF} (typing_of_term [] dummyf (term_of ct1));
    63.8 -val ct1' = cterm_of @{theory} (term_of_dB [] (#T (rep_cterm ct1)) dB1);
    63.9 +val (dB1, _) = @{code type_NF} (typing_of_term [] dummyf (Thm.term_of ct1));
   63.10 +val ct1' = Thm.cterm_of @{theory} (term_of_dB [] (#T (Thm.rep_cterm ct1)) dB1);
   63.11  
   63.12  val ct2 = @{cterm "%f x. (%x. f x x) ((%x. f x x) ((%x. f x x) ((%x. f x x) ((%x. f x x) ((%x. f x x) x)))))"};
   63.13 -val (dB2, _) = @{code type_NF} (typing_of_term [] dummyf (term_of ct2));
   63.14 -val ct2' = cterm_of @{theory} (term_of_dB [] (#T (rep_cterm ct2)) dB2);
   63.15 +val (dB2, _) = @{code type_NF} (typing_of_term [] dummyf (Thm.term_of ct2));
   63.16 +val ct2' = Thm.cterm_of @{theory} (term_of_dB [] (#T (Thm.rep_cterm ct2)) dB2);
   63.17  *}
   63.18  
   63.19  end
    64.1 --- a/src/HOL/Statespace/distinct_tree_prover.ML	Tue Mar 03 19:08:04 2015 +0100
    64.2 +++ b/src/HOL/Statespace/distinct_tree_prover.ML	Wed Mar 04 19:53:18 2015 +0100
    64.3 @@ -90,12 +90,12 @@
    64.4   *)
    64.5  fun instantiate instTs insts =
    64.6    let
    64.7 -    val instTs' = map (fn (T, U) => (dest_TVar (typ_of T), typ_of U)) instTs;
    64.8 +    val instTs' = map (fn (T, U) => (dest_TVar (Thm.typ_of T), Thm.typ_of U)) instTs;
    64.9      fun substT x = (case AList.lookup (op =) instTs' x of NONE => TVar x | SOME T' => T');
   64.10      fun mapT_and_recertify ct =
   64.11        let
   64.12 -        val thy = theory_of_cterm ct;
   64.13 -      in (cterm_of thy (Term.map_types (Term.map_type_tvar substT) (term_of ct))) end;
   64.14 +        val thy = Thm.theory_of_cterm ct;
   64.15 +      in (Thm.cterm_of thy (Term.map_types (Term.map_type_tvar substT) (Thm.term_of ct))) end;
   64.16      val insts' = map (apfst mapT_and_recertify) insts;
   64.17    in Thm.instantiate (instTs, insts') end;
   64.18  
   64.19 @@ -133,7 +133,8 @@
   64.20      fun mtch (env as (tyinsts, insts)) =
   64.21        fn (Var (ixn, T), ct) =>
   64.22            (case AList.lookup (op =) insts ixn of
   64.23 -            NONE => (naive_typ_match (T, typ_of (ctyp_of_term ct)) tyinsts, (ixn, ct) :: insts)
   64.24 +            NONE =>
   64.25 +              (naive_typ_match (T, Thm.typ_of (Thm.ctyp_of_term ct)) tyinsts, (ixn, ct) :: insts)
   64.26            | SOME _ => env)
   64.27         | (f $ t, ct) =>
   64.28            let val (cf, ct') = Thm.dest_comb ct;
   64.29 @@ -144,14 +145,16 @@
   64.30  
   64.31  fun discharge prems rule =
   64.32    let
   64.33 -    val thy = theory_of_thm (hd prems);
   64.34 +    val thy = Thm.theory_of_thm (hd prems);
   64.35      val (tyinsts,insts) =
   64.36 -      fold naive_cterm_first_order_match (prems_of rule ~~ map cprop_of prems) ([], []);
   64.37 +      fold naive_cterm_first_order_match (Thm.prems_of rule ~~ map Thm.cprop_of prems) ([], []);
   64.38  
   64.39      val tyinsts' =
   64.40 -      map (fn (v, (S, U)) => (ctyp_of thy (TVar (v, S)), ctyp_of thy U)) tyinsts;
   64.41 +      map (fn (v, (S, U)) =>
   64.42 +        (Thm.ctyp_of thy (TVar (v, S)), Thm.ctyp_of thy U)) tyinsts;
   64.43      val insts' =
   64.44 -      map (fn (idxn, ct) => (cterm_of thy (Var (idxn, typ_of (ctyp_of_term ct))), ct)) insts;
   64.45 +      map (fn (idxn, ct) =>
   64.46 +        (Thm.cterm_of thy (Var (idxn, Thm.typ_of (Thm.ctyp_of_term ct))), ct)) insts;
   64.47      val rule' = Thm.instantiate (tyinsts', insts') rule;
   64.48    in fold Thm.elim_implies prems rule' end;
   64.49  
   64.50 @@ -160,7 +163,7 @@
   64.51  val (l_in_set_root, x_in_set_root, r_in_set_root) =
   64.52    let
   64.53      val (Node_l_x_d, r) =
   64.54 -      cprop_of @{thm in_set_root}
   64.55 +      Thm.cprop_of @{thm in_set_root}
   64.56        |> Thm.dest_comb |> #2
   64.57        |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2 |> Thm.dest_comb;
   64.58      val (Node_l, x) = Node_l_x_d |> Thm.dest_comb |> #1 |> Thm.dest_comb;
   64.59 @@ -170,7 +173,7 @@
   64.60  val (x_in_set_left, r_in_set_left) =
   64.61    let
   64.62      val (Node_l_x_d, r) =
   64.63 -      cprop_of @{thm in_set_left}
   64.64 +      Thm.cprop_of @{thm in_set_left}
   64.65        |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2
   64.66        |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2 |> Thm.dest_comb;
   64.67      val x = Node_l_x_d |> Thm.dest_comb |> #1 |> Thm.dest_comb |> #2;
   64.68 @@ -179,7 +182,7 @@
   64.69  val (x_in_set_right, l_in_set_right) =
   64.70    let
   64.71      val (Node_l, x) =
   64.72 -      cprop_of @{thm in_set_right}
   64.73 +      Thm.cprop_of @{thm in_set_right}
   64.74        |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2
   64.75        |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2
   64.76        |> Thm.dest_comb |> #1 |> Thm.dest_comb |> #1
   64.77 @@ -207,25 +210,25 @@
   64.78  
   64.79      val (ps, x_rest, y_rest) = split_common_prefix x_path y_path;
   64.80      val dist_subtree_thm = dist_subtree ps dist_thm;
   64.81 -    val subtree = cprop_of dist_subtree_thm |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2;
   64.82 +    val subtree = Thm.cprop_of dist_subtree_thm |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2;
   64.83      val (_, [l, _, _, r]) = Drule.strip_comb subtree;
   64.84  
   64.85      fun in_set ps tree =
   64.86        let
   64.87          val (_, [l, x, _, r]) = Drule.strip_comb tree;
   64.88 -        val xT = ctyp_of_term x;
   64.89 +        val xT = Thm.ctyp_of_term x;
   64.90        in
   64.91          (case ps of
   64.92            [] =>
   64.93              instantiate
   64.94 -              [(ctyp_of_term x_in_set_root, xT)]
   64.95 +              [(Thm.ctyp_of_term x_in_set_root, xT)]
   64.96                [(l_in_set_root, l), (x_in_set_root, x), (r_in_set_root, r)] @{thm in_set_root}
   64.97          | Left :: ps' =>
   64.98              let
   64.99                val in_set_l = in_set ps' l;
  64.100                val in_set_left' =
  64.101                  instantiate
  64.102 -                  [(ctyp_of_term x_in_set_left, xT)]
  64.103 +                  [(Thm.ctyp_of_term x_in_set_left, xT)]
  64.104                    [(x_in_set_left, x), (r_in_set_left, r)] @{thm in_set_left};
  64.105              in discharge [in_set_l] in_set_left' end
  64.106          | Right :: ps' =>
  64.107 @@ -233,7 +236,7 @@
  64.108                val in_set_r = in_set ps' r;
  64.109                val in_set_right' =
  64.110                  instantiate
  64.111 -                  [(ctyp_of_term x_in_set_right, xT)]
  64.112 +                  [(Thm.ctyp_of_term x_in_set_right, xT)]
  64.113                    [(x_in_set_right, x), (l_in_set_right, l)] @{thm in_set_right};
  64.114              in discharge [in_set_r] in_set_right' end)
  64.115        end;
  64.116 @@ -286,29 +289,29 @@
  64.117          @{thm subtract_Tip} |> Thm.cprop_of |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2
  64.118          |> Thm.dest_comb |> #2;
  64.119        val [alpha] = ct |> Thm.ctyp_of_term |> Thm.dest_ctyp;
  64.120 -    in (alpha, #1 (dest_Var (term_of ct))) end;
  64.121 +    in (alpha, #1 (dest_Var (Thm.term_of ct))) end;
  64.122  in
  64.123  
  64.124  fun subtractProver (Const (@{const_name Tip}, T)) ct dist_thm =
  64.125        let
  64.126          val ct' = dist_thm |> Thm.cprop_of |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2;
  64.127 -        val thy = theory_of_cterm ct;
  64.128 +        val thy = Thm.theory_of_cterm ct;
  64.129          val [alphaI] = #2 (dest_Type T);
  64.130        in
  64.131          Thm.instantiate
  64.132 -          ([(alpha, ctyp_of thy alphaI)],
  64.133 -           [(cterm_of thy (Var (v, treeT alphaI)), ct')]) @{thm subtract_Tip}
  64.134 +          ([(alpha, Thm.ctyp_of thy alphaI)],
  64.135 +           [(Thm.cterm_of thy (Var (v, treeT alphaI)), ct')]) @{thm subtract_Tip}
  64.136        end
  64.137    | subtractProver (Const (@{const_name Node}, nT) $ l $ x $ d $ r) ct dist_thm =
  64.138        let
  64.139          val ct' = dist_thm |> Thm.cprop_of |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2;
  64.140          val (_, [cl, _, _, cr]) = Drule.strip_comb ct;
  64.141 -        val ps = the (find_tree x (term_of ct'));
  64.142 +        val ps = the (find_tree x (Thm.term_of ct'));
  64.143          val del_tree = deleteProver dist_thm ps;
  64.144          val dist_thm' = discharge [del_tree, dist_thm] @{thm delete_Some_all_distinct};
  64.145 -        val sub_l = subtractProver (term_of cl) cl (dist_thm');
  64.146 +        val sub_l = subtractProver (Thm.term_of cl) cl (dist_thm');
  64.147          val sub_r =
  64.148 -          subtractProver (term_of cr) cr
  64.149 +          subtractProver (Thm.term_of cr) cr
  64.150              (discharge [sub_l, dist_thm'] @{thm subtract_Some_all_distinct_res});
  64.151        in discharge [del_tree, sub_l, sub_r] @{thm subtract_Node} end;
  64.152  
  64.153 @@ -317,7 +320,7 @@
  64.154  fun distinct_implProver dist_thm ct =
  64.155    let
  64.156      val ctree = ct |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2;
  64.157 -    val sub = subtractProver (term_of ctree) ctree dist_thm;
  64.158 +    val sub = subtractProver (Thm.term_of ctree) ctree dist_thm;
  64.159    in @{thm subtract_Some_all_distinct} OF [sub, dist_thm] end;
  64.160  
  64.161  fun get_fst_success f [] = NONE
  64.162 @@ -329,8 +332,8 @@
  64.163  fun neq_x_y ctxt x y name =
  64.164    (let
  64.165      val dist_thm = the (try (Proof_Context.get_thm ctxt) name);
  64.166 -    val ctree = cprop_of dist_thm |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2;
  64.167 -    val tree = term_of ctree;
  64.168 +    val ctree = Thm.cprop_of dist_thm |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2;
  64.169 +    val tree = Thm.term_of ctree;
  64.170      val x_path = the (find_tree x tree);
  64.171      val y_path = the (find_tree y tree);
  64.172      val thm = distinctTreeProver dist_thm x_path y_path;
    65.1 --- a/src/HOL/Statespace/state_fun.ML	Tue Mar 03 19:08:04 2015 +0100
    65.2 +++ b/src/HOL/Statespace/state_fun.ML	Wed Mar 04 19:53:18 2015 +0100
    65.3 @@ -56,14 +56,14 @@
    65.4        let val thy = Proof_Context.theory_of ctxt in
    65.5          (case t of (Const (@{const_name HOL.conj},_) $ P $ Q) =>
    65.6            let
    65.7 -            val P_P' = Simplifier.rewrite ctxt (cterm_of thy P);
    65.8 -            val P' = P_P' |> prop_of |> Logic.dest_equals |> #2;
    65.9 +            val P_P' = Simplifier.rewrite ctxt (Thm.cterm_of thy P);
   65.10 +            val P' = P_P' |> Thm.prop_of |> Logic.dest_equals |> #2;
   65.11            in
   65.12              if isFalse P' then SOME (conj1_False OF [P_P'])
   65.13              else
   65.14                let
   65.15 -                val Q_Q' = Simplifier.rewrite ctxt (cterm_of thy Q);
   65.16 -                val Q' = Q_Q' |> prop_of |> Logic.dest_equals |> #2;
   65.17 +                val Q_Q' = Simplifier.rewrite ctxt (Thm.cterm_of thy Q);
   65.18 +                val Q' = Q_Q' |> Thm.prop_of |> Logic.dest_equals |> #2;
   65.19                in
   65.20                  if isFalse Q' then SOME (conj2_False OF [Q_Q'])
   65.21                  else if isTrue P' andalso isTrue Q' then SOME (conj_True OF [P_P', Q_Q'])
   65.22 @@ -141,12 +141,12 @@
   65.23              | mk_upds s = (Var (("s", mi + 1), sT), mi + 2);
   65.24  
   65.25            val ct =
   65.26 -            cterm_of thy (Const (@{const_name StateFun.lookup}, lT) $ destr $ n $ fst (mk_upds s));
   65.27 +            Thm.cterm_of thy (Const (@{const_name StateFun.lookup}, lT) $ destr $ n $ fst (mk_upds s));
   65.28            val basic_ss = #1 (Data.get (Context.Proof ctxt));
   65.29            val ctxt' = ctxt |> Config.put simp_depth_limit 100 |> put_simpset basic_ss;
   65.30            val thm = Simplifier.rewrite ctxt' ct;
   65.31          in
   65.32 -          if (op aconv) (Logic.dest_equals (prop_of thm))
   65.33 +          if (op aconv) (Logic.dest_equals (Thm.prop_of thm))
   65.34            then NONE
   65.35            else SOME thm
   65.36          end
   65.37 @@ -251,7 +251,7 @@
   65.38                      Goal.prove ctxt0 [] []
   65.39                        (Logic.list_all (vars, Logic.mk_equals (trm, trm')))
   65.40                        (fn _ => rtac meta_ext 1 THEN simp_tac ctxt1 1);
   65.41 -                  val eq2 = Simplifier.asm_full_rewrite ctxt2 (Thm.dest_equals_rhs (cprop_of eq1));
   65.42 +                  val eq2 = Simplifier.asm_full_rewrite ctxt2 (Thm.dest_equals_rhs (Thm.cprop_of eq1));
   65.43                  in SOME (Thm.transitive eq1 eq2) end
   65.44              | _ => NONE)
   65.45            end
   65.46 @@ -375,7 +375,7 @@
   65.47            val ctxt = Context.proof_of context;
   65.48            val (lookup_ss, ex_lookup_ss, simprocs_active) = Data.get context;
   65.49            val (lookup_ss', ex_lookup_ss') =
   65.50 -            (case concl_of thm of
   65.51 +            (case Thm.concl_of thm of
   65.52                (_ $ ((Const (@{const_name Ex}, _) $ _))) =>
   65.53                  (lookup_ss, simpset_map ctxt (Simplifier.add_simp thm) ex_lookup_ss)
   65.54              | _ =>
    66.1 --- a/src/HOL/Statespace/state_space.ML	Tue Mar 03 19:08:04 2015 +0100
    66.2 +++ b/src/HOL/Statespace/state_space.ML	Wed Mar 04 19:53:18 2015 +0100
    66.3 @@ -190,8 +190,8 @@
    66.4  fun neq_x_y ctxt x y =
    66.5    (let
    66.6      val dist_thm = the (get_dist_thm (Context.Proof ctxt) (#1 (dest_Free x)));
    66.7 -    val ctree = cprop_of dist_thm |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2;
    66.8 -    val tree = term_of ctree;
    66.9 +    val ctree = Thm.cprop_of dist_thm |> Thm.dest_comb |> #2 |> Thm.dest_comb |> #2;
   66.10 +    val tree = Thm.term_of ctree;
   66.11      val x_path = the (DistinctTreeProver.find_tree x tree);
   66.12      val y_path = the (DistinctTreeProver.find_tree y tree);
   66.13      val thm = DistinctTreeProver.distinctTreeProver dist_thm x_path y_path;
   66.14 @@ -238,7 +238,7 @@
   66.15      val dist_thm_name = distinct_compsN;
   66.16  
   66.17      val dist_thm_full_name = dist_thm_name;
   66.18 -    fun comps_of_thm thm = prop_of thm
   66.19 +    fun comps_of_thm thm = Thm.prop_of thm
   66.20               |> (fn (_$(_$t)) => DistinctTreeProver.dest_tree t) |> map (fst o dest_Free);
   66.21  
   66.22      fun type_attr phi = Thm.declaration_attribute (fn thm => fn context =>
    67.1 --- a/src/HOL/TLA/Action.thy	Tue Mar 03 19:08:04 2015 +0100
    67.2 +++ b/src/HOL/TLA/Action.thy	Wed Mar 04 19:53:18 2015 +0100
    67.3 @@ -116,7 +116,7 @@
    67.4  val action_rewrite = int_rewrite
    67.5  
    67.6  fun action_use ctxt th =
    67.7 -    case (concl_of th) of
    67.8 +    case Thm.concl_of th of
    67.9        Const _ $ (Const (@{const_name Valid}, _) $ _) =>
   67.10                (flatten (action_unlift ctxt th) handle THM _ => th)
   67.11      | _ => th;
    68.1 --- a/src/HOL/TLA/Intensional.thy	Tue Mar 03 19:08:04 2015 +0100
    68.2 +++ b/src/HOL/TLA/Intensional.thy	Wed Mar 04 19:53:18 2015 +0100
    68.3 @@ -271,18 +271,18 @@
    68.4      fun matchsome tha thb =
    68.5        let fun hmatch 0 = raise THM("matchsome: no match", 0, [tha,thb])
    68.6              | hmatch n = matchres tha n thb handle THM _ => hmatch (n-1)
    68.7 -      in hmatch (nprems_of thb) end
    68.8 +      in hmatch (Thm.nprems_of thb) end
    68.9  
   68.10      fun hflatten t =
   68.11 -        case (concl_of t) of
   68.12 -          Const _ $ (Const (@{const_name HOL.implies}, _) $ _ $ _) => hflatten (t RS mp)
   68.13 -        | _ => (hflatten (matchsome conjI t)) handle THM _ => zero_var_indexes t
   68.14 +      case Thm.concl_of t of
   68.15 +        Const _ $ (Const (@{const_name HOL.implies}, _) $ _ $ _) => hflatten (t RS mp)
   68.16 +      | _ => (hflatten (matchsome conjI t)) handle THM _ => zero_var_indexes t
   68.17    in
   68.18      hflatten t
   68.19    end
   68.20  
   68.21  fun int_use ctxt th =
   68.22 -    case (concl_of th) of
   68.23 +    case Thm.concl_of th of
   68.24        Const _ $ (Const (@{const_name Valid}, _) $ _) =>
   68.25                (flatten (int_unlift ctxt th) handle THM _ => th)
   68.26      | _ => th
    69.1 --- a/src/HOL/TLA/TLA.thy	Tue Mar 03 19:08:04 2015 +0100
    69.2 +++ b/src/HOL/TLA/TLA.thy	Wed Mar 04 19:53:18 2015 +0100
    69.3 @@ -126,7 +126,7 @@
    69.4  val temp_rewrite = int_rewrite
    69.5  
    69.6  fun temp_use ctxt th =
    69.7 -  case (concl_of th) of
    69.8 +  case Thm.concl_of th of
    69.9      Const _ $ (Const (@{const_name Intensional.Valid}, _) $ _) =>
   69.10              ((flatten (temp_unlift ctxt th)) handle THM _ => th)
   69.11    | _ => th;
    70.1 --- a/src/HOL/TPTP/TPTP_Parser/tptp_reconstruct.ML	Tue Mar 03 19:08:04 2015 +0100
    70.2 +++ b/src/HOL/TPTP/TPTP_Parser/tptp_reconstruct.ML	Wed Mar 04 19:53:18 2015 +0100
    70.3 @@ -737,7 +737,7 @@
    70.4    in
    70.5      (*Instantiate the abstract rule based on the contents of the
    70.6        required instance*)
    70.7 -    diff_and_instantiate ctxt abs_rule_thm (prop_of abs_rule_thm) rule_t
    70.8 +    diff_and_instantiate ctxt abs_rule_thm (Thm.prop_of abs_rule_thm) rule_t
    70.9    end
   70.10  
   70.11  
   70.12 @@ -1089,7 +1089,7 @@
   70.13            raise SKELETON
   70.14          (*FIXME or classify it as follows:
   70.15            [(Caboose,
   70.16 -            prop_of @{thm asm_rl}
   70.17 +            Thm.prop_of @{thm asm_rl}
   70.18              |> SOME,
   70.19              SOME (@{thm asm_rl}, TRY (HEADGOAL atac)))]
   70.20           *)
   70.21 @@ -1097,17 +1097,17 @@
   70.22            case hd skel of
   70.23                Assumed =>
   70.24                  (hd skel,
   70.25 -                 prop_of @{thm asm_rl}
   70.26 +                 Thm.prop_of @{thm asm_rl}
   70.27                   |> SOME,
   70.28                   SOME (@{thm asm_rl}, TRY (HEADGOAL atac))) :: rest memo ctxt
   70.29              | Caboose =>
   70.30                  [(Caboose,
   70.31 -                  prop_of @{thm asm_rl}
   70.32 +                  Thm.prop_of @{thm asm_rl}
   70.33                    |> SOME,
   70.34                    SOME (@{thm asm_rl}, TRY (HEADGOAL atac)))]
   70.35              | Unconjoin =>
   70.36                  (hd skel,
   70.37 -                 prop_of @{thm conjI}
   70.38 +                 Thm.prop_of @{thm conjI}
   70.39                   |> SOME,
   70.40                   SOME (@{thm conjI}, rtac @{thm conjI} 1)) :: rest memo ctxt
   70.41              | Split (split_node, solved_node, antes) =>
   70.42 @@ -1126,7 +1126,7 @@
   70.43                        simulate_split ctxt split_fmla minor_prems_assumps conclusion
   70.44                  in
   70.45                    (hd skel,
   70.46 -                   prop_of split_thm
   70.47 +                   Thm.prop_of split_thm
   70.48                     |> SOME,
   70.49                     SOME (split_thm, rtac split_thm 1)) :: rest memo ctxt
   70.50                  end
   70.51 @@ -1190,7 +1190,7 @@
   70.52                            |> Global_Theory.get_thm thy
   70.53                  in
   70.54                    (hd skel,
   70.55 -                   prop_of (def_thm thy)
   70.56 +                   Thm.prop_of (def_thm thy)
   70.57                     |> SOME,
   70.58                     SOME (def_thm thy,
   70.59                           HEADGOAL (rtac_wrap def_thm))) :: rest memo ctxt
   70.60 @@ -1206,7 +1206,7 @@
   70.61                            |> Global_Theory.get_thm thy
   70.62                  in
   70.63                    (hd skel,
   70.64 -                   prop_of ax_thm
   70.65 +                   Thm.prop_of ax_thm
   70.66                     |> SOME,
   70.67                     SOME (ax_thm, rtac ax_thm 1)) :: rest memo ctxt
   70.68                  end
   70.69 @@ -1256,11 +1256,11 @@
   70.70      let
   70.71        val thy = Proof_Context.theory_of ctxt
   70.72      in
   70.73 -      (Synth_step "ccontr", prop_of @{thm ccontr} |> SOME,
   70.74 +      (Synth_step "ccontr", Thm.prop_of @{thm ccontr} |> SOME,
   70.75         SOME (@{thm ccontr}, rtac @{thm ccontr} 1)) ::
   70.76 -      (Synth_step "neg_eq_false", prop_of neg_eq_false |> SOME,
   70.77 +      (Synth_step "neg_eq_false", Thm.prop_of neg_eq_false |> SOME,
   70.78         SOME (neg_eq_false, dtac neg_eq_false 1)) ::
   70.79 -      (Synth_step "sas_if_needed_tac", prop_of @{thm asm_rl}(*FIXME *) |> SOME,
   70.80 +      (Synth_step "sas_if_needed_tac", Thm.prop_of @{thm asm_rl} (*FIXME *) |> SOME,
   70.81         SOME (sas_if_needed_tac ctxt prob_name)) ::
   70.82        skel_to_naive_tactic_dbg prover_tac ctxt prob_name
   70.83         (make_skeleton ctxt
    71.1 --- a/src/HOL/TPTP/TPTP_Parser/tptp_reconstruct_library.ML	Tue Mar 03 19:08:04 2015 +0100
    71.2 +++ b/src/HOL/TPTP/TPTP_Parser/tptp_reconstruct_library.ML	Wed Mar 04 19:53:18 2015 +0100
    71.3 @@ -563,7 +563,7 @@
    71.4    In addition to the abstract thm ("scheme_thm"), this function is
    71.5    also supplied with the (sub)term of the abstract thm ("scheme_t")
    71.6    we want to use in the diff, in case only part of "scheme_t"
    71.7 -  might be needed (not the whole "prop_of scheme_thm")*)
    71.8 +  might be needed (not the whole "Thm.prop_of scheme_thm")*)
    71.9  fun diff_and_instantiate ctxt scheme_thm scheme_t instance_t =
   71.10    let
   71.11      val thy = Proof_Context.theory_of ctxt
   71.12 @@ -572,14 +572,14 @@
   71.13        diff thy (scheme_t, instance_t)
   71.14  
   71.15      (*valuation of type variables*)
   71.16 -    val typeval = map (apply2 (ctyp_of thy)) type_pairing
   71.17 +    val typeval = map (apply2 (Thm.ctyp_of thy)) type_pairing
   71.18  
   71.19      val typeval_env =
   71.20        map (apfst dest_TVar) type_pairing
   71.21      (*valuation of term variables*)
   71.22      val termval =
   71.23        map (apfst (type_devar typeval_env)) term_pairing
   71.24 -      |> map (apply2 (cterm_of thy))
   71.25 +      |> map (apply2 (Thm.cterm_of thy))
   71.26    in
   71.27      Thm.instantiate (typeval, termval) scheme_thm
   71.28    end
   71.29 @@ -670,7 +670,7 @@
   71.30  fun head_quantified_variable ctxt i = fn st =>
   71.31    let
   71.32      val gls =
   71.33 -      prop_of st
   71.34 +      Thm.prop_of st
   71.35        |> Logic.strip_horn
   71.36        |> fst
   71.37  
    72.1 --- a/src/HOL/TPTP/TPTP_Proof_Reconstruction.thy	Tue Mar 03 19:08:04 2015 +0100
    72.2 +++ b/src/HOL/TPTP/TPTP_Proof_Reconstruction.thy	Wed Mar 04 19:53:18 2015 +0100
    72.3 @@ -168,7 +168,7 @@
    72.4  fun inst_parametermatch_tac ctxt thms i = fn st =>
    72.5    let
    72.6      val gls =
    72.7 -      prop_of st
    72.8 +      Thm.prop_of st
    72.9        |> Logic.strip_horn
   72.10        |> fst
   72.11  
   72.12 @@ -204,7 +204,7 @@
   72.13  fun nominal_inst_parametermatch_tac ctxt thm i = fn st =>
   72.14    let
   72.15      val gls =
   72.16 -      prop_of st
   72.17 +      Thm.prop_of st
   72.18        |> Logic.strip_horn
   72.19        |> fst
   72.20  
   72.21 @@ -247,7 +247,7 @@
   72.22  fun canonicalise_qtfr_order ctxt i = fn st =>
   72.23    let
   72.24      val gls =
   72.25 -      prop_of st
   72.26 +      Thm.prop_of st
   72.27        |> Logic.strip_horn
   72.28        |> fst
   72.29    in
   72.30 @@ -649,7 +649,7 @@
   72.31      val thy = Proof_Context.theory_of ctxt
   72.32  
   72.33      val gls =
   72.34 -      prop_of st
   72.35 +      Thm.prop_of st
   72.36        |> Logic.strip_horn
   72.37        |> fst
   72.38  
   72.39 @@ -689,7 +689,7 @@
   72.40      val thy = Proof_Context.theory_of ctxt
   72.41  
   72.42      val gls =
   72.43 -      prop_of st
   72.44 +      Thm.prop_of st
   72.45        |> Logic.strip_horn
   72.46        |> fst
   72.47  
   72.48 @@ -764,7 +764,7 @@
   72.49      val _ = @{assert} (arity > 0)
   72.50  
   72.51      val gls =
   72.52 -      prop_of st
   72.53 +      Thm.prop_of st
   72.54        |> Logic.strip_horn
   72.55        |> fst
   72.56  
   72.57 @@ -809,7 +809,7 @@
   72.58      val thy = Proof_Context.theory_of ctxt
   72.59  
   72.60      val gls =
   72.61 -      prop_of st
   72.62 +      Thm.prop_of st
   72.63        |> Logic.strip_horn
   72.64        |> fst
   72.65  
   72.66 @@ -917,7 +917,7 @@
   72.67      (* val contextualise = fold absdummy (map snd params) *)
   72.68      val contextualise = fold absfree params
   72.69  
   72.70 -    val skolem_cts = map (contextualise #> cterm_of thy) skolem_terms
   72.71 +    val skolem_cts = map (contextualise #> Thm.cterm_of thy) skolem_terms
   72.72  
   72.73  
   72.74  (*now the instantiation code*)
   72.75 @@ -937,7 +937,7 @@
   72.76          fun make_var pre_var =
   72.77            the_single pre_var
   72.78            |> Var
   72.79 -          |> cterm_of thy
   72.80 +          |> Thm.cterm_of thy
   72.81            |> SOME
   72.82        in
   72.83          if null pre_var then NONE
   72.84 @@ -1049,7 +1049,7 @@
   72.85  fun find_dec_arity i = fn st =>
   72.86    let
   72.87      val gls =
   72.88 -      prop_of st
   72.89 +      Thm.prop_of st
   72.90        |> Logic.strip_horn
   72.91        |> fst
   72.92    in
   72.93 @@ -1093,7 +1093,7 @@
   72.94  fun breakdown_inference i = fn st =>
   72.95    let
   72.96      val gls =
   72.97 -      prop_of st
   72.98 +      Thm.prop_of st
   72.99        |> Logic.strip_horn
  72.100        |> fst
  72.101    in
  72.102 @@ -1110,7 +1110,7 @@
  72.103      val rule = extuni_dec_n ctxt arity
  72.104  
  72.105      val rule_hyp =
  72.106 -      prop_of rule
  72.107 +      Thm.prop_of rule
  72.108        |> Logic.dest_implies
  72.109        |> fst (*assuming that rule has single hypothesis*)
  72.110  
  72.111 @@ -1208,7 +1208,7 @@
  72.112  fun standard_cnf_type ctxt i : thm -> (TPTP_Reconstruct.formula_kind * int * bool) option = fn st =>
  72.113    let
  72.114      val gls =
  72.115 -      prop_of st
  72.116 +      Thm.prop_of st
  72.117        |> Logic.strip_horn
  72.118        |> fst
  72.119  
  72.120 @@ -1681,7 +1681,7 @@
  72.121  fun clause_consts_diff thm =
  72.122    let
  72.123      val t =
  72.124 -      prop_of thm
  72.125 +      Thm.prop_of thm
  72.126        |> Logic.dest_implies
  72.127        |> fst
  72.128  
  72.129 @@ -1707,7 +1707,7 @@
  72.130  fun remove_redundant_quantification ctxt i = fn st =>
  72.131    let
  72.132      val gls =
  72.133 -      prop_of st
  72.134 +      Thm.prop_of st
  72.135        |> Logic.strip_horn
  72.136        |> fst
  72.137    in
  72.138 @@ -1763,7 +1763,7 @@
  72.139  fun remove_redundant_quantification_in_lit ctxt i = fn st =>
  72.140    let
  72.141      val gls =
  72.142 -      prop_of st
  72.143 +      Thm.prop_of st
  72.144        |> Logic.strip_horn
  72.145        |> fst
  72.146    in
  72.147 @@ -2003,7 +2003,7 @@
  72.148       thy
  72.149       prob_name (#meta pannot) n
  72.150        |> the
  72.151 -      |> (fn {inference_fmla, ...} => cterm_of thy inference_fmla)
  72.152 +      |> (fn {inference_fmla, ...} => Thm.cterm_of thy inference_fmla)
  72.153        |> oracle_iinterp
  72.154    end
  72.155  *}
    73.1 --- a/src/HOL/TPTP/atp_theory_export.ML	Tue Mar 03 19:08:04 2015 +0100
    73.2 +++ b/src/HOL/TPTP/atp_theory_export.ML	Wed Mar 04 19:53:18 2015 +0100
    73.3 @@ -170,7 +170,7 @@
    73.4      val problem =
    73.5        facts
    73.6        |> map (fn ((_, loc), th) =>
    73.7 -        ((Thm.get_name_hint th, loc), th |> prop_of |> mono ? monomorphize_term ctxt))
    73.8 +        ((Thm.get_name_hint th, loc), th |> Thm.prop_of |> mono ? monomorphize_term ctxt))
    73.9        |> generate_atp_problem ctxt format Axiom type_enc Exporter combsN false false true []
   73.10          @{prop False}
   73.11        |> #1 |> sort_wrt (heading_sort_key o fst)
    74.1 --- a/src/HOL/TPTP/mash_export.ML	Tue Mar 03 19:08:04 2015 +0100
    74.2 +++ b/src/HOL/TPTP/mash_export.ML	Wed Mar 04 19:53:18 2015 +0100
    74.3 @@ -58,7 +58,7 @@
    74.4    | _ => ("", []))
    74.5  
    74.6  fun has_thm_thy th thy =
    74.7 -  Context.theory_name thy = Context.theory_name (theory_of_thm th)
    74.8 +  Context.theory_name thy = Context.theory_name (Thm.theory_of_thm th)
    74.9  
   74.10  fun has_thys thys th = exists (has_thm_thy th) thys
   74.11  
   74.12 @@ -98,7 +98,7 @@
   74.13      fun do_fact ((_, stature), th) =
   74.14        let
   74.15          val name = nickname_of_thm th
   74.16 -        val feats = features_of ctxt (theory_of_thm th) stature [prop_of th]
   74.17 +        val feats = features_of ctxt (Thm.theory_of_thm th) stature [Thm.prop_of th]
   74.18          val s = encode_str name ^ ": " ^ encode_strs (sort string_ord feats) ^ "\n"
   74.19        in
   74.20          File.append path s
   74.21 @@ -188,14 +188,14 @@
   74.22            val _ = tracing ("Fact " ^ string_of_int j ^ ": " ^ name)
   74.23            val isar_deps = isar_dependencies_of name_tabs th
   74.24            val do_query = not (is_bad_query ctxt ho_atp step j th isar_deps)
   74.25 -          val goal_feats = features_of ctxt (theory_of_thm th) stature [prop_of th]
   74.26 +          val goal_feats = features_of ctxt (Thm.theory_of_thm th) stature [Thm.prop_of th]
   74.27            val access_facts = filter_accessible_from th new_facts @ old_facts
   74.28            val (marker, deps) =
   74.29              smart_dependencies_of ctxt params_opt access_facts name_tabs th isar_deps
   74.30  
   74.31            fun extra_features_of (((_, stature), th), weight) =
   74.32 -            [prop_of th]
   74.33 -            |> features_of ctxt (theory_of_thm th) stature
   74.34 +            [Thm.prop_of th]
   74.35 +            |> features_of ctxt (Thm.theory_of_thm th) stature
   74.36              |> map (rpair (weight * extra_feature_factor))
   74.37  
   74.38            val query =
   74.39 @@ -261,7 +261,7 @@
   74.40                val suggs =
   74.41                  old_facts
   74.42                  |> filter_accessible_from th
   74.43 -                |> mepo_or_mash_suggested_facts ctxt (theory_of_thm th) params max_suggs hyp_ts
   74.44 +                |> mepo_or_mash_suggested_facts ctxt (Thm.theory_of_thm th) params max_suggs hyp_ts
   74.45                    concl_t
   74.46                  |> map (nickname_of_thm o snd)
   74.47              in
    75.1 --- a/src/HOL/Tools/ATP/atp_problem_generate.ML	Tue Mar 03 19:08:04 2015 +0100
    75.2 +++ b/src/HOL/Tools/ATP/atp_problem_generate.ML	Wed Mar 04 19:53:18 2015 +0100
    75.3 @@ -760,9 +760,9 @@
    75.4  fun do_introduce_combinators ctxt Ts t =
    75.5    let val thy = Proof_Context.theory_of ctxt in
    75.6      t |> conceal_bounds Ts
    75.7 -      |> cterm_of thy
    75.8 +      |> Thm.cterm_of thy
    75.9        |> Meson_Clausify.introduce_combinators_in_cterm
   75.10 -      |> prop_of |> Logic.dest_equals |> snd
   75.11 +      |> Thm.prop_of |> Logic.dest_equals |> snd
   75.12        |> reveal_bounds Ts
   75.13    end
   75.14    (* A type variable of sort "{}" will make abstraction fail. *)
   75.15 @@ -1211,7 +1211,7 @@
   75.16    if exists_Const (member (op =) Meson.presimplified_consts o fst) t then
   75.17      t |> Skip_Proof.make_thm (Proof_Context.theory_of ctxt)
   75.18        |> Meson.presimplify ctxt
   75.19 -      |> prop_of
   75.20 +      |> Thm.prop_of
   75.21    else
   75.22      t
   75.23  
   75.24 @@ -1750,7 +1750,7 @@
   75.25                   I
   75.26                 else
   75.27                   ths ~~ (1 upto length ths)
   75.28 -                 |> maps (dub_and_inst needs_sound o apfst (apsnd prop_of))
   75.29 +                 |> maps (dub_and_inst needs_sound o apfst (apsnd Thm.prop_of))
   75.30                   |> make_facts
   75.31                   |> union (op = o apply2 #iformula))
   75.32             (if completish then completish_helper_table else helper_table)
    76.1 --- a/src/HOL/Tools/ATP/atp_proof_reconstruct.ML	Tue Mar 03 19:08:04 2015 +0100
    76.2 +++ b/src/HOL/Tools/ATP/atp_proof_reconstruct.ML	Wed Mar 04 19:53:18 2015 +0100
    76.3 @@ -580,7 +580,7 @@
    76.4        | uncomb (Abs (s, T, t)) = Abs (s, T, uncomb t)
    76.5        | uncomb (t as Const (x as (s, _))) =
    76.6          (case AList.lookup (op =) combinator_table s of
    76.7 -          SOME thm => thm |> prop_of |> specialize_type thy x |> Logic.dest_equals |> snd
    76.8 +          SOME thm => thm |> Thm.prop_of |> specialize_type thy x |> Logic.dest_equals |> snd
    76.9          | NONE => t)
   76.10        | uncomb t = t
   76.11    in uncomb end
    77.1 --- a/src/HOL/Tools/ATP/atp_util.ML	Tue Mar 03 19:08:04 2015 +0100
    77.2 +++ b/src/HOL/Tools/ATP/atp_util.ML	Wed Mar 04 19:53:18 2015 +0100
    77.3 @@ -342,7 +342,7 @@
    77.4    if exists_Const (fn (s, _) => s = @{const_name Not}) t then
    77.5      t |> Skip_Proof.make_thm thy
    77.6        |> Meson.cong_extensionalize_thm thy
    77.7 -      |> prop_of
    77.8 +      |> Thm.prop_of
    77.9    else
   77.10      t
   77.11  
   77.12 @@ -353,8 +353,8 @@
   77.13  fun abs_extensionalize_term ctxt t =
   77.14    if exists_Const is_fun_equality t then
   77.15      let val thy = Proof_Context.theory_of ctxt in
   77.16 -      t |> cterm_of thy |> Meson.abs_extensionalize_conv ctxt
   77.17 -        |> prop_of |> Logic.dest_equals |> snd
   77.18 +      t |> Thm.cterm_of thy |> Meson.abs_extensionalize_conv ctxt
   77.19 +        |> Thm.prop_of |> Logic.dest_equals |> snd
   77.20      end
   77.21    else
   77.22      t
   77.23 @@ -405,7 +405,7 @@
   77.24  fun strip_subgoal goal i ctxt =
   77.25    let
   77.26      val (t, (frees, params)) =
   77.27 -      Logic.goal_params (prop_of goal) i
   77.28 +      Logic.goal_params (Thm.prop_of goal) i
   77.29        ||> (map dest_Free #> Variable.variant_frees ctxt [] #> `(map Free))
   77.30      val hyp_ts = t |> Logic.strip_assums_hyp |> map (curry subst_bounds frees)
   77.31      val concl_t = t |> Logic.strip_assums_concl |> curry subst_bounds frees
    78.1 --- a/src/HOL/Tools/ATP/atp_waldmeister.ML	Tue Mar 03 19:08:04 2015 +0100
    78.2 +++ b/src/HOL/Tools/ATP/atp_waldmeister.ML	Wed Mar 04 19:53:18 2015 +0100
    78.3 @@ -516,7 +516,7 @@
    78.4        if helper_lemmas_needed then
    78.5          [(helpersN,
    78.6            @{thms waldmeister_fol}
    78.7 -          |> map (fn th => (("", (Global, General)), preproc (prop_of th)))
    78.8 +          |> map (fn th => (("", (Global, General)), preproc (Thm.prop_of th)))
    78.9            |> map (fn ((s, _) ,t) => mk_formula helper_prefix s Axiom (eq_trm_to_atp thy t)))]
   78.10        else
   78.11          []
    79.1 --- a/src/HOL/Tools/BNF/bnf_fp_def_sugar.ML	Tue Mar 03 19:08:04 2015 +0100
    79.2 +++ b/src/HOL/Tools/BNF/bnf_fp_def_sugar.ML	Wed Mar 04 19:53:18 2015 +0100
    79.3 @@ -474,7 +474,7 @@
    79.4  
    79.5  fun flip_rels lthy n thm =
    79.6    let
    79.7 -    val Rs = Term.add_vars (prop_of thm) [];
    79.8 +    val Rs = Term.add_vars (Thm.prop_of thm) [];
    79.9      val Rs' = rev (drop (length Rs - n) Rs);
   79.10      val cRs = map (fn f => (Proof_Context.cterm_of lthy (Var f), Proof_Context.cterm_of lthy (mk_flip f))) Rs';
   79.11    in
    80.1 --- a/src/HOL/Tools/BNF/bnf_fp_def_sugar_tactics.ML	Tue Mar 03 19:08:04 2015 +0100
    80.2 +++ b/src/HOL/Tools/BNF/bnf_fp_def_sugar_tactics.ML	Wed Mar 04 19:53:18 2015 +0100
    80.3 @@ -94,7 +94,7 @@
    80.4  
    80.5  fun co_induct_inst_as_projs ctxt k thm =
    80.6    let
    80.7 -    val fs = Term.add_vars (prop_of thm) []
    80.8 +    val fs = Term.add_vars (Thm.prop_of thm) []
    80.9        |> filter (fn (_, Type (@{type_name fun}, [_, T'])) => T' <> HOLogic.boolT | _ => false);
   80.10      fun mk_cfp (f as (_, T)) =
   80.11        (Proof_Context.cterm_of ctxt (Var f), Proof_Context.cterm_of ctxt (mk_proj T (num_binder_types T) k));
   80.12 @@ -107,7 +107,7 @@
   80.13  
   80.14  fun mk_case_transfer_tac ctxt rel_cases cases =
   80.15    let
   80.16 -    val n = length (tl (prems_of rel_cases));
   80.17 +    val n = length (tl (Thm.prems_of rel_cases));
   80.18    in
   80.19      REPEAT_DETERM (HEADGOAL (rtac rel_funI)) THEN
   80.20      HEADGOAL (etac rel_cases) THEN
   80.21 @@ -512,7 +512,7 @@
   80.22      val assms_tac =
   80.23        let val assms' = map (unfold_thms ctxt (@{thm id_bnf_def} :: ctor_defs)) assms in
   80.24          fold (curry (op ORELSE')) (map (fn thm =>
   80.25 -            funpow (length (prems_of thm)) (fn tac => tac THEN' atac) (rtac thm)) assms')
   80.26 +            funpow (length (Thm.prems_of thm)) (fn tac => tac THEN' atac) (rtac thm)) assms')
   80.27            (etac FalseE)
   80.28        end;
   80.29      val exhausts' = map (fn thm => thm RS @{thm asm_rl[of "P x y" for P x y]}) exhausts
    81.1 --- a/src/HOL/Tools/BNF/bnf_fp_util.ML	Tue Mar 03 19:08:04 2015 +0100
    81.2 +++ b/src/HOL/Tools/BNF/bnf_fp_util.ML	Wed Mar 04 19:53:18 2015 +0100
    81.3 @@ -469,7 +469,7 @@
    81.4        val T = mk_tupleT_balanced tfrees;
    81.5      in
    81.6        @{thm asm_rl[of "ALL x. P x --> Q x" for P Q]}
    81.7 -      |> Drule.instantiate' [SOME (ctyp_of @{theory} T)] []
    81.8 +      |> Drule.instantiate' [SOME (Thm.ctyp_of @{theory} T)] []
    81.9        |> Raw_Simplifier.rewrite_goals_rule @{context} @{thms split_paired_All[THEN eq_reflection]}
   81.10        |> (fn thm => impI RS funpow n (fn th => allI RS th) thm)
   81.11        |> Thm.varifyT_global
    82.1 --- a/src/HOL/Tools/BNF/bnf_gfp_rec_sugar.ML	Tue Mar 03 19:08:04 2015 +0100
    82.2 +++ b/src/HOL/Tools/BNF/bnf_gfp_rec_sugar.ML	Wed Mar 04 19:53:18 2015 +0100
    82.3 @@ -1343,7 +1343,7 @@
    82.4                    NONE => []
    82.5                  | SOME (exhaustive_code, rhs, raw_rhs, ctr_thms) =>
    82.6                    let
    82.7 -                    val ms = map (Logic.count_prems o prop_of) ctr_thms;
    82.8 +                    val ms = map (Logic.count_prems o Thm.prop_of) ctr_thms;
    82.9                      val (raw_goal, goal) = (raw_rhs, rhs)
   82.10                        |> apply2 (curry mk_Trueprop_eq (applied_fun_of fun_name fun_T fun_args)
   82.11                          #> curry Logic.list_all (map dest_Free fun_args));
    83.1 --- a/src/HOL/Tools/BNF/bnf_gfp_rec_sugar_tactics.ML	Tue Mar 03 19:08:04 2015 +0100
    83.2 +++ b/src/HOL/Tools/BNF/bnf_gfp_rec_sugar_tactics.ML	Wed Mar 04 19:53:18 2015 +0100
    83.3 @@ -40,7 +40,7 @@
    83.4  fun exhaust_inst_as_projs ctxt frees thm =
    83.5    let
    83.6      val num_frees = length frees;
    83.7 -    val fs = Term.add_vars (prop_of thm) [] |> filter (can dest_funT o snd);
    83.8 +    val fs = Term.add_vars (Thm.prop_of thm) [] |> filter (can dest_funT o snd);
    83.9      fun find s = find_index (curry (op =) s) frees;
   83.10      fun mk_cfp (f as ((s, _), T)) =
   83.11        (Proof_Context.cterm_of ctxt (Var f), Proof_Context.cterm_of ctxt (mk_proj T num_frees (find s)));
   83.12 @@ -149,7 +149,7 @@
   83.13    unfold_thms_tac ctxt (@{thm split_def} :: unfold_lets @ sel_funs) THEN HEADGOAL (rtac refl);
   83.14  
   83.15  fun inst_split_eq ctxt split =
   83.16 -  (case prop_of split of
   83.17 +  (case Thm.prop_of split of
   83.18      @{const Trueprop} $ (Const (@{const_name HOL.eq}, _) $ (Var (_, Type (_, [T, _])) $ _) $ _) =>
   83.19      let
   83.20        val s = Name.uu;
    84.1 --- a/src/HOL/Tools/BNF/bnf_lfp_size.ML	Tue Mar 03 19:08:04 2015 +0100
    84.2 +++ b/src/HOL/Tools/BNF/bnf_lfp_size.ML	Wed Mar 04 19:53:18 2015 +0100
    84.3 @@ -258,7 +258,7 @@
    84.4        val size_thmss = map2 append size_simpss overloaded_size_simpss;
    84.5        val size_gen_thmss = size_simpss
    84.6        fun rhs_is_zero thm =
    84.7 -        let val Const (trueprop, _) $ (Const (eq, _) $ _ $ rhs) = prop_of thm in
    84.8 +        let val Const (trueprop, _) $ (Const (eq, _) $ _ $ rhs) = Thm.prop_of thm in
    84.9            trueprop = @{const_name Trueprop} andalso
   84.10            eq = @{const_name HOL.eq} andalso
   84.11            rhs = HOLogic.zero
    85.1 --- a/src/HOL/Tools/BNF/bnf_tactics.ML	Tue Mar 03 19:08:04 2015 +0100
    85.2 +++ b/src/HOL/Tools/BNF/bnf_tactics.ML	Wed Mar 04 19:53:18 2015 +0100
    85.3 @@ -36,7 +36,7 @@
    85.4  (*stolen from Christian Urban's Cookbook (and adapted slightly)*)
    85.5  fun fo_rtac thm = Subgoal.FOCUS (fn {concl, ...} =>
    85.6    let
    85.7 -    val concl_pat = Drule.strip_imp_concl (cprop_of thm)
    85.8 +    val concl_pat = Drule.strip_imp_concl (Thm.cprop_of thm)
    85.9      val insts = Thm.first_order_match (concl_pat, concl)
   85.10    in
   85.11      rtac (Drule.instantiate_normalize insts thm) 1
    86.1 --- a/src/HOL/Tools/Ctr_Sugar/ctr_sugar.ML	Tue Mar 03 19:08:04 2015 +0100
    86.2 +++ b/src/HOL/Tools/Ctr_Sugar/ctr_sugar.ML	Wed Mar 04 19:53:18 2015 +0100
    86.3 @@ -795,7 +795,7 @@
    86.4                val sel_thmss = @{map 3} (map oo make_sel_thm) xss' case_thms sel_defss;
    86.5  
    86.6                fun has_undefined_rhs thm =
    86.7 -                (case snd (HOLogic.dest_eq (HOLogic.dest_Trueprop (prop_of thm))) of
    86.8 +                (case snd (HOLogic.dest_eq (HOLogic.dest_Trueprop (Thm.prop_of thm))) of
    86.9                    Const (@{const_name undefined}, _) => true
   86.10                  | _ => false);
   86.11  
    87.1 --- a/src/HOL/Tools/Ctr_Sugar/ctr_sugar_code.ML	Tue Mar 03 19:08:04 2015 +0100
    87.2 +++ b/src/HOL/Tools/Ctr_Sugar/ctr_sugar_code.ML	Wed Mar 04 19:53:18 2015 +0100
    87.3 @@ -53,7 +53,7 @@
    87.4      fun true_eq tu = HOLogic.mk_eq (mk_fcT_eq tu, @{term True});
    87.5      fun false_eq tu = HOLogic.mk_eq (mk_fcT_eq tu, @{term False});
    87.6  
    87.7 -    val monomorphic_prop_of = prop_of o Thm.unvarify_global o Drule.zero_var_indexes;
    87.8 +    val monomorphic_prop_of = Thm.prop_of o Thm.unvarify_global o Drule.zero_var_indexes;
    87.9  
   87.10      fun massage_inject (tp $ (eqv $ (_ $ t $ u) $ rhs)) = tp $ (eqv $ mk_fcT_eq (t, u) $ rhs);
   87.11      fun massage_distinct (tp $ (_ $ (_ $ t $ u))) = [tp $ false_eq (t, u), tp $ false_eq (u, t)];
    88.1 --- a/src/HOL/Tools/Ctr_Sugar/ctr_sugar_util.ML	Tue Mar 03 19:08:04 2015 +0100
    88.2 +++ b/src/HOL/Tools/Ctr_Sugar/ctr_sugar_util.ML	Wed Mar 04 19:53:18 2015 +0100
    88.3 @@ -178,7 +178,8 @@
    88.4  fun subst_nonatomic_types [] = I
    88.5    | subst_nonatomic_types inst = map_types (typ_subst_nonatomic inst);
    88.6  
    88.7 -fun lhs_head_of thm = Term.head_of (fst (HOLogic.dest_eq (HOLogic.dest_Trueprop (prop_of thm))));
    88.8 +fun lhs_head_of thm =
    88.9 +  Term.head_of (fst (HOLogic.dest_eq (HOLogic.dest_Trueprop (Thm.prop_of thm))));
   88.10  
   88.11  fun mk_predT Ts = Ts ---> HOLogic.boolT;
   88.12  fun mk_pred1T T = mk_predT [T];
   88.13 @@ -213,7 +214,7 @@
   88.14  fun cterm_instantiate_pos cts thm =
   88.15    let
   88.16      val cert = Thm.cterm_of (Thm.theory_of_thm thm);
   88.17 -    val vars = Term.add_vars (prop_of thm) [];
   88.18 +    val vars = Term.add_vars (Thm.prop_of thm) [];
   88.19      val vars' = rev (drop (length vars - length cts) vars);
   88.20      val ps = map_filter (fn (_, NONE) => NONE
   88.21        | (var, SOME ct) => SOME (cert (Var var), ct)) (vars' ~~ cts);
    89.1 --- a/src/HOL/Tools/Function/fun_cases.ML	Tue Mar 03 19:08:04 2015 +0100
    89.2 +++ b/src/HOL/Tools/Function/fun_cases.ML	Wed Mar 04 19:53:18 2015 +0100
    89.3 @@ -30,7 +30,7 @@
    89.4      val info = Function.get_info ctxt f handle List.Empty => err ();
    89.5      val {elims, pelims, is_partial, ...} = info;
    89.6      val elims = if is_partial then pelims else the elims;
    89.7 -    val cprop = cterm_of thy prop;
    89.8 +    val cprop = Thm.cterm_of thy prop;
    89.9      fun mk_elim rl =
   89.10        Thm.implies_intr cprop
   89.11          (Tactic.rule_by_tactic ctxt (Inductive.mk_cases_tac ctxt) (Thm.assume cprop RS rl))
    90.1 --- a/src/HOL/Tools/Function/function.ML	Tue Mar 03 19:08:04 2015 +0100
    90.2 +++ b/src/HOL/Tools/Function/function.ML	Wed Mar 04 19:53:18 2015 +0100
    90.3 @@ -166,7 +166,7 @@
    90.4        prepare_function do_print prep default_constraint fixspec eqns config lthy
    90.5    in
    90.6      lthy'
    90.7 -    |> Proof.theorem NONE (snd oo afterqed) [[(Logic.unprotect (concl_of goal_state), [])]]
    90.8 +    |> Proof.theorem NONE (snd oo afterqed) [[(Logic.unprotect (Thm.concl_of goal_state), [])]]
    90.9      |> Proof.refine (Method.primitive_text (K (K goal_state))) |> Seq.hd
   90.10    end
   90.11  
    91.1 --- a/src/HOL/Tools/Function/function_common.ML	Tue Mar 03 19:08:04 2015 +0100
    91.2 +++ b/src/HOL/Tools/Function/function_common.ML	Wed Mar 04 19:53:18 2015 +0100
    91.3 @@ -339,11 +339,11 @@
    91.4  fun import_function_data t ctxt =
    91.5    let
    91.6      val thy = Proof_Context.theory_of ctxt
    91.7 -    val ct = cterm_of thy t
    91.8 +    val ct = Thm.cterm_of thy t
    91.9      val inst_morph = lift_morphism thy o Thm.instantiate
   91.10  
   91.11      fun match (trm, data) =
   91.12 -      SOME (transform_function_data data (inst_morph (Thm.match (cterm_of thy trm, ct))))
   91.13 +      SOME (transform_function_data data (inst_morph (Thm.match (Thm.cterm_of thy trm, ct))))
   91.14        handle Pattern.MATCH => NONE
   91.15    in
   91.16      get_first match (Item_Net.retrieve (get_functions ctxt) t)
    92.1 --- a/src/HOL/Tools/Function/function_context_tree.ML	Tue Mar 03 19:08:04 2015 +0100
    92.2 +++ b/src/HOL/Tools/Function/function_context_tree.ML	Wed Mar 04 19:53:18 2015 +0100
    92.3 @@ -87,7 +87,7 @@
    92.4  
    92.5  fun cong_deps crule =
    92.6    let
    92.7 -    val num_branches = map_index (apsnd branch_vars) (prems_of crule)
    92.8 +    val num_branches = map_index (apsnd branch_vars) (Thm.prems_of crule)
    92.9    in
   92.10      Int_Graph.empty
   92.11      |> fold (fn (i,_)=> Int_Graph.new_node (i,i)) num_branches
   92.12 @@ -114,13 +114,13 @@
   92.13          val thy = Proof_Context.theory_of ctxt
   92.14  
   92.15          val tt' = Logic.mk_equals (Pattern.rewrite_term thy [(Free fvar, h)] [] t, t)
   92.16 -        val (c, subs) = (concl_of r, prems_of r)
   92.17 +        val (c, subs) = (Thm.concl_of r, Thm.prems_of r)
   92.18  
   92.19          val subst =
   92.20            Pattern.match (Proof_Context.theory_of ctxt) (c, tt') (Vartab.empty, Vartab.empty)
   92.21          val branches = map (mk_branch ctxt o Envir.beta_norm o Envir.subst_term subst) subs
   92.22          val inst = map (fn v =>
   92.23 -            (cterm_of thy (Var v), cterm_of thy (Envir.subst_term subst (Var v))))
   92.24 +            (Thm.cterm_of thy (Var v), Thm.cterm_of thy (Envir.subst_term subst (Var v))))
   92.25            (Term.add_vars c [])
   92.26        in
   92.27           (cterm_instantiate inst r, dep, branches)
   92.28 @@ -160,8 +160,8 @@
   92.29  
   92.30  fun inst_tree thy fvar f tr =
   92.31    let
   92.32 -    val cfvar = cterm_of thy fvar
   92.33 -    val cf = cterm_of thy f
   92.34 +    val cfvar = Thm.cterm_of thy fvar
   92.35 +    val cf = Thm.cterm_of thy f
   92.36  
   92.37      fun inst_term t =
   92.38        subst_bound(f, abstract_over (fvar, t))
   92.39 @@ -174,7 +174,7 @@
   92.40        | inst_tree_aux (RCall (t, str)) =
   92.41          RCall (inst_term t, inst_tree_aux str)
   92.42      and inst_branch ((fxs, assms), str) =
   92.43 -      ((fxs, map (Thm.assume o cterm_of thy o inst_term o prop_of) assms),
   92.44 +      ((fxs, map (Thm.assume o Thm.cterm_of thy o inst_term o Thm.prop_of) assms),
   92.45         inst_tree_aux str)
   92.46    in
   92.47      inst_tree_aux tr
   92.48 @@ -185,15 +185,15 @@
   92.49  fun compose (fs1, as1) (fs2, as2) = (fs1 @ fs2, as1 @ as2)
   92.50  
   92.51  fun export_term (fixes, assumes) =
   92.52 - fold_rev (curry Logic.mk_implies o prop_of) assumes
   92.53 + fold_rev (curry Logic.mk_implies o Thm.prop_of) assumes
   92.54   #> fold_rev (Logic.all o Free) fixes
   92.55  
   92.56  fun export_thm thy (fixes, assumes) =
   92.57 - fold_rev (Thm.implies_intr o cprop_of) assumes
   92.58 - #> fold_rev (Thm.forall_intr o cterm_of thy o Free) fixes
   92.59 + fold_rev (Thm.implies_intr o Thm.cprop_of) assumes
   92.60 + #> fold_rev (Thm.forall_intr o Thm.cterm_of thy o Free) fixes
   92.61  
   92.62  fun import_thm thy (fixes, athms) =
   92.63 - fold (Thm.forall_elim o cterm_of thy o Free) fixes
   92.64 + fold (Thm.forall_elim o Thm.cterm_of thy o Free) fixes
   92.65   #> fold Thm.elim_implies athms
   92.66  
   92.67  
   92.68 @@ -243,7 +243,7 @@
   92.69  fun rewrite_by_tree ctxt h ih x tr =
   92.70    let
   92.71      val thy = Proof_Context.theory_of ctxt
   92.72 -    fun rewrite_help _ _ x (Leaf t) = (Thm.reflexive (cterm_of thy t), x)
   92.73 +    fun rewrite_help _ _ x (Leaf t) = (Thm.reflexive (Thm.cterm_of thy t), x)
   92.74        | rewrite_help fix h_as x (RCall (_ $ arg, st)) =
   92.75          let
   92.76            val (inner, (lRi,ha)::x') = rewrite_help fix h_as x st (* "a' = a" *)
   92.77 @@ -251,10 +251,10 @@
   92.78            val iha = import_thm thy (fix, h_as) ha (* (a', h a') : G *)
   92.79              |> Conv.fconv_rule (Conv.arg_conv (Conv.comb_conv (Conv.arg_conv (K inner))))
   92.80                                                      (* (a, h a) : G   *)
   92.81 -          val inst_ih = instantiate' [] [SOME (cterm_of thy arg)] ih
   92.82 +          val inst_ih = instantiate' [] [SOME (Thm.cterm_of thy arg)] ih
   92.83            val eq = Thm.implies_elim (Thm.implies_elim inst_ih lRi) iha (* h a = f a *)
   92.84  
   92.85 -          val h_a'_eq_h_a = Thm.combination (Thm.reflexive (cterm_of thy h)) inner
   92.86 +          val h_a'_eq_h_a = Thm.combination (Thm.reflexive (Thm.cterm_of thy h)) inner
   92.87            val h_a_eq_f_a = eq RS eq_reflection
   92.88            val result = Thm.transitive h_a'_eq_h_a h_a_eq_f_a
   92.89          in
    93.1 --- a/src/HOL/Tools/Function/function_core.ML	Tue Mar 03 19:08:04 2015 +0100
    93.2 +++ b/src/HOL/Tools/Function/function_core.ML	Wed Mar 04 19:53:18 2015 +0100
    93.3 @@ -152,10 +152,10 @@
    93.4      val lhs = inst pre_lhs
    93.5      val rhs = inst pre_rhs
    93.6  
    93.7 -    val cqs = map (cterm_of thy) qs
    93.8 -    val ags = map (Thm.assume o cterm_of thy) gs
    93.9 +    val cqs = map (Thm.cterm_of thy) qs
   93.10 +    val ags = map (Thm.assume o Thm.cterm_of thy) gs
   93.11  
   93.12 -    val case_hyp = Thm.assume (cterm_of thy (HOLogic.mk_Trueprop (mk_eq (x, lhs))))
   93.13 +    val case_hyp = Thm.assume (Thm.cterm_of thy (HOLogic.mk_Trueprop (mk_eq (x, lhs))))
   93.14    in
   93.15      ClauseContext { ctxt = ctxt', qs = qs, gs = gs, lhs = lhs, rhs = rhs,
   93.16        cqs = cqs, ags = ags, case_hyp = case_hyp }
   93.17 @@ -201,7 +201,7 @@
   93.18  
   93.19          val h_assum =
   93.20            HOLogic.mk_Trueprop (G $ rcarg $ (h $ rcarg))
   93.21 -          |> fold_rev (curry Logic.mk_implies o prop_of) rcassm
   93.22 +          |> fold_rev (curry Logic.mk_implies o Thm.prop_of) rcassm
   93.23            |> fold_rev (Logic.all o Free) rcfix
   93.24            |> Pattern.rewrite_term (Proof_Context.theory_of ctxt) [(f, h)] []
   93.25            |> abstract_over_list (rev qs)
   93.26 @@ -235,7 +235,7 @@
   93.27      val ClauseContext {cqs=cqsi,ags=agsi,lhs=lhsi,...} = ctxi
   93.28      val ClauseContext {cqs=cqsj,ags=agsj,lhs=lhsj,...} = ctxj
   93.29  
   93.30 -    val lhsi_eq_lhsj = cterm_of thy (HOLogic.mk_Trueprop (mk_eq (lhsi, lhsj)))
   93.31 +    val lhsi_eq_lhsj = Thm.cterm_of thy (HOLogic.mk_Trueprop (mk_eq (lhsi, lhsj)))
   93.32    in if j < i then
   93.33      let
   93.34        val compat = lookup_compat_thm j i cts
   93.35 @@ -274,15 +274,15 @@
   93.36  
   93.37      val Ris = map (fn RCInfo {llRI, ...} => llRI) RCs
   93.38      val h_assums = map (fn RCInfo {h_assum, ...} =>
   93.39 -      Thm.assume (cterm_of thy (subst_bounds (rev qs, h_assum)))) RCs
   93.40 +      Thm.assume (Thm.cterm_of thy (subst_bounds (rev qs, h_assum)))) RCs
   93.41  
   93.42      val (eql, _) =
   93.43        Function_Context_Tree.rewrite_by_tree ctxt h ih_elim_case (Ris ~~ h_assums) tree
   93.44  
   93.45      val replace_lemma = (eql RS meta_eq_to_obj_eq)
   93.46 -      |> Thm.implies_intr (cprop_of case_hyp)
   93.47 -      |> fold_rev (Thm.implies_intr o cprop_of) h_assums
   93.48 -      |> fold_rev (Thm.implies_intr o cprop_of) ags
   93.49 +      |> Thm.implies_intr (Thm.cprop_of case_hyp)
   93.50 +      |> fold_rev (Thm.implies_intr o Thm.cprop_of) h_assums
   93.51 +      |> fold_rev (Thm.implies_intr o Thm.cprop_of) ags
   93.52        |> fold_rev Thm.forall_intr cqs
   93.53        |> Thm.close_derivation
   93.54    in
   93.55 @@ -293,7 +293,8 @@
   93.56  fun mk_uniqueness_clause thy globals compat_store clausei clausej RLj =
   93.57    let
   93.58      val Globals {h, y, x, fvar, ...} = globals
   93.59 -    val ClauseInfo {no=i, cdata=cctxi as ClauseContext {ctxt=ctxti, lhs=lhsi, case_hyp, ...}, ...} = clausei
   93.60 +    val ClauseInfo {no=i, cdata=cctxi as ClauseContext {ctxt=ctxti, lhs=lhsi, case_hyp, ...}, ...} =
   93.61 +      clausei
   93.62      val ClauseInfo {no=j, qglr=cdescj, RCs=RCsj, ...} = clausej
   93.63  
   93.64      val cctxj as ClauseContext {ags = agsj', lhs = lhsj', rhs = rhsj', qs = qsj', cqs = cqsj', ...} =
   93.65 @@ -301,15 +302,17 @@
   93.66  
   93.67      val rhsj'h = Pattern.rewrite_term thy [(fvar,h)] [] rhsj'
   93.68      val compat = get_compat_thm thy compat_store i j cctxi cctxj
   93.69 -    val Ghsj' = map (fn RCInfo {h_assum, ...} => Thm.assume (cterm_of thy (subst_bounds (rev qsj', h_assum)))) RCsj
   93.70 +    val Ghsj' =
   93.71 +      map (fn RCInfo {h_assum, ...} =>
   93.72 +        Thm.assume (Thm.cterm_of thy (subst_bounds (rev qsj', h_assum)))) RCsj
   93.73  
   93.74      val RLj_import = RLj
   93.75        |> fold Thm.forall_elim cqsj'
   93.76        |> fold Thm.elim_implies agsj'
   93.77        |> fold Thm.elim_implies Ghsj'
   93.78  
   93.79 -    val y_eq_rhsj'h = Thm.assume (cterm_of thy (HOLogic.mk_Trueprop (mk_eq (y, rhsj'h))))
   93.80 -    val lhsi_eq_lhsj' = Thm.assume (cterm_of thy (HOLogic.mk_Trueprop (mk_eq (lhsi, lhsj'))))
   93.81 +    val y_eq_rhsj'h = Thm.assume (Thm.cterm_of thy (HOLogic.mk_Trueprop (mk_eq (y, rhsj'h))))
   93.82 +    val lhsi_eq_lhsj' = Thm.assume (Thm.cterm_of thy (HOLogic.mk_Trueprop (mk_eq (lhsi, lhsj'))))
   93.83         (* lhs_i = lhs_j' |-- lhs_i = lhs_j' *)
   93.84    in
   93.85      (trans OF [case_hyp, lhsi_eq_lhsj']) (* lhs_i = lhs_j' |-- x = lhs_j' *)
   93.86 @@ -319,12 +322,12 @@
   93.87        (* lhs_i = lhs_j', Gj', Rj1' ... Rjk' |-- rhs_j'_h = rhs_i_f *)
   93.88      |> (fn it => trans OF [y_eq_rhsj'h, it])
   93.89        (* lhs_i = lhs_j', Gj', Rj1' ... Rjk', y = rhs_j_h' |-- y = rhs_i_f *)
   93.90 -    |> fold_rev (Thm.implies_intr o cprop_of) Ghsj'
   93.91 -    |> fold_rev (Thm.implies_intr o cprop_of) agsj'
   93.92 +    |> fold_rev (Thm.implies_intr o Thm.cprop_of) Ghsj'
   93.93 +    |> fold_rev (Thm.implies_intr o Thm.cprop_of) agsj'
   93.94        (* lhs_i = lhs_j' , y = rhs_j_h' |-- Gj', Rj1'...Rjk' ==> y = rhs_i_f *)
   93.95 -    |> Thm.implies_intr (cprop_of y_eq_rhsj'h)
   93.96 -    |> Thm.implies_intr (cprop_of lhsi_eq_lhsj')
   93.97 -    |> fold_rev Thm.forall_intr (cterm_of thy h :: cqsj')
   93.98 +    |> Thm.implies_intr (Thm.cprop_of y_eq_rhsj'h)
   93.99 +    |> Thm.implies_intr (Thm.cprop_of lhsi_eq_lhsj')
  93.100 +    |> fold_rev Thm.forall_intr (Thm.cterm_of thy h :: cqsj')
  93.101    end
  93.102  
  93.103  
  93.104 @@ -339,13 +342,13 @@
  93.105      val ih_intro_case = full_simplify (put_simpset HOL_basic_ss ctxt addsimps [case_hyp]) ih_intro
  93.106  
  93.107      fun prep_RC (RCInfo {llRI, RIvs, CCas, ...}) = (llRI RS ih_intro_case)
  93.108 -      |> fold_rev (Thm.implies_intr o cprop_of) CCas
  93.109 -      |> fold_rev (Thm.forall_intr o cterm_of thy o Free) RIvs
  93.110 +      |> fold_rev (Thm.implies_intr o Thm.cprop_of) CCas
  93.111 +      |> fold_rev (Thm.forall_intr o Thm.cterm_of thy o Free) RIvs
  93.112  
  93.113      val existence = fold (curry op COMP o prep_RC) RCs lGI
  93.114  
  93.115 -    val P = cterm_of thy (mk_eq (y, rhsC))
  93.116 -    val G_lhs_y = Thm.assume (cterm_of thy (HOLogic.mk_Trueprop (G $ lhs $ y)))
  93.117 +    val P = Thm.cterm_of thy (mk_eq (y, rhsC))
  93.118 +    val G_lhs_y = Thm.assume (Thm.cterm_of thy (HOLogic.mk_Trueprop (G $ lhs $ y)))
  93.119  
  93.120      val unique_clauses =
  93.121        map2 (mk_uniqueness_clause thy globals compat_store clausei) clauses rep_lemmas
  93.122 @@ -356,31 +359,32 @@
  93.123        |> Seq.list_of |> the_single
  93.124  
  93.125      val uniqueness = G_cases
  93.126 -      |> Thm.forall_elim (cterm_of thy lhs)
  93.127 -      |> Thm.forall_elim (cterm_of thy y)
  93.128 +      |> Thm.forall_elim (Thm.cterm_of thy lhs)
  93.129 +      |> Thm.forall_elim (Thm.cterm_of thy y)
  93.130        |> Thm.forall_elim P
  93.131        |> Thm.elim_implies G_lhs_y
  93.132        |> fold elim_implies_eta unique_clauses
  93.133 -      |> Thm.implies_intr (cprop_of G_lhs_y)
  93.134 -      |> Thm.forall_intr (cterm_of thy y)
  93.135 +      |> Thm.implies_intr (Thm.cprop_of G_lhs_y)
  93.136 +      |> Thm.forall_intr (Thm.cterm_of thy y)
  93.137  
  93.138 -    val P2 = cterm_of thy (lambda y (G $ lhs $ y)) (* P2 y := (lhs, y): G *)
  93.139 +    val P2 = Thm.cterm_of thy (lambda y (G $ lhs $ y)) (* P2 y := (lhs, y): G *)
  93.140  
  93.141      val exactly_one =
  93.142 -      @{thm ex1I} |> instantiate' [SOME (ctyp_of thy ranT)] [SOME P2, SOME (cterm_of thy rhsC)]
  93.143 +      @{thm ex1I}
  93.144 +      |> instantiate' [SOME (Thm.ctyp_of thy ranT)] [SOME P2, SOME (Thm.cterm_of thy rhsC)]
  93.145        |> curry (op COMP) existence
  93.146        |> curry (op COMP) uniqueness
  93.147        |> simplify (put_simpset HOL_basic_ss ctxt addsimps [case_hyp RS sym])
  93.148 -      |> Thm.implies_intr (cprop_of case_hyp)
  93.149 -      |> fold_rev (Thm.implies_intr o cprop_of) ags
  93.150 +      |> Thm.implies_intr (Thm.cprop_of case_hyp)
  93.151 +      |> fold_rev (Thm.implies_intr o Thm.cprop_of) ags
  93.152        |> fold_rev Thm.forall_intr cqs
  93.153  
  93.154      val function_value =
  93.155        existence
  93.156        |> Thm.implies_intr ihyp
  93.157 -      |> Thm.implies_intr (cprop_of case_hyp)
  93.158 -      |> Thm.forall_intr (cterm_of thy x)
  93.159 -      |> Thm.forall_elim (cterm_of thy lhs)
  93.160 +      |> Thm.implies_intr (Thm.cprop_of case_hyp)
  93.161 +      |> Thm.forall_intr (Thm.cterm_of thy x)
  93.162 +      |> Thm.forall_elim (Thm.cterm_of thy lhs)
  93.163        |> curry (op RS) refl
  93.164    in
  93.165      (exactly_one, function_value)
  93.166 @@ -397,12 +401,12 @@
  93.167        Logic.mk_implies (HOLogic.mk_Trueprop (R $ Bound 0 $ x),
  93.168          HOLogic.mk_Trueprop (Const (@{const_name Ex1}, (ranT --> boolT) --> boolT) $
  93.169            Abs ("y", ranT, G $ Bound 1 $ Bound 0))))
  93.170 -      |> cterm_of thy
  93.171 +      |> Thm.cterm_of thy
  93.172  
  93.173      val ihyp_thm = Thm.assume ihyp |> Thm.forall_elim_vars 0
  93.174      val ih_intro = ihyp_thm RS (f_def RS ex1_implies_ex)
  93.175      val ih_elim = ihyp_thm RS (f_def RS ex1_implies_un)
  93.176 -      |> instantiate' [] [NONE, SOME (cterm_of thy h)]
  93.177 +      |> instantiate' [] [NONE, SOME (Thm.cterm_of thy h)]
  93.178  
  93.179      val _ = trace_msg (K "Proving Replacement lemmas...")
  93.180      val repLemmas = map (mk_replacement_lemma ctxt h ih_elim) clauses
  93.181 @@ -419,16 +423,17 @@
  93.182        |> Thm.forall_elim_vars 0
  93.183        |> fold (curry op COMP) ex1s
  93.184        |> Thm.implies_intr (ihyp)
  93.185 -      |> Thm.implies_intr (cterm_of thy (HOLogic.mk_Trueprop (mk_acc domT R $ x)))
  93.186 -      |> Thm.forall_intr (cterm_of thy x)
  93.187 +      |> Thm.implies_intr (Thm.cterm_of thy (HOLogic.mk_Trueprop (mk_acc domT R $ x)))
  93.188 +      |> Thm.forall_intr (Thm.cterm_of thy x)
  93.189        |> (fn it => Drule.compose (it, 2, acc_induct_rule)) (* "EX! y. (?x,y):G" *)
  93.190 -      |> (fn it => fold (Thm.forall_intr o cterm_of thy o Var) (Term.add_vars (prop_of it) []) it)
  93.191 +      |> (fn it =>
  93.192 +          fold (Thm.forall_intr o Thm.cterm_of thy o Var) (Term.add_vars (Thm.prop_of it) []) it)
  93.193  
  93.194      val goalstate =  Conjunction.intr graph_is_function complete
  93.195        |> Thm.close_derivation
  93.196        |> Goal.protect 0
  93.197 -      |> fold_rev (Thm.implies_intr o cprop_of) compat
  93.198 -      |> Thm.implies_intr (cprop_of complete)
  93.199 +      |> fold_rev (Thm.implies_intr o Thm.cprop_of) compat
  93.200 +      |> Thm.implies_intr (Thm.cprop_of complete)
  93.201    in
  93.202      (goalstate, values)
  93.203    end
  93.204 @@ -458,7 +463,7 @@
  93.205        let
  93.206          val (qs, t) = dest_all_all orig_intro
  93.207          val frees = Variable.add_frees lthy t [] |> remove (op =) (Binding.name_of R, T)
  93.208 -        val vars = Term.add_vars (prop_of thm) []
  93.209 +        val vars = Term.add_vars (Thm.prop_of thm) []
  93.210          val varmap = AList.lookup (op =) (frees ~~ map fst vars)
  93.211            #> the_default ("", 0)
  93.212        in
  93.213 @@ -478,7 +483,7 @@
  93.214        let
  93.215          fun mk_h_assm (rcfix, rcassm, rcarg) =
  93.216            HOLogic.mk_Trueprop (Free Gvar $ rcarg $ (fvar $ rcarg))
  93.217 -          |> fold_rev (curry Logic.mk_implies o prop_of) rcassm
  93.218 +          |> fold_rev (curry Logic.mk_implies o Thm.prop_of) rcassm
  93.219            |> fold_rev (Logic.all o Free) rcfix
  93.220        in
  93.221          HOLogic.mk_Trueprop (Free Gvar $ lhs $ rhs)
  93.222 @@ -511,7 +516,7 @@
  93.223  
  93.224      fun mk_RIntro (ClauseContext {qs, gs, lhs, ...}, (oqs, _, _, _)) (rcfix, rcassm, rcarg) =
  93.225        HOLogic.mk_Trueprop (Free Rvar $ rcarg $ lhs)
  93.226 -      |> fold_rev (curry Logic.mk_implies o prop_of) rcassm
  93.227 +      |> fold_rev (curry Logic.mk_implies o Thm.prop_of) rcassm
  93.228        |> fold_rev (curry Logic.mk_implies) gs
  93.229        |> fold_rev (Logic.all o Free) rcfix
  93.230        |> fold_rev mk_forall_rename (map fst oqs ~~ qs)
  93.231 @@ -549,7 +554,7 @@
  93.232    let
  93.233      fun inst_term t = subst_bound(f, abstract_over (fvar, t))
  93.234    in
  93.235 -    (rcfix, map (Thm.assume o cterm_of thy o inst_term o prop_of) rcassm, inst_term rcarg)
  93.236 +    (rcfix, map (Thm.assume o Thm.cterm_of thy o inst_term o Thm.prop_of) rcassm, inst_term rcarg)
  93.237    end
  93.238  
  93.239  
  93.240 @@ -563,19 +568,20 @@
  93.241      val thy = Proof_Context.theory_of ctxt
  93.242      val Globals {domT, z, ...} = globals
  93.243  
  93.244 -    fun mk_psimp (ClauseInfo {qglr = (oqs, _, _, _), cdata = ClauseContext {cqs, lhs, ags, ...}, ...}) valthm =
  93.245 +    fun mk_psimp
  93.246 +      (ClauseInfo {qglr = (oqs, _, _, _), cdata = ClauseContext {cqs, lhs, ags, ...}, ...}) valthm =
  93.247        let
  93.248 -        val lhs_acc = cterm_of thy (HOLogic.mk_Trueprop (mk_acc domT R $ lhs)) (* "acc R lhs" *)
  93.249 -        val z_smaller = cterm_of thy (HOLogic.mk_Trueprop (R $ z $ lhs)) (* "R z lhs" *)
  93.250 +        val lhs_acc = Thm.cterm_of thy (HOLogic.mk_Trueprop (mk_acc domT R $ lhs)) (* "acc R lhs" *)
  93.251 +        val z_smaller = Thm.cterm_of thy (HOLogic.mk_Trueprop (R $ z $ lhs)) (* "R z lhs" *)
  93.252        in
  93.253          ((Thm.assume z_smaller) RS ((Thm.assume lhs_acc) RS acc_downward))
  93.254          |> (fn it => it COMP graph_is_function)
  93.255          |> Thm.implies_intr z_smaller
  93.256 -        |> Thm.forall_intr (cterm_of thy z)
  93.257 +        |> Thm.forall_intr (Thm.cterm_of thy z)
  93.258          |> (fn it => it COMP valthm)
  93.259          |> Thm.implies_intr lhs_acc
  93.260          |> asm_simplify (put_simpset HOL_basic_ss ctxt addsimps [f_iff])
  93.261 -        |> fold_rev (Thm.implies_intr o cprop_of) ags
  93.262 +        |> fold_rev (Thm.implies_intr o Thm.cprop_of) ags
  93.263          |> fold_rev forall_intr_rename (map fst oqs ~~ cqs)
  93.264        end
  93.265    in
  93.266 @@ -594,23 +600,23 @@
  93.267      val Globals {domT, x, z, a, P, D, ...} = globals
  93.268      val acc_R = mk_acc domT R
  93.269  
  93.270 -    val x_D = Thm.assume (cterm_of thy (HOLogic.mk_Trueprop (D $ x)))
  93.271 -    val a_D = cterm_of thy (HOLogic.mk_Trueprop (D $ a))
  93.272 +    val x_D = Thm.assume (Thm.cterm_of thy (HOLogic.mk_Trueprop (D $ x)))
  93.273 +    val a_D = Thm.cterm_of thy (HOLogic.mk_Trueprop (D $ a))
  93.274  
  93.275 -    val D_subset = cterm_of thy (Logic.all x
  93.276 +    val D_subset = Thm.cterm_of thy (Logic.all x
  93.277        (Logic.mk_implies (HOLogic.mk_Trueprop (D $ x), HOLogic.mk_Trueprop (acc_R $ x))))
  93.278  
  93.279      val D_dcl = (* "!!x z. [| x: D; (z,x):R |] ==> z:D" *)
  93.280        Logic.all x (Logic.all z (Logic.mk_implies (HOLogic.mk_Trueprop (D $ x),
  93.281          Logic.mk_implies (HOLogic.mk_Trueprop (R $ z $ x),
  93.282            HOLogic.mk_Trueprop (D $ z)))))
  93.283 -      |> cterm_of thy
  93.284 +      |> Thm.cterm_of thy
  93.285  
  93.286      (* Inductive Hypothesis: !!z. (z,x):R ==> P z *)
  93.287      val ihyp = Logic.all_const domT $ Abs ("z", domT,
  93.288        Logic.mk_implies (HOLogic.mk_Trueprop (R $ Bound 0 $ x),
  93.289          HOLogic.mk_Trueprop (P $ Bound 0)))
  93.290 -      |> cterm_of thy
  93.291 +      |> Thm.cterm_of thy
  93.292  
  93.293      val aihyp = Thm.assume ihyp
  93.294  
  93.295 @@ -628,19 +634,19 @@
  93.296          end
  93.297  
  93.298          fun mk_Prec (RCInfo {llRI, RIvs, CCas, rcarg, ...}) = sih
  93.299 -          |> Thm.forall_elim (cterm_of thy rcarg)
  93.300 +          |> Thm.forall_elim (Thm.cterm_of thy rcarg)
  93.301            |> Thm.elim_implies llRI
  93.302 -          |> fold_rev (Thm.implies_intr o cprop_of) CCas
  93.303 -          |> fold_rev (Thm.forall_intr o cterm_of thy o Free) RIvs
  93.304 +          |> fold_rev (Thm.implies_intr o Thm.cprop_of) CCas
  93.305 +          |> fold_rev (Thm.forall_intr o Thm.cterm_of thy o Free) RIvs
  93.306  
  93.307          val P_recs = map mk_Prec RCs   (*  [P rec1, P rec2, ... ]  *)
  93.308  
  93.309          val step = HOLogic.mk_Trueprop (P $ lhs)
  93.310 -          |> fold_rev (curry Logic.mk_implies o prop_of) P_recs
  93.311 +          |> fold_rev (curry Logic.mk_implies o Thm.prop_of) P_recs
  93.312            |> fold_rev (curry Logic.mk_implies) gs
  93.313            |> curry Logic.mk_implies (HOLogic.mk_Trueprop (D $ lhs))
  93.314            |> fold_rev mk_forall_rename (map fst oqs ~~ qs)
  93.315 -          |> cterm_of thy
  93.316 +          |> Thm.cterm_of thy
  93.317  
  93.318          val P_lhs = Thm.assume step
  93.319            |> fold Thm.forall_elim cqs
  93.320 @@ -648,12 +654,12 @@
  93.321            |> fold Thm.elim_implies ags
  93.322            |> fold Thm.elim_implies P_recs
  93.323  
  93.324 -        val res = cterm_of thy (HOLogic.mk_Trueprop (P $ x))
  93.325 +        val res = Thm.cterm_of thy (HOLogic.mk_Trueprop (P $ x))
  93.326            |> Conv.arg_conv (Conv.arg_conv case_hyp_conv)
  93.327            |> Thm.symmetric (* P lhs == P x *)
  93.328            |> (fn eql => Thm.equal_elim eql P_lhs) (* "P x" *)
  93.329 -          |> Thm.implies_intr (cprop_of case_hyp)
  93.330 -          |> fold_rev (Thm.implies_intr o cprop_of) ags
  93.331 +          |> Thm.implies_intr (Thm.cprop_of case_hyp)
  93.332 +          |> fold_rev (Thm.implies_intr o Thm.cprop_of) ags
  93.333            |> fold_rev Thm.forall_intr cqs
  93.334        in
  93.335          (res, step)
  93.336 @@ -665,8 +671,8 @@
  93.337        |> Thm.forall_elim_vars 0
  93.338        |> fold (curry op COMP) cases (*  P x  *)
  93.339        |> Thm.implies_intr ihyp
  93.340 -      |> Thm.implies_intr (cprop_of x_D)
  93.341 -      |> Thm.forall_intr (cterm_of thy x)
  93.342 +      |> Thm.implies_intr (Thm.cprop_of x_D)
  93.343 +      |> Thm.forall_intr (Thm.cterm_of thy x)
  93.344  
  93.345      val subset_induct_rule =
  93.346        acc_subset_induct
  93.347 @@ -681,16 +687,16 @@
  93.348  
  93.349      val simple_induct_rule =
  93.350        subset_induct_rule
  93.351 -      |> Thm.forall_intr (cterm_of thy D)
  93.352 -      |> Thm.forall_elim (cterm_of thy acc_R)
  93.353 +      |> Thm.forall_intr (Thm.cterm_of thy D)
  93.354 +      |> Thm.forall_elim (Thm.cterm_of thy acc_R)
  93.355        |> atac 1 |> Seq.hd
  93.356        |> (curry op COMP) (acc_downward
  93.357 -        |> (instantiate' [SOME (ctyp_of thy domT)]
  93.358 -             (map (SOME o cterm_of thy) [R, x, z]))
  93.359 -        |> Thm.forall_intr (cterm_of thy z)
  93.360 -        |> Thm.forall_intr (cterm_of thy x))
  93.361 -      |> Thm.forall_intr (cterm_of thy a)
  93.362 -      |> Thm.forall_intr (cterm_of thy P)
  93.363 +        |> (instantiate' [SOME (Thm.ctyp_of thy domT)]
  93.364 +             (map (SOME o Thm.cterm_of thy) [R, x, z]))
  93.365 +        |> Thm.forall_intr (Thm.cterm_of thy z)
  93.366 +        |> Thm.forall_intr (Thm.cterm_of thy x))
  93.367 +      |> Thm.forall_intr (Thm.cterm_of thy a)
  93.368 +      |> Thm.forall_intr (Thm.cterm_of thy P)
  93.369    in
  93.370      simple_induct_rule
  93.371    end
  93.372 @@ -704,7 +710,7 @@
  93.373        qglr = (oqs, _, _, _), ...} = clause
  93.374      val goal = HOLogic.mk_Trueprop (mk_acc domT R $ lhs)
  93.375        |> fold_rev (curry Logic.mk_implies) gs
  93.376 -      |> cterm_of thy
  93.377 +      |> Thm.cterm_of thy
  93.378    in
  93.379      Goal.init goal
  93.380      |> (SINGLE (resolve_tac ctxt [accI] 1)) |> the
  93.381 @@ -737,11 +743,11 @@
  93.382            |> map (fn (ctxt, thm) => Function_Context_Tree.export_thm thy ctxt thm)
  93.383  
  93.384          val hyp = HOLogic.mk_Trueprop (R' $ arg $ lhs)
  93.385 -          |> fold_rev (curry Logic.mk_implies o prop_of) used (* additional hyps *)
  93.386 +          |> fold_rev (curry Logic.mk_implies o Thm.prop_of) used (* additional hyps *)
  93.387            |> Function_Context_Tree.export_term (fixes, assumes)
  93.388 -          |> fold_rev (curry Logic.mk_implies o prop_of) ags
  93.389 +          |> fold_rev (curry Logic.mk_implies o Thm.prop_of) ags
  93.390            |> fold_rev mk_forall_rename (map fst oqs ~~ qs)
  93.391 -          |> cterm_of thy
  93.392 +          |> Thm.cterm_of thy
  93.393  
  93.394          val thm = Thm.assume hyp
  93.395            |> fold Thm.forall_elim cqs
  93.396 @@ -750,7 +756,7 @@
  93.397            |> fold Thm.elim_implies used (*  "(arg, lhs) : R'"  *)
  93.398  
  93.399          val z_eq_arg = HOLogic.mk_Trueprop (mk_eq (z, arg))
  93.400 -          |> cterm_of thy |> Thm.assume
  93.401 +          |> Thm.cterm_of thy |> Thm.assume
  93.402  
  93.403          val acc = thm COMP ih_case
  93.404          val z_acc_local = acc
  93.405 @@ -786,42 +792,42 @@
  93.406  
  93.407      val wfR' = HOLogic.mk_Trueprop (Const (@{const_name Wellfounded.wfP},
  93.408        (domT --> domT --> boolT) --> boolT) $ R')
  93.409 -      |> cterm_of thy (* "wf R'" *)
  93.410 +      |> Thm.cterm_of thy (* "wf R'" *)
  93.411  
  93.412      (* Inductive Hypothesis: !!z. (z,x):R' ==> z : acc R *)
  93.413      val ihyp = Logic.all_const domT $ Abs ("z", domT,
  93.414        Logic.mk_implies (HOLogic.mk_Trueprop (R' $ Bound 0 $ x),
  93.415          HOLogic.mk_Trueprop (acc_R $ Bound 0)))
  93.416 -      |> cterm_of thy
  93.417 +      |> Thm.cterm_of thy
  93.418  
  93.419      val ihyp_a = Thm.assume ihyp |> Thm.forall_elim_vars 0
  93.420  
  93.421 -    val R_z_x = cterm_of thy (HOLogic.mk_Trueprop (R $ z $ x))
  93.422 +    val R_z_x = Thm.cterm_of thy (HOLogic.mk_Trueprop (R $ z $ x))
  93.423  
  93.424      val (hyps, cases) = fold (mk_nest_term_case ctxt globals R' ihyp_a) clauses ([], [])
  93.425    in
  93.426      R_cases
  93.427 -    |> Thm.forall_elim (cterm_of thy z)
  93.428 -    |> Thm.forall_elim (cterm_of thy x)
  93.429 -    |> Thm.forall_elim (cterm_of thy (acc_R $ z))
  93.430 +    |> Thm.forall_elim (Thm.cterm_of thy z)
  93.431 +    |> Thm.forall_elim (Thm.cterm_of thy x)
  93.432 +    |> Thm.forall_elim (Thm.cterm_of thy (acc_R $ z))
  93.433      |> curry op COMP (Thm.assume R_z_x)
  93.434      |> fold_rev (curry op COMP) cases
  93.435      |> Thm.implies_intr R_z_x
  93.436 -    |> Thm.forall_intr (cterm_of thy z)
  93.437 +    |> Thm.forall_intr (Thm.cterm_of thy z)
  93.438      |> (fn it => it COMP accI)
  93.439      |> Thm.implies_intr ihyp
  93.440 -    |> Thm.forall_intr (cterm_of thy x)
  93.441 +    |> Thm.forall_intr (Thm.cterm_of thy x)
  93.442      |> (fn it => Drule.compose (it, 2, wf_induct_rule))
  93.443      |> curry op RS (Thm.assume wfR')
  93.444      |> forall_intr_vars
  93.445      |> (fn it => it COMP allI)
  93.446      |> fold Thm.implies_intr hyps
  93.447      |> Thm.implies_intr wfR'
  93.448 -    |> Thm.forall_intr (cterm_of thy R')
  93.449 -    |> Thm.forall_elim (cterm_of thy (inrel_R))
  93.450 +    |> Thm.forall_intr (Thm.cterm_of thy R')
  93.451 +    |> Thm.forall_elim (Thm.cterm_of thy (inrel_R))
  93.452      |> curry op RS wf_in_rel
  93.453      |> full_simplify (put_simpset HOL_basic_ss ctxt addsimps [in_rel_def])
  93.454 -    |> Thm.forall_intr (cterm_of thy Rrel)
  93.455 +    |> Thm.forall_intr (Thm.cterm_of thy Rrel)
  93.456    end
  93.457  
  93.458  
  93.459 @@ -892,7 +898,7 @@
  93.460  
  93.461      fun mk_partial_rules provedgoal =
  93.462        let
  93.463 -        val newthy = theory_of_thm provedgoal (*FIXME*)
  93.464 +        val newthy = Thm.theory_of_thm provedgoal (*FIXME*)
  93.465          val newctxt = Proof_Context.init_global newthy (*FIXME*)
  93.466  
  93.467          val (graph_is_function, complete_thm) =
    94.1 --- a/src/HOL/Tools/Function/function_elims.ML	Tue Mar 03 19:08:04 2015 +0100
    94.2 +++ b/src/HOL/Tools/Function/function_elims.ML	Wed Mar 04 19:53:18 2015 +0100
    94.3 @@ -43,7 +43,7 @@
    94.4            if Logic.occs (Free x, t) then raise Match else false
    94.5        | _ => raise Match);
    94.6      fun mk_eq thm =
    94.7 -      (if inspect (prop_of thm) then [thm RS eq_reflection]
    94.8 +      (if inspect (Thm.prop_of thm) then [thm RS eq_reflection]
    94.9         else [Thm.symmetric (thm RS eq_reflection)])
   94.10        handle Match => [];
   94.11      val simpset =
   94.12 @@ -80,7 +80,7 @@
   94.13  fun mk_partial_elim_rules ctxt result =
   94.14    let
   94.15      val thy = Proof_Context.theory_of ctxt;
   94.16 -    val cert = cterm_of thy;
   94.17 +    val cert = Thm.cterm_of thy;
   94.18  
   94.19      val FunctionResult {fs, R, dom, psimps, cases, ...} = result;
   94.20      val n_fs = length fs;
   94.21 @@ -98,14 +98,14 @@
   94.22  
   94.23          val f_simps =
   94.24            filter (fn r =>
   94.25 -            (prop_of r |> Logic.strip_assums_concl
   94.26 +            (Thm.prop_of r |> Logic.strip_assums_concl
   94.27                |> HOLogic.dest_Trueprop
   94.28                |> dest_funprop |> fst |> fst) = f)
   94.29              psimps;
   94.30  
   94.31          val arity =
   94.32            hd f_simps
   94.33 -          |> prop_of
   94.34 +          |> Thm.prop_of
   94.35            |> Logic.strip_assums_concl
   94.36            |> HOLogic.dest_Trueprop
   94.37            |> snd o fst o dest_funprop
    95.1 --- a/src/HOL/Tools/Function/function_lib.ML	Tue Mar 03 19:08:04 2015 +0100
    95.2 +++ b/src/HOL/Tools/Function/function_lib.ML	Wed Mar 04 19:53:18 2015 +0100
    95.3 @@ -62,7 +62,7 @@
    95.4  fun forall_intr_rename (n, cv) thm =
    95.5    let
    95.6      val allthm = Thm.forall_intr cv thm
    95.7 -    val (_ $ abs) = prop_of allthm
    95.8 +    val (_ $ abs) = Thm.prop_of allthm
    95.9    in Thm.rename_boundvars abs (Abs (n, dummyT, Term.dummy)) allthm end
   95.10  
   95.11  
   95.12 @@ -95,17 +95,17 @@
   95.13  
   95.14  fun regroup_conv neu cn ac is ct =
   95.15   let
   95.16 -   val thy = theory_of_cterm ct
   95.17 +   val thy = Thm.theory_of_cterm ct
   95.18     val ctxt = Proof_Context.init_global thy  (* FIXME proper context!? *)
   95.19  
   95.20     val mk = HOLogic.mk_binop cn
   95.21 -   val t = term_of ct
   95.22 +   val t = Thm.term_of ct
   95.23     val xs = dest_binop_list cn t
   95.24     val js = subtract (op =) is (0 upto (length xs) - 1)
   95.25     val ty = fastype_of t
   95.26   in
   95.27     Goal.prove_internal ctxt []
   95.28 -     (cterm_of thy
   95.29 +     (Thm.cterm_of thy
   95.30         (Logic.mk_equals (t,
   95.31            if null is
   95.32            then mk (Const (neu, ty), foldr1 mk (map (nth xs) js))
    96.1 --- a/src/HOL/Tools/Function/induction_schema.ML	Tue Mar 03 19:08:04 2015 +0100
    96.2 +++ b/src/HOL/Tools/Function/induction_schema.ML	Wed Mar 04 19:53:18 2015 +0100
    96.3 @@ -46,8 +46,8 @@
    96.4    (map meta (@{thm split_conv} :: @{thms sum.case}))
    96.5  
    96.6  fun term_conv thy cv t =
    96.7 -  cv (cterm_of thy t)
    96.8 -  |> prop_of |> Logic.dest_equals |> snd
    96.9 +  cv (Thm.cterm_of thy t)
   96.10 +  |> Thm.prop_of |> Logic.dest_equals |> snd
   96.11  
   96.12  fun mk_relT T = HOLogic.mk_setT (HOLogic.mk_prodT (T, T))
   96.13  
   96.14 @@ -205,7 +205,7 @@
   96.15    (IndScheme {T, cases=scases, branches}) =
   96.16    let
   96.17      val thy = Proof_Context.theory_of ctxt
   96.18 -    val cert = cterm_of thy
   96.19 +    val cert = Thm.cterm_of thy
   96.20  
   96.21      val n = length branches
   96.22      val scases_idx = map_index I scases
   96.23 @@ -274,14 +274,14 @@
   96.24                  |> Conv.fconv_rule (sum_prod_conv ctxt)
   96.25                  |> Conv.fconv_rule (ind_rulify ctxt)
   96.26                  |> (fn th => th COMP ipres) (* P rs *)
   96.27 -                |> fold_rev (Thm.implies_intr o cprop_of) cGas
   96.28 +                |> fold_rev (Thm.implies_intr o Thm.cprop_of) cGas
   96.29                  |> fold_rev Thm.forall_intr cGvs
   96.30                end
   96.31  
   96.32              val P_recs = map2 mk_Prec rs ineq_press   (*  [P rec1, P rec2, ... ]  *)
   96.33  
   96.34              val step = HOLogic.mk_Trueprop (list_comb (P, lhs))
   96.35 -              |> fold_rev (curry Logic.mk_implies o prop_of) P_recs
   96.36 +              |> fold_rev (curry Logic.mk_implies o Thm.prop_of) P_recs
   96.37                |> fold_rev (curry Logic.mk_implies) gs
   96.38                |> fold_rev (Logic.all o Free) qs
   96.39                |> cert
   96.40 @@ -295,7 +295,7 @@
   96.41                |> fold Thm.elim_implies ags
   96.42                |> fold Thm.elim_implies P_recs (* P lhs *)
   96.43                |> Conv.fconv_rule (Conv.arg_conv Plhs_to_Pxs_conv) (* P xs *)
   96.44 -              |> fold_rev (Thm.implies_intr o cprop_of) (ags @ case_hyps)
   96.45 +              |> fold_rev (Thm.implies_intr o Thm.cprop_of) (ags @ case_hyps)
   96.46                |> fold_rev Thm.forall_intr cqs (* !!qs. Gas ==> xs = lhss ==> P xs *)
   96.47            in
   96.48              (res, (cidx, step))
   96.49 @@ -308,7 +308,7 @@
   96.50            |> fold (Thm.forall_elim o cert) (fxs @ map Free ws)
   96.51            |> fold Thm.elim_implies C_hyps
   96.52            |> fold Thm.elim_implies cases (* P xs *)
   96.53 -          |> fold_rev (Thm.implies_intr o cprop_of) C_hyps
   96.54 +          |> fold_rev (Thm.implies_intr o Thm.cprop_of) C_hyps
   96.55            |> fold_rev (Thm.forall_intr o cert o Free) ws
   96.56  
   96.57          val Pxs = cert (HOLogic.mk_Trueprop (P_comp $ x))
   96.58 @@ -319,7 +319,7 @@
   96.59            |> Seq.hd
   96.60            |> Thm.elim_implies (Conv.fconv_rule Drule.beta_eta_conversion bstep)
   96.61            |> Goal.finish ctxt
   96.62 -          |> Thm.implies_intr (cprop_of branch_hyp)
   96.63 +          |> Thm.implies_intr (Thm.cprop_of branch_hyp)
   96.64            |> fold_rev (Thm.forall_intr o cert) fxs
   96.65        in
   96.66          (Pxs, steps)
   96.67 @@ -380,7 +380,7 @@
   96.68        end
   96.69  
   96.70      val res = Conjunction.intr_balanced (map_index project branches)
   96.71 -      |> fold_rev Thm.implies_intr (map cprop_of newgoals @ steps)
   96.72 +      |> fold_rev Thm.implies_intr (map Thm.cprop_of newgoals @ steps)
   96.73        |> Drule.generalize ([], [Rn])
   96.74  
   96.75      val nbranches = length branches
    97.1 --- a/src/HOL/Tools/Function/lexicographic_order.ML	Tue Mar 03 19:08:04 2015 +0100
    97.2 +++ b/src/HOL/Tools/Function/lexicographic_order.ML	Wed Mar 04 19:53:18 2015 +0100
    97.3 @@ -68,7 +68,7 @@
    97.4  
    97.5  fun mk_cell thy solve_tac (vars, prems, lhs, rhs) mfun = Lazy.lazy (fn _ =>
    97.6    let
    97.7 -    val goals = cterm_of thy o mk_goal (vars, prems, mfun $ lhs, mfun $ rhs)
    97.8 +    val goals = Thm.cterm_of thy o mk_goal (vars, prems, mfun $ lhs, mfun $ rhs)
    97.9    in
   97.10      case try_proof (goals @{const_name Orderings.less}) solve_tac of
   97.11        Solved thm => Less thm
   97.12 @@ -76,7 +76,7 @@
   97.13        (case try_proof (goals @{const_name Orderings.less_eq}) solve_tac of
   97.14           Solved thm2 => LessEq (thm2, thm)
   97.15         | Stuck thm2 =>
   97.16 -         if prems_of thm2 = [HOLogic.Trueprop $ @{term False}] then False thm2
   97.17 +         if Thm.prems_of thm2 = [HOLogic.Trueprop $ @{term False}] then False thm2
   97.18           else None (thm2, thm)
   97.19         | _ => raise Match) (* FIXME *)
   97.20      | _ => raise Match
   97.21 @@ -176,7 +176,7 @@
   97.22  fun lex_order_tac quiet ctxt solve_tac st = SUBGOAL (fn _ =>
   97.23    let
   97.24      val thy = Proof_Context.theory_of ctxt
   97.25 -    val ((_ $ (_ $ rel)) :: tl) = prems_of st
   97.26 +    val ((_ $ (_ $ rel)) :: tl) = Thm.prems_of st
   97.27  
   97.28      val (domT, _) = HOLogic.dest_prodT (HOLogic.dest_setT (fastype_of rel))
   97.29  
   97.30 @@ -201,7 +201,7 @@
   97.31              else ()
   97.32    
   97.33          in (* 4: proof reconstruction *)
   97.34 -          st |> (PRIMITIVE (cterm_instantiate [(cterm_of thy rel, cterm_of thy relation)])
   97.35 +          st |> (PRIMITIVE (cterm_instantiate [(Thm.cterm_of thy rel, Thm.cterm_of thy relation)])
   97.36            THEN (REPEAT (rtac @{thm "wf_mlex"} 1))
   97.37            THEN (rtac @{thm "wf_empty"} 1)
   97.38            THEN EVERY (map prove_row clean_table))
    98.1 --- a/src/HOL/Tools/Function/measure_functions.ML	Tue Mar 03 19:08:04 2015 +0100
    98.2 +++ b/src/HOL/Tools/Function/measure_functions.ML	Wed Mar 04 19:53:18 2015 +0100
    98.3 @@ -21,7 +21,7 @@
    98.4    DEPTH_SOLVE (resolve_tac ctxt (rev (Named_Theorems.get ctxt @{named_theorems measure_function})) 1)
    98.5      (HOLogic.mk_Trueprop (mk_is_measure (Var (("f",0), T --> HOLogic.natT)))
    98.6       |> Proof_Context.cterm_of ctxt |> Goal.init)
    98.7 -  |> Seq.map (prop_of #> (fn _ $ (_ $ (_ $ f)) => f))
    98.8 +  |> Seq.map (Thm.prop_of #> (fn _ $ (_ $ (_ $ f)) => f))
    98.9    |> Seq.list_of
   98.10  
   98.11  
    99.1 --- a/src/HOL/Tools/Function/mutual.ML	Tue Mar 03 19:08:04 2015 +0100
    99.2 +++ b/src/HOL/Tools/Function/mutual.ML	Wed Mar 04 19:53:18 2015 +0100
    99.3 @@ -160,13 +160,13 @@
    99.4      val args = map inst pre_args
    99.5      val rhs = inst pre_rhs
    99.6  
    99.7 -    val cqs = map (cterm_of thy) qs
    99.8 -    val ags = map (Thm.assume o cterm_of thy) gs
    99.9 +    val cqs = map (Thm.cterm_of thy) qs
   99.10 +    val ags = map (Thm.assume o Thm.cterm_of thy) gs
   99.11  
   99.12      val import = fold Thm.forall_elim cqs
   99.13        #> fold Thm.elim_implies ags
   99.14  
   99.15 -    val export = fold_rev (Thm.implies_intr o cprop_of) ags
   99.16 +    val export = fold_rev (Thm.implies_intr o Thm.cprop_of) ags
   99.17        #> fold_rev forall_intr_rename (oqnames ~~ cqs)
   99.18    in
   99.19      F ctxt (f, qs, gs, args, rhs) import export
   99.20 @@ -199,7 +199,9 @@
   99.21  fun mk_applied_form ctxt caTs thm =
   99.22    let
   99.23      val thy = Proof_Context.theory_of ctxt
   99.24 -    val xs = map_index (fn (i,T) => cterm_of thy (Free ("x" ^ string_of_int i, T))) caTs (* FIXME: Bind xs properly *)
   99.25 +    val xs =
   99.26 +      map_index (fn (i, T) =>
   99.27 +        Thm.cterm_of thy (Free ("x" ^ string_of_int i, T))) caTs (* FIXME: Bind xs properly *)
   99.28    in
   99.29      fold (fn x => fn thm => Thm.combination thm (Thm.reflexive x)) xs thm
   99.30      |> Conv.fconv_rule (Thm.beta_conversion true)
   100.1 --- a/src/HOL/Tools/Function/partial_function.ML	Tue Mar 03 19:08:04 2015 +0100
   100.2 +++ b/src/HOL/Tools/Function/partial_function.ML	Wed Mar 04 19:53:18 2015 +0100
   100.3 @@ -69,7 +69,7 @@
   100.4           NONE => NONE
   100.5         | SOME {case_thms, ...} =>
   100.6             let
   100.7 -             val lhs = prop_of (hd case_thms)
   100.8 +             val lhs = Thm.prop_of (hd case_thms)
   100.9                 |> HOLogic.dest_Trueprop |> HOLogic.dest_eq |> fst;
  100.10               val arity = length (snd (strip_comb lhs));
  100.11               val conv = funpow (length args - arity) Conv.fun_conv
  100.12 @@ -112,7 +112,7 @@
  100.13  fun cterm_instantiate' cts thm =
  100.14    let
  100.15      val thy = Thm.theory_of_thm thm;
  100.16 -    val vs = rev (Term.add_vars (prop_of thm) [])
  100.17 +    val vs = rev (Term.add_vars (Thm.prop_of thm) [])
  100.18        |> map (Thm.cterm_of thy o Var);
  100.19    in
  100.20      cterm_instantiate (zip_options vs cts) thm
   101.1 --- a/src/HOL/Tools/Function/pat_completeness.ML	Tue Mar 03 19:08:04 2015 +0100
   101.2 +++ b/src/HOL/Tools/Function/pat_completeness.ML	Wed Mar 04 19:53:18 2015 +0100
   101.3 @@ -24,9 +24,9 @@
   101.4  fun inst_free var inst = Thm.forall_elim inst o Thm.forall_intr var
   101.5  
   101.6  fun inst_case_thm thy x P thm =
   101.7 -  let val [Pv, xv] = Term.add_vars (prop_of thm) []
   101.8 +  let val [Pv, xv] = Term.add_vars (Thm.prop_of thm) []
   101.9    in
  101.10 -    thm |> cterm_instantiate (map (apply2 (cterm_of thy)) [(Var xv, x), (Var Pv, P)])
  101.11 +    thm |> cterm_instantiate (map (apply2 (Thm.cterm_of thy)) [(Var xv, x), (Var Pv, P)])
  101.12    end
  101.13  
  101.14  fun invent_vars constr i =
  101.15 @@ -44,7 +44,7 @@
  101.16    | filter_pats thy cons pvars (([], thm) :: pts) = raise Match
  101.17    | filter_pats thy cons pvars (((pat as Free _) :: pats, thm) :: pts) =
  101.18      let val inst = list_comb (cons, pvars)
  101.19 -    in (inst :: pats, inst_free (cterm_of thy pat) (cterm_of thy inst) thm)
  101.20 +    in (inst :: pats, inst_free (Thm.cterm_of thy pat) (Thm.cterm_of thy inst) thm)
  101.21         :: (filter_pats thy cons pvars pts)
  101.22      end
  101.23    | filter_pats thy cons pvars ((pat :: pats, thm) :: pts) =
  101.24 @@ -58,7 +58,7 @@
  101.25    let
  101.26      val thy = Proof_Context.theory_of ctxt
  101.27      val (_, subps) = strip_comb pat
  101.28 -    val eqs = map (cterm_of thy o HOLogic.mk_Trueprop o HOLogic.mk_eq) (avars ~~ subps)
  101.29 +    val eqs = map (Thm.cterm_of thy o HOLogic.mk_Trueprop o HOLogic.mk_eq) (avars ~~ subps)
  101.30      val c_eq_pat = simplify (put_simpset HOL_basic_ss ctxt addsimps (map Thm.assume eqs)) c_assum
  101.31    in
  101.32      (subps @ pats,
  101.33 @@ -72,13 +72,13 @@
  101.34    let
  101.35      val thy = Proof_Context.theory_of ctxt
  101.36      val (avars, pvars, newidx) = invent_vars cons idx
  101.37 -    val c_hyp = cterm_of thy (HOLogic.mk_Trueprop (HOLogic.mk_eq (v, list_comb (cons, avars))))
  101.38 +    val c_hyp = Thm.cterm_of thy (HOLogic.mk_Trueprop (HOLogic.mk_eq (v, list_comb (cons, avars))))
  101.39      val c_assum = Thm.assume c_hyp
  101.40      val newpats = map (transform_pat ctxt avars c_assum) (filter_pats thy cons pvars pats)
  101.41    in
  101.42      o_alg ctxt P newidx (avars @ vs) newpats
  101.43      |> Thm.implies_intr c_hyp
  101.44 -    |> fold_rev (Thm.forall_intr o cterm_of thy) avars
  101.45 +    |> fold_rev (Thm.forall_intr o Thm.cterm_of thy) avars
  101.46    end
  101.47    | constr_case _ _ _ _ _ _ = raise Match
  101.48  and o_alg _ P idx [] (([], Pthm) :: _)  = Pthm
  101.49 @@ -110,10 +110,10 @@
  101.50        HOLogic.mk_Trueprop P
  101.51        |> fold_rev (curry Logic.mk_implies o HOLogic.mk_Trueprop o HOLogic.mk_eq) (xs ~~ pats)
  101.52        |> fold_rev Logic.all qs
  101.53 -      |> cterm_of thy
  101.54 +      |> Thm.cterm_of thy
  101.55  
  101.56      val hyps = map2 mk_assum qss patss
  101.57 -    fun inst_hyps hyp qs = fold (Thm.forall_elim o cterm_of thy) qs (Thm.assume hyp)
  101.58 +    fun inst_hyps hyp qs = fold (Thm.forall_elim o Thm.cterm_of thy) qs (Thm.assume hyp)
  101.59      val assums = map2 inst_hyps hyps qss
  101.60      in
  101.61        o_alg ctxt P 2 xs (patss ~~ assums)
  101.62 @@ -141,7 +141,7 @@
  101.63  
  101.64      val patss = map (map snd) x_pats
  101.65      val complete_thm = prove_completeness ctxt xs thesis qss patss
  101.66 -      |> fold_rev (Thm.forall_intr o cterm_of thy) vs
  101.67 +      |> fold_rev (Thm.forall_intr o Thm.cterm_of thy) vs
  101.68      in
  101.69        PRIMITIVE (fn st => Drule.compose (complete_thm, i, st))
  101.70    end
   102.1 --- a/src/HOL/Tools/Function/relation.ML	Tue Mar 03 19:08:04 2015 +0100
   102.2 +++ b/src/HOL/Tools/Function/relation.ML	Wed Mar 04 19:53:18 2015 +0100
   102.3 @@ -16,11 +16,11 @@
   102.4  (* tactic version *)
   102.5  
   102.6  fun inst_state_tac inst st =
   102.7 -  case Term.add_vars (prop_of st) [] of
   102.8 +  (case Term.add_vars (Thm.prop_of st) [] of
   102.9      [v as (_, T)] =>
  102.10        let val cert = Thm.cterm_of (Thm.theory_of_thm st);
  102.11        in PRIMITIVE (Thm.instantiate ([], [(cert (Var v), cert (inst T))])) st end
  102.12 -  | _ => Seq.empty;
  102.13 +  | _ => Seq.empty);
  102.14  
  102.15  fun relation_tac ctxt rel i =
  102.16    TRY (Function_Common.termination_rule_tac ctxt i)
  102.17 @@ -30,7 +30,7 @@
  102.18  (* version with type inference *)
  102.19  
  102.20  fun inst_state_infer_tac ctxt rel st =
  102.21 -  case Term.add_vars (prop_of st) [] of
  102.22 +  (case Term.add_vars (Thm.prop_of st) [] of
  102.23      [v as (_, T)] =>
  102.24        let
  102.25          val cert = Proof_Context.cterm_of ctxt;
  102.26 @@ -42,7 +42,7 @@
  102.27        in
  102.28          PRIMITIVE (Thm.instantiate ([], [(cert (Var v), rel')])) st
  102.29        end
  102.30 -  | _ => Seq.empty;
  102.31 +  | _ => Seq.empty);
  102.32  
  102.33  fun relation_infer_tac ctxt rel i =
  102.34    TRY (Function_Common.termination_rule_tac ctxt i)
   103.1 --- a/src/HOL/Tools/Function/scnp_reconstruct.ML	Tue Mar 03 19:08:04 2015 +0100
   103.2 +++ b/src/HOL/Tools/Function/scnp_reconstruct.ML	Wed Mar 04 19:53:18 2015 +0100
   103.3 @@ -158,7 +158,7 @@
   103.4        (case Termination.get_descent D (nth cs cidx) m1 m2 of
   103.5          SOME (Termination.Less thm) =>
   103.6            if bStrict then thm
   103.7 -          else (thm COMP (Thm.lift_rule (cprop_of thm) @{thm less_imp_le}))
   103.8 +          else (thm COMP (Thm.lift_rule (Thm.cprop_of thm) @{thm less_imp_le}))
   103.9        | SOME (Termination.LessEq (thm, _))  =>
  103.10            if not bStrict then thm
  103.11            else raise Fail "get_desc_thm"
  103.12 @@ -272,7 +272,7 @@
  103.13      val level_mapping =
  103.14        map_index pt_lev lev
  103.15          |> Termination.mk_sumcases D (setT nat_pairT)
  103.16 -        |> cterm_of thy
  103.17 +        |> Thm.cterm_of thy
  103.18      in
  103.19        PROFILE "Proof Reconstruction"
  103.20          (CONVERSION (Conv.arg_conv (Conv.arg_conv (Function_Lib.regroup_union_conv sl))) 1
   104.1 --- a/src/HOL/Tools/Function/termination.ML	Tue Mar 03 19:08:04 2015 +0100
   104.2 +++ b/src/HOL/Tools/Function/termination.ML	Wed Mar 04 19:53:18 2015 +0100
   104.3 @@ -144,7 +144,7 @@
   104.4          Const (@{const_abbrev Set.empty}, fastype_of c1))
   104.5        |> HOLogic.mk_Trueprop (* "C1 O C2 = {}" *)
   104.6    in
   104.7 -    case Function_Lib.try_proof (cterm_of thy goal) chain_tac of
   104.8 +    case Function_Lib.try_proof (Thm.cterm_of thy goal) chain_tac of
   104.9        Function_Lib.Solved thm => SOME thm
  104.10      | _ => NONE
  104.11    end
  104.12 @@ -169,7 +169,7 @@
  104.13  fun mk_desc thy tac vs Gam l r m1 m2 =
  104.14    let
  104.15      fun try rel =
  104.16 -      try_proof (cterm_of thy
  104.17 +      try_proof (Thm.cterm_of thy
  104.18          (Logic.list_all (vs,
  104.19             Logic.mk_implies (HOLogic.mk_Trueprop Gam,
  104.20               HOLogic.mk_Trueprop (Const (rel, @{typ "nat => nat => bool"})
  104.21 @@ -181,7 +181,7 @@
  104.22         (case try @{const_name Orderings.less_eq} of
  104.23            Solved thm2 => LessEq (thm2, thm)
  104.24          | Stuck thm2 =>
  104.25 -          if prems_of thm2 = [HOLogic.Trueprop $ @{term False}]
  104.26 +          if Thm.prems_of thm2 = [HOLogic.Trueprop $ @{term False}]
  104.27            then False thm2 else None (thm2, thm)
  104.28          | _ => raise Match) (* FIXME *)
  104.29       | _ => raise Match
  104.30 @@ -275,8 +275,8 @@
  104.31  fun wf_union_tac ctxt st = SUBGOAL (fn _ =>
  104.32    let
  104.33      val thy = Proof_Context.theory_of ctxt
  104.34 -    val cert = cterm_of thy
  104.35 -    val ((_ $ (_ $ rel)) :: ineqs) = prems_of st
  104.36 +    val cert = Thm.cterm_of thy
  104.37 +    val ((_ $ (_ $ rel)) :: ineqs) = Thm.prems_of st
  104.38  
  104.39      fun mk_compr ineq =
  104.40        let
   105.1 --- a/src/HOL/Tools/Lifting/lifting_bnf.ML	Tue Mar 03 19:08:04 2015 +0100
   105.2 +++ b/src/HOL/Tools/Lifting/lifting_bnf.ML	Wed Mar 04 19:53:18 2015 +0100
   105.3 @@ -20,7 +20,7 @@
   105.4  fun Quotient_tac bnf ctxt i =
   105.5    let
   105.6      val rel_Grp = rel_Grp_of_bnf bnf
   105.7 -    fun get_lhs thm = thm |> concl_of |> HOLogic.dest_Trueprop |> HOLogic.dest_eq |> fst
   105.8 +    fun get_lhs thm = thm |> Thm.concl_of |> HOLogic.dest_Trueprop |> HOLogic.dest_eq |> fst
   105.9      val vars = get_lhs rel_Grp |> strip_comb |> snd |> map_filter (try (strip_comb #> snd #> hd))
  105.10      val UNIVs = map (fn var => HOLogic.mk_UNIV (var |> dest_Var |> snd |> dest_Type |> snd |> hd)) vars
  105.11      val inst = map2 (curry (apply2 (Proof_Context.cterm_of ctxt))) vars UNIVs
   106.1 --- a/src/HOL/Tools/Lifting/lifting_def.ML	Tue Mar 03 19:08:04 2015 +0100
   106.2 +++ b/src/HOL/Tools/Lifting/lifting_def.ML	Wed Mar 04 19:53:18 2015 +0100
   106.3 @@ -57,12 +57,12 @@
   106.4  fun try_prove_reflexivity ctxt prop =
   106.5    let
   106.6      val thy = Proof_Context.theory_of ctxt
   106.7 -    val cprop = cterm_of thy prop
   106.8 +    val cprop = Thm.cterm_of thy prop
   106.9      val rule = @{thm ge_eq_refl}
  106.10 -    val concl_pat = Drule.strip_imp_concl (cprop_of rule)
  106.11 +    val concl_pat = Drule.strip_imp_concl (Thm.cprop_of rule)
  106.12      val insts = Thm.first_order_match (concl_pat, cprop)
  106.13      val rule = Drule.instantiate_normalize insts rule
  106.14 -    val prop = hd (prems_of rule)
  106.15 +    val prop = hd (Thm.prems_of rule)
  106.16    in
  106.17      case mono_eq_prover ctxt prop of
  106.18        SOME thm => SOME (thm RS rule)
  106.19 @@ -83,7 +83,7 @@
  106.20    let
  106.21      fun preprocess ctxt thm =
  106.22        let
  106.23 -        val tm = (strip_args 2 o HOLogic.dest_Trueprop o concl_of) thm;
  106.24 +        val tm = (strip_args 2 o HOLogic.dest_Trueprop o Thm.concl_of) thm;
  106.25          val param_rel = (snd o dest_comb o fst o dest_comb) tm;
  106.26          val thy = Proof_Context.theory_of ctxt;
  106.27          val free_vars = Term.add_vars param_rel [];
  106.28 @@ -99,25 +99,26 @@
  106.29            end;
  106.30          
  106.31          val subst = fold make_subst free_vars [];
  106.32 -        val csubst = map (apply2 (cterm_of thy)) subst;
  106.33 +        val csubst = map (apply2 (Thm.cterm_of thy)) subst;
  106.34          val inst_thm = Drule.cterm_instantiate csubst thm;
  106.35        in
  106.36          Conv.fconv_rule 
  106.37 -          ((Conv.concl_conv (nprems_of inst_thm) o HOLogic.Trueprop_conv o Conv.fun2_conv o Conv.arg1_conv)
  106.38 +          ((Conv.concl_conv (Thm.nprems_of inst_thm) o
  106.39 +            HOLogic.Trueprop_conv o Conv.fun2_conv o Conv.arg1_conv)
  106.40              (Raw_Simplifier.rewrite ctxt false (Transfer.get_sym_relator_eq ctxt))) inst_thm
  106.41        end
  106.42  
  106.43      fun inst_relcomppI thy ant1 ant2 =
  106.44        let
  106.45 -        val t1 = (HOLogic.dest_Trueprop o concl_of) ant1
  106.46 -        val t2 = (HOLogic.dest_Trueprop o prop_of) ant2
  106.47 -        val fun1 = cterm_of thy (strip_args 2 t1)
  106.48 -        val args1 = map (cterm_of thy) (get_args 2 t1)
  106.49 -        val fun2 = cterm_of thy (strip_args 2 t2)
  106.50 -        val args2 = map (cterm_of thy) (get_args 1 t2)
  106.51 +        val t1 = (HOLogic.dest_Trueprop o Thm.concl_of) ant1
  106.52 +        val t2 = (HOLogic.dest_Trueprop o Thm.prop_of) ant2
  106.53 +        val fun1 = Thm.cterm_of thy (strip_args 2 t1)
  106.54 +        val args1 = map (Thm.cterm_of thy) (get_args 2 t1)
  106.55 +        val fun2 = Thm.cterm_of thy (strip_args 2 t2)
  106.56 +        val args2 = map (Thm.cterm_of thy) (get_args 1 t2)
  106.57          val relcomppI = Drule.incr_indexes2 ant1 ant2 @{thm relcomppI}
  106.58 -        val vars = (rev (Term.add_vars (prop_of relcomppI) []))
  106.59 -        val subst = map (apfst ((cterm_of thy) o Var)) (vars ~~ ([fun1] @ args1 @ [fun2] @ args2))
  106.60 +        val vars = (rev (Term.add_vars (Thm.prop_of relcomppI) []))
  106.61 +        val subst = map (apfst (Thm.cterm_of thy o Var)) (vars ~~ ([fun1] @ args1 @ [fun2] @ args2))
  106.62        in
  106.63          Drule.cterm_instantiate subst relcomppI
  106.64        end
  106.65 @@ -126,11 +127,12 @@
  106.66        let
  106.67          val thy = Proof_Context.theory_of ctxt
  106.68          fun mk_POS ty = Const (@{const_name POS}, ty --> ty --> HOLogic.boolT)
  106.69 -        val rel = (Thm.dest_fun2 o Thm.dest_arg o cprop_of) thm
  106.70 -        val typ = (typ_of o ctyp_of_term) rel
  106.71 -        val POS_const = cterm_of thy (mk_POS typ)
  106.72 -        val var = cterm_of thy (Var (("X", #maxidx (rep_cterm (rel)) + 1), typ))
  106.73 -        val goal = Thm.apply (cterm_of thy HOLogic.Trueprop) (Thm.apply (Thm.apply POS_const rel) var)
  106.74 +        val rel = (Thm.dest_fun2 o Thm.dest_arg o Thm.cprop_of) thm
  106.75 +        val typ = (Thm.typ_of o Thm.ctyp_of_term) rel
  106.76 +        val POS_const = Thm.cterm_of thy (mk_POS typ)
  106.77 +        val var = Thm.cterm_of thy (Var (("X", #maxidx (Thm.rep_cterm (rel)) + 1), typ))
  106.78 +        val goal =
  106.79 +          Thm.apply (Thm.cterm_of thy HOLogic.Trueprop) (Thm.apply (Thm.apply POS_const rel) var)
  106.80        in
  106.81          [Lifting_Term.merge_transfer_relations ctxt goal, thm] MRSL @{thm POS_apply}
  106.82        end
  106.83 @@ -208,13 +210,13 @@
  106.84  
  106.85  fun unabs_def ctxt def = 
  106.86    let
  106.87 -    val (_, rhs) = Thm.dest_equals (cprop_of def)
  106.88 +    val (_, rhs) = Thm.dest_equals (Thm.cprop_of def)
  106.89      fun dest_abs (Abs (var_name, T, _)) = (var_name, T)
  106.90        | dest_abs tm = raise TERM("get_abs_var",[tm])
  106.91 -    val (var_name, T) = dest_abs (term_of rhs)
  106.92 +    val (var_name, T) = dest_abs (Thm.term_of rhs)
  106.93      val (new_var_names, ctxt') = Variable.variant_fixes [var_name] ctxt
  106.94      val thy = Proof_Context.theory_of ctxt'
  106.95 -    val refl_thm = Thm.reflexive (cterm_of thy (Free (hd new_var_names, T)))
  106.96 +    val refl_thm = Thm.reflexive (Thm.cterm_of thy (Free (hd new_var_names, T)))
  106.97    in
  106.98      Thm.combination def refl_thm |>
  106.99      singleton (Proof_Context.export ctxt' ctxt)
 106.100 @@ -222,8 +224,8 @@
 106.101  
 106.102  fun unabs_all_def ctxt def = 
 106.103    let
 106.104 -    val (_, rhs) = Thm.dest_equals (cprop_of def)
 106.105 -    val xs = strip_abs_vars (term_of rhs)
 106.106 +    val (_, rhs) = Thm.dest_equals (Thm.cprop_of def)
 106.107 +    val xs = strip_abs_vars (Thm.term_of rhs)
 106.108    in  
 106.109      fold (K (unabs_def ctxt)) xs def
 106.110    end
 106.111 @@ -295,11 +297,11 @@
 106.112          val rel_fun = prove_rel ctxt rsp_thm (rty, qty)
 106.113          val rep_abs_thm = [quot_thm, rel_fun] MRSL @{thm Quotient_rep_abs_eq}
 106.114        in
 106.115 -        case mono_eq_prover ctxt (hd(prems_of rep_abs_thm)) of
 106.116 +        case mono_eq_prover ctxt (hd (Thm.prems_of rep_abs_thm)) of
 106.117            SOME mono_eq_thm =>
 106.118              let
 106.119                val rep_abs_eq = mono_eq_thm RS rep_abs_thm
 106.120 -              val rep = (cterm_of thy o quot_thm_rep) quot_thm
 106.121 +              val rep = (Thm.cterm_of thy o quot_thm_rep) quot_thm
 106.122                val rep_refl = Thm.reflexive rep RS @{thm meta_eq_to_obj_eq}
 106.123                val repped_eq = [rep_refl, unabs_def RS @{thm meta_eq_to_obj_eq}] MRSL @{thm cong}
 106.124                val code_cert = [repped_eq, rep_abs_eq] MRSL trans
 106.125 @@ -323,11 +325,11 @@
 106.126          val rep_abs_folded_unmapped_thm = 
 106.127            let
 106.128              val rep_id = [quot_thm, def_thm] MRSL @{thm Quotient_Rep_eq}
 106.129 -            val ctm = Thm.dest_equals_lhs (cprop_of rep_id)
 106.130 +            val ctm = Thm.dest_equals_lhs (Thm.cprop_of rep_id)
 106.131              val unfolded_maps_eq = unfold_fun_maps ctm
 106.132              val t1 = [quot_thm, def_thm, rsp_thm] MRSL @{thm Quotient_rep_abs_fold_unmap}
 106.133              val prems_pat = (hd o Drule.cprems_of) t1
 106.134 -            val insts = Thm.first_order_match (prems_pat, cprop_of unfolded_maps_eq)
 106.135 +            val insts = Thm.first_order_match (prems_pat, Thm.cprop_of unfolded_maps_eq)
 106.136            in
 106.137              unfolded_maps_eq RS (Drule.instantiate_normalize insts t1)
 106.138            end
 106.139 @@ -354,7 +356,7 @@
 106.140        | no_abstr (Const (name, _)) = not (Code.is_abstr thy name)
 106.141        | no_abstr _ = true
 106.142      fun is_valid_eq eqn = can (Code.assert_eqn thy) (mk_meta_eq eqn, true) 
 106.143 -      andalso no_abstr (prop_of eqn)
 106.144 +      andalso no_abstr (Thm.prop_of eqn)
 106.145      fun is_valid_abs_eq abs_eq = can (Code.assert_abs_eqn thy NONE) (mk_meta_eq abs_eq)
 106.146  
 106.147    in
 106.148 @@ -378,7 +380,7 @@
 106.149  local
 106.150    fun encode_code_eq thy abs_eq opt_rep_eq (rty, qty) = 
 106.151      let
 106.152 -      fun mk_type typ = typ |> Logic.mk_type |> cterm_of thy |> Drule.mk_term
 106.153 +      fun mk_type typ = typ |> Logic.mk_type |> Thm.cterm_of thy |> Drule.mk_term
 106.154      in
 106.155        Conjunction.intr_balanced [abs_eq, (the_default TrueI opt_rep_eq), mk_type rty, mk_type qty]
 106.156      end
 106.157 @@ -386,12 +388,12 @@
 106.158    exception DECODE
 106.159      
 106.160    fun decode_code_eq thm =
 106.161 -    if nprems_of thm > 0 then raise DECODE 
 106.162 +    if Thm.nprems_of thm > 0 then raise DECODE 
 106.163      else
 106.164        let
 106.165          val [abs_eq, rep_eq, rty, qty] = Conjunction.elim_balanced 4 thm
 106.166          val opt_rep_eq = if Thm.eq_thm_prop (rep_eq, TrueI) then NONE else SOME rep_eq
 106.167 -        fun dest_type typ = typ |> Drule.dest_term |> term_of |> Logic.dest_type
 106.168 +        fun dest_type typ = typ |> Drule.dest_term |> Thm.term_of |> Logic.dest_type
 106.169        in
 106.170          (abs_eq, opt_rep_eq, (dest_type rty, dest_type qty)) 
 106.171        end
 106.172 @@ -508,7 +510,7 @@
 106.173              map_interrupt prove assms
 106.174            end
 106.175      
 106.176 -        fun cconl_of thm = Drule.strip_imp_concl (cprop_of thm)
 106.177 +        fun cconl_of thm = Drule.strip_imp_concl (Thm.cprop_of thm)
 106.178          fun lhs_of thm = fst (Thm.dest_equals (cconl_of thm))
 106.179          fun rhs_of thm = snd (Thm.dest_equals (cconl_of thm))
 106.180          val rule1 = Thm.incr_indexes (#maxidx (Thm.rep_cterm ct) + 1) rule;
 106.181 @@ -622,7 +624,7 @@
 106.182      val (prsp_tm, rsp_prsp_eq) = HOLogic.mk_Trueprop (rsp_rel $ forced_rhs $ forced_rhs)
 106.183        |> Proof_Context.cterm_of lthy
 106.184        |> cr_to_pcr_conv
 106.185 -      |> ` concl_of
 106.186 +      |> `Thm.concl_of
 106.187        |>> Logic.dest_equals
 106.188        |>> snd
 106.189      val to_rsp = rsp_prsp_eq RS Drule.equal_elim_rule2
 106.190 @@ -637,7 +639,7 @@
 106.191        | NONE =>  
 106.192          let
 106.193            val readable_rsp_thm_eq = mk_readable_rsp_thm_eq prsp_tm lthy
 106.194 -          val (readable_rsp_tm, _) = Logic.dest_implies (prop_of readable_rsp_thm_eq)
 106.195 +          val (readable_rsp_tm, _) = Logic.dest_implies (Thm.prop_of readable_rsp_thm_eq)
 106.196            val readable_rsp_tm_tnames = rename_to_tnames lthy readable_rsp_tm
 106.197        
 106.198            fun after_qed' thm_list lthy = 
   107.1 --- a/src/HOL/Tools/Lifting/lifting_info.ML	Tue Mar 03 19:08:04 2015 +0100
   107.2 +++ b/src/HOL/Tools/Lifting/lifting_info.ML	Wed Mar 04 19:53:18 2015 +0100
   107.3 @@ -160,7 +160,7 @@
   107.4        end
   107.5  
   107.6      val ((_, [rel_quot_thm_fixed]), ctxt') = Variable.importT [rel_quot_thm] ctxt
   107.7 -    val rel_quot_thm_prop = prop_of rel_quot_thm_fixed
   107.8 +    val rel_quot_thm_prop = Thm.prop_of rel_quot_thm_fixed
   107.9      val rel_quot_thm_concl = Logic.strip_imp_concl rel_quot_thm_prop
  107.10      val rel_quot_thm_prems = Logic.strip_imp_prems rel_quot_thm_prop;
  107.11      val concl_absT = quot_term_absT ctxt' rel_quot_thm_concl
  107.12 @@ -184,7 +184,7 @@
  107.13  fun add_quot_map rel_quot_thm ctxt = 
  107.14    let
  107.15      val _ = Context.cases (K ()) (quot_map_thm_sanity_check rel_quot_thm) ctxt
  107.16 -    val rel_quot_thm_concl = (Logic.strip_imp_concl o prop_of) rel_quot_thm
  107.17 +    val rel_quot_thm_concl = (Logic.strip_imp_concl o Thm.prop_of) rel_quot_thm
  107.18      val (_, abs, _, _) = (dest_Quotient o HOLogic.dest_Trueprop) rel_quot_thm_concl
  107.19      val relatorT_name = (fst o dest_Type o fst o dest_funT o fastype_of) abs
  107.20      val minfo = {rel_quot_thm = rel_quot_thm}
  107.21 @@ -204,7 +204,7 @@
  107.22           [Pretty.str "type:", 
  107.23            Pretty.str ty_name,
  107.24            Pretty.str "quot. theorem:", 
  107.25 -          Syntax.pretty_term ctxt (prop_of rel_quot_thm)])
  107.26 +          Syntax.pretty_term ctxt (Thm.prop_of rel_quot_thm)])
  107.27    in
  107.28      map prt_map (Symtab.dest (get_quot_maps ctxt))
  107.29      |> Pretty.big_list "maps for type constructors:"
  107.30 @@ -243,11 +243,11 @@
  107.31         [Pretty.str "type:", 
  107.32          Pretty.str qty_name,
  107.33          Pretty.str "quot. thm:",
  107.34 -        Syntax.pretty_term ctxt (prop_of quot_thm),
  107.35 +        Syntax.pretty_term ctxt (Thm.prop_of quot_thm),
  107.36          Pretty.str "pcrel_def thm:",
  107.37 -        option_fold (Pretty.str "-") ((Syntax.pretty_term ctxt) o prop_of o #pcrel_def) pcr_info,
  107.38 +        option_fold (Pretty.str "-") ((Syntax.pretty_term ctxt) o Thm.prop_of o #pcrel_def) pcr_info,
  107.39          Pretty.str "pcr_cr_eq thm:",
  107.40 -        option_fold (Pretty.str "-") ((Syntax.pretty_term ctxt) o prop_of o #pcr_cr_eq) pcr_info])
  107.41 +        option_fold (Pretty.str "-") ((Syntax.pretty_term ctxt) o Thm.prop_of o #pcr_cr_eq) pcr_info])
  107.42    in
  107.43      map prt_quot (Symtab.dest (get_quotients ctxt))
  107.44      |> Pretty.big_list "quotients:"
  107.45 @@ -304,13 +304,13 @@
  107.46  fun introduce_polarities rule =
  107.47    let
  107.48      val dest_less_eq = HOLogic.dest_bin @{const_name "less_eq"} dummyT
  107.49 -    val prems_pairs = map (dest_less_eq o HOLogic.dest_Trueprop) (prems_of rule)
  107.50 +    val prems_pairs = map (dest_less_eq o HOLogic.dest_Trueprop) (Thm.prems_of rule)
  107.51      val equal_prems = filter op= prems_pairs
  107.52      val _ =
  107.53        if null equal_prems then () 
  107.54        else error "The rule contains reflexive assumptions."
  107.55      val concl_pairs = rule 
  107.56 -      |> concl_of
  107.57 +      |> Thm.concl_of
  107.58        |> HOLogic.dest_Trueprop
  107.59        |> dest_less_eq
  107.60        |> apply2 (snd o strip_comb)
  107.61 @@ -351,7 +351,7 @@
  107.62    let
  107.63      fun find_eq_rule thm ctxt =
  107.64        let
  107.65 -        val concl_rhs = (hd o get_args 1 o HOLogic.dest_Trueprop o concl_of) thm;
  107.66 +        val concl_rhs = (hd o get_args 1 o HOLogic.dest_Trueprop o Thm.concl_of) thm;
  107.67          val rules = Item_Net.retrieve (Transfer.get_relator_eq_item_net ctxt) concl_rhs;
  107.68        in
  107.69          find_first (fn thm => Pattern.matches (Proof_Context.theory_of ctxt) (concl_rhs, 
  107.70 @@ -372,7 +372,7 @@
  107.71    let
  107.72      val pol_mono_rule = introduce_polarities mono_rule
  107.73      val mono_ruleT_name = (fst o dest_Type o fst o relation_types o fst o relation_types o snd o 
  107.74 -      dest_Const o head_of o HOLogic.dest_Trueprop o concl_of) pol_mono_rule
  107.75 +      dest_Const o head_of o HOLogic.dest_Trueprop o Thm.concl_of) pol_mono_rule
  107.76      val _ = if Symtab.defined (get_relator_distr_data' ctxt) mono_ruleT_name 
  107.77        then error ("Monotocity rule for type " ^ quote mono_ruleT_name ^ " is already_defined.")
  107.78        else ()
  107.79 @@ -389,7 +389,7 @@
  107.80    fun add_distr_rule update_entry distr_rule ctxt =
  107.81      let
  107.82        val distr_ruleT_name = (fst o dest_Type o fst o relation_types o fst o relation_types o snd o 
  107.83 -        dest_Const o head_of o HOLogic.dest_Trueprop o concl_of) distr_rule
  107.84 +        dest_Const o head_of o HOLogic.dest_Trueprop o Thm.concl_of) distr_rule
  107.85      in
  107.86        if Symtab.defined (get_relator_distr_data' ctxt) distr_ruleT_name then 
  107.87          Data.map (map_relator_distr_data (Symtab.map_entry distr_ruleT_name (update_entry distr_rule))) 
  107.88 @@ -441,8 +441,8 @@
  107.89  local
  107.90    fun sanity_check rule =
  107.91      let
  107.92 -      val assms = map (perhaps (try HOLogic.dest_Trueprop)) (prems_of rule)
  107.93 -      val concl = (perhaps (try HOLogic.dest_Trueprop)) (concl_of rule);
  107.94 +      val assms = map (perhaps (try HOLogic.dest_Trueprop)) (Thm.prems_of rule)
  107.95 +      val concl = (perhaps (try HOLogic.dest_Trueprop)) (Thm.concl_of rule);
  107.96        val (lhs, rhs) =
  107.97          (case concl of
  107.98            Const (@{const_name less_eq}, _) $ (lhs as Const (@{const_name relcompp},_) $ _ $ _) $ rhs =>
  107.99 @@ -477,7 +477,7 @@
 107.100    fun add_distr_rule distr_rule ctxt = 
 107.101      let
 107.102        val _ = sanity_check distr_rule
 107.103 -      val concl = (perhaps (try HOLogic.dest_Trueprop)) (concl_of distr_rule)
 107.104 +      val concl = (perhaps (try HOLogic.dest_Trueprop)) (Thm.concl_of distr_rule)
 107.105      in
 107.106        (case concl of
 107.107          Const (@{const_name less_eq}, _) $ (Const (@{const_name relcompp},_) $ _ $ _) $ _ =>
   108.1 --- a/src/HOL/Tools/Lifting/lifting_setup.ML	Tue Mar 03 19:08:04 2015 +0100
   108.2 +++ b/src/HOL/Tools/Lifting/lifting_setup.ML	Wed Mar 04 19:53:18 2015 +0100
   108.3 @@ -98,7 +98,7 @@
   108.4  in
   108.5    fun define_pcr_cr_eq lthy pcr_rel_def =
   108.6      let
   108.7 -      val lhs = (term_of o Thm.lhs_of) pcr_rel_def
   108.8 +      val lhs = (Thm.term_of o Thm.lhs_of) pcr_rel_def
   108.9        val qty_name = (Binding.name o Long_Name.base_name o fst o dest_Type o List.last o binder_types o fastype_of) lhs
  108.10        val args = (snd o strip_comb) lhs
  108.11        
  108.12 @@ -109,7 +109,7 @@
  108.13            val (fresh_var, ctxt) = yield_singleton Variable.invent_types sort ctxt
  108.14            val thy = Proof_Context.theory_of ctxt
  108.15          in
  108.16 -          ((cterm_of thy var, cterm_of thy (HOLogic.eq_const (TFree fresh_var))), ctxt)
  108.17 +          ((Thm.cterm_of thy var, Thm.cterm_of thy (HOLogic.eq_const (TFree fresh_var))), ctxt)
  108.18          end
  108.19        
  108.20        val orig_lthy = lthy
  108.21 @@ -120,7 +120,7 @@
  108.22          |> Conv.fconv_rule (Conv.arg_conv (Conv.arg1_conv 
  108.23            (Transfer.bottom_rewr_conv (Transfer.get_relator_eq lthy))))
  108.24    in
  108.25 -    case (term_of o Thm.rhs_of) pcr_cr_eq of
  108.26 +    case (Thm.term_of o Thm.rhs_of) pcr_cr_eq of
  108.27        Const (@{const_name "relcompp"}, _) $ Const (@{const_name HOL.eq}, _) $ _ =>
  108.28          let
  108.29            val thm = 
  108.30 @@ -172,13 +172,13 @@
  108.31  fun quot_thm_sanity_check ctxt quot_thm =
  108.32    let
  108.33      val _ = 
  108.34 -      if (nprems_of quot_thm > 0) then   
  108.35 +      if (Thm.nprems_of quot_thm > 0) then   
  108.36            raise QUOT_ERROR [Pretty.block
  108.37              [Pretty.str "The Quotient theorem has extra assumptions:",
  108.38               Pretty.brk 1,
  108.39               Display.pretty_thm ctxt quot_thm]]
  108.40        else ()
  108.41 -    val _ = quot_thm |> concl_of |> HOLogic.dest_Trueprop |> dest_Quotient
  108.42 +    val _ = quot_thm |> Thm.concl_of |> HOLogic.dest_Trueprop |> dest_Quotient
  108.43      handle TERM _ => raise QUOT_ERROR
  108.44            [Pretty.block
  108.45              [Pretty.str "The Quotient theorem is not of the right form:",
  108.46 @@ -290,7 +290,7 @@
  108.47        val thy = Proof_Context.theory_of ctxt
  108.48        val orig_ctxt = ctxt
  108.49        val (fixed_goal, ctxt) = yield_singleton (import_terms_exclude not_fix) goal ctxt
  108.50 -      val init_goal = Goal.init (cterm_of thy fixed_goal)
  108.51 +      val init_goal = Goal.init (Thm.cterm_of thy fixed_goal)
  108.52      in
  108.53        (singleton (Variable.export ctxt orig_ctxt) o Goal.conclude) (the (SINGLE tac init_goal))
  108.54      end
  108.55 @@ -307,7 +307,7 @@
  108.56            val thy = Proof_Context.theory_of ctxt
  108.57            val orig_ctxt = ctxt
  108.58            val (fixed_goal, ctxt) = yield_singleton (Variable.import_terms true) goal ctxt
  108.59 -          val init_goal = Goal.init (cterm_of thy fixed_goal)
  108.60 +          val init_goal = Goal.init (Thm.cterm_of thy fixed_goal)
  108.61            val rules = Transfer.get_transfer_raw ctxt
  108.62            val rules = constraint :: OO_rules @ rules
  108.63            val tac =
  108.64 @@ -318,8 +318,9 @@
  108.65        
  108.66        fun make_goal pcr_def constr =
  108.67          let 
  108.68 -          val pred_name = (fst o dest_Const o strip_args 1 o HOLogic.dest_Trueprop o prop_of) constr
  108.69 -          val arg = (fst o Logic.dest_equals o prop_of) pcr_def
  108.70 +          val pred_name =
  108.71 +            (fst o dest_Const o strip_args 1 o HOLogic.dest_Trueprop o Thm.prop_of) constr
  108.72 +          val arg = (fst o Logic.dest_equals o Thm.prop_of) pcr_def
  108.73          in
  108.74            HOLogic.mk_Trueprop ((Const (pred_name, (fastype_of arg) --> HOLogic.boolT)) $ arg)
  108.75          end
  108.76 @@ -337,8 +338,9 @@
  108.77          in
  108.78            fn thm => 
  108.79              let
  108.80 -              val prems = map HOLogic.dest_Trueprop (prems_of thm)
  108.81 -              val thm_name = (Long_Name.base_name o fst o dest_Const o strip_args 1 o HOLogic.dest_Trueprop o concl_of) thm
  108.82 +              val prems = map HOLogic.dest_Trueprop (Thm.prems_of thm)
  108.83 +              val thm_name =
  108.84 +                (Long_Name.base_name o fst o dest_Const o strip_args 1 o HOLogic.dest_Trueprop o Thm.concl_of) thm
  108.85                val non_trivial_assms = filter_out is_trivial_assm prems
  108.86              in
  108.87                if null non_trivial_assms then ()
  108.88 @@ -378,9 +380,9 @@
  108.89           @{thm id_transfer}
  108.90          |> Thm.incr_indexes (Term.maxidx_of_term parametrized_relator + 1)
  108.91          |> Conv.fconv_rule(HOLogic.Trueprop_conv (Conv.arg_conv id_unfold then_conv Conv.arg1_conv id_unfold))
  108.92 -      val var = Var (hd (Term.add_vars (prop_of id_transfer) []))
  108.93 +      val var = Var (hd (Term.add_vars (Thm.prop_of id_transfer) []))
  108.94        val thy = Proof_Context.theory_of lthy
  108.95 -      val inst = [(cterm_of thy var, cterm_of thy parametrized_relator)]
  108.96 +      val inst = [(Thm.cterm_of thy var, Thm.cterm_of thy parametrized_relator)]
  108.97        val id_par_thm = Drule.cterm_instantiate inst id_transfer
  108.98      in
  108.99        Lifting_Def.generate_parametric_transfer_rule lthy id_transfer_rule id_par_thm
 108.100 @@ -403,7 +405,9 @@
 108.101    
 108.102    fun fold_Domainp_pcrel pcrel_def thm =
 108.103      let
 108.104 -      val ct = thm |> cprop_of |> Drule.strip_imp_concl |> Thm.dest_arg |> Thm.dest_arg1 |> Thm.dest_arg
 108.105 +      val ct =
 108.106 +        thm |> Thm.cprop_of |> Drule.strip_imp_concl
 108.107 +        |> Thm.dest_arg |> Thm.dest_arg1 |> Thm.dest_arg
 108.108        val pcrel_def = Thm.incr_indexes (#maxidx (Thm.rep_cterm ct) + 1) pcrel_def
 108.109        val thm = Thm.instantiate (Thm.match (ct, Thm.rhs_of pcrel_def)) thm
 108.110          handle Pattern.MATCH => raise CTERM ("fold_Domainp_pcrel", [ct, Thm.rhs_of pcrel_def])
 108.111 @@ -413,7 +417,7 @@
 108.112  
 108.113    fun reduce_Domainp ctxt rules thm =
 108.114      let
 108.115 -      val goal = thm |> prems_of |> hd
 108.116 +      val goal = thm |> Thm.prems_of |> hd
 108.117        val var = goal |> HOLogic.dest_Trueprop |> dest_comb |> snd |> dest_Var 
 108.118        val reduced_assm =
 108.119          reduce_goal [var] goal (TRY (REPEAT_ALL_NEW (resolve_tac ctxt rules) 1)) ctxt
 108.120 @@ -425,7 +429,7 @@
 108.121      let
 108.122        fun reduce_first_assm ctxt rules thm =
 108.123          let
 108.124 -          val goal = thm |> prems_of |> hd
 108.125 +          val goal = thm |> Thm.prems_of |> hd
 108.126            val reduced_assm =
 108.127              reduce_goal [] goal (TRY (REPEAT_ALL_NEW (resolve_tac ctxt rules) 1)) ctxt
 108.128          in
 108.129 @@ -626,7 +630,7 @@
 108.130    let
 108.131      val transfer_attr = Attrib.internal (K Transfer.transfer_add)
 108.132      val transfer_domain_attr = Attrib.internal (K Transfer.transfer_domain_add)
 108.133 -    val (_ $ rep_fun $ _ $ typedef_set) = (HOLogic.dest_Trueprop o prop_of) typedef_thm
 108.134 +    val (_ $ rep_fun $ _ $ typedef_set) = (HOLogic.dest_Trueprop o Thm.prop_of) typedef_thm
 108.135      val (T_def, lthy) = define_crel rep_fun lthy
 108.136      (**)
 108.137      val T_def = Morphism.thm (Local_Theory.target_morphism lthy) T_def
 108.138 @@ -742,12 +746,12 @@
 108.139  fun setup_lifting_cmd xthm opt_reflp_xthm opt_par_xthm lthy =
 108.140    let 
 108.141      val input_thm = singleton (Attrib.eval_thms lthy) xthm
 108.142 -    val input_term = (HOLogic.dest_Trueprop o prop_of) input_thm
 108.143 +    val input_term = (HOLogic.dest_Trueprop o Thm.prop_of) input_thm
 108.144        handle TERM _ => error "Unsupported type of a theorem. Only Quotient or type_definition are supported."
 108.145  
 108.146      fun sanity_check_reflp_thm reflp_thm = 
 108.147        let
 108.148 -        val reflp_tm = (HOLogic.dest_Trueprop o prop_of) reflp_thm
 108.149 +        val reflp_tm = (HOLogic.dest_Trueprop o Thm.prop_of) reflp_thm
 108.150            handle TERM _ => error "Invalid form of the reflexivity theorem. Use \"reflp R\"."
 108.151        in
 108.152          case reflp_tm of
 108.153 @@ -813,13 +817,13 @@
 108.154            let
 108.155              val pcrel_def = #pcrel_def pcr
 108.156              val pcr_cr_eq = #pcr_cr_eq pcr
 108.157 -            val (def_lhs, _) = Logic.dest_equals (prop_of pcrel_def)
 108.158 +            val (def_lhs, _) = Logic.dest_equals (Thm.prop_of pcrel_def)
 108.159                handle TERM _ => raise PCR_ERROR [Pretty.block 
 108.160                      [Pretty.str "The pcr definiton theorem is not a plain meta equation:",
 108.161                      Pretty.brk 1,
 108.162                      Display.pretty_thm ctxt pcrel_def]]
 108.163              val pcr_const_def = head_of def_lhs
 108.164 -            val (eq_lhs, eq_rhs) = HOLogic.dest_eq (HOLogic.dest_Trueprop (prop_of pcr_cr_eq))
 108.165 +            val (eq_lhs, eq_rhs) = HOLogic.dest_eq (HOLogic.dest_Trueprop (Thm.prop_of pcr_cr_eq))
 108.166                handle TERM _ => raise PCR_ERROR [Pretty.block 
 108.167                      [Pretty.str "The pcr_cr equation theorem is not a plain equation:",
 108.168                      Pretty.brk 1,
 108.169 @@ -939,7 +943,7 @@
 108.170      val transfer_rel_name = transfer_rel |> dest_Const |> fst;
 108.171      fun has_transfer_rel thm = 
 108.172        let
 108.173 -        val concl = thm |> concl_of |> HOLogic.dest_Trueprop
 108.174 +        val concl = thm |> Thm.concl_of |> HOLogic.dest_Trueprop
 108.175        in
 108.176          member op= (fold_transfer_rel (fn tm => Term.add_const_names tm []) concl) transfer_rel_name
 108.177        end
 108.178 @@ -952,7 +956,7 @@
 108.179  
 108.180  fun get_transfer_rel (qinfo : Lifting_Info.quotient) =
 108.181    let
 108.182 -    fun get_pcrel pcr_def = pcr_def |> concl_of |> Logic.dest_equals |> fst |> head_of
 108.183 +    fun get_pcrel pcr_def = pcr_def |> Thm.concl_of |> Logic.dest_equals |> fst |> head_of
 108.184    in
 108.185      if is_some (#pcr_info qinfo) 
 108.186        then get_pcrel (#pcrel_def (the (#pcr_info qinfo)))
   109.1 --- a/src/HOL/Tools/Lifting/lifting_term.ML	Tue Mar 03 19:08:04 2015 +0100
   109.2 +++ b/src/HOL/Tools/Lifting/lifting_term.ML	Wed Mar 04 19:53:18 2015 +0100
   109.3 @@ -128,7 +128,7 @@
   109.4         Pretty.str "found."]))
   109.5    end
   109.6  
   109.7 -fun is_id_quot thm = (prop_of thm = prop_of @{thm identity_quotient})
   109.8 +fun is_id_quot thm = (Thm.prop_of thm = Thm.prop_of @{thm identity_quotient})  (* FIXME equality!? *)
   109.9  
  109.10  fun zip_Tvars ctxt type_name rty_Tvars qty_Tvars =
  109.11    case try (get_rel_quot_thm ctxt) type_name of
  109.12 @@ -167,7 +167,7 @@
  109.13  
  109.14          val rty = Type (type_name, rty_Tvars)
  109.15          val qty = Type (type_name, qty_Tvars)
  109.16 -        val rel_quot_thm_concl = (Logic.strip_imp_concl o prop_of) rel_quot_thm
  109.17 +        val rel_quot_thm_concl = (Logic.strip_imp_concl o Thm.prop_of) rel_quot_thm
  109.18          val schematic_rel_absT = quot_term_absT rel_quot_thm_concl;
  109.19          val thy = Proof_Context.theory_of ctxt
  109.20          val absT = rty --> qty
  109.21 @@ -180,7 +180,7 @@
  109.22          val _ = Sign.typ_unify thy (schematic_rel_absT, schematic_absT) (Vartab.empty,maxidx)
  109.23            handle Type.TUNIFY => equiv_univ_err ctxt schematic_rel_absT schematic_absT
  109.24          val subs = raw_match (schematic_rel_absT, absT) Vartab.empty
  109.25 -        val rel_quot_thm_prems = (Logic.strip_imp_prems o prop_of) rel_quot_thm
  109.26 +        val rel_quot_thm_prems = (Logic.strip_imp_prems o Thm.prop_of) rel_quot_thm
  109.27        in
  109.28          map (dest_funT o 
  109.29               Envir.subst_type subs o
  109.30 @@ -278,7 +278,7 @@
  109.31      val (_, qty_schematic) = quot_thm_rty_qty quot_thm
  109.32      val match_env = Sign.typ_match thy (qty_schematic, qty) Vartab.empty
  109.33      fun prep_ty thy (x, (S, ty)) =
  109.34 -      (ctyp_of thy (TVar (x, S)), ctyp_of thy ty)
  109.35 +      (Thm.ctyp_of thy (TVar (x, S)), Thm.ctyp_of thy ty)
  109.36      val ty_inst = Vartab.fold (cons o (prep_ty thy)) match_env []
  109.37    in
  109.38      Thm.instantiate (ty_inst, []) quot_thm
  109.39 @@ -372,7 +372,8 @@
  109.40        then 
  109.41          let 
  109.42            val thy = Proof_Context.theory_of ctxt
  109.43 -          val instantiated_id_quot_thm = instantiate' [SOME (ctyp_of thy ty)] [] @{thm identity_quotient}
  109.44 +          val instantiated_id_quot_thm =
  109.45 +            instantiate' [SOME (Thm.ctyp_of thy ty)] [] @{thm identity_quotient}
  109.46          in
  109.47            (instantiated_id_quot_thm, (table, ctxt)) 
  109.48          end
  109.49 @@ -389,7 +390,7 @@
  109.50            let
  109.51              val thy = Proof_Context.theory_of ctxt
  109.52              val (Q_t, ctxt') = get_fresh_Q_t ctxt
  109.53 -            val Q_thm = Thm.assume (cterm_of thy Q_t)
  109.54 +            val Q_thm = Thm.assume (Thm.cterm_of thy Q_t)
  109.55              val table' = (ty, Q_thm)::table
  109.56            in
  109.57              (Q_thm, (table', ctxt'))
  109.58 @@ -422,7 +423,7 @@
  109.59  (* Parametrization *)
  109.60  
  109.61  local
  109.62 -  fun get_lhs rule = (Thm.dest_fun o Thm.dest_arg o strip_imp_concl o cprop_of) rule;
  109.63 +  fun get_lhs rule = (Thm.dest_fun o Thm.dest_arg o strip_imp_concl o Thm.cprop_of) rule;
  109.64    
  109.65    fun no_imp _ = raise CTERM ("no implication", []);
  109.66    
  109.67 @@ -464,7 +465,7 @@
  109.68    fun merge_transfer_relations ctxt ctm =
  109.69      let
  109.70        val ctm = Thm.dest_arg ctm
  109.71 -      val tm = term_of ctm
  109.72 +      val tm = Thm.term_of ctm
  109.73        val rel = (hd o get_args 2) tm
  109.74    
  109.75        fun same_constants (Const (n1,_)) (Const (n2,_)) = n1 = n2
  109.76 @@ -472,11 +473,11 @@
  109.77        
  109.78        fun prove_extra_assms ctxt ctm distr_rule =
  109.79          let
  109.80 -          fun prove_assm assm = try (Goal.prove ctxt [] [] (term_of assm))
  109.81 +          fun prove_assm assm = try (Goal.prove ctxt [] [] (Thm.term_of assm))
  109.82              (fn _ => SOLVED' (REPEAT_ALL_NEW (resolve_tac ctxt (Transfer.get_transfer_raw ctxt))) 1)
  109.83    
  109.84            fun is_POS_or_NEG ctm =
  109.85 -            case (head_of o term_of o Thm.dest_arg) ctm of
  109.86 +            case (head_of o Thm.term_of o Thm.dest_arg) ctm of
  109.87                Const (@{const_name POS}, _) => true
  109.88                | Const (@{const_name NEG}, _) => true
  109.89                | _ => false
  109.90 @@ -515,7 +516,7 @@
  109.91                else
  109.92                  let 
  109.93                    val pcrel_def = get_pcrel_def ctxt ((fst o dest_Type) qty)
  109.94 -                  val pcrel_const = (head_of o fst o Logic.dest_equals o prop_of) pcrel_def
  109.95 +                  val pcrel_const = (head_of o fst o Logic.dest_equals o Thm.prop_of) pcrel_def
  109.96                  in
  109.97                    if same_constants pcrel_const (head_of trans_rel) then
  109.98                      let
  109.99 @@ -547,7 +548,7 @@
 109.100    let
 109.101      fun parametrize_relation_conv ctm =
 109.102        let
 109.103 -        val (rty, qty) = (relation_types o fastype_of) (term_of ctm)
 109.104 +        val (rty, qty) = (relation_types o fastype_of) (Thm.term_of ctm)
 109.105        in
 109.106          if same_type_constrs (rty, qty) then
 109.107            if forall op= (Targs rty ~~ Targs qty) then
   110.1 --- a/src/HOL/Tools/Lifting/lifting_util.ML	Tue Mar 03 19:08:04 2015 +0100
   110.2 +++ b/src/HOL/Tools/Lifting/lifting_util.ML	Wed Mar 04 19:53:18 2015 +0100
   110.3 @@ -57,19 +57,19 @@
   110.4  *)
   110.5  
   110.6  fun quot_thm_rel quot_thm =
   110.7 -  case (dest_Quotient o HOLogic.dest_Trueprop o prop_of) quot_thm of
   110.8 +  case (dest_Quotient o HOLogic.dest_Trueprop o Thm.prop_of) quot_thm of
   110.9      (rel, _, _, _) => rel
  110.10  
  110.11  fun quot_thm_abs quot_thm =
  110.12 -  case (dest_Quotient o HOLogic.dest_Trueprop o prop_of) quot_thm of
  110.13 +  case (dest_Quotient o HOLogic.dest_Trueprop o Thm.prop_of) quot_thm of
  110.14      (_, abs, _, _) => abs
  110.15  
  110.16  fun quot_thm_rep quot_thm =
  110.17 -  case (dest_Quotient o HOLogic.dest_Trueprop o prop_of) quot_thm of
  110.18 +  case (dest_Quotient o HOLogic.dest_Trueprop o Thm.prop_of) quot_thm of
  110.19      (_, _, rep, _) => rep
  110.20  
  110.21  fun quot_thm_crel quot_thm =
  110.22 -  case (dest_Quotient o HOLogic.dest_Trueprop o prop_of) quot_thm of
  110.23 +  case (dest_Quotient o HOLogic.dest_Trueprop o Thm.prop_of) quot_thm of
  110.24      (_, _, _, crel) => crel
  110.25  
  110.26  fun quot_thm_rty_qty quot_thm =
  110.27 @@ -87,7 +87,7 @@
  110.28      Thm.implies_elim thm (Thm.assume assm)
  110.29    end
  110.30  
  110.31 -fun undisch_all thm = funpow (nprems_of thm) undisch thm
  110.32 +fun undisch_all thm = funpow (Thm.nprems_of thm) undisch thm
  110.33  
  110.34  fun is_fun_type (Type (@{type_name fun}, _)) = true
  110.35    | is_fun_type _ = false
   111.1 --- a/src/HOL/Tools/Meson/meson.ML	Tue Mar 03 19:08:04 2015 +0100
   111.2 +++ b/src/HOL/Tools/Meson/meson.ML	Wed Mar 04 19:53:18 2015 +0100
   111.3 @@ -101,13 +101,13 @@
   111.4  fun first_order_resolve thA thB =
   111.5    (case
   111.6      try (fn () =>
   111.7 -      let val thy = theory_of_thm thA
   111.8 -          val tmA = concl_of thA
   111.9 -          val Const(@{const_name Pure.imp},_) $ tmB $ _ = prop_of thB
  111.10 +      let val thy = Thm.theory_of_thm thA
  111.11 +          val tmA = Thm.concl_of thA
  111.12 +          val Const(@{const_name Pure.imp},_) $ tmB $ _ = Thm.prop_of thB
  111.13            val tenv =
  111.14              Pattern.first_order_match thy (tmB, tmA)
  111.15                                            (Vartab.empty, Vartab.empty) |> snd
  111.16 -          val ct_pairs = map (apply2 (cterm_of thy) o term_pair_of) (Vartab.dest tenv)
  111.17 +          val ct_pairs = map (apply2 (Thm.cterm_of thy) o term_pair_of) (Vartab.dest tenv)
  111.18        in  thA RS (cterm_instantiate ct_pairs thB)  end) () of
  111.19      SOME th => th
  111.20    | NONE => raise THM ("first_order_resolve", 0, [thA, thB]))
  111.21 @@ -152,10 +152,10 @@
  111.22  (* Forward proof while preserving bound variables names *)
  111.23  fun rename_bound_vars_RS th rl =
  111.24    let
  111.25 -    val t = concl_of th
  111.26 -    val r = concl_of rl
  111.27 +    val t = Thm.concl_of th
  111.28 +    val r = Thm.concl_of rl
  111.29      val th' = th RS Thm.rename_boundvars r (protect_bound_var_names r) rl
  111.30 -    val t' = concl_of th'
  111.31 +    val t' = Thm.concl_of th'
  111.32    in Thm.rename_boundvars t' (fix_bound_var_names t t') th' end
  111.33  
  111.34  (*raises exception if no rules apply*)
  111.35 @@ -171,11 +171,11 @@
  111.36     problem, due to the (spurious) choices between projection and imitation. The
  111.37     workaround is to instantiate "?P := (%c. ... c ... c ... c ...)" manually. *)
  111.38  fun quant_resolve_tac ctxt th i st =
  111.39 -  case (concl_of st, prop_of th) of
  111.40 +  case (Thm.concl_of st, Thm.prop_of th) of
  111.41      (@{const Trueprop} $ (Var _ $ (c as Free _)), @{const Trueprop} $ _) =>
  111.42      let
  111.43 -      val cc = cterm_of (theory_of_thm th) c
  111.44 -      val ct = Thm.dest_arg (cprop_of th)
  111.45 +      val cc = Thm.cterm_of (Thm.theory_of_thm th) c
  111.46 +      val ct = Thm.dest_arg (Thm.cprop_of th)
  111.47      in resolve_tac ctxt [th] i (Drule.instantiate' [] [SOME (Thm.lambda cc ct)] st) end
  111.48    | _ => resolve_tac ctxt [th] i st
  111.49  
  111.50 @@ -228,7 +228,7 @@
  111.51    | signed_lits_aux (Const(@{const_name Not},_) $ P) (poslits, neglits) = (poslits, P::neglits)
  111.52    | signed_lits_aux P (poslits, neglits) = (P::poslits, neglits);
  111.53  
  111.54 -fun signed_lits th = signed_lits_aux (HOLogic.dest_Trueprop (concl_of th)) ([],[]);
  111.55 +fun signed_lits th = signed_lits_aux (HOLogic.dest_Trueprop (Thm.concl_of th)) ([],[]);
  111.56  
  111.57  (*Literals like X=X are tautologous*)
  111.58  fun taut_poslit (Const(@{const_name HOL.eq},_) $ t $ u) = t aconv u
  111.59 @@ -258,7 +258,7 @@
  111.60  
  111.61  fun refl_clause_aux 0 th = th
  111.62    | refl_clause_aux n th =
  111.63 -       case HOLogic.dest_Trueprop (concl_of th) of
  111.64 +       case HOLogic.dest_Trueprop (Thm.concl_of th) of
  111.65            (Const (@{const_name HOL.disj}, _) $ (Const (@{const_name HOL.disj}, _) $ _ $ _) $ _) =>
  111.66              refl_clause_aux n (th RS disj_assoc)    (*isolate an atom as first disjunct*)
  111.67          | (Const (@{const_name HOL.disj}, _) $ (Const(@{const_name Not},_) $ (Const(@{const_name HOL.eq},_) $ t $ u)) $ _) =>
  111.68 @@ -275,7 +275,7 @@
  111.69  
  111.70  (*Simplify a clause by applying reflexivity to its negated equality literals*)
  111.71  fun refl_clause th =
  111.72 -  let val neqs = notequal_lits_count (HOLogic.dest_Trueprop (concl_of th))
  111.73 +  let val neqs = notequal_lits_count (HOLogic.dest_Trueprop (Thm.concl_of th))
  111.74    in  zero_var_indexes (refl_clause_aux neqs th)  end
  111.75    handle TERM _ => th;  (*probably dest_Trueprop on a weird theorem*)
  111.76  
  111.77 @@ -302,7 +302,7 @@
  111.78  
  111.79  (*Remove duplicate literals, if there are any*)
  111.80  fun nodups ctxt th =
  111.81 -  if has_duplicates (op =) (literals (prop_of th))
  111.82 +  if has_duplicates (op =) (literals (Thm.prop_of th))
  111.83      then nodups_aux ctxt [] th
  111.84      else th;
  111.85  
  111.86 @@ -353,7 +353,8 @@
  111.87    fun freeze_spec th ctxt =
  111.88      let
  111.89        val cert = Proof_Context.cterm_of ctxt;
  111.90 -      val ([x], ctxt') = Variable.variant_fixes [name_of (HOLogic.dest_Trueprop (concl_of th))] ctxt;
  111.91 +      val ([x], ctxt') =
  111.92 +        Variable.variant_fixes [name_of (HOLogic.dest_Trueprop (Thm.concl_of th))] ctxt;
  111.93        val spec' = Thm.instantiate ([], [(spec_var, cert (Free (x, spec_varT)))]) spec;
  111.94      in (th RS spec', ctxt') end
  111.95  end;
  111.96 @@ -371,10 +372,10 @@
  111.97  fun cnf old_skolem_ths ctxt (th, ths) =
  111.98    let val ctxt_ref = Unsynchronized.ref ctxt   (* FIXME ??? *)
  111.99        fun cnf_aux (th,ths) =
 111.100 -        if not (can HOLogic.dest_Trueprop (prop_of th)) then ths (*meta-level: ignore*)
 111.101 -        else if not (has_conns [@{const_name All}, @{const_name Ex}, @{const_name HOL.conj}] (prop_of th))
 111.102 +        if not (can HOLogic.dest_Trueprop (Thm.prop_of th)) then ths (*meta-level: ignore*)
 111.103 +        else if not (has_conns [@{const_name All}, @{const_name Ex}, @{const_name HOL.conj}] (Thm.prop_of th))
 111.104          then nodups ctxt th :: ths (*no work to do, terminate*)
 111.105 -        else case head_of (HOLogic.dest_Trueprop (concl_of th)) of
 111.106 +        else case head_of (HOLogic.dest_Trueprop (Thm.concl_of th)) of
 111.107              Const (@{const_name HOL.conj}, _) => (*conjunction*)
 111.108                  cnf_aux (th RS conjunct1, cnf_aux (th RS conjunct2, ths))
 111.109            | Const (@{const_name All}, _) => (*universal quantifier*)
 111.110 @@ -395,7 +396,7 @@
 111.111            | _ => nodups ctxt th :: ths  (*no work to do*)
 111.112        and cnf_nil th = cnf_aux (th, [])
 111.113        val cls =
 111.114 -        if has_too_many_clauses ctxt (concl_of th) then
 111.115 +        if has_too_many_clauses ctxt (Thm.concl_of th) then
 111.116            (trace_msg ctxt (fn () =>
 111.117                 "cnf is ignoring: " ^ Display.string_of_thm ctxt th); ths)
 111.118          else
 111.119 @@ -417,7 +418,7 @@
 111.120  
 111.121  (*Associate disjuctions to right -- make leftmost disjunct a LITERAL*)
 111.122  fun assoc_right th =
 111.123 -  if is_left (prop_of th) then assoc_right (th RS disj_assoc)
 111.124 +  if is_left (Thm.prop_of th) then assoc_right (th RS disj_assoc)
 111.125    else th;
 111.126  
 111.127  (*Must check for negative literal first!*)
 111.128 @@ -439,7 +440,7 @@
 111.129  
 111.130  (*Create a meta-level Horn clause*)
 111.131  fun make_horn crules th =
 111.132 -  if ok4horn (concl_of th)
 111.133 +  if ok4horn (Thm.concl_of th)
 111.134    then make_horn crules (tryres(th,crules)) handle THM _ => th
 111.135    else th;
 111.136  
 111.137 @@ -449,7 +450,7 @@
 111.138    let fun rots (0,_) = hcs
 111.139          | rots (k,th) = zero_var_indexes (make_horn crules th) ::
 111.140                          rots(k-1, assoc_right (th RS disj_comm))
 111.141 -  in case nliterals(prop_of th) of
 111.142 +  in case nliterals(Thm.prop_of th) of
 111.143          1 => th::hcs
 111.144        | n => rots(n, assoc_right th)
 111.145    end;
 111.146 @@ -461,7 +462,7 @@
 111.147      in  fn ths => #2 (fold_rev name1 ths (length ths, []))  end;
 111.148  
 111.149  (*Is the given disjunction an all-negative support clause?*)
 111.150 -fun is_negative th = forall (not o #1) (literals (prop_of th));
 111.151 +fun is_negative th = forall (not o #1) (literals (Thm.prop_of th));
 111.152  
 111.153  val neg_clauses = filter is_negative;
 111.154  
 111.155 @@ -489,12 +490,12 @@
 111.156         TRYING_eq_assume_tac (i-1) (Thm.eq_assumption i st)
 111.157         handle THM _ => TRYING_eq_assume_tac (i-1) st;
 111.158  
 111.159 -fun TRYALL_eq_assume_tac st = TRYING_eq_assume_tac (nprems_of st) st;
 111.160 +fun TRYALL_eq_assume_tac st = TRYING_eq_assume_tac (Thm.nprems_of st) st;
 111.161  
 111.162  (*Loop checking: FAIL if trying to prove the same thing twice
 111.163    -- if *ANY* subgoal has repeated literals*)
 111.164  fun check_tac st =
 111.165 -  if exists (fn prem => has_reps (rhyps(prem,[]))) (prems_of st)
 111.166 +  if exists (fn prem => has_reps (rhyps(prem,[]))) (Thm.prems_of st)
 111.167    then  Seq.empty  else  Seq.single st;
 111.168  
 111.169  
 111.170 @@ -506,7 +507,7 @@
 111.171  (*Sums the sizes of the subgoals, ignoring hypotheses (ancestors)*)
 111.172  fun addconcl prem sz = size_of_term (Logic.strip_assums_concl prem) + sz;
 111.173  
 111.174 -fun size_of_subgoals st = fold_rev addconcl (prems_of st) 0;
 111.175 +fun size_of_subgoals st = fold_rev addconcl (Thm.prems_of st) 0;
 111.176  
 111.177  
 111.178  (*Negation Normal Form*)
 111.179 @@ -518,7 +519,7 @@
 111.180    | ok4nnf _ = false;
 111.181  
 111.182  fun make_nnf1 ctxt th =
 111.183 -  if ok4nnf (concl_of th)
 111.184 +  if ok4nnf (Thm.concl_of th)
 111.185    then make_nnf1 ctxt (tryres(th, nnf_rls))
 111.186      handle THM ("tryres", _, _) =>
 111.187          forward_res ctxt (make_nnf1 ctxt)
 111.188 @@ -552,9 +553,10 @@
 111.189    #> simplify (put_simpset nnf_ss ctxt)
 111.190    #> rewrite_rule ctxt @{thms Let_def [abs_def]}
 111.191  
 111.192 -fun make_nnf ctxt th = case prems_of th of
 111.193 +fun make_nnf ctxt th =
 111.194 +  (case Thm.prems_of th of
 111.195      [] => th |> presimplify ctxt |> make_nnf1 ctxt
 111.196 -  | _ => raise THM ("make_nnf: premises in argument", 0, [th]);
 111.197 +  | _ => raise THM ("make_nnf: premises in argument", 0, [th]));
 111.198  
 111.199  fun choice_theorems thy =
 111.200    try (Global_Theory.get_thm thy) "Hilbert_Choice.choice" |> the_list
 111.201 @@ -564,7 +566,7 @@
 111.202  fun skolemize_with_choice_theorems ctxt choice_ths =
 111.203    let
 111.204      fun aux th =
 111.205 -      if not (has_conns [@{const_name Ex}] (prop_of th)) then
 111.206 +      if not (has_conns [@{const_name Ex}] (Thm.prop_of th)) then
 111.207          th
 111.208        else
 111.209          tryres (th, choice_ths @
 111.210 @@ -615,35 +617,35 @@
 111.211  
 111.212  val ext_cong_neq = @{thm ext_cong_neq}
 111.213  val F_ext_cong_neq =
 111.214 -  Term.add_vars (prop_of @{thm ext_cong_neq}) []
 111.215 +  Term.add_vars (Thm.prop_of @{thm ext_cong_neq}) []
 111.216    |> filter (fn ((s, _), _) => s = "F")
 111.217    |> the_single |> Var
 111.218  
 111.219  (* Strengthens "f g ~= f h" to "f g ~= f h & (EX x. g x ~= h x)". *)
 111.220  fun cong_extensionalize_thm thy th =
 111.221 -  case concl_of th of
 111.222 +  (case Thm.concl_of th of
 111.223      @{const Trueprop} $ (@{const Not}
 111.224          $ (Const (@{const_name HOL.eq}, Type (_, [T, _]))
 111.225             $ (t as _ $ _) $ (u as _ $ _))) =>
 111.226      (case get_F_pattern T t u of
 111.227         SOME p =>
 111.228 -       let val inst = [apply2 (cterm_of thy) (F_ext_cong_neq, p)] in
 111.229 +       let val inst = [apply2 (Thm.cterm_of thy) (F_ext_cong_neq, p)] in
 111.230           th RS cterm_instantiate inst ext_cong_neq
 111.231         end
 111.232       | NONE => th)
 111.233 -  | _ => th
 111.234 +  | _ => th)
 111.235  
 111.236  (* Removes the lambdas from an equation of the form "t = (%x1 ... xn. u)". It
 111.237     would be desirable to do this symmetrically but there's at least one existing
 111.238     proof in "Tarski" that relies on the current behavior. *)
 111.239  fun abs_extensionalize_conv ctxt ct =
 111.240 -  case term_of ct of
 111.241 +  (case Thm.term_of ct of
 111.242      Const (@{const_name HOL.eq}, _) $ _ $ Abs _ =>
 111.243      ct |> (Conv.rewr_conv @{thm fun_eq_iff [THEN eq_reflection]}
 111.244             then_conv abs_extensionalize_conv ctxt)
 111.245    | _ $ _ => Conv.comb_conv (abs_extensionalize_conv ctxt) ct
 111.246    | Abs _ => Conv.abs_conv (abs_extensionalize_conv o snd) ctxt ct
 111.247 -  | _ => Conv.all_conv ct
 111.248 +  | _ => Conv.all_conv ct)
 111.249  
 111.250  val abs_extensionalize_thm = Conv.fconv_rule o abs_extensionalize_conv
 111.251  
 111.252 @@ -673,7 +675,7 @@
 111.253    in Variable.export ctxt' ctxt cnfs @ cls end;
 111.254  
 111.255  (*Sort clauses by number of literals*)
 111.256 -fun fewerlits (th1, th2) = nliterals (prop_of th1) < nliterals (prop_of th2)
 111.257 +fun fewerlits (th1, th2) = nliterals (Thm.prop_of th1) < nliterals (Thm.prop_of th2)
 111.258  
 111.259  (*Make clauses from a list of theorems, previously Skolemized and put into nnf.
 111.260    The resulting clauses are HOL disjunctions.*)
   112.1 --- a/src/HOL/Tools/Meson/meson_clausify.ML	Tue Mar 03 19:08:04 2015 +0100
   112.2 +++ b/src/HOL/Tools/Meson/meson_clausify.ML	Wed Mar 04 19:53:18 2015 +0100
   112.3 @@ -35,20 +35,20 @@
   112.4  
   112.5  (**** Transformation of Elimination Rules into First-Order Formulas****)
   112.6  
   112.7 -val cfalse = cterm_of @{theory HOL} @{term False};
   112.8 -val ctp_false = cterm_of @{theory HOL} (HOLogic.mk_Trueprop @{term False});
   112.9 +val cfalse = Thm.cterm_of @{theory HOL} @{term False};
  112.10 +val ctp_false = Thm.cterm_of @{theory HOL} (HOLogic.mk_Trueprop @{term False});
  112.11  
  112.12  (* Converts an elim-rule into an equivalent theorem that does not have the
  112.13     predicate variable. Leaves other theorems unchanged. We simply instantiate
  112.14     the conclusion variable to False. (Cf. "transform_elim_prop" in
  112.15     "Sledgehammer_Util".) *)
  112.16  fun transform_elim_theorem th =
  112.17 -  case concl_of th of    (*conclusion variable*)
  112.18 -       @{const Trueprop} $ (v as Var (_, @{typ bool})) =>
  112.19 -           Thm.instantiate ([], [(cterm_of @{theory HOL} v, cfalse)]) th
  112.20 -    | v as Var(_, @{typ prop}) =>
  112.21 -           Thm.instantiate ([], [(cterm_of @{theory HOL} v, ctp_false)]) th
  112.22 -    | _ => th
  112.23 +  (case Thm.concl_of th of    (*conclusion variable*)
  112.24 +    @{const Trueprop} $ (v as Var (_, @{typ bool})) =>
  112.25 +      Thm.instantiate ([], [(Thm.cterm_of @{theory HOL} v, cfalse)]) th
  112.26 +  | v as Var(_, @{typ prop}) =>
  112.27 +      Thm.instantiate ([], [(Thm.cterm_of @{theory HOL} v, ctp_false)]) th
  112.28 +  | _ => th)
  112.29  
  112.30  
  112.31  (**** SKOLEMIZATION BY INFERENCE (lcp) ****)
  112.32 @@ -83,7 +83,7 @@
  112.33        | dec_sko (@{const disj} $ p $ q) rhss = rhss |> dec_sko p |> dec_sko q
  112.34        | dec_sko (@{const Trueprop} $ p) rhss = dec_sko p rhss
  112.35        | dec_sko _ rhss = rhss
  112.36 -  in  dec_sko (prop_of th) []  end;
  112.37 +  in  dec_sko (Thm.prop_of th) []  end;
  112.38  
  112.39  
  112.40  (**** REPLACING ABSTRACTIONS BY COMBINATORS ****)
  112.41 @@ -94,20 +94,20 @@
  112.42    | is_quasi_lambda_free (Abs _) = false
  112.43    | is_quasi_lambda_free _ = true
  112.44  
  112.45 -val [f_B,g_B] = map (cterm_of @{theory}) (Misc_Legacy.term_vars (prop_of @{thm abs_B}));
  112.46 -val [g_C,f_C] = map (cterm_of @{theory}) (Misc_Legacy.term_vars (prop_of @{thm abs_C}));
  112.47 -val [f_S,g_S] = map (cterm_of @{theory}) (Misc_Legacy.term_vars (prop_of @{thm abs_S}));
  112.48 +val [f_B,g_B] = map (Thm.cterm_of @{theory}) (Misc_Legacy.term_vars (Thm.prop_of @{thm abs_B}));
  112.49 +val [g_C,f_C] = map (Thm.cterm_of @{theory}) (Misc_Legacy.term_vars (Thm.prop_of @{thm abs_C}));
  112.50 +val [f_S,g_S] = map (Thm.cterm_of @{theory}) (Misc_Legacy.term_vars (Thm.prop_of @{thm abs_S}));
  112.51  
  112.52  (* FIXME: Requires more use of cterm constructors. *)
  112.53  fun abstract ct =
  112.54    let
  112.55 -      val thy = theory_of_cterm ct
  112.56 -      val Abs(x,_,body) = term_of ct
  112.57 -      val Type(@{type_name fun}, [xT,bodyT]) = typ_of (ctyp_of_term ct)
  112.58 -      val cxT = ctyp_of thy xT
  112.59 -      val cbodyT = ctyp_of thy bodyT
  112.60 +      val thy = Thm.theory_of_cterm ct
  112.61 +      val Abs(x,_,body) = Thm.term_of ct
  112.62 +      val Type(@{type_name fun}, [xT,bodyT]) = Thm.typ_of (Thm.ctyp_of_term ct)
  112.63 +      val cxT = Thm.ctyp_of thy xT
  112.64 +      val cbodyT = Thm.ctyp_of thy bodyT
  112.65        fun makeK () =
  112.66 -        instantiate' [SOME cxT, SOME cbodyT] [SOME (cterm_of thy body)]
  112.67 +        instantiate' [SOME cxT, SOME cbodyT] [SOME (Thm.cterm_of thy body)]
  112.68                       @{thm abs_K}
  112.69    in
  112.70        case body of
  112.71 @@ -118,27 +118,28 @@
  112.72          | rator$rand =>
  112.73              if Term.is_dependent rator then (*C or S*)
  112.74                 if Term.is_dependent rand then (*S*)
  112.75 -                 let val crator = cterm_of thy (Abs(x,xT,rator))
  112.76 -                     val crand = cterm_of thy (Abs(x,xT,rand))
  112.77 +                 let val crator = Thm.cterm_of thy (Abs(x,xT,rator))
  112.78 +                     val crand = Thm.cterm_of thy (Abs(x,xT,rand))
  112.79                       val abs_S' = cterm_instantiate [(f_S,crator),(g_S,crand)] @{thm abs_S}
  112.80 -                     val (_,rhs) = Thm.dest_equals (cprop_of abs_S')
  112.81 +                     val (_,rhs) = Thm.dest_equals (Thm.cprop_of abs_S')
  112.82                   in
  112.83                     Thm.transitive abs_S' (Conv.binop_conv abstract rhs)
  112.84                   end
  112.85                 else (*C*)
  112.86 -                 let val crator = cterm_of thy (Abs(x,xT,rator))
  112.87 -                     val abs_C' = cterm_instantiate [(f_C,crator),(g_C,cterm_of thy rand)] @{thm abs_C}
  112.88 -                     val (_,rhs) = Thm.dest_equals (cprop_of abs_C')
  112.89 +                 let val crator = Thm.cterm_of thy (Abs(x,xT,rator))
  112.90 +                     val abs_C' =
  112.91 +                      cterm_instantiate [(f_C,crator),(g_C,Thm.cterm_of thy rand)] @{thm abs_C}
  112.92 +                     val (_,rhs) = Thm.dest_equals (Thm.cprop_of abs_C')
  112.93                   in
  112.94                     Thm.transitive abs_C' (Conv.fun_conv (Conv.arg_conv abstract) rhs)
  112.95                   end
  112.96              else if Term.is_dependent rand then (*B or eta*)
  112.97                 if rand = Bound 0 then Thm.eta_conversion ct
  112.98                 else (*B*)
  112.99 -                 let val crand = cterm_of thy (Abs(x,xT,rand))
 112.100 -                     val crator = cterm_of thy rator
 112.101 +                 let val crand = Thm.cterm_of thy (Abs(x,xT,rand))
 112.102 +                     val crator = Thm.cterm_of thy rator
 112.103                       val abs_B' = cterm_instantiate [(f_B,crator),(g_B,crand)] @{thm abs_B}
 112.104 -                     val (_,rhs) = Thm.dest_equals (cprop_of abs_B')
 112.105 +                     val (_,rhs) = Thm.dest_equals (Thm.cprop_of abs_B')
 112.106                   in Thm.transitive abs_B' (Conv.arg_conv abstract rhs) end
 112.107              else makeK()
 112.108          | _ => raise Fail "abstract: Bad term"
 112.109 @@ -146,13 +147,13 @@
 112.110  
 112.111  (* Traverse a theorem, remplacing lambda-abstractions with combinators. *)
 112.112  fun introduce_combinators_in_cterm ct =
 112.113 -  if is_quasi_lambda_free (term_of ct) then
 112.114 +  if is_quasi_lambda_free (Thm.term_of ct) then
 112.115      Thm.reflexive ct
 112.116 -  else case term_of ct of
 112.117 +  else case Thm.term_of ct of
 112.118      Abs _ =>
 112.119      let
 112.120        val (cv, cta) = Thm.dest_abs NONE ct
 112.121 -      val (v, _) = dest_Free (term_of cv)
 112.122 +      val (v, _) = dest_Free (Thm.term_of cv)
 112.123        val u_th = introduce_combinators_in_cterm cta
 112.124        val cu = Thm.rhs_of u_th
 112.125        val comb_eq = abstract (Thm.lambda cv cu)
 112.126 @@ -164,12 +165,12 @@
 112.127      end
 112.128  
 112.129  fun introduce_combinators_in_theorem ctxt th =
 112.130 -  if is_quasi_lambda_free (prop_of th) then
 112.131 +  if is_quasi_lambda_free (Thm.prop_of th) then
 112.132      th
 112.133    else
 112.134      let
 112.135        val th = Drule.eta_contraction_rule th
 112.136 -      val eqth = introduce_combinators_in_cterm (cprop_of th)
 112.137 +      val eqth = introduce_combinators_in_cterm (Thm.cprop_of th)
 112.138      in Thm.equal_elim eqth th end
 112.139      handle THM (msg, _, _) =>
 112.140             (warning ("Error in the combinator translation of " ^ Display.string_of_thm ctxt th ^
 112.141 @@ -178,7 +179,7 @@
 112.142              TrueI)
 112.143  
 112.144  (*cterms are used throughout for efficiency*)
 112.145 -val cTrueprop = cterm_of @{theory HOL} HOLogic.Trueprop;
 112.146 +val cTrueprop = Thm.cterm_of @{theory HOL} HOLogic.Trueprop;
 112.147  
 112.148  (*Given an abstraction over n variables, replace the bound variables by free
 112.149    ones. Return the body, along with the list of free variables.*)
 112.150 @@ -193,15 +194,15 @@
 112.151  fun old_skolem_theorem_of_def ctxt rhs0 =
 112.152    let
 112.153      val thy = Proof_Context.theory_of ctxt
 112.154 -    val rhs = rhs0 |> Type.legacy_freeze_thaw |> #1 |> cterm_of thy
 112.155 +    val rhs = rhs0 |> Type.legacy_freeze_thaw |> #1 |> Thm.cterm_of thy
 112.156      val rhs' = rhs |> Thm.dest_comb |> snd
 112.157      val (ch, frees) = c_variant_abs_multi (rhs', [])
 112.158 -    val (hilbert, cabs) = ch |> Thm.dest_comb |>> term_of
 112.159 +    val (hilbert, cabs) = ch |> Thm.dest_comb |>> Thm.term_of
 112.160      val T =
 112.161        case hilbert of
 112.162          Const (_, Type (@{type_name fun}, [_, T])) => T
 112.163        | _ => raise TERM ("old_skolem_theorem_of_def: expected \"Eps\"", [hilbert])
 112.164 -    val cex = cterm_of thy (HOLogic.exists_const T)
 112.165 +    val cex = Thm.cterm_of thy (HOLogic.exists_const T)
 112.166      val ex_tm = Thm.apply cTrueprop (Thm.apply cex cabs)
 112.167      val conc =
 112.168        Drule.list_comb (rhs, frees)
 112.169 @@ -219,7 +220,7 @@
 112.170  
 112.171  fun to_definitional_cnf_with_quantifiers ctxt th =
 112.172    let
 112.173 -    val eqth = CNF.make_cnfx_thm ctxt (HOLogic.dest_Trueprop (prop_of th))
 112.174 +    val eqth = CNF.make_cnfx_thm ctxt (HOLogic.dest_Trueprop (Thm.prop_of th))
 112.175      val eqth = eqth RS @{thm eq_reflection}
 112.176      val eqth = eqth RS @{thm TruepropI}
 112.177    in Thm.equal_elim eqth th end
 112.178 @@ -271,7 +272,7 @@
 112.179  
 112.180  fun zap pos ct =
 112.181    ct
 112.182 -  |> (case term_of ct of
 112.183 +  |> (case Thm.term_of ct of
 112.184          Const (s, _) $ Abs (s', _, _) =>
 112.185          if s = @{const_name Pure.all} orelse s = @{const_name All} orelse
 112.186             s = @{const_name Ex} then
 112.187 @@ -325,23 +326,23 @@
 112.188              skolemize choice_ths
 112.189          val discharger_th = th |> pull_out
 112.190          val discharger_th =
 112.191 -          discharger_th |> has_too_many_clauses ctxt (concl_of discharger_th)
 112.192 +          discharger_th |> has_too_many_clauses ctxt (Thm.concl_of discharger_th)
 112.193                             ? (to_definitional_cnf_with_quantifiers ctxt
 112.194                                #> pull_out)
 112.195          val zapped_th =
 112.196 -          discharger_th |> prop_of |> rename_bound_vars_to_be_zapped ax_no
 112.197 +          discharger_th |> Thm.prop_of |> rename_bound_vars_to_be_zapped ax_no
 112.198            |> (if no_choice then
 112.199 -                Skip_Proof.make_thm thy #> skolemize [cheat_choice] #> cprop_of
 112.200 +                Skip_Proof.make_thm thy #> skolemize [cheat_choice] #> Thm.cprop_of
 112.201                else
 112.202 -                cterm_of thy)
 112.203 +                Thm.cterm_of thy)
 112.204            |> zap true
 112.205          val fixes =
 112.206 -          [] |> Term.add_free_names (prop_of zapped_th)
 112.207 +          [] |> Term.add_free_names (Thm.prop_of zapped_th)
 112.208               |> filter is_zapped_var_name
 112.209          val ctxt' = ctxt |> Variable.add_fixes_direct fixes
 112.210          val fully_skolemized_t =
 112.211            zapped_th |> singleton (Variable.export ctxt' ctxt)
 112.212 -                    |> cprop_of |> Thm.dest_equals |> snd |> term_of
 112.213 +                    |> Thm.cprop_of |> Thm.dest_equals |> snd |> Thm.term_of
 112.214        in
 112.215          if exists_subterm (fn Var ((s, _), _) =>
 112.216                                String.isPrefix new_skolem_var_prefix s
 112.217 @@ -349,7 +350,7 @@
 112.218            let
 112.219              val (fully_skolemized_ct, ctxt) =
 112.220                Variable.import_terms true [fully_skolemized_t] ctxt
 112.221 -              |>> the_single |>> cterm_of thy
 112.222 +              |>> the_single |>> Thm.cterm_of thy
 112.223            in
 112.224              (SOME (discharger_th, fully_skolemized_ct),
 112.225               (Thm.assume fully_skolemized_ct, ctxt))
 112.226 @@ -358,7 +359,7 @@
 112.227           (NONE, (th, ctxt))
 112.228        end
 112.229      else
 112.230 -      (NONE, (th |> has_too_many_clauses ctxt (concl_of th)
 112.231 +      (NONE, (th |> has_too_many_clauses ctxt (Thm.concl_of th)
 112.232                      ? to_definitional_cnf_with_quantifiers ctxt, ctxt))
 112.233    end
 112.234  
 112.235 @@ -376,14 +377,14 @@
 112.236         th ctxt
 112.237      val (cnf_ths, ctxt) = clausify nnf_th
 112.238      fun intr_imp ct th =
 112.239 -      Thm.instantiate ([], map (apply2 (cterm_of thy))
 112.240 +      Thm.instantiate ([], map (apply2 (Thm.cterm_of thy))
 112.241                                 [(Var (("i", 0), @{typ nat}),
 112.242                                   HOLogic.mk_nat ax_no)])
 112.243                        (zero_var_indexes @{thm skolem_COMBK_D})
 112.244        RS Thm.implies_intr ct th
 112.245    in
 112.246      (opt |> Option.map (I #>> singleton (Variable.export ctxt ctxt0)
 112.247 -                        ##> (term_of #> HOLogic.dest_Trueprop
 112.248 +                        ##> (Thm.term_of #> HOLogic.dest_Trueprop
 112.249                               #> singleton (Variable.export_terms ctxt ctxt0))),
 112.250       cnf_ths |> map (combinators ? introduce_combinators_in_theorem ctxt
 112.251                       #> (case opt of SOME (_, ct) => intr_imp ct | NONE => I))
   113.1 --- a/src/HOL/Tools/Metis/metis_generate.ML	Tue Mar 03 19:08:04 2015 +0100
   113.2 +++ b/src/HOL/Tools/Metis/metis_generate.ML	Wed Mar 04 19:53:18 2015 +0100
   113.3 @@ -216,7 +216,7 @@
   113.4          (0 upto length fact_clauses - 1) fact_clauses
   113.5      val (old_skolems, props) =
   113.6        fold_rev (fn (name, th) => fn (old_skolems, props) =>
   113.7 -           th |> prop_of |> Logic.strip_imp_concl
   113.8 +           th |> Thm.prop_of |> Logic.strip_imp_concl
   113.9                |> conceal_old_skolem_terms (length clauses) old_skolems
  113.10                ||> (lam_trans = liftingN orelse lam_trans = lam_liftingN) ? eliminate_lam_wrappers
  113.11                ||> (fn prop => (name, prop) :: props))
   114.1 --- a/src/HOL/Tools/Metis/metis_reconstruct.ML	Tue Mar 03 19:08:04 2015 +0100
   114.2 +++ b/src/HOL/Tools/Metis/metis_reconstruct.ML	Wed Mar 04 19:53:18 2015 +0100
   114.3 @@ -88,7 +88,7 @@
   114.4    the (AList.lookup (uncurry Metis_Thm.equal) th_pairs fth)
   114.5    handle Option.Option => raise Fail ("Failed to find Metis theorem " ^ Metis_Thm.toString fth)
   114.6  
   114.7 -fun cterm_incr_types thy idx = cterm_of thy o (map_types (Logic.incr_tvar idx))
   114.8 +fun cterm_incr_types thy idx = Thm.cterm_of thy o map_types (Logic.incr_tvar idx)
   114.9  
  114.10  (* INFERENCE RULE: AXIOM *)
  114.11  
  114.12 @@ -103,8 +103,8 @@
  114.13  fun inst_excluded_middle thy i_atom =
  114.14    let
  114.15      val th = EXCLUDED_MIDDLE
  114.16 -    val [vx] = Term.add_vars (prop_of th) []
  114.17 -    val substs = [(cterm_of thy (Var vx), cterm_of thy i_atom)]
  114.18 +    val [vx] = Term.add_vars (Thm.prop_of th) []
  114.19 +    val substs = [(Thm.cterm_of thy (Var vx), Thm.cterm_of thy i_atom)]
  114.20    in
  114.21      cterm_instantiate substs th
  114.22    end
  114.23 @@ -122,7 +122,7 @@
  114.24    let
  114.25      val thy = Proof_Context.theory_of ctxt
  114.26      val i_th = lookth th_pairs th
  114.27 -    val i_th_vars = Term.add_vars (prop_of i_th) []
  114.28 +    val i_th_vars = Term.add_vars (Thm.prop_of i_th) []
  114.29  
  114.30      fun find_var x = the (List.find (fn ((a,_),_) => a=x) i_th_vars)
  114.31      fun subst_translation (x,y) =
  114.32 @@ -131,7 +131,7 @@
  114.33          (* We call "polish_hol_terms" below. *)
  114.34          val t = hol_term_of_metis ctxt type_enc sym_tab y
  114.35        in
  114.36 -        SOME (cterm_of thy (Var v), t)
  114.37 +        SOME (Thm.cterm_of thy (Var v), t)
  114.38        end
  114.39        handle Option.Option =>
  114.40               (trace_msg ctxt (fn () =>
  114.41 @@ -160,8 +160,8 @@
  114.42      val _ = trace_msg ctxt (fn () =>
  114.43        cat_lines ("subst_translations:" ::
  114.44          (substs' |> map (fn (x, y) =>
  114.45 -          Syntax.string_of_term ctxt (term_of x) ^ " |-> " ^
  114.46 -          Syntax.string_of_term ctxt (term_of y)))))
  114.47 +          Syntax.string_of_term ctxt (Thm.term_of x) ^ " |-> " ^
  114.48 +          Syntax.string_of_term ctxt (Thm.term_of y)))))
  114.49    in
  114.50      cterm_instantiate substs' i_th
  114.51    end
  114.52 @@ -175,7 +175,7 @@
  114.53    let
  114.54      val tvs = Term.add_tvars (Thm.full_prop_of th) []
  114.55      val thy = Thm.theory_of_thm th
  114.56 -    fun inc_tvar ((a, i), s) = apply2 (ctyp_of thy) (TVar ((a, i), s), TVar ((a, i + inc), s))
  114.57 +    fun inc_tvar ((a, i), s) = apply2 (Thm.ctyp_of thy) (TVar ((a, i), s), TVar ((a, i + inc), s))
  114.58    in
  114.59      Thm.instantiate (map inc_tvar tvs, []) th
  114.60    end
  114.61 @@ -188,7 +188,7 @@
  114.62      val tha = incr_type_indexes (1 + Thm.maxidx_of thb) tha
  114.63      fun res (tha, thb) =
  114.64        (case Thm.bicompose (SOME ctxt) {flatten = true, match = false, incremented = true}
  114.65 -            (false, tha, nprems_of tha) i thb
  114.66 +            (false, tha, Thm.nprems_of tha) i thb
  114.67             |> Seq.list_of |> distinct Thm.eq_thm of
  114.68          [th] => th
  114.69        | _ =>
  114.70 @@ -207,13 +207,13 @@
  114.71        let
  114.72          val thy = Proof_Context.theory_of ctxt
  114.73          val ps = []
  114.74 -          |> fold (Term.add_vars o prop_of) [tha, thb]
  114.75 +          |> fold (Term.add_vars o Thm.prop_of) [tha, thb]
  114.76            |> AList.group (op =)
  114.77            |> maps (fn ((s, _), T :: Ts) => map (fn T' => (Free (s, T), Free (s, T'))) Ts)
  114.78            |> rpair (Envir.empty ~1)
  114.79            |-> fold (Pattern.unify (Context.Proof ctxt))
  114.80            |> Envir.type_env |> Vartab.dest
  114.81 -          |> map (fn (x, (S, T)) => apply2 (ctyp_of thy) (TVar (x, S), T))
  114.82 +          |> map (fn (x, (S, T)) => apply2 (Thm.ctyp_of thy) (TVar (x, S), T))
  114.83        in
  114.84          (* The unifier, which is invoked from "Thm.bicompose", will sometimes refuse to unify
  114.85             "?a::?'a" with "?a::?'b" or "?a::nat" and throw a "TERM" exception (with "add_ffpair" as
  114.86 @@ -248,7 +248,7 @@
  114.87  
  114.88  (* Permute a rule's premises to move the i-th premise to the last position. *)
  114.89  fun make_last i th =
  114.90 -  let val n = nprems_of th in
  114.91 +  let val n = Thm.nprems_of th in
  114.92      if i >= 1 andalso i <= n then Thm.permute_prems (i - 1) 1 th
  114.93      else raise THM ("select_literal", i, [th])
  114.94    end
  114.95 @@ -259,7 +259,7 @@
  114.96     don't use this trick in general because it makes the proof object uglier than
  114.97     necessary. FIXME. *)
  114.98  fun negate_head ctxt th =
  114.99 -  if exists (fn t => t aconv @{prop "~ False"}) (prems_of th) then
 114.100 +  if exists (fn t => t aconv @{prop "~ False"}) (Thm.prems_of th) then
 114.101      (th RS @{thm select_FalseI})
 114.102      |> fold (rewrite_rule ctxt o single) @{thms not_atomize_select atomize_not_select}
 114.103    else
 114.104 @@ -286,11 +286,11 @@
 114.105            singleton (hol_terms_of_metis ctxt type_enc concealed sym_tab) (Metis_Term.Fn atom)
 114.106          val _ = trace_msg ctxt (fn () => "  atom: " ^ Syntax.string_of_term ctxt i_atom)
 114.107        in
 114.108 -        (case index_of_literal (s_not i_atom) (prems_of i_th1) of
 114.109 +        (case index_of_literal (s_not i_atom) (Thm.prems_of i_th1) of
 114.110            0 => (trace_msg ctxt (fn () => "Failed to find literal in \"th1\""); i_th1)
 114.111          | j1 =>
 114.112            (trace_msg ctxt (fn () => "  index th1: " ^ string_of_int j1);
 114.113 -           (case index_of_literal i_atom (prems_of i_th2) of
 114.114 +           (case index_of_literal i_atom (Thm.prems_of i_th2) of
 114.115               0 => (trace_msg ctxt (fn () => "Failed to find literal in \"th2\""); i_th2)
 114.116             | j2 =>
 114.117               (trace_msg ctxt (fn () => "  index th2: " ^ string_of_int j2);
 114.118 @@ -303,7 +303,7 @@
 114.119  
 114.120  val REFL_THM = Thm.incr_indexes 2 @{lemma "t ~= t ==> False" by simp}
 114.121  
 114.122 -val refl_x = cterm_of @{theory} (Var (hd (Term.add_vars (prop_of REFL_THM) [])));
 114.123 +val refl_x = Thm.cterm_of @{theory} (Var (hd (Term.add_vars (Thm.prop_of REFL_THM) [])));
 114.124  val refl_idx = 1 + Thm.maxidx_of REFL_THM;
 114.125  
 114.126  fun refl_inference ctxt type_enc concealed sym_tab t =
 114.127 @@ -374,8 +374,8 @@
 114.128        val imax = maxidx_of_term (i_tm $ tm_abs $ tm_subst)  (*ill-typed but gives right max*)
 114.129        val subst' = Thm.incr_indexes (imax+1) (if pos then subst_em else ssubst_em)
 114.130        val _ = trace_msg ctxt (fn () => "subst' " ^ Display.string_of_thm ctxt subst')
 114.131 -      val eq_terms = map (apply2 (cterm_of thy))
 114.132 -        (ListPair.zip (Misc_Legacy.term_vars (prop_of subst'), [tm_abs, tm_subst, i_tm]))
 114.133 +      val eq_terms = map (apply2 (Thm.cterm_of thy))
 114.134 +        (ListPair.zip (Misc_Legacy.term_vars (Thm.prop_of subst'), [tm_abs, tm_subst, i_tm]))
 114.135    in
 114.136      cterm_instantiate eq_terms subst'
 114.137    end
 114.138 @@ -399,9 +399,9 @@
 114.139      [] => th
 114.140    | pairs =>
 114.141      let
 114.142 -      val thy = theory_of_thm th
 114.143 -      val cert = cterm_of thy
 114.144 -      val certT = ctyp_of thy
 114.145 +      val thy = Thm.theory_of_thm th
 114.146 +      val cert = Thm.cterm_of thy
 114.147 +      val certT = Thm.ctyp_of thy
 114.148        val (tyenv, tenv) = fold (Pattern.first_order_match thy) pairs (Vartab.empty, Vartab.empty)
 114.149  
 114.150        fun mkT (v, (S, T)) = (certT (TVar (v, S)), certT T)
 114.151 @@ -429,13 +429,13 @@
 114.152    let
 114.153      val num_metis_lits =
 114.154        count is_metis_literal_genuine (Metis_LiteralSet.toList (Metis_Thm.clause fol_th))
 114.155 -    val num_isabelle_lits = count is_isabelle_literal_genuine (prems_of th)
 114.156 +    val num_isabelle_lits = count is_isabelle_literal_genuine (Thm.prems_of th)
 114.157    in
 114.158      if num_metis_lits >= num_isabelle_lits then
 114.159        th
 114.160      else
 114.161        let
 114.162 -        val (prems0, concl) = th |> prop_of |> Logic.strip_horn
 114.163 +        val (prems0, concl) = th |> Thm.prop_of |> Logic.strip_horn
 114.164          val prems = prems0 |> map normalize_literal |> distinct Term.aconv_untyped
 114.165          val goal = Logic.list_implies (prems, concl)
 114.166          val ctxt' = fold Thm.declare_hyps (#hyps (Thm.crep_thm th)) ctxt
 114.167 @@ -454,7 +454,7 @@
 114.168  
 114.169  fun replay_one_inference ctxt type_enc concealed sym_tab (fol_th, inf)
 114.170                           th_pairs =
 114.171 -  if not (null th_pairs) andalso prop_of (snd (hd th_pairs)) aconv @{prop False} then
 114.172 +  if not (null th_pairs) andalso Thm.prop_of (snd (hd th_pairs)) aconv @{prop False} then
 114.173      (* Isabelle sometimes identifies literals (premises) that are distinct in
 114.174         Metis (e.g., because of type variables). We give the Isabelle proof the
 114.175         benefice of the doubt. *)
 114.176 @@ -481,7 +481,7 @@
 114.177     where the nonvariables are goal parameters. *)
 114.178  fun unify_first_prem_with_concl thy i th =
 114.179    let
 114.180 -    val goal = Logic.get_goal (prop_of th) i |> Envir.beta_eta_contract
 114.181 +    val goal = Logic.get_goal (Thm.prop_of th) i |> Envir.beta_eta_contract
 114.182      val prem = goal |> Logic.strip_assums_hyp |> hd
 114.183      val concl = goal |> Logic.strip_assums_concl
 114.184  
 114.185 @@ -522,7 +522,7 @@
 114.186        | _ => I)
 114.187  
 114.188      val t_inst =
 114.189 -      [] |> try (unify_terms (prem, concl) #> map (apply2 (cterm_of thy)))
 114.190 +      [] |> try (unify_terms (prem, concl) #> map (apply2 (Thm.cterm_of thy)))
 114.191           |> the_default [] (* FIXME *)
 114.192    in
 114.193      cterm_instantiate t_inst th
 114.194 @@ -543,7 +543,7 @@
 114.195    let
 114.196      val thy = Proof_Context.theory_of ctxt
 114.197  
 114.198 -    val params = Logic.strip_params (Logic.get_goal (prop_of st) i) |> rev
 114.199 +    val params = Logic.strip_params (Logic.get_goal (Thm.prop_of st) i) |> rev
 114.200  
 114.201      fun repair (t as (Var ((s, _), _))) =
 114.202          (case find_index (fn (s', _) => s' = s) params of
 114.203 @@ -561,7 +561,7 @@
 114.204      val t' = t |> repair |> fold (absdummy o snd) params
 114.205  
 114.206      fun do_instantiate th =
 114.207 -      (case Term.add_vars (prop_of th) []
 114.208 +      (case Term.add_vars (Thm.prop_of th) []
 114.209              |> filter_out ((Meson_Clausify.is_zapped_var_name orf is_metis_fresh_variable) o fst
 114.210                o fst) of
 114.211          [] => th
 114.212 @@ -576,8 +576,9 @@
 114.213              Envir.Envir {maxidx = Vartab.fold (Integer.max o snd o fst) tyenv 0,
 114.214                tenv = Vartab.empty, tyenv = tyenv}
 114.215            val ty_inst =
 114.216 -            Vartab.fold (fn (x, (S, T)) => cons (apply2 (ctyp_of thy) (TVar (x, S), T))) tyenv []
 114.217 -          val t_inst = [apply2 (cterm_of thy o Envir.norm_term env) (Var var, t')]
 114.218 +            Vartab.fold (fn (x, (S, T)) => cons (apply2 (Thm.ctyp_of thy) (TVar (x, S), T)))
 114.219 +              tyenv []
 114.220 +          val t_inst = [apply2 (Thm.cterm_of thy o Envir.norm_term env) (Var var, t')]
 114.221          in
 114.222            Drule.instantiate_normalize (ty_inst, t_inst) th
 114.223          end
 114.224 @@ -639,7 +640,7 @@
 114.225     specified axioms. The axioms have leading "All" and "Ex" quantifiers, which
 114.226     must be eliminated first. *)
 114.227  fun discharge_skolem_premises ctxt axioms prems_imp_false =
 114.228 -  if prop_of prems_imp_false aconv @{prop False} then
 114.229 +  if Thm.prop_of prems_imp_false aconv @{prop False} then
 114.230      prems_imp_false
 114.231    else
 114.232      let
 114.233 @@ -685,7 +686,7 @@
 114.234              clusters_in_term true t |> cluster_no > 1 ? cons (ax_no, cluster_no - 1))
 114.235          | _ => raise TERM ("discharge_skolem_premises: Expected Var", [var]))
 114.236  
 114.237 -      val prems = Logic.strip_imp_prems (prop_of prems_imp_false)
 114.238 +      val prems = Logic.strip_imp_prems (Thm.prop_of prems_imp_false)
 114.239        val substs = prems |> map2 subst_info_of_prem (1 upto length prems)
 114.240                           |> sort (int_ord o apply2 fst)
 114.241        val depss = maps (map_filter deps_of_term_subst o snd o snd o snd) substs
   115.1 --- a/src/HOL/Tools/Metis/metis_tactic.ML	Tue Mar 03 19:08:04 2015 +0100
   115.2 +++ b/src/HOL/Tools/Metis/metis_tactic.ML	Wed Mar 04 19:53:18 2015 +0100
   115.3 @@ -33,7 +33,7 @@
   115.4  
   115.5  (* Designed to work also with monomorphic instances of polymorphic theorems. *)
   115.6  fun have_common_thm ths1 ths2 =
   115.7 -  exists (member (Term.aconv_untyped o apply2 prop_of) ths1) (map Meson.make_meta_clause ths2)
   115.8 +  exists (member (Term.aconv_untyped o apply2 Thm.prop_of) ths1) (map Meson.make_meta_clause ths2)
   115.9  
  115.10  (*Determining which axiom clauses are actually used*)
  115.11  fun used_axioms axioms (th, Metis_Proof.Axiom _) = SOME (lookth axioms th)
  115.12 @@ -48,12 +48,12 @@
  115.13      (case hol_clause_of_metis ctxt type_enc sym_tab concealed mth of
  115.14        Const (@{const_name HOL.eq}, _) $ _ $ t =>
  115.15        let
  115.16 -        val ct = cterm_of thy t
  115.17 -        val cT = ctyp_of_term ct
  115.18 +        val ct = Thm.cterm_of thy t
  115.19 +        val cT = Thm.ctyp_of_term ct
  115.20        in refl |> Drule.instantiate' [SOME cT] [SOME ct] end
  115.21      | Const (@{const_name disj}, _) $ t1 $ t2 =>
  115.22        (if can HOLogic.dest_not t1 then t2 else t1)
  115.23 -      |> HOLogic.mk_Trueprop |> cterm_of thy |> Thm.trivial
  115.24 +      |> HOLogic.mk_Trueprop |> Thm.cterm_of thy |> Thm.trivial
  115.25      | _ => raise Fail "expected reflexive or trivial clause")
  115.26    end
  115.27    |> Meson.make_meta_clause
  115.28 @@ -63,7 +63,7 @@
  115.29      val thy = Proof_Context.theory_of ctxt
  115.30      val tac = rewrite_goals_tac ctxt @{thms lambda_def [abs_def]} THEN resolve_tac ctxt [refl] 1
  115.31      val t = hol_clause_of_metis ctxt type_enc sym_tab concealed mth
  115.32 -    val ct = cterm_of thy (HOLogic.mk_Trueprop t)
  115.33 +    val ct = Thm.cterm_of thy (HOLogic.mk_Trueprop t)
  115.34    in Goal.prove_internal ctxt [] ct (K tac) |> Meson.make_meta_clause end
  115.35  
  115.36  fun add_vars_and_frees (t $ u) = fold (add_vars_and_frees) [t, u]
  115.37 @@ -73,16 +73,16 @@
  115.38    | add_vars_and_frees _ = I
  115.39  
  115.40  fun introduce_lam_wrappers ctxt th =
  115.41 -  if Meson_Clausify.is_quasi_lambda_free (prop_of th) then
  115.42 +  if Meson_Clausify.is_quasi_lambda_free (Thm.prop_of th) then
  115.43      th
  115.44    else
  115.45      let
  115.46        val thy = Proof_Context.theory_of ctxt
  115.47        fun conv first ctxt ct =
  115.48 -        if Meson_Clausify.is_quasi_lambda_free (term_of ct) then
  115.49 +        if Meson_Clausify.is_quasi_lambda_free (Thm.term_of ct) then
  115.50            Thm.reflexive ct
  115.51          else
  115.52 -          (case term_of ct of
  115.53 +          (case Thm.term_of ct of
  115.54              Abs (_, _, u) =>
  115.55              if first then
  115.56                (case add_vars_and_frees u [] of
  115.57 @@ -90,18 +90,18 @@
  115.58                  Conv.abs_conv (conv false o snd) ctxt ct
  115.59                  |> (fn th => Meson.first_order_resolve th @{thm Metis.eq_lambdaI})
  115.60                | v :: _ =>
  115.61 -                Abs (Name.uu, fastype_of v, abstract_over (v, term_of ct)) $ v
  115.62 -                |> cterm_of thy
  115.63 +                Abs (Name.uu, fastype_of v, abstract_over (v, Thm.term_of ct)) $ v
  115.64 +                |> Thm.cterm_of thy
  115.65                  |> Conv.comb_conv (conv true ctxt))
  115.66              else
  115.67                Conv.abs_conv (conv false o snd) ctxt ct
  115.68            | Const (@{const_name Meson.skolem}, _) $ _ => Thm.reflexive ct
  115.69            | _ => Conv.comb_conv (conv true ctxt) ct)
  115.70 -      val eq_th = conv true ctxt (cprop_of th)
  115.71 +      val eq_th = conv true ctxt (Thm.cprop_of th)
  115.72        (* We replace the equation's left-hand side with a beta-equivalent term
  115.73           so that "Thm.equal_elim" works below. *)
  115.74 -      val t0 $ _ $ t2 = prop_of eq_th
  115.75 -      val eq_ct = t0 $ prop_of th $ t2 |> cterm_of thy
  115.76 +      val t0 $ _ $ t2 = Thm.prop_of eq_th
  115.77 +      val eq_ct = t0 $ Thm.prop_of th $ t2 |> Thm.cterm_of thy
  115.78        val eq_th' = Goal.prove_internal ctxt [] eq_ct (K (resolve_tac ctxt [eq_th] 1))
  115.79      in Thm.equal_elim eq_th' th end
  115.80  
  115.81 @@ -189,7 +189,7 @@
  115.82             ("Falling back on " ^ quote (metis_call (hd fallback_type_encs) lam_trans) ^ "...");
  115.83         FOL_SOLVE unused fallback_type_encs lam_trans ctxt cls ths0)
  115.84    in
  115.85 -    (case filter (fn t => prop_of t aconv @{prop False}) cls of
  115.86 +    (case filter (fn t => Thm.prop_of t aconv @{prop False}) cls of
  115.87         false_th :: _ => [false_th RS @{thm FalseE}]
  115.88       | [] =>
  115.89       (case Metis_Resolution.loop (Metis_Resolution.new (resolution_params ordering)
  115.90 @@ -197,7 +197,7 @@
  115.91         Metis_Resolution.Contradiction mth =>
  115.92         let
  115.93           val _ = trace_msg ctxt (fn () => "METIS RECONSTRUCTION START: " ^ Metis_Thm.toString mth)
  115.94 -         val ctxt' = fold Variable.declare_constraints (map prop_of cls) ctxt
  115.95 +         val ctxt' = fold Variable.declare_constraints (map Thm.prop_of cls) ctxt
  115.96                        (*add constraints arising from converting goal to clause form*)
  115.97           val proof = Metis_Proof.proof mth
  115.98           val result = fold (replay_one_inference ctxt' type_enc concealed sym_tab) proof axioms
  115.99 @@ -243,7 +243,7 @@
 115.100  
 115.101  fun preskolem_tac ctxt st0 =
 115.102    (if exists (Meson.has_too_many_clauses ctxt)
 115.103 -             (Logic.prems_of_goal (prop_of st0) 1) then
 115.104 +             (Logic.prems_of_goal (Thm.prop_of st0) 1) then
 115.105       Simplifier.full_simp_tac (Meson_Clausify.ss_only @{thms not_all not_ex} ctxt) 1
 115.106       THEN CNF.cnfx_rewrite_tac ctxt 1
 115.107     else
 115.108 @@ -269,7 +269,7 @@
 115.109     prevent "Subgoal.FOCUS" from freezing the type variables. We don't do it for nonschematic facts
 115.110     "X" because this breaks a few proofs (in the rare and subtle case where a proof relied on
 115.111     extensionality not being applied) and brings few benefits. *)
 115.112 -val has_tvar = exists_type (exists_subtype (fn TVar _ => true | _ => false)) o prop_of
 115.113 +val has_tvar = exists_type (exists_subtype (fn TVar _ => true | _ => false)) o Thm.prop_of
 115.114  
 115.115  fun metis_method ((override_type_encs, lam_trans), ths) ctxt facts =
 115.116    let val (schem_facts, nonschem_facts) = List.partition has_tvar facts in
   116.1 --- a/src/HOL/Tools/Nitpick/nitpick.ML	Tue Mar 03 19:08:04 2015 +0100
   116.2 +++ b/src/HOL/Tools/Nitpick/nitpick.ML	Wed Mar 04 19:53:18 2015 +0100
   116.3 @@ -1065,14 +1065,14 @@
   116.4  fun pick_nits_in_subgoal state params mode i step =
   116.5    let
   116.6      val ctxt = Proof.context_of state
   116.7 -    val t = state |> Proof.raw_goal |> #goal |> prop_of
   116.8 +    val t = state |> Proof.raw_goal |> #goal |> Thm.prop_of
   116.9    in
  116.10      case Logic.count_prems t of
  116.11        0 => (writeln "No subgoal!"; (noneN, []))
  116.12      | n =>
  116.13        let
  116.14          val t = Logic.goal_params t i |> fst
  116.15 -        val assms = map term_of (Assumption.all_assms_of ctxt)
  116.16 +        val assms = map Thm.term_of (Assumption.all_assms_of ctxt)
  116.17          val (subst, assms, t) = extract_fixed_frees ctxt (assms, t)
  116.18        in pick_nits_in_term state params mode i n step subst [] assms t end
  116.19    end
   117.1 --- a/src/HOL/Tools/Nitpick/nitpick_hol.ML	Tue Mar 03 19:08:04 2015 +0100
   117.2 +++ b/src/HOL/Tools/Nitpick/nitpick_hol.ML	Wed Mar 04 19:53:18 2015 +0100
   117.3 @@ -598,7 +598,7 @@
   117.4       {Rep, Abs_inverse, Rep_inverse, ...}) :: _ =>
   117.5      SOME {abs_type = Logic.varifyT_global abs_type,
   117.6            rep_type = Logic.varifyT_global rep_type, Abs_name = Abs_name,
   117.7 -          Rep_name = Rep_name, prop_of_Rep = prop_of Rep,
   117.8 +          Rep_name = Rep_name, prop_of_Rep = Thm.prop_of Rep,
   117.9            Abs_inverse = SOME Abs_inverse, Rep_inverse = SOME Rep_inverse}
  117.10    | _ => NONE
  117.11  
  117.12 @@ -805,7 +805,7 @@
  117.13        val {qtyp, equiv_rel, equiv_thm, ...} =
  117.14          the (Quotient_Info.lookup_quotients thy s)
  117.15        val partial =
  117.16 -        case prop_of equiv_thm of
  117.17 +        case Thm.prop_of equiv_thm of
  117.18            @{const Trueprop} $ (Const (@{const_name equivp}, _) $ _) => false
  117.19          | @{const Trueprop} $ (Const (@{const_name part_equivp}, _) $ _) => true
  117.20          | _ => raise NOT_SUPPORTED "Ill-formed quotient type equivalence \
  117.21 @@ -1349,7 +1349,7 @@
  117.22    in
  117.23      Theory.nodes_of thy
  117.24      |> maps Thm.axioms_of
  117.25 -    |> map (apsnd (subst_atomic subst o prop_of))
  117.26 +    |> map (apsnd (subst_atomic subst o Thm.prop_of))
  117.27      |> sort (fast_string_ord o apply2 fst)
  117.28      |> Ord_List.inter (fast_string_ord o apsnd fst) def_names
  117.29      |> map snd
  117.30 @@ -1364,8 +1364,8 @@
  117.31    ctxt |> Spec_Rules.get
  117.32         |> filter (curry (op =) Spec_Rules.Unknown o fst)
  117.33         |> maps (snd o snd)
  117.34 -       |> filter_out (is_built_in_theory o theory_of_thm)
  117.35 -       |> map (subst_atomic subst o prop_of)
  117.36 +       |> filter_out (is_built_in_theory o Thm.theory_of_thm)
  117.37 +       |> map (subst_atomic subst o Thm.prop_of)
  117.38  
  117.39  fun arity_of_built_in_const (s, T) =
  117.40    if s = @{const_name If} then
  117.41 @@ -1928,7 +1928,7 @@
  117.42  
  117.43  fun const_def_tables ctxt subst ts =
  117.44    (def_table_for
  117.45 -    (map prop_of (rev (Named_Theorems.get ctxt @{named_theorems nitpick_unfold}))) subst,
  117.46 +    (map Thm.prop_of (rev (Named_Theorems.get ctxt @{named_theorems nitpick_unfold}))) subst,
  117.47     fold (fn (s, t) => Symtab.map_default (s, []) (cons t))
  117.48          (map pair_for_prop ts) Symtab.empty)
  117.49  
  117.50 @@ -1938,22 +1938,22 @@
  117.51    fold (append o paired_with_consts) ts [] |> AList.group (op =) |> Symtab.make
  117.52  
  117.53  fun const_simp_table ctxt =
  117.54 -  def_table_for (map_filter (equationalize_term ctxt "nitpick_simp" o prop_of)
  117.55 +  def_table_for (map_filter (equationalize_term ctxt "nitpick_simp" o Thm.prop_of)
  117.56      (rev (Named_Theorems.get ctxt @{named_theorems nitpick_simp})))
  117.57  
  117.58  fun const_psimp_table ctxt =
  117.59 -  def_table_for (map_filter (equationalize_term ctxt "nitpick_psimp" o prop_of)
  117.60 +  def_table_for (map_filter (equationalize_term ctxt "nitpick_psimp" o Thm.prop_of)
  117.61      (rev (Named_Theorems.get ctxt @{named_theorems nitpick_psimp})))
  117.62  
  117.63  fun const_choice_spec_table ctxt subst =
  117.64 -  map (subst_atomic subst o prop_of)
  117.65 +  map (subst_atomic subst o Thm.prop_of)
  117.66      (rev (Named_Theorems.get ctxt @{named_theorems nitpick_choice_spec}))
  117.67    |> const_nondef_table
  117.68  
  117.69  fun inductive_intro_table ctxt subst def_tables =
  117.70    let val thy = Proof_Context.theory_of ctxt in
  117.71      def_table_for
  117.72 -        (maps (map (unfold_mutually_inductive_preds thy def_tables o prop_of)
  117.73 +        (maps (map (unfold_mutually_inductive_preds thy def_tables o Thm.prop_of)
  117.74                 o snd o snd)
  117.75           (filter (fn (cat, _) => cat = Spec_Rules.Inductive orelse
  117.76                                   cat = Spec_Rules.Co_Inductive) (Spec_Rules.get ctxt))) subst
  117.77 @@ -1962,7 +1962,7 @@
  117.78  fun ground_theorem_table thy =
  117.79    fold ((fn @{const Trueprop} $ t1 =>
  117.80              is_ground_term t1 ? Inttab.map_default (hash_term t1, []) (cons t1)
  117.81 -          | _ => I) o prop_of o snd) (Global_Theory.all_thms_of thy true) Inttab.empty
  117.82 +          | _ => I) o Thm.prop_of o snd) (Global_Theory.all_thms_of thy true) Inttab.empty
  117.83  
  117.84  fun ersatz_table ctxt =
  117.85   #ersatz_table (Data.get (Context.Proof ctxt))
  117.86 @@ -1979,7 +1979,7 @@
  117.87    in
  117.88      typedef_info ctxt (fst (dest_Type abs_T)) |> the
  117.89      |> pairf #Abs_inverse #Rep_inverse
  117.90 -    |> apply2 (specialize_type thy x o prop_of o the)
  117.91 +    |> apply2 (specialize_type thy x o Thm.prop_of o the)
  117.92      ||> single |> op ::
  117.93    end
  117.94  
  117.95 @@ -2149,7 +2149,7 @@
  117.96             SOME wf => wf
  117.97           | NONE =>
  117.98             let
  117.99 -             val goal = prop |> cterm_of thy |> Goal.init
 117.100 +             val goal = prop |> Thm.cterm_of thy |> Goal.init
 117.101               val wf = exists (terminates_by ctxt tac_timeout goal)
 117.102                               termination_tacs
 117.103             in Synchronized.change cached_wf_props (cons (prop, wf)); wf end
   118.1 --- a/src/HOL/Tools/Nitpick/nitpick_model.ML	Tue Mar 03 19:08:04 2015 +0100
   118.2 +++ b/src/HOL/Tools/Nitpick/nitpick_model.ML	Wed Mar 04 19:53:18 2015 +0100
   118.3 @@ -1062,7 +1062,7 @@
   118.4              |> writeln
   118.5            else
   118.6              ()
   118.7 -        val goal = prop |> cterm_of thy |> Goal.init
   118.8 +        val goal = prop |> Thm.cterm_of thy |> Goal.init
   118.9        in
  118.10          (goal |> SINGLE (DETERM_TIMEOUT auto_timeout (auto_tac ctxt))
  118.11                |> the |> Goal.finish ctxt; true)
   119.1 --- a/src/HOL/Tools/Nitpick/nitpick_preproc.ML	Tue Mar 03 19:08:04 2015 +0100
   119.2 +++ b/src/HOL/Tools/Nitpick/nitpick_preproc.ML	Wed Mar 04 19:53:18 2015 +0100
   119.3 @@ -1025,7 +1025,7 @@
   119.4        let
   119.5          val supers = Sign.complete_sort thy S
   119.6          val class_axioms =
   119.7 -          maps (fn class => map prop_of (Axclass.get_info thy class |> #axioms
   119.8 +          maps (fn class => map Thm.prop_of (Axclass.get_info thy class |> #axioms
   119.9                                           handle ERROR _ => [])) supers
  119.10          val monomorphic_class_axioms =
  119.11            map (fn t => case Term.add_tvars t [] of
   120.1 --- a/src/HOL/Tools/Nitpick/nitpick_util.ML	Tue Mar 03 19:08:04 2015 +0100
   120.2 +++ b/src/HOL/Tools/Nitpick/nitpick_util.ML	Wed Mar 04 19:53:18 2015 +0100
   120.3 @@ -305,7 +305,7 @@
   120.4      let
   120.5        val (state, i, message) = f ()
   120.6        val ctxt = Proof.context_of state
   120.7 -      val goal = Logic.get_goal (prop_of (#goal (Proof.goal state))) i
   120.8 +      val goal = Logic.get_goal (Thm.prop_of (#goal (Proof.goal state))) i
   120.9        val hash = String.substring (SHA1.rep (SHA1.digest (hackish_string_of_term ctxt goal)), 0, 12)
  120.10      in
  120.11        File.append (Path.explode "$ISABELLE_HOME_USER/spy_nitpick")
   121.1 --- a/src/HOL/Tools/Old_Datatype/old_datatype.ML	Tue Mar 03 19:08:04 2015 +0100
   121.2 +++ b/src/HOL/Tools/Old_Datatype/old_datatype.ML	Wed Mar 04 19:53:18 2015 +0100
   121.3 @@ -27,7 +27,7 @@
   121.4  (** auxiliary **)
   121.5  
   121.6  val distinct_lemma = @{lemma "f x \<noteq> f y ==> x \<noteq> y" by iprover};
   121.7 -val (_ $ (_ $ (_ $ (distinct_f $ _) $ _))) = hd (prems_of distinct_lemma);
   121.8 +val (_ $ (_ $ (_ $ (distinct_f $ _) $ _))) = hd (Thm.prems_of distinct_lemma);
   121.9  
  121.10  fun exh_thm_of (dt_info : Old_Datatype_Aux.info Symtab.table) tname =
  121.11    #exhaust (the (Symtab.lookup dt_info tname));
  121.12 @@ -246,10 +246,10 @@
  121.13      fun dt_constr_defs (((((_, (_, _, constrs)), tname), typedef: Typedef.info), T), constr_syntax)
  121.14          (thy, defs, eqns, rep_congs, dist_lemmas) =
  121.15        let
  121.16 -        val _ $ (_ $ (cong_f $ _) $ _) = concl_of arg_cong;
  121.17 -        val rep_const = cterm_of thy (Const (#Rep_name (#1 typedef), T --> Univ_elT));
  121.18 -        val cong' = cterm_instantiate [(cterm_of thy cong_f, rep_const)] arg_cong;
  121.19 -        val dist = cterm_instantiate [(cterm_of thy distinct_f, rep_const)] distinct_lemma;
  121.20 +        val _ $ (_ $ (cong_f $ _) $ _) = Thm.concl_of arg_cong;
  121.21 +        val rep_const = Thm.cterm_of thy (Const (#Rep_name (#1 typedef), T --> Univ_elT));
  121.22 +        val cong' = cterm_instantiate [(Thm.cterm_of thy cong_f, rep_const)] arg_cong;
  121.23 +        val dist = cterm_instantiate [(Thm.cterm_of thy distinct_f, rep_const)] distinct_lemma;
  121.24          val (thy', defs', eqns', _) =
  121.25            fold (make_constr_def typedef T (length constrs))
  121.26              (constrs ~~ constr_syntax) (Sign.add_path tname thy, defs, [], 1);
  121.27 @@ -390,7 +390,7 @@
  121.28      (* prove  inj Rep_dt_i  and  Rep_dt_i x : rep_set_dt_i *)
  121.29  
  121.30      val fun_congs =
  121.31 -      map (fn T => make_elim (Drule.instantiate' [SOME (ctyp_of thy5 T)] [] fun_cong)) branchTs;
  121.32 +      map (fn T => make_elim (Drule.instantiate' [SOME (Thm.ctyp_of thy5 T)] [] fun_cong)) branchTs;
  121.33  
  121.34      fun prove_iso_thms ds (inj_thms, elem_thms) =
  121.35        let
  121.36 @@ -609,7 +609,7 @@
  121.37      val (indrule_lemma_prems, indrule_lemma_concls) =
  121.38        split_list (map2 mk_indrule_lemma descr' recTs);
  121.39  
  121.40 -    val cert = cterm_of thy6;
  121.41 +    val cert = Thm.cterm_of thy6;
  121.42  
  121.43      val indrule_lemma =
  121.44        Goal.prove_sorry_global thy6 [] []
  121.45 @@ -623,7 +623,7 @@
  121.46                [TRY (rtac conjI 1), resolve_tac ctxt Rep_inverse_thms 1,
  121.47                 etac mp 1, resolve_tac ctxt iso_elem_thms 1])]);
  121.48  
  121.49 -    val Ps = map head_of (HOLogic.dest_conj (HOLogic.dest_Trueprop (concl_of indrule_lemma)));
  121.50 +    val Ps = map head_of (HOLogic.dest_conj (HOLogic.dest_Trueprop (Thm.concl_of indrule_lemma)));
  121.51      val frees =
  121.52        if length Ps = 1 then [Free ("P", snd (dest_Var (hd Ps)))]
  121.53        else map (Free o apfst fst o dest_Var) Ps;
   122.1 --- a/src/HOL/Tools/Old_Datatype/old_datatype_aux.ML	Tue Mar 03 19:08:04 2015 +0100
   122.2 +++ b/src/HOL/Tools/Old_Datatype/old_datatype_aux.ML	Wed Mar 04 19:53:18 2015 +0100
   122.3 @@ -126,9 +126,9 @@
   122.4  
   122.5  fun ind_tac indrule indnames = CSUBGOAL (fn (cgoal, i) =>
   122.6    let
   122.7 -    val cert = cterm_of (Thm.theory_of_cterm cgoal);
   122.8 -    val goal = term_of cgoal;
   122.9 -    val ts = HOLogic.dest_conj (HOLogic.dest_Trueprop (concl_of indrule));
  122.10 +    val cert = Thm.cterm_of (Thm.theory_of_cterm cgoal);
  122.11 +    val goal = Thm.term_of cgoal;
  122.12 +    val ts = HOLogic.dest_conj (HOLogic.dest_Trueprop (Thm.concl_of indrule));
  122.13      val ts' = HOLogic.dest_conj (HOLogic.dest_Trueprop (Logic.strip_imp_concl goal));
  122.14      val getP =
  122.15        if can HOLogic.dest_imp (hd ts)
  122.16 @@ -158,16 +158,18 @@
  122.17  fun exh_tac ctxt exh_thm_of = CSUBGOAL (fn (cgoal, i) =>
  122.18    let
  122.19      val thy = Thm.theory_of_cterm cgoal;
  122.20 -    val goal = term_of cgoal;
  122.21 +    val goal = Thm.term_of cgoal;
  122.22      val params = Logic.strip_params goal;
  122.23      val (_, Type (tname, _)) = hd (rev params);
  122.24      val exhaustion = Thm.lift_rule cgoal (exh_thm_of tname);
  122.25 -    val prem' = hd (prems_of exhaustion);
  122.26 +    val prem' = hd (Thm.prems_of exhaustion);
  122.27      val _ $ (_ $ lhs $ _) = hd (rev (Logic.strip_assums_hyp prem'));
  122.28      val exhaustion' =
  122.29 -      cterm_instantiate [(cterm_of thy (head_of lhs),
  122.30 -        cterm_of thy (fold_rev (fn (_, T) => fn t => Abs ("z", T, t)) params (Bound 0)))] exhaustion;
  122.31 -  in compose_tac ctxt (false, exhaustion', nprems_of exhaustion) i end);
  122.32 +      cterm_instantiate
  122.33 +        [(Thm.cterm_of thy (head_of lhs),
  122.34 +          Thm.cterm_of thy (fold_rev (fn (_, T) => fn t => Abs ("z", T, t)) params (Bound 0)))]
  122.35 +        exhaustion;
  122.36 +  in compose_tac ctxt (false, exhaustion', Thm.nprems_of exhaustion) i end);
  122.37  
  122.38  
  122.39  (********************** Internal description of datatypes *********************)
   123.1 --- a/src/HOL/Tools/Old_Datatype/old_datatype_data.ML	Tue Mar 03 19:08:04 2015 +0100
   123.2 +++ b/src/HOL/Tools/Old_Datatype/old_datatype_data.ML	Wed Mar 04 19:53:18 2015 +0100
   123.3 @@ -87,12 +87,12 @@
   123.4  val info_of_case = Symtab.lookup o #cases o Data.get;
   123.5  
   123.6  fun ctrs_of_exhaust exhaust =
   123.7 -  Logic.strip_imp_prems (prop_of exhaust) |>
   123.8 +  Logic.strip_imp_prems (Thm.prop_of exhaust) |>
   123.9    map (head_of o snd o HOLogic.dest_eq o HOLogic.dest_Trueprop o the_single
  123.10      o Logic.strip_assums_hyp);
  123.11  
  123.12  fun case_of_case_rewrite case_rewrite =
  123.13 -  head_of (fst (HOLogic.dest_eq (HOLogic.dest_Trueprop (prop_of case_rewrite))));
  123.14 +  head_of (fst (HOLogic.dest_eq (HOLogic.dest_Trueprop (Thm.prop_of case_rewrite))));
  123.15  
  123.16  fun ctr_sugar_of_info ({exhaust, nchotomy, inject, distinct, case_rewrites, case_cong,
  123.17      case_cong_weak, split, split_asm, ...} : Old_Datatype_Aux.info) =
   124.1 --- a/src/HOL/Tools/Old_Datatype/old_rep_datatype.ML	Tue Mar 03 19:08:04 2015 +0100
   124.2 +++ b/src/HOL/Tools/Old_Datatype/old_rep_datatype.ML	Wed Mar 04 19:53:18 2015 +0100
   124.3 @@ -35,7 +35,8 @@
   124.4      val newTs = take (length (hd descr)) recTs;
   124.5  
   124.6      val maxidx = Thm.maxidx_of induct;
   124.7 -    val induct_Ps = map head_of (HOLogic.dest_conj (HOLogic.dest_Trueprop (concl_of induct)));
   124.8 +    val induct_Ps =
   124.9 +      map head_of (HOLogic.dest_conj (HOLogic.dest_Trueprop (Thm.concl_of induct)));
  124.10  
  124.11      fun prove_casedist_thm (i, (T, t)) =
  124.12        let
  124.13 @@ -45,7 +46,7 @@
  124.14            Abs ("z", T, HOLogic.imp $ HOLogic.mk_eq (Var (("a", maxidx + 1), T), Bound 0) $
  124.15              Var (("P", 0), HOLogic.boolT));
  124.16          val insts = take i dummyPs @ (P :: drop (i + 1) dummyPs);
  124.17 -        val cert = cterm_of thy;
  124.18 +        val cert = Thm.cterm_of thy;
  124.19          val insts' = map cert induct_Ps ~~ map cert insts;
  124.20          val induct' =
  124.21            refl RS
  124.22 @@ -87,7 +88,8 @@
  124.23      val used = fold Term.add_tfree_namesT recTs [];
  124.24      val newTs = take (length (hd descr)) recTs;
  124.25  
  124.26 -    val induct_Ps = map head_of (HOLogic.dest_conj (HOLogic.dest_Trueprop (concl_of induct)));
  124.27 +    val induct_Ps =
  124.28 +      map head_of (HOLogic.dest_conj (HOLogic.dest_Trueprop (Thm.concl_of induct)));
  124.29  
  124.30      val big_rec_name' = "rec_set_" ^ big_name;
  124.31      val rec_set_names' =
  124.32 @@ -202,7 +204,7 @@
  124.33              Const (@{const_name Ex1}, (T2 --> HOLogic.boolT) --> HOLogic.boolT) $
  124.34                absfree ("y", T2) (set_t $ Old_Datatype_Aux.mk_Free "x" T1 i $ Free ("y", T2)))
  124.35                  (rec_sets ~~ recTs ~~ rec_result_Ts ~~ (1 upto length recTs));
  124.36 -        val cert = cterm_of thy1;
  124.37 +        val cert = Thm.cterm_of thy1;
  124.38          val insts =
  124.39            map (fn ((i, T), t) => absfree ("x" ^ string_of_int i, T) t)
  124.40              ((1 upto length recTs) ~~ recTs ~~ rec_unique_ts);
  124.41 @@ -351,7 +353,7 @@
  124.42        map2 prove_cases newTs (Old_Datatype_Prop.make_cases case_names0 descr thy2);
  124.43  
  124.44      fun case_name_of (th :: _) =
  124.45 -      fst (dest_Const (head_of (fst (HOLogic.dest_eq (HOLogic.dest_Trueprop (prop_of th))))));
  124.46 +      fst (dest_Const (head_of (fst (HOLogic.dest_eq (HOLogic.dest_Trueprop (Thm.prop_of th))))));
  124.47  
  124.48      val case_names = map case_name_of case_thms;
  124.49    in
  124.50 @@ -377,8 +379,8 @@
  124.51  
  124.52      fun prove_split_thms ((((((t1, t2), inject), dist_rewrites'), exhaustion), case_thms'), T) =
  124.53        let
  124.54 -        val cert = cterm_of thy;
  124.55 -        val _ $ (_ $ lhs $ _) = hd (Logic.strip_assums_hyp (hd (prems_of exhaustion)));
  124.56 +        val cert = Thm.cterm_of thy;
  124.57 +        val _ $ (_ $ lhs $ _) = hd (Logic.strip_assums_hyp (hd (Thm.prems_of exhaustion)));
  124.58          val exhaustion' = cterm_instantiate [(cert lhs, cert (Free ("x", T)))] exhaustion;
  124.59          fun tac ctxt =
  124.60            EVERY [resolve_tac ctxt [exhaustion'] 1,
  124.61 @@ -448,9 +450,9 @@
  124.62        let
  124.63          val Const (@{const_name Pure.imp}, _) $ tm $ _ = t;
  124.64          val Const (@{const_name Trueprop}, _) $ (Const (@{const_name HOL.eq}, _) $ _ $ Ma) = tm;
  124.65 -        val cert = cterm_of thy;
  124.66 +        val cert = Thm.cterm_of thy;
  124.67          val nchotomy' = nchotomy RS spec;
  124.68 -        val [v] = Term.add_vars (concl_of nchotomy') [];
  124.69 +        val [v] = Term.add_vars (Thm.concl_of nchotomy') [];
  124.70          val nchotomy'' = cterm_instantiate [(cert (Var v), cert Ma)] nchotomy';
  124.71        in
  124.72          Goal.prove_sorry_global thy [] (Logic.strip_imp_prems t) (Logic.strip_imp_concl t)
   125.1 --- a/src/HOL/Tools/Predicate_Compile/code_prolog.ML	Tue Mar 03 19:08:04 2015 +0100
   125.2 +++ b/src/HOL/Tools/Predicate_Compile/code_prolog.ML	Wed Mar 04 19:53:18 2015 +0100
   125.3 @@ -319,7 +319,7 @@
   125.4  fun translate_intros ensure_groundness ctxt gr const constant_table =
   125.5    let
   125.6      val intros = map (preprocess_intro (Proof_Context.theory_of ctxt)) (Graph.get_node gr const)
   125.7 -    val (intros', ctxt') = Variable.import_terms true (map prop_of intros) ctxt
   125.8 +    val (intros', ctxt') = Variable.import_terms true (map Thm.prop_of intros) ctxt
   125.9      val constant_table' = declare_consts (fold Term.add_const_names intros' []) constant_table
  125.10      fun translate_intro intro =
  125.11        let
   126.1 --- a/src/HOL/Tools/Predicate_Compile/core_data.ML	Tue Mar 03 19:08:04 2015 +0100
   126.2 +++ b/src/HOL/Tools/Predicate_Compile/core_data.ML	Wed Mar 04 19:53:18 2015 +0100
   126.3 @@ -235,7 +235,7 @@
   126.4          fun term_pair_of (ix, (ty, t)) = (Var (ix, ty), t)
   126.5          fun inst_of_matches tts =
   126.6            fold (Pattern.match thy) tts (Vartab.empty, Vartab.empty)
   126.7 -          |> snd |> Vartab.dest |> map (apply2 (cterm_of thy) o term_pair_of)
   126.8 +          |> snd |> Vartab.dest |> map (apply2 (Thm.cterm_of thy) o term_pair_of)
   126.9          val (cases, (eqs, prems1)) = apsnd (chop (nargs - nparams)) (chop n prems)
  126.10          val case_th =
  126.11            rewrite_rule ctxt2 (@{thm Predicate.eq_is_eq} :: map meta_eq_of eqs) (nth cases (i - 1))
  126.12 @@ -247,8 +247,8 @@
  126.13            Thm.instantiate ([], inst_of_matches pats) case_th
  126.14              OF replicate nargs @{thm refl}
  126.15          val thesis =
  126.16 -          Thm.instantiate ([], inst_of_matches (prems_of case_th' ~~ map prop_of prems2)) case_th'
  126.17 -            OF prems2
  126.18 +          Thm.instantiate ([], inst_of_matches (Thm.prems_of case_th' ~~ map Thm.prop_of prems2))
  126.19 +            case_th' OF prems2
  126.20        in rtac thesis 1 end
  126.21    in
  126.22      Goal.prove ctxt (Term.add_free_names cases_rule []) [] cases_rule
  126.23 @@ -277,7 +277,7 @@
  126.24          val pos = Position.thread_data ()
  126.25          fun is_intro_of intro =
  126.26            let
  126.27 -            val (const, _) = strip_comb (HOLogic.dest_Trueprop (concl_of intro))
  126.28 +            val (const, _) = strip_comb (HOLogic.dest_Trueprop (Thm.concl_of intro))
  126.29            in (fst (dest_Const const) = name) end;
  126.30          val intros = map (preprocess_intro thy) (filter is_intro_of (#intrs result))
  126.31          val index = find_index (fn s => s = name) (#names (fst info))
  126.32 @@ -330,7 +330,7 @@
  126.33  fun set_elim thm =
  126.34    let
  126.35      val (name, _) =
  126.36 -      dest_Const (fst (strip_comb (HOLogic.dest_Trueprop (hd (prems_of thm)))))
  126.37 +      dest_Const (fst (strip_comb (HOLogic.dest_Trueprop (hd (Thm.prems_of thm)))))
  126.38    in
  126.39      PredData.map (Graph.map_node name (map_pred_data (apsnd (apfst (apfst (apsnd (K (SOME thm))))))))
  126.40    end
   127.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_aux.ML	Tue Mar 03 19:08:04 2015 +0100
   127.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_aux.ML	Wed Mar 04 19:53:18 2015 +0100
   127.3 @@ -459,13 +459,13 @@
   127.4        (Const (@{const_name Trueprop}, _) $ (Const (@{const_name HOL.eq}, _) $ _ $ _)) = true
   127.5    | is_equationlike_term _ = false
   127.6  
   127.7 -val is_equationlike = is_equationlike_term o prop_of
   127.8 +val is_equationlike = is_equationlike_term o Thm.prop_of
   127.9  
  127.10  fun is_pred_equation_term (Const (@{const_name Pure.eq}, _) $ u $ v) =
  127.11        (fastype_of u = @{typ bool}) andalso (fastype_of v = @{typ bool})
  127.12    | is_pred_equation_term _ = false
  127.13  
  127.14 -val is_pred_equation = is_pred_equation_term o prop_of
  127.15 +val is_pred_equation = is_pred_equation_term o Thm.prop_of
  127.16  
  127.17  fun is_intro_term constname t =
  127.18    the_default false (try (fn t =>
  127.19 @@ -473,7 +473,7 @@
  127.20        Const (c, _) => c = constname
  127.21      | _ => false) t)
  127.22  
  127.23 -fun is_intro constname t = is_intro_term constname (prop_of t)
  127.24 +fun is_intro constname t = is_intro_term constname (Thm.prop_of t)
  127.25  
  127.26  fun is_predT (T as Type("fun", [_, _])) = (body_type T = @{typ bool})
  127.27    | is_predT _ = false
  127.28 @@ -528,7 +528,8 @@
  127.29      val t'' = Term.subst_bounds (rev vs, t');
  127.30    in ((ps', t''), nctxt') end
  127.31  
  127.32 -val strip_intro_concl = strip_comb o HOLogic.dest_Trueprop o Logic.strip_imp_concl o prop_of
  127.33 +val strip_intro_concl =
  127.34 +  strip_comb o HOLogic.dest_Trueprop o Logic.strip_imp_concl o Thm.prop_of
  127.35  
  127.36  
  127.37  (* introduction rule combinators *)
  127.38 @@ -610,7 +611,7 @@
  127.39  (* lifting term operations to theorems *)
  127.40  
  127.41  fun map_term thy f th =
  127.42 -  Skip_Proof.make_thm thy (f (prop_of th))
  127.43 +  Skip_Proof.make_thm thy (f (Thm.prop_of th))
  127.44  
  127.45  (*
  127.46  fun equals_conv lhs_cv rhs_cv ct =
  127.47 @@ -860,23 +861,23 @@
  127.48    end
  127.49  
  127.50  fun dest_conjunct_prem th =
  127.51 -  (case HOLogic.dest_Trueprop (prop_of th) of
  127.52 +  (case HOLogic.dest_Trueprop (Thm.prop_of th) of
  127.53      (Const (@{const_name HOL.conj}, _) $ _ $ _) =>
  127.54 -      dest_conjunct_prem (th RS @{thm conjunct1})
  127.55 -        @ dest_conjunct_prem (th RS @{thm conjunct2})
  127.56 -   | _ => [th])
  127.57 +      dest_conjunct_prem (th RS @{thm conjunct1}) @
  127.58 +      dest_conjunct_prem (th RS @{thm conjunct2})
  127.59 +  | _ => [th])
  127.60  
  127.61  fun expand_tuples thy intro =
  127.62    let
  127.63      val ctxt = Proof_Context.init_global thy
  127.64      val (((T_insts, t_insts), [intro']), ctxt1) = Variable.import false [intro] ctxt
  127.65 -    val intro_t = prop_of intro'
  127.66 +    val intro_t = Thm.prop_of intro'
  127.67      val concl = Logic.strip_imp_concl intro_t
  127.68      val (_, args) = strip_comb (HOLogic.dest_Trueprop concl)
  127.69      val (pats', intro_t', ctxt2) = rewrite_args args ([], intro_t, ctxt1)
  127.70      val (pats', _, ctxt3) = fold_atoms rewrite_prem intro_t' (pats', intro_t', ctxt2)
  127.71      fun rewrite_pat (ct1, ct2) =
  127.72 -      (ct1, cterm_of thy (Pattern.rewrite_term thy pats' [] (term_of ct2)))
  127.73 +      (ct1, Thm.cterm_of thy (Pattern.rewrite_term thy pats' [] (Thm.term_of ct2)))
  127.74      val t_insts' = map rewrite_pat t_insts
  127.75      val intro'' = Thm.instantiate (T_insts, t_insts') intro
  127.76      val [intro'''] = Variable.export ctxt3 ctxt [intro'']
  127.77 @@ -939,7 +940,7 @@
  127.78    let
  127.79      val th = case_rewrite thy Tcon
  127.80      val ctxt = Proof_Context.init_global thy
  127.81 -    val f = fst (strip_comb (fst (HOLogic.dest_eq (HOLogic.dest_Trueprop (prop_of th)))))
  127.82 +    val f = fst (strip_comb (fst (HOLogic.dest_eq (HOLogic.dest_Trueprop (Thm.prop_of th)))))
  127.83      val Type ("fun", [uninst_T, uninst_T']) = fastype_of f
  127.84      val ([yname], ctxt') = Variable.add_fixes ["y"] ctxt
  127.85      val T' = TFree ("'t'", @{sort type})
  127.86 @@ -1026,7 +1027,7 @@
  127.87  (* Some last processing *)
  127.88  
  127.89  fun remove_pointless_clauses intro =
  127.90 -  if Logic.strip_imp_prems (prop_of intro) = [@{prop "False"}] then
  127.91 +  if Logic.strip_imp_prems (Thm.prop_of intro) = [@{prop "False"}] then
  127.92      []
  127.93    else [intro]
  127.94  
  127.95 @@ -1045,7 +1046,7 @@
  127.96        map_filter_premises (fn p => if p = @{prop True} then NONE else SOME p) intro_t
  127.97    in
  127.98      Option.map (Skip_Proof.make_thm thy)
  127.99 -      (process_False (process_True (prop_of (process intro))))
 127.100 +      (process_False (process_True (Thm.prop_of (process intro))))
 127.101    end
 127.102  
 127.103  
 127.104 @@ -1089,7 +1090,7 @@
 127.105          fun instantiate_ho_args th =
 127.106            let
 127.107              val (_, args') =
 127.108 -              (strip_comb o HOLogic.dest_Trueprop o Logic.strip_imp_concl o prop_of) th
 127.109 +              (strip_comb o HOLogic.dest_Trueprop o Logic.strip_imp_concl o Thm.prop_of) th
 127.110              val ho_args' = map dest_Var (ho_args_of_typ T args')
 127.111            in Thm.certify_instantiate ([], ho_args' ~~ ho_args) th end
 127.112          val outp_pred =
 127.113 @@ -1136,7 +1137,7 @@
 127.114      val (((pred, params), intros_th), ctxt1) = import_intros pred introrules ctxt
 127.115      (* TODO: distinct required ? -- test case with more than one parameter! *)
 127.116      val params = distinct (op aconv) params
 127.117 -    val intros = map prop_of intros_th
 127.118 +    val intros = map Thm.prop_of intros_th
 127.119      val ([propname], ctxt2) = Variable.variant_fixes ["thesis"] ctxt1
 127.120      val prop = HOLogic.mk_Trueprop (Free (propname, HOLogic.boolT))
 127.121      val argsT = binder_types (fastype_of pred)
   128.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_core.ML	Tue Mar 03 19:08:04 2015 +0100
   128.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_core.ML	Wed Mar 04 19:53:18 2015 +0100
   128.3 @@ -1226,7 +1226,7 @@
   128.4  fun prepare_intrs options ctxt prednames intros =
   128.5    let
   128.6      val thy = Proof_Context.theory_of ctxt
   128.7 -    val intrs = map prop_of intros
   128.8 +    val intrs = map Thm.prop_of intros
   128.9      val preds = map (fn c => Const (c, Sign.the_const_type thy c)) prednames
  128.10      val (preds, intrs) = unify_consts thy preds intrs
  128.11      val ([preds, intrs], _) = fold_burrow (Variable.import_terms false) [preds, intrs] ctxt
   129.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_data.ML	Tue Mar 03 19:08:04 2015 +0100
   129.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_data.ML	Wed Mar 04 19:53:18 2015 +0100
   129.3 @@ -72,17 +72,17 @@
   129.4      | _ => raise TERM ("defining_const_of_introrule_term failed: Not a constant", [t])
   129.5    end
   129.6  *)
   129.7 -val defining_term_of_introrule = defining_term_of_introrule_term o prop_of
   129.8 +val defining_term_of_introrule = defining_term_of_introrule_term o Thm.prop_of
   129.9  
  129.10  fun defining_const_of_introrule th =
  129.11    (case defining_term_of_introrule th of
  129.12      Const (c, _) => c
  129.13 -  | _ => raise TERM ("defining_const_of_introrule failed: Not a constant", [prop_of th]))
  129.14 +  | _ => raise TERM ("defining_const_of_introrule failed: Not a constant", [Thm.prop_of th]))
  129.15  
  129.16  (*TODO*)
  129.17  fun is_introlike_term _ = true
  129.18  
  129.19 -val is_introlike = is_introlike_term o prop_of
  129.20 +val is_introlike = is_introlike_term o Thm.prop_of
  129.21  
  129.22  fun check_equation_format_term (t as (Const (@{const_name Pure.eq}, _) $ u $ _)) =
  129.23        (case strip_comb u of
  129.24 @@ -95,19 +95,19 @@
  129.25    | check_equation_format_term t =
  129.26        raise TERM ("check_equation_format_term failed: Not an equation", [t])
  129.27  
  129.28 -val check_equation_format = check_equation_format_term o prop_of
  129.29 +val check_equation_format = check_equation_format_term o Thm.prop_of
  129.30  
  129.31  
  129.32  fun defining_term_of_equation_term (Const (@{const_name Pure.eq}, _) $ u $ _) = fst (strip_comb u)
  129.33    | defining_term_of_equation_term t =
  129.34        raise TERM ("defining_const_of_equation_term failed: Not an equation", [t])
  129.35  
  129.36 -val defining_term_of_equation = defining_term_of_equation_term o prop_of
  129.37 +val defining_term_of_equation = defining_term_of_equation_term o Thm.prop_of
  129.38  
  129.39  fun defining_const_of_equation th =
  129.40    (case defining_term_of_equation th of
  129.41      Const (c, _) => c
  129.42 -  | _ => raise TERM ("defining_const_of_equation failed: Not a constant", [prop_of th]))
  129.43 +  | _ => raise TERM ("defining_const_of_equation failed: Not a constant", [Thm.prop_of th]))
  129.44  
  129.45  
  129.46  
  129.47 @@ -115,7 +115,7 @@
  129.48  (* Normalizing equations *)
  129.49  
  129.50  fun mk_meta_equation th =
  129.51 -  (case prop_of th of
  129.52 +  (case Thm.prop_of th of
  129.53      Const (@{const_name Trueprop}, _) $ (Const (@{const_name HOL.eq}, _) $ _ $ _) =>
  129.54        th RS @{thm eq_reflection}
  129.55    | _ => th)
  129.56 @@ -124,7 +124,7 @@
  129.57  
  129.58  fun full_fun_cong_expand th =
  129.59    let
  129.60 -    val (f, args) = strip_comb (fst (Logic.dest_equals (prop_of th)))
  129.61 +    val (f, args) = strip_comb (fst (Logic.dest_equals (Thm.prop_of th)))
  129.62      val i = length (binder_types (fastype_of f)) - length args
  129.63    in funpow i (fn th => th RS meta_fun_cong) th end;
  129.64  
  129.65 @@ -137,7 +137,7 @@
  129.66    let
  129.67      val ctxt = Proof_Context.init_global thy  (* FIXME proper context!? *)
  129.68      val ((_, [th']), _) = Variable.import true [th] ctxt
  129.69 -    val t = prop_of th'
  129.70 +    val t = Thm.prop_of th'
  129.71      val frees = Term.add_frees t []
  129.72      val freenames = Term.add_free_names t []
  129.73      val nctxt = Name.make_context freenames
  129.74 @@ -269,7 +269,7 @@
  129.75          Type (Tcon, _) => can (Ctr_Sugar.dest_ctr ctxt Tcon) (Const x)
  129.76        | _ => false)
  129.77      fun defiants_of specs =
  129.78 -      fold (Term.add_consts o prop_of) specs []
  129.79 +      fold (Term.add_consts o Thm.prop_of) specs []
  129.80        |> filter_out is_datatype_constructor
  129.81        |> filter_out is_nondefining_const
  129.82        |> filter_out has_code_pred_intros
   130.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_fun.ML	Tue Mar 03 19:08:04 2015 +0100
   130.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_fun.ML	Wed Mar 04 19:53:18 2015 +0100
   130.3 @@ -169,7 +169,7 @@
   130.4            SOME raw_split_thm =>
   130.5            let
   130.6              val split_thm = prepare_split_thm (Proof_Context.init_global thy) raw_split_thm
   130.7 -            val (assms, concl) = Logic.strip_horn (prop_of split_thm)
   130.8 +            val (assms, concl) = Logic.strip_horn (Thm.prop_of split_thm)
   130.9              val (_, [split_t]) = strip_comb (HOLogic.dest_Trueprop concl)
  130.10              val t' = case_betapply thy t
  130.11              val subst = Pattern.match thy (split_t, t') (Vartab.empty, Vartab.empty)
  130.12 @@ -311,7 +311,7 @@
  130.13    let
  130.14      fun lookup_pred t = lookup thy (Fun_Pred.get thy) t
  130.15      (*val _ = tracing ("Rewriting intro " ^ Display.string_of_thm_global thy intro)*)
  130.16 -    val intro_t = Logic.unvarify_global (prop_of intro)
  130.17 +    val intro_t = Logic.unvarify_global (Thm.prop_of intro)
  130.18      val (prems, concl) = Logic.strip_horn intro_t
  130.19      val frees = map fst (Term.add_frees intro_t [])
  130.20      fun rewrite prem names =
   131.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_pred.ML	Tue Mar 03 19:08:04 2015 +0100
   131.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_pred.ML	Wed Mar 04 19:53:18 2015 +0100
   131.3 @@ -36,7 +36,7 @@
   131.4        (* TODO: contextify things - this line is to unvarify the split_thm *)
   131.5        (*val ((_, [isplit_thm]), _) =
   131.6          Variable.import true [split_thm] (Proof_Context.init_global thy)*)
   131.7 -      val (assms, concl) = Logic.strip_horn (prop_of split_thm)
   131.8 +      val (assms, concl) = Logic.strip_horn (Thm.prop_of split_thm)
   131.9        val (_, [split_t]) = strip_comb (HOLogic.dest_Trueprop concl) 
  131.10        val atom' = case_betapply thy atom
  131.11        val subst = Pattern.match thy (split_t, atom') (Vartab.empty, Vartab.empty)
  131.12 @@ -132,7 +132,7 @@
  131.13      val ctxt = Proof_Context.init_global thy  (* FIXME proper context!? *)
  131.14      val ((_, intros), ctxt') = Variable.import true intros ctxt
  131.15      val (intros', (local_defs, thy')) = (fold_map o fold_map_atoms)
  131.16 -      (flatten constname) (map prop_of intros) ([], thy)
  131.17 +      (flatten constname) (map Thm.prop_of intros) ([], thy)
  131.18      val ctxt'' = Proof_Context.transfer thy' ctxt'
  131.19      val intros'' =
  131.20        map (fn t => Goal.prove ctxt'' [] [] t (fn _ => ALLGOALS (Skip_Proof.cheat_tac ctxt''))) intros'
  131.21 @@ -147,7 +147,7 @@
  131.22      val ((_, ths'), ctxt') = Variable.import true ths ctxt
  131.23      fun introrulify' th =
  131.24        let
  131.25 -        val (lhs, rhs) = Logic.dest_equals (prop_of th)
  131.26 +        val (lhs, rhs) = Logic.dest_equals (Thm.prop_of th)
  131.27          val frees = Term.add_free_names rhs []
  131.28          val disjuncts = HOLogic.dest_disj rhs
  131.29          val nctxt = Name.make_context frees
  131.30 @@ -158,14 +158,14 @@
  131.31            in
  131.32              (ps, Logic.list_implies (prems, HOLogic.mk_Trueprop lhs))
  131.33            end
  131.34 -        val x = ((cterm_of thy) o the_single o snd o strip_comb o HOLogic.dest_Trueprop o fst o
  131.35 -          Logic.dest_implies o prop_of) @{thm exI}
  131.36 +        val x = (Thm.cterm_of thy o the_single o snd o strip_comb o HOLogic.dest_Trueprop o fst o
  131.37 +          Logic.dest_implies o Thm.prop_of) @{thm exI}
  131.38          fun prove_introrule (index, (ps, introrule)) =
  131.39            let
  131.40              val tac = Simplifier.simp_tac (put_simpset HOL_basic_ss ctxt' addsimps [th]) 1
  131.41                THEN Inductive.select_disj_tac ctxt' (length disjuncts) (index + 1) 1
  131.42                THEN (EVERY (map (fn y =>
  131.43 -                rtac (Drule.cterm_instantiate [(x, cterm_of thy (Free y))] @{thm exI}) 1) ps))
  131.44 +                rtac (Drule.cterm_instantiate [(x, Thm.cterm_of thy (Free y))] @{thm exI}) 1) ps))
  131.45                THEN REPEAT_DETERM (rtac @{thm conjI} 1 THEN assume_tac ctxt' 1)