prefer control symbol antiquotations;
authorwenzelm
Wed Dec 06 20:43:09 2017 +0100 (10 months ago)
changeset 67149e61557884799
parent 67148 d24dcac5eb4c
child 67150 ecbd8ff928c5
prefer control symbol antiquotations;
src/HOL/Deriv.thy
src/HOL/HOL.thy
src/HOL/Tools/Argo/argo_real.ML
src/HOL/Tools/Argo/argo_tactic.ML
src/HOL/Tools/Function/fun.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_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/sum_tree.ML
src/HOL/Tools/Function/termination.ML
src/HOL/Tools/Meson/meson.ML
src/HOL/Tools/Meson/meson_clausify.ML
src/HOL/Tools/Meson/meson_tactic.ML
src/HOL/Tools/Quickcheck/abstract_generators.ML
src/HOL/Tools/Quickcheck/exhaustive_generators.ML
src/HOL/Tools/Quickcheck/find_unused_assms.ML
src/HOL/Tools/Quickcheck/narrowing_generators.ML
src/HOL/Tools/Quickcheck/quickcheck_common.ML
src/HOL/Tools/Quickcheck/random_generators.ML
src/HOL/Tools/SMT/conj_disj_perm.ML
src/HOL/Tools/SMT/smt_builtin.ML
src/HOL/Tools/SMT/smt_config.ML
src/HOL/Tools/SMT/smt_datatypes.ML
src/HOL/Tools/SMT/smt_normalize.ML
src/HOL/Tools/SMT/smt_translate.ML
src/HOL/Tools/arith_data.ML
src/HOL/Tools/boolean_algebra_cancel.ML
src/HOL/Tools/choice_specification.ML
src/HOL/Tools/cnf.ML
src/HOL/Tools/code_evaluation.ML
src/HOL/Tools/coinduction.ML
src/HOL/Tools/functor.ML
src/HOL/Tools/groebner.ML
src/HOL/Tools/group_cancel.ML
src/HOL/Tools/hologic.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/lin_arith.ML
src/HOL/Tools/monomorph.ML
src/HOL/Tools/nat_arith.ML
src/HOL/Tools/record.ML
src/HOL/Tools/sat.ML
src/HOL/Tools/split_rule.ML
src/HOL/Tools/try0.ML
src/HOL/Tools/typedef.ML
src/HOL/Tools/value_command.ML
src/HOL/Topological_Spaces.thy
src/Tools/atomize_elim.ML
src/Tools/case_product.ML
src/Tools/coherent.ML
src/Tools/eqsubst.ML
src/Tools/induct.ML
src/Tools/induct_tacs.ML
src/Tools/induction.ML
src/Tools/nbe.ML
src/Tools/quickcheck.ML
src/Tools/solve_direct.ML
src/Tools/subtyping.ML
src/Tools/try.ML
     1.1 --- a/src/HOL/Deriv.thy	Wed Dec 06 19:34:59 2017 +0100
     1.2 +++ b/src/HOL/Deriv.thy	Wed Dec 06 20:43:09 2017 +0100
     1.3 @@ -51,7 +51,7 @@
     1.4      fun eq_rule thm = get_first (try (fn eq_thm => eq_thm OF [thm])) eq_thms
     1.5    in
     1.6      Global_Theory.add_thms_dynamic
     1.7 -      (@{binding derivative_eq_intros},
     1.8 +      (\<^binding>\<open>derivative_eq_intros\<close>,
     1.9          fn context =>
    1.10            Named_Theorems.get (Context.proof_of context) @{named_theorems derivative_intros}
    1.11            |> map_filter eq_rule)
     2.1 --- a/src/HOL/HOL.thy	Wed Dec 06 19:34:59 2017 +0100
     2.2 +++ b/src/HOL/HOL.thy	Wed Dec 06 20:43:09 2017 +0100
     2.3 @@ -28,23 +28,23 @@
     2.4  ML_file "~~/src/Provers/quantifier1.ML"
     2.5  ML_file "~~/src/Tools/atomize_elim.ML"
     2.6  ML_file "~~/src/Tools/cong_tac.ML"
     2.7 -ML_file "~~/src/Tools/intuitionistic.ML" setup \<open>Intuitionistic.method_setup @{binding iprover}\<close>
     2.8 +ML_file "~~/src/Tools/intuitionistic.ML" setup \<open>Intuitionistic.method_setup \<^binding>\<open>iprover\<close>\<close>
     2.9  ML_file "~~/src/Tools/project_rule.ML"
    2.10  ML_file "~~/src/Tools/subtyping.ML"
    2.11  ML_file "~~/src/Tools/case_product.ML"
    2.12  
    2.13  
    2.14 -ML \<open>Plugin_Name.declare_setup @{binding extraction}\<close>
    2.15 +ML \<open>Plugin_Name.declare_setup \<^binding>\<open>extraction\<close>\<close>
    2.16  
    2.17  ML \<open>
    2.18 -  Plugin_Name.declare_setup @{binding quickcheck_random};
    2.19 -  Plugin_Name.declare_setup @{binding quickcheck_exhaustive};
    2.20 -  Plugin_Name.declare_setup @{binding quickcheck_bounded_forall};
    2.21 -  Plugin_Name.declare_setup @{binding quickcheck_full_exhaustive};
    2.22 -  Plugin_Name.declare_setup @{binding quickcheck_narrowing};
    2.23 +  Plugin_Name.declare_setup \<^binding>\<open>quickcheck_random\<close>;
    2.24 +  Plugin_Name.declare_setup \<^binding>\<open>quickcheck_exhaustive\<close>;
    2.25 +  Plugin_Name.declare_setup \<^binding>\<open>quickcheck_bounded_forall\<close>;
    2.26 +  Plugin_Name.declare_setup \<^binding>\<open>quickcheck_full_exhaustive\<close>;
    2.27 +  Plugin_Name.declare_setup \<^binding>\<open>quickcheck_narrowing\<close>;
    2.28  \<close>
    2.29  ML \<open>
    2.30 -  Plugin_Name.define_setup @{binding quickcheck}
    2.31 +  Plugin_Name.define_setup \<^binding>\<open>quickcheck\<close>
    2.32     [@{plugin quickcheck_exhaustive},
    2.33      @{plugin quickcheck_random},
    2.34      @{plugin quickcheck_bounded_forall},
    2.35 @@ -66,7 +66,7 @@
    2.36  
    2.37  subsubsection \<open>Core syntax\<close>
    2.38  
    2.39 -setup \<open>Axclass.class_axiomatization (@{binding type}, [])\<close>
    2.40 +setup \<open>Axclass.class_axiomatization (\<^binding>\<open>type\<close>, [])\<close>
    2.41  default_sort type
    2.42  setup \<open>Object_Logic.add_base_sort @{sort type}\<close>
    2.43  
     3.1 --- a/src/HOL/Tools/Argo/argo_real.ML	Wed Dec 06 19:34:59 2017 +0100
     3.2 +++ b/src/HOL/Tools/Argo/argo_real.ML	Wed Dec 06 20:43:09 2017 +0100
     3.3 @@ -9,7 +9,7 @@
     3.4  
     3.5  (* translating input terms *)
     3.6  
     3.7 -fun trans_type _ @{typ Real.real} tcx = SOME (Argo_Expr.Real, tcx)
     3.8 +fun trans_type _ \<^typ>\<open>Real.real\<close> tcx = SOME (Argo_Expr.Real, tcx)
     3.9    | trans_type _ _ _ = NONE
    3.10  
    3.11  fun trans_term f (@{const Groups.uminus_class.uminus (real)} $ t) tcx =
    3.12 @@ -34,7 +34,7 @@
    3.13        tcx |> f t1 ||>> f t2 |>> uncurry Argo_Expr.mk_le |> SOME
    3.14    | trans_term _ t tcx =
    3.15        (case try HOLogic.dest_number t of
    3.16 -        SOME (@{typ Real.real}, n) => SOME (Argo_Expr.mk_num (Rat.of_int n), tcx)
    3.17 +        SOME (\<^typ>\<open>Real.real\<close>, n) => SOME (Argo_Expr.mk_num (Rat.of_int n), tcx)
    3.18        | _ => NONE)
    3.19  
    3.20  
    3.21 @@ -47,7 +47,7 @@
    3.22  fun mk_le t1 t2 = @{const Orderings.ord_class.less_eq (real)} $ t1 $ t2
    3.23  fun mk_lt t1 t2 = @{const Orderings.ord_class.less (real)} $ t1 $ t2
    3.24  
    3.25 -fun mk_real_num i = HOLogic.mk_number @{typ Real.real} i
    3.26 +fun mk_real_num i = HOLogic.mk_number \<^typ>\<open>Real.real\<close> i
    3.27  
    3.28  fun mk_number n =
    3.29    let val (p, q) = Rat.dest n
    3.30 @@ -93,7 +93,7 @@
    3.31  fun inv_num_conv ctxt = nums_conv mk_divide (fn (_, n) => Rat.inv n) ctxt @1
    3.32  
    3.33  fun cmp_nums_conv ctxt b ct =
    3.34 -  let val t = if b then @{const HOL.True} else @{const HOL.False}
    3.35 +  let val t = if b then \<^const>\<open>HOL.True\<close> else \<^const>\<open>HOL.False\<close>
    3.36    in simp_conv ctxt (HOLogic.mk_eq (Thm.term_of ct, t)) ct end
    3.37  
    3.38  local
     4.1 --- a/src/HOL/Tools/Argo/argo_tactic.ML	Wed Dec 06 19:34:59 2017 +0100
     4.2 +++ b/src/HOL/Tools/Argo/argo_tactic.ML	Wed Dec 06 20:43:09 2017 +0100
     4.3 @@ -62,7 +62,7 @@
     4.4    | requires_mode Basic = [Basic, Full]
     4.5    | requires_mode Full = [Full]
     4.6  
     4.7 -val trace = Attrib.setup_config_string @{binding argo_trace} (K (string_of_mode None))
     4.8 +val trace = Attrib.setup_config_string \<^binding>\<open>argo_trace\<close> (K (string_of_mode None))
     4.9  
    4.10  fun allows_mode ctxt = exists (equal (Config.get ctxt trace) o string_of_mode) o requires_mode
    4.11  
    4.12 @@ -77,7 +77,7 @@
    4.13  
    4.14  (* timeout *)
    4.15  
    4.16 -val timeout = Attrib.setup_config_real @{binding argo_timeout} (K 10.0)
    4.17 +val timeout = Attrib.setup_config_real \<^binding>\<open>argo_timeout\<close> (K 10.0)
    4.18  
    4.19  fun time_of_timeout ctxt = Time.fromReal (Config.get ctxt timeout)
    4.20  
    4.21 @@ -144,8 +144,8 @@
    4.22      SOME ty => (ty, tcx)
    4.23    | NONE => add_new_type T tcx)
    4.24  
    4.25 -fun trans_type _ @{typ HOL.bool} = pair Argo_Expr.Bool
    4.26 -  | trans_type ctxt (Type (@{type_name "fun"}, [T1, T2])) =
    4.27 +fun trans_type _ \<^typ>\<open>HOL.bool\<close> = pair Argo_Expr.Bool
    4.28 +  | trans_type ctxt (Type (\<^type_name>\<open>fun\<close>, [T1, T2])) =
    4.29        trans_type ctxt T1 ##>> trans_type ctxt T2 #>> Argo_Expr.Func
    4.30    | trans_type ctxt T = (fn tcx =>
    4.31        (case ext_trans_type ctxt (trans_type ctxt) T tcx of
    4.32 @@ -164,22 +164,22 @@
    4.33      SOME c => (Argo_Expr.mk_con c, tcx)
    4.34    | NONE => add_new_term ctxt t (Term.fastype_of t) tcx)
    4.35  
    4.36 -fun mk_eq @{typ HOL.bool} = Argo_Expr.mk_iff
    4.37 +fun mk_eq \<^typ>\<open>HOL.bool\<close> = Argo_Expr.mk_iff
    4.38    | mk_eq _ = Argo_Expr.mk_eq
    4.39  
    4.40 -fun trans_term _ @{const HOL.True} = pair Argo_Expr.true_expr
    4.41 -  | trans_term _ @{const HOL.False} = pair Argo_Expr.false_expr
    4.42 -  | trans_term ctxt (@{const HOL.Not} $ t) = trans_term ctxt t #>> Argo_Expr.mk_not
    4.43 -  | trans_term ctxt (@{const HOL.conj} $ t1 $ t2) =
    4.44 +fun trans_term _ \<^const>\<open>HOL.True\<close> = pair Argo_Expr.true_expr
    4.45 +  | trans_term _ \<^const>\<open>HOL.False\<close> = pair Argo_Expr.false_expr
    4.46 +  | trans_term ctxt (\<^const>\<open>HOL.Not\<close> $ t) = trans_term ctxt t #>> Argo_Expr.mk_not
    4.47 +  | trans_term ctxt (\<^const>\<open>HOL.conj\<close> $ t1 $ t2) =
    4.48        trans_term ctxt t1 ##>> trans_term ctxt t2 #>> uncurry Argo_Expr.mk_and2
    4.49 -  | trans_term ctxt (@{const HOL.disj} $ t1 $ t2) =
    4.50 +  | trans_term ctxt (\<^const>\<open>HOL.disj\<close> $ t1 $ t2) =
    4.51        trans_term ctxt t1 ##>> trans_term ctxt t2 #>> uncurry Argo_Expr.mk_or2
    4.52 -  | trans_term ctxt (@{const HOL.implies} $ t1 $ t2) =
    4.53 +  | trans_term ctxt (\<^const>\<open>HOL.implies\<close> $ t1 $ t2) =
    4.54        trans_term ctxt t1 ##>> trans_term ctxt t2 #>> uncurry Argo_Expr.mk_imp
    4.55 -  | trans_term ctxt (Const (@{const_name HOL.If}, _) $ t1 $ t2 $ t3) =
    4.56 +  | trans_term ctxt (Const (\<^const_name>\<open>HOL.If\<close>, _) $ t1 $ t2 $ t3) =
    4.57        trans_term ctxt t1 ##>> trans_term ctxt t2 ##>> trans_term ctxt t3 #>>
    4.58        (fn ((u1, u2), u3) => Argo_Expr.mk_ite u1 u2 u3)
    4.59 -  | trans_term ctxt (Const (@{const_name HOL.eq}, T) $ t1 $ t2) =
    4.60 +  | trans_term ctxt (Const (\<^const_name>\<open>HOL.eq\<close>, T) $ t1 $ t2) =
    4.61        trans_term ctxt t1 ##>> trans_term ctxt t2 #>> uncurry (mk_eq (Term.domain_type T))
    4.62    | trans_term ctxt (t as (t1 $ t2)) = (fn tcx =>
    4.63        (case ext_trans_term ctxt (trans_term ctxt) t tcx of
    4.64 @@ -260,16 +260,16 @@
    4.65  fun mk_ite t1 t2 t3 =
    4.66    let
    4.67      val T = Term.fastype_of t2
    4.68 -    val ite = Const (@{const_name HOL.If}, [@{typ HOL.bool}, T, T] ---> T)
    4.69 +    val ite = Const (\<^const_name>\<open>HOL.If\<close>, [\<^typ>\<open>HOL.bool\<close>, T, T] ---> T)
    4.70    in ite $ t1 $ t2 $ t3 end
    4.71  
    4.72 -fun term_of _ (Argo_Expr.E (Argo_Expr.True, _)) = @{const HOL.True}
    4.73 -  | term_of _ (Argo_Expr.E (Argo_Expr.False, _)) = @{const HOL.False}
    4.74 +fun term_of _ (Argo_Expr.E (Argo_Expr.True, _)) = \<^const>\<open>HOL.True\<close>
    4.75 +  | term_of _ (Argo_Expr.E (Argo_Expr.False, _)) = \<^const>\<open>HOL.False\<close>
    4.76    | term_of cx (Argo_Expr.E (Argo_Expr.Not, [e])) = HOLogic.mk_not (term_of cx e)
    4.77    | term_of cx (Argo_Expr.E (Argo_Expr.And, es)) =
    4.78 -      mk_nary' @{const HOL.True} HOLogic.mk_conj (map (term_of cx) es)
    4.79 +      mk_nary' \<^const>\<open>HOL.True\<close> HOLogic.mk_conj (map (term_of cx) es)
    4.80    | term_of cx (Argo_Expr.E (Argo_Expr.Or, es)) =
    4.81 -      mk_nary' @{const HOL.False} HOLogic.mk_disj (map (term_of cx) es)
    4.82 +      mk_nary' \<^const>\<open>HOL.False\<close> HOLogic.mk_disj (map (term_of cx) es)
    4.83    | term_of cx (Argo_Expr.E (Argo_Expr.Imp, [e1, e2])) =
    4.84        HOLogic.mk_imp (term_of cx e1, term_of cx e2)
    4.85    | term_of cx (Argo_Expr.E (Argo_Expr.Iff, [e1, e2])) =
    4.86 @@ -289,7 +289,7 @@
    4.87          SOME t => t
    4.88        | NONE => raise Fail "bad expression")
    4.89  
    4.90 -fun as_prop ct = Thm.apply @{cterm HOL.Trueprop} ct
    4.91 +fun as_prop ct = Thm.apply \<^cterm>\<open>HOL.Trueprop\<close> ct
    4.92  
    4.93  fun cterm_of ctxt cons e = Thm.cterm_of ctxt (term_of (ctxt, cons) e)
    4.94  fun cprop_of ctxt cons e = as_prop (cterm_of ctxt cons e)
    4.95 @@ -316,7 +316,7 @@
    4.96  fun with_frees ctxt n mk =
    4.97    let
    4.98      val ns = map (fn i => "P" ^ string_of_int i) (0 upto (n - 1))
    4.99 -    val ts = map (Free o rpair @{typ bool}) ns
   4.100 +    val ts = map (Free o rpair \<^typ>\<open>bool\<close>) ns
   4.101      val t = mk_nary HOLogic.mk_disj (mk ts)
   4.102    in prove_taut ctxt ns t end
   4.103  
   4.104 @@ -373,12 +373,12 @@
   4.105  
   4.106  fun flat_conj_conv ct =
   4.107    (case Thm.term_of ct of
   4.108 -    @{const HOL.conj} $ _ $ _ => flatten_conv flat_conj_conv flatten_and_thm ct
   4.109 +    \<^const>\<open>HOL.conj\<close> $ _ $ _ => flatten_conv flat_conj_conv flatten_and_thm ct
   4.110    | _ => Conv.all_conv ct)
   4.111  
   4.112  fun flat_disj_conv ct =
   4.113    (case Thm.term_of ct of
   4.114 -    @{const HOL.disj} $ _ $ _ => flatten_conv flat_disj_conv flatten_or_thm ct
   4.115 +    \<^const>\<open>HOL.disj\<close> $ _ $ _ => flatten_conv flat_disj_conv flatten_or_thm ct
   4.116    | _ => Conv.all_conv ct)
   4.117  
   4.118  fun explode rule1 rule2 thm =
   4.119 @@ -414,7 +414,7 @@
   4.120    in mk_rewr (discharge2 lhs rhs rule) end
   4.121  
   4.122  fun with_conj f g ct = iff_intro iff_conj_thm (f o explode_conj) g ct
   4.123 -fun with_ndis f g ct = iff_intro iff_ndis_thm (f o explode_ndis) g (Thm.apply @{cterm HOL.Not} ct)
   4.124 +fun with_ndis f g ct = iff_intro iff_ndis_thm (f o explode_ndis) g (Thm.apply \<^cterm>\<open>HOL.Not\<close> ct)
   4.125  
   4.126  fun swap_indices n iss = map (fn i => find_index (fn is => member (op =) is i) iss) (0 upto (n - 1))
   4.127  fun sort_nary w f g (n, iss) = w (f (map hd iss)) (under_assumption (f (swap_indices n iss) o g))
   4.128 @@ -484,7 +484,7 @@
   4.129    | replay_args_conv ctxt [c1, c2] ct = binop_conv (replay_conv ctxt c1) (replay_conv ctxt c2) ct
   4.130    | replay_args_conv ctxt (c :: cs) ct =
   4.131        (case Term.head_of (Thm.term_of ct) of
   4.132 -        Const (@{const_name HOL.If}, _) =>
   4.133 +        Const (\<^const_name>\<open>HOL.If\<close>, _) =>
   4.134            let val (cs', c') = split_last cs
   4.135            in Conv.combination_conv (replay_args_conv ctxt (c :: cs')) (replay_conv ctxt c') ct end
   4.136        | _ => binop_conv (replay_conv ctxt c) (replay_args_conv ctxt cs) ct)
   4.137 @@ -520,7 +520,7 @@
   4.138  
   4.139  val unit_rule = @{lemma "(P \<Longrightarrow> False) \<Longrightarrow> (\<not>P \<Longrightarrow> False) \<Longrightarrow> False" by fast}
   4.140  val unit_rule_var = Thm.dest_arg (Thm.dest_arg1 (Thm.cprem_of unit_rule 1))
   4.141 -val bogus_ct = @{cterm HOL.True}
   4.142 +val bogus_ct = \<^cterm>\<open>HOL.True\<close>
   4.143  
   4.144  fun replay_unit_res lit (pthm, plits) (nthm, nlits) =
   4.145    let
   4.146 @@ -543,7 +543,7 @@
   4.147  fun replay_hyp i ct =
   4.148    if i < 0 then (Thm.assume ct, [(~i, ct)])
   4.149    else
   4.150 -    let val cu = as_prop (Thm.apply @{cterm HOL.Not} (Thm.apply @{cterm HOL.Not} (Thm.dest_arg ct)))
   4.151 +    let val cu = as_prop (Thm.apply \<^cterm>\<open>HOL.Not\<close> (Thm.apply \<^cterm>\<open>HOL.Not\<close> (Thm.dest_arg ct)))
   4.152      in (discharge (Thm.assume cu) dneg_rule, [(~i, cu)]) end
   4.153  
   4.154  
   4.155 @@ -601,7 +601,7 @@
   4.156  
   4.157  fun unclausify (thm, lits) ls =
   4.158    (case (Thm.prop_of thm, lits) of
   4.159 -    (@{const HOL.Trueprop} $ @{const HOL.False}, [(_, ct)]) =>
   4.160 +    (\<^const>\<open>HOL.Trueprop\<close> $ \<^const>\<open>HOL.False\<close>, [(_, ct)]) =>
   4.161        let val thm = Thm.implies_intr ct thm
   4.162        in (discharge thm unclausify_rule1 handle THM _ => discharge thm unclausify_rule2, ls) end
   4.163    | _ => (thm, Ord_List.union lit_ord lits ls))
   4.164 @@ -668,22 +668,22 @@
   4.165    let val ct = Drule.strip_imp_concl (Thm.cprop_of thm)
   4.166    in
   4.167      (case Thm.term_of ct of
   4.168 -      @{const HOL.Trueprop} $ Var (_, @{typ HOL.bool}) =>
   4.169 -        instantiate (Thm.dest_arg ct) @{cterm HOL.False} thm
   4.170 -    | Var _ => instantiate ct @{cprop HOL.False} thm
   4.171 +      \<^const>\<open>HOL.Trueprop\<close> $ Var (_, \<^typ>\<open>HOL.bool\<close>) =>
   4.172 +        instantiate (Thm.dest_arg ct) \<^cterm>\<open>HOL.False\<close> thm
   4.173 +    | Var _ => instantiate ct \<^cprop>\<open>HOL.False\<close> thm
   4.174      | _ => thm)
   4.175    end
   4.176  
   4.177  fun atomize_conv ctxt ct =
   4.178    (case Thm.term_of ct of
   4.179 -    @{const HOL.Trueprop} $ _ => Conv.all_conv
   4.180 -  | @{const Pure.imp} $ _ $ _ =>
   4.181 +    \<^const>\<open>HOL.Trueprop\<close> $ _ => Conv.all_conv
   4.182 +  | \<^const>\<open>Pure.imp\<close> $ _ $ _ =>
   4.183        Conv.binop_conv (atomize_conv ctxt) then_conv
   4.184        Conv.rewr_conv @{thm atomize_imp}
   4.185 -  | Const (@{const_name Pure.eq}, _) $ _ $ _ =>
   4.186 +  | Const (\<^const_name>\<open>Pure.eq\<close>, _) $ _ $ _ =>
   4.187        Conv.binop_conv (atomize_conv ctxt) then_conv
   4.188        Conv.rewr_conv @{thm atomize_eq}
   4.189 -  | Const (@{const_name Pure.all}, _) $ Abs _ =>
   4.190 +  | Const (\<^const_name>\<open>Pure.all\<close>, _) $ Abs _ =>
   4.191        Conv.binder_conv (atomize_conv o snd) ctxt then_conv
   4.192        Conv.rewr_conv @{thm atomize_all}
   4.193    | _ => Conv.all_conv) ct
   4.194 @@ -723,7 +723,7 @@
   4.195      | (NONE, _) => Tactical.no_tac)) ctxt
   4.196  
   4.197  val _ =
   4.198 -  Theory.setup (Method.setup @{binding argo}
   4.199 +  Theory.setup (Method.setup \<^binding>\<open>argo\<close>
   4.200      (Scan.optional Attrib.thms [] >>
   4.201        (fn thms => fn ctxt => METHOD (fn facts =>
   4.202          HEADGOAL (argo_tac ctxt (thms @ facts)))))
     5.1 --- a/src/HOL/Tools/Function/fun.ML	Wed Dec 06 19:34:59 2017 +0100
     5.2 +++ b/src/HOL/Tools/Function/fun.ML	Wed Dec 06 20:43:09 2017 +0100
     5.3 @@ -70,7 +70,7 @@
     5.4          val qs = map Free (Name.invent Name.context "a" n ~~ argTs)
     5.5        in
     5.6          HOLogic.mk_eq(list_comb (Free (fname, fT), qs),
     5.7 -          Const (@{const_name undefined}, rT))
     5.8 +          Const (\<^const_name>\<open>undefined\<close>, rT))
     5.9          |> HOLogic.mk_Trueprop
    5.10          |> fold_rev Logic.all qs
    5.11        end
    5.12 @@ -171,7 +171,7 @@
    5.13  
    5.14  
    5.15  val _ =
    5.16 -  Outer_Syntax.local_theory' @{command_keyword fun}
    5.17 +  Outer_Syntax.local_theory' \<^command_keyword>\<open>fun\<close>
    5.18      "define general recursive functions (short version)"
    5.19      (function_parser fun_config
    5.20        >> (fn (config, (fixes, specs)) => add_fun_cmd fixes specs config))
     6.1 --- a/src/HOL/Tools/Function/fun_cases.ML	Wed Dec 06 19:34:59 2017 +0100
     6.2 +++ b/src/HOL/Tools/Function/fun_cases.ML	Wed Dec 06 20:43:09 2017 +0100
     6.3 @@ -54,7 +54,7 @@
     6.4  val fun_cases_cmd = gen_fun_cases Attrib.check_src Syntax.read_prop;
     6.5  
     6.6  val _ =
     6.7 -  Outer_Syntax.local_theory @{command_keyword fun_cases}
     6.8 +  Outer_Syntax.local_theory \<^command_keyword>\<open>fun_cases\<close>
     6.9      "create simplified instances of elimination rules for function equations"
    6.10      (Parse.and_list1 Parse_Spec.simple_specs >> (snd oo fun_cases_cmd));
    6.11  
     7.1 --- a/src/HOL/Tools/Function/function.ML	Wed Dec 06 19:34:59 2017 +0100
     7.2 +++ b/src/HOL/Tools/Function/function.ML	Wed Dec 06 20:43:09 2017 +0100
     7.3 @@ -273,13 +273,13 @@
     7.4  (* outer syntax *)
     7.5  
     7.6  val _ =
     7.7 -  Outer_Syntax.local_theory_to_proof' @{command_keyword function}
     7.8 +  Outer_Syntax.local_theory_to_proof' \<^command_keyword>\<open>function\<close>
     7.9      "define general recursive functions"
    7.10      (function_parser default_config
    7.11        >> (fn (config, (fixes, specs)) => function_cmd fixes specs config))
    7.12  
    7.13  val _ =
    7.14 -  Outer_Syntax.local_theory_to_proof @{command_keyword termination}
    7.15 +  Outer_Syntax.local_theory_to_proof \<^command_keyword>\<open>termination\<close>
    7.16      "prove termination of a recursive function"
    7.17      (Scan.option Parse.term >> termination_cmd)
    7.18  
     8.1 --- a/src/HOL/Tools/Function/function_common.ML	Wed Dec 06 19:34:59 2017 +0100
     8.2 +++ b/src/HOL/Tools/Function/function_common.ML	Wed Dec 06 20:43:09 2017 +0100
     8.3 @@ -118,7 +118,7 @@
     8.4  
     8.5  fun PROFILE msg = if !profile then timeap_msg msg else I
     8.6  
     8.7 -val acc_const_name = @{const_name Wellfounded.accp}
     8.8 +val acc_const_name = \<^const_name>\<open>Wellfounded.accp\<close>
     8.9  fun mk_acc domT R =
    8.10    Const (acc_const_name, (domT --> domT --> HOLogic.boolT) --> domT --> HOLogic.boolT) $ R
    8.11  
    8.12 @@ -128,8 +128,8 @@
    8.13  fun split_def ctxt check_head geq =
    8.14    let
    8.15      fun input_error msg = cat_lines [msg, Syntax.string_of_term ctxt geq]
    8.16 -    val qs = Term.strip_qnt_vars @{const_name Pure.all} geq
    8.17 -    val imp = Term.strip_qnt_body @{const_name Pure.all} geq
    8.18 +    val qs = Term.strip_qnt_vars \<^const_name>\<open>Pure.all\<close> geq
    8.19 +    val imp = Term.strip_qnt_body \<^const_name>\<open>Pure.all\<close> geq
    8.20      val (gs, eq) = Logic.strip_horn imp
    8.21  
    8.22      val (f_args, rhs) = HOLogic.dest_eq (HOLogic.dest_Trueprop eq)
    8.23 @@ -372,7 +372,7 @@
    8.24       || (Parse.reserved "no_partials" >> K No_Partials))
    8.25  
    8.26    fun config_parser default =
    8.27 -    (Scan.optional (@{keyword "("} |-- Parse.!!! (Parse.list1 option_parser) --| @{keyword ")"}) [])
    8.28 +    (Scan.optional (\<^keyword>\<open>(\<close> |-- Parse.!!! (Parse.list1 option_parser) --| \<^keyword>\<open>)\<close>) [])
    8.29       >> (fn opts => fold apply_opt opts default)
    8.30  in
    8.31    fun function_parser default_cfg =
     9.1 --- a/src/HOL/Tools/Function/function_core.ML	Wed Dec 06 19:34:59 2017 +0100
     9.2 +++ b/src/HOL/Tools/Function/function_core.ML	Wed Dec 06 20:43:09 2017 +0100
     9.3 @@ -394,7 +394,7 @@
     9.4      (* Inductive Hypothesis: !!z. (z,x):R ==> EX!y. (z,y):G *)
     9.5      val ihyp = Logic.all_const domT $ Abs ("z", domT,
     9.6        Logic.mk_implies (HOLogic.mk_Trueprop (R $ Bound 0 $ x),
     9.7 -        HOLogic.mk_Trueprop (Const (@{const_name Ex1}, (ranT --> boolT) --> boolT) $
     9.8 +        HOLogic.mk_Trueprop (Const (\<^const_name>\<open>Ex1\<close>, (ranT --> boolT) --> boolT) $
     9.9            Abs ("y", ranT, G $ Bound 1 $ Bound 0))))
    9.10        |> Thm.cterm_of ctxt
    9.11  
    9.12 @@ -494,7 +494,7 @@
    9.13        Thm.make_def_binding (Config.get lthy function_internals)
    9.14          (derived_name_suffix defname "_sumC")
    9.15      val f_def =
    9.16 -      Abs ("x", domT, Const (@{const_name Fun_Def.THE_default}, ranT --> (ranT --> boolT) --> ranT)
    9.17 +      Abs ("x", domT, Const (\<^const_name>\<open>Fun_Def.THE_default\<close>, ranT --> (ranT --> boolT) --> ranT)
    9.18          $ (default $ Bound 0) $ Abs ("y", ranT, G $ Bound 1 $ Bound 0))
    9.19        |> Syntax.check_term lthy
    9.20    in
    9.21 @@ -777,10 +777,10 @@
    9.22      val R' = Free (Rn, fastype_of R)
    9.23  
    9.24      val Rrel = Free (Rn, HOLogic.mk_setT (HOLogic.mk_prodT (domT, domT)))
    9.25 -    val inrel_R = Const (@{const_name Fun_Def.in_rel},
    9.26 +    val inrel_R = Const (\<^const_name>\<open>Fun_Def.in_rel\<close>,
    9.27        HOLogic.mk_setT (HOLogic.mk_prodT (domT, domT)) --> fastype_of R) $ Rrel
    9.28  
    9.29 -    val wfR' = HOLogic.mk_Trueprop (Const (@{const_name Wellfounded.wfP},
    9.30 +    val wfR' = HOLogic.mk_Trueprop (Const (\<^const_name>\<open>Wellfounded.wfP\<close>,
    9.31        (domT --> domT --> boolT) --> boolT) $ R')
    9.32        |> Thm.cterm_of ctxt' (* "wf R'" *)
    9.33  
    10.1 --- a/src/HOL/Tools/Function/function_elims.ML	Wed Dec 06 19:34:59 2017 +0100
    10.2 +++ b/src/HOL/Tools/Function/function_elims.ML	Wed Dec 06 20:43:09 2017 +0100
    10.3 @@ -24,9 +24,9 @@
    10.4  (* Extract a function and its arguments from a proposition that is
    10.5     either of the form "f x y z = ..." or, in case of function that
    10.6     returns a boolean, "f x y z" *)
    10.7 -fun dest_funprop (Const (@{const_name HOL.eq}, _) $ lhs $ rhs) = (strip_comb lhs, rhs)
    10.8 -  | dest_funprop (Const (@{const_name Not}, _) $ t) = (strip_comb t, @{term False})
    10.9 -  | dest_funprop t = (strip_comb t, @{term True});
   10.10 +fun dest_funprop (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ lhs $ rhs) = (strip_comb lhs, rhs)
   10.11 +  | dest_funprop (Const (\<^const_name>\<open>Not\<close>, _) $ t) = (strip_comb t, \<^term>\<open>False\<close>)
   10.12 +  | dest_funprop t = (strip_comb t, \<^term>\<open>True\<close>);
   10.13  
   10.14  local
   10.15  
   10.16 @@ -34,9 +34,9 @@
   10.17    let
   10.18      fun inspect eq =
   10.19        (case eq of
   10.20 -        Const (@{const_name Trueprop}, _) $ (Const (@{const_name HOL.eq}, _) $ Free x $ t) =>
   10.21 +        Const (\<^const_name>\<open>Trueprop\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ Free x $ t) =>
   10.22            if Logic.occs (Free x, t) then raise Match else true
   10.23 -      | Const (@{const_name Trueprop}, _) $ (Const (@{const_name HOL.eq}, _) $ t $ Free x) =>
   10.24 +      | Const (\<^const_name>\<open>Trueprop\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ t $ Free x) =>
   10.25            if Logic.occs (Free x, t) then raise Match else false
   10.26        | _ => raise Match);
   10.27      fun mk_eq thm =
   10.28 @@ -68,7 +68,7 @@
   10.29        |> Tactic.rule_by_tactic ctxt (distinct_subgoals_tac THEN TRY (resolve_tac ctxt eq_boolI 1))
   10.30        |> Tactic.rule_by_tactic ctxt (distinct_subgoals_tac THEN ALLGOALS (bool_subst_tac ctxt));
   10.31    in
   10.32 -    map mk_bool_elim [@{cterm True}, @{cterm False}]
   10.33 +    map mk_bool_elim [\<^cterm>\<open>True\<close>, \<^cterm>\<open>False\<close>]
   10.34    end;
   10.35  
   10.36  in
   10.37 @@ -86,7 +86,7 @@
   10.38          fun mk_funeq 0 T (acc_args, acc_lhs) =
   10.39                let val y = variant_free acc_lhs ("y", T)
   10.40                in (y, rev acc_args, HOLogic.mk_Trueprop (HOLogic.mk_eq (acc_lhs, y))) end
   10.41 -          | mk_funeq n (Type (@{type_name fun}, [S, T])) (acc_args, acc_lhs) =
   10.42 +          | mk_funeq n (Type (\<^type_name>\<open>fun\<close>, [S, T])) (acc_args, acc_lhs) =
   10.43                let val x = variant_free acc_lhs ("x", S)
   10.44                in mk_funeq (n - 1) T (x :: acc_args, acc_lhs $ x) end
   10.45            | mk_funeq _ _ _ = raise TERM ("Not a function", [f]);
   10.46 @@ -111,7 +111,7 @@
   10.47          val args = HOLogic.mk_tuple arg_vars;
   10.48          val domT = R |> dest_Free |> snd |> hd o snd o dest_Type;
   10.49  
   10.50 -        val P = Thm.cterm_of ctxt (variant_free prop ("P", @{typ bool}));
   10.51 +        val P = Thm.cterm_of ctxt (variant_free prop ("P", \<^typ>\<open>bool\<close>));
   10.52          val sumtree_inj = Sum_Tree.mk_inj domT n_fs (idx + 1) args;
   10.53  
   10.54          val cprop = Thm.cterm_of ctxt prop;
   10.55 @@ -137,7 +137,7 @@
   10.56            |> Thm.forall_intr (Thm.cterm_of ctxt rhs_var);
   10.57  
   10.58          val bool_elims =
   10.59 -          if fastype_of rhs_var = @{typ bool}
   10.60 +          if fastype_of rhs_var = \<^typ>\<open>bool\<close>
   10.61            then mk_bool_elims ctxt elim_stripped
   10.62            else [];
   10.63  
    11.1 --- a/src/HOL/Tools/Function/function_lib.ML	Wed Dec 06 19:34:59 2017 +0100
    11.2 +++ b/src/HOL/Tools/Function/function_lib.ML	Wed Dec 06 20:43:09 2017 +0100
    11.3 @@ -50,7 +50,7 @@
    11.4  
    11.5  
    11.6  (* Removes all quantifiers from a term, replacing bound variables by frees. *)
    11.7 -fun dest_all_all (t as (Const (@{const_name Pure.all},_) $ _)) =
    11.8 +fun dest_all_all (t as (Const (\<^const_name>\<open>Pure.all\<close>,_) $ _)) =
    11.9    let
   11.10      val (v,b) = Logic.dest_all t |> apfst Free
   11.11      val (vs, b') = dest_all_all b
   11.12 @@ -129,7 +129,7 @@
   11.13  
   11.14  (* instance for unions *)
   11.15  fun regroup_union_conv ctxt =
   11.16 -  regroup_conv ctxt @{const_abbrev Set.empty} @{const_name Lattices.sup}
   11.17 +  regroup_conv ctxt \<^const_abbrev>\<open>Set.empty\<close> \<^const_name>\<open>Lattices.sup\<close>
   11.18      (map (fn t => t RS eq_reflection)
   11.19        (@{thms Un_ac} @ @{thms Un_empty_right} @ @{thms Un_empty_left}))
   11.20  
    12.1 --- a/src/HOL/Tools/Function/induction_schema.ML	Wed Dec 06 19:34:59 2017 +0100
    12.2 +++ b/src/HOL/Tools/Function/induction_schema.ML	Wed Dec 06 20:43:09 2017 +0100
    12.3 @@ -140,7 +140,7 @@
    12.4    end
    12.5  
    12.6  fun mk_wf R (IndScheme {T, ...}) =
    12.7 -  HOLogic.Trueprop $ (Const (@{const_name wf}, mk_relT T --> HOLogic.boolT) $ R)
    12.8 +  HOLogic.Trueprop $ (Const (\<^const_name>\<open>wf\<close>, mk_relT T --> HOLogic.boolT) $ R)
    12.9  
   12.10  fun mk_ineqs R thesisn (IndScheme {T, cases, branches}) =
   12.11    let
   12.12 @@ -215,7 +215,7 @@
   12.13      val ihyp = Logic.all_const T $ Abs ("z", T,
   12.14        Logic.mk_implies
   12.15          (HOLogic.mk_Trueprop (
   12.16 -          Const (@{const_name Set.member}, HOLogic.mk_prodT (T, T) --> mk_relT T --> HOLogic.boolT) 
   12.17 +          Const (\<^const_name>\<open>Set.member\<close>, HOLogic.mk_prodT (T, T) --> mk_relT T --> HOLogic.boolT) 
   12.18            $ (HOLogic.pair_const T T $ Bound 0 $ x)
   12.19            $ R),
   12.20           HOLogic.mk_Trueprop (P_comp $ Bound 0)))
    13.1 --- a/src/HOL/Tools/Function/lexicographic_order.ML	Wed Dec 06 19:34:59 2017 +0100
    13.2 +++ b/src/HOL/Tools/Function/lexicographic_order.ML	Wed Dec 06 20:43:09 2017 +0100
    13.3 @@ -22,9 +22,9 @@
    13.4    let
    13.5      val relT = HOLogic.mk_setT (HOLogic.mk_prodT (domT, domT))
    13.6      val mlexT = (domT --> HOLogic.natT) --> relT --> relT
    13.7 -    fun mk_ms [] = Const (@{const_abbrev Set.empty}, relT)
    13.8 +    fun mk_ms [] = Const (\<^const_abbrev>\<open>Set.empty\<close>, relT)
    13.9        | mk_ms (f::fs) =
   13.10 -        Const (@{const_name mlex_prod}, mlexT) $ f $ mk_ms fs
   13.11 +        Const (\<^const_name>\<open>mlex_prod\<close>, mlexT) $ f $ mk_ms fs
   13.12    in
   13.13      mk_ms mfuns
   13.14    end
   13.15 @@ -70,13 +70,13 @@
   13.16    let
   13.17      val goals = Thm.cterm_of ctxt o mk_goal (vars, prems, mfun $ lhs, mfun $ rhs)
   13.18    in
   13.19 -    (case try_proof ctxt (goals @{const_name Orderings.less}) solve_tac of
   13.20 +    (case try_proof ctxt (goals \<^const_name>\<open>Orderings.less\<close>) solve_tac of
   13.21        Solved thm => Less thm
   13.22      | Stuck thm =>
   13.23 -        (case try_proof ctxt (goals @{const_name Orderings.less_eq}) solve_tac of
   13.24 +        (case try_proof ctxt (goals \<^const_name>\<open>Orderings.less_eq\<close>) solve_tac of
   13.25            Solved thm2 => LessEq (thm2, thm)
   13.26          | Stuck thm2 =>
   13.27 -            if Thm.prems_of thm2 = [HOLogic.Trueprop $ @{term False}] then False thm2
   13.28 +            if Thm.prems_of thm2 = [HOLogic.Trueprop $ \<^term>\<open>False\<close>] then False thm2
   13.29              else None (thm2, thm)
   13.30          | _ => raise Match) (* FIXME *)
   13.31      | _ => raise Match)
    14.1 --- a/src/HOL/Tools/Function/measure_functions.ML	Wed Dec 06 19:34:59 2017 +0100
    14.2 +++ b/src/HOL/Tools/Function/measure_functions.ML	Wed Dec 06 20:43:09 2017 +0100
    14.3 @@ -15,10 +15,10 @@
    14.4  (** User-declared size functions **)
    14.5  
    14.6  fun mk_is_measure t =
    14.7 -  Const (@{const_name is_measure}, fastype_of t --> HOLogic.boolT) $ t
    14.8 +  Const (\<^const_name>\<open>is_measure\<close>, fastype_of t --> HOLogic.boolT) $ t
    14.9  
   14.10  fun find_measures ctxt T =
   14.11 -  DEPTH_SOLVE (resolve_tac ctxt (rev (Named_Theorems.get ctxt @{named_theorems measure_function})) 1)
   14.12 +  DEPTH_SOLVE (resolve_tac ctxt (rev (Named_Theorems.get ctxt \<^named_theorems>\<open>measure_function\<close>)) 1)
   14.13      (HOLogic.mk_Trueprop (mk_is_measure (Var (("f",0), T --> HOLogic.natT)))
   14.14       |> Thm.cterm_of ctxt |> Goal.init)
   14.15    |> Seq.map (Thm.prop_of #> (fn _ $ (_ $ (_ $ f)) => f))
   14.16 @@ -30,17 +30,17 @@
   14.17  fun constant_0 T = Abs ("x", T, HOLogic.zero)
   14.18  fun constant_1 T = Abs ("x", T, HOLogic.Suc_zero)
   14.19  
   14.20 -fun mk_funorder_funs (Type (@{type_name Sum_Type.sum}, [fT, sT])) =
   14.21 +fun mk_funorder_funs (Type (\<^type_name>\<open>Sum_Type.sum\<close>, [fT, sT])) =
   14.22    map (fn m => Sum_Tree.mk_sumcase fT sT HOLogic.natT m (constant_0 sT)) (mk_funorder_funs fT)
   14.23    @ map (fn m => Sum_Tree.mk_sumcase fT sT HOLogic.natT (constant_0 fT) m) (mk_funorder_funs sT)
   14.24    | mk_funorder_funs T = [ constant_1 T ]
   14.25  
   14.26 -fun mk_ext_base_funs ctxt (Type (@{type_name Sum_Type.sum}, [fT, sT])) =
   14.27 +fun mk_ext_base_funs ctxt (Type (\<^type_name>\<open>Sum_Type.sum\<close>, [fT, sT])) =
   14.28      map_product (Sum_Tree.mk_sumcase fT sT HOLogic.natT)
   14.29        (mk_ext_base_funs ctxt fT) (mk_ext_base_funs ctxt sT)
   14.30    | mk_ext_base_funs ctxt T = find_measures ctxt T
   14.31  
   14.32 -fun mk_all_measure_funs ctxt (T as Type (@{type_name Sum_Type.sum}, _)) =
   14.33 +fun mk_all_measure_funs ctxt (T as Type (\<^type_name>\<open>Sum_Type.sum\<close>, _)) =
   14.34      mk_ext_base_funs ctxt T @ mk_funorder_funs T
   14.35    | mk_all_measure_funs ctxt T = find_measures ctxt T
   14.36  
    15.1 --- a/src/HOL/Tools/Function/mutual.ML	Wed Dec 06 19:34:59 2017 +0100
    15.2 +++ b/src/HOL/Tools/Function/mutual.ML	Wed Dec 06 20:43:09 2017 +0100
    15.3 @@ -247,7 +247,7 @@
    15.4  fun mutual_cases_rule ctxt cases_rule n ST (MutualPart {i, cargTs = Ts, ...}) =
    15.5    let
    15.6      val [P, x] =
    15.7 -      Variable.variant_frees ctxt [] [("P", @{typ bool}), ("x", HOLogic.mk_tupleT Ts)]
    15.8 +      Variable.variant_frees ctxt [] [("P", \<^typ>\<open>bool\<close>), ("x", HOLogic.mk_tupleT Ts)]
    15.9        |> map (Thm.cterm_of ctxt o Free);
   15.10      val sumtree_inj = Thm.cterm_of ctxt (Sum_Tree.mk_inj ST n i (Thm.term_of x));
   15.11  
    16.1 --- a/src/HOL/Tools/Function/partial_function.ML	Wed Dec 06 19:34:59 2017 +0100
    16.2 +++ b/src/HOL/Tools/Function/partial_function.ML	Wed Dec 06 20:43:09 2017 +0100
    16.3 @@ -109,7 +109,7 @@
    16.4  fun mono_tac ctxt =
    16.5    K (Local_Defs.unfold0_tac ctxt [@{thm curry_def}])
    16.6    THEN' (TRY o REPEAT_ALL_NEW
    16.7 -   (resolve_tac ctxt (rev (Named_Theorems.get ctxt @{named_theorems partial_function_mono}))
    16.8 +   (resolve_tac ctxt (rev (Named_Theorems.get ctxt \<^named_theorems>\<open>partial_function_mono\<close>))
    16.9       ORELSE' split_cases_tac ctxt));
   16.10  
   16.11  
   16.12 @@ -135,7 +135,7 @@
   16.13  (*** currying transformation ***)
   16.14  
   16.15  fun curry_const (A, B, C) =
   16.16 -  Const (@{const_name Product_Type.curry},
   16.17 +  Const (\<^const_name>\<open>Product_Type.curry\<close>,
   16.18      [HOLogic.mk_prodT (A, B) --> C, A, B] ---> C);
   16.19  
   16.20  fun mk_curry f =
   16.21 @@ -310,10 +310,10 @@
   16.22  val add_partial_function = gen_add_partial_function Specification.check_multi_specs;
   16.23  val add_partial_function_cmd = gen_add_partial_function Specification.read_multi_specs;
   16.24  
   16.25 -val mode = @{keyword "("} |-- Parse.name --| @{keyword ")"};
   16.26 +val mode = \<^keyword>\<open>(\<close> |-- Parse.name --| \<^keyword>\<open>)\<close>;
   16.27  
   16.28  val _ =
   16.29 -  Outer_Syntax.local_theory @{command_keyword partial_function} "define partial function"
   16.30 +  Outer_Syntax.local_theory \<^command_keyword>\<open>partial_function\<close> "define partial function"
   16.31      ((mode -- (Parse.vars -- (Parse.where_ |-- Parse_Spec.simple_spec)))
   16.32        >> (fn (mode, (vars, spec)) => add_partial_function_cmd mode vars spec #> #2));
   16.33  
    17.1 --- a/src/HOL/Tools/Function/sum_tree.ML	Wed Dec 06 19:34:59 2017 +0100
    17.2 +++ b/src/HOL/Tools/Function/sum_tree.ML	Wed Dec 06 20:43:09 2017 +0100
    17.3 @@ -30,28 +30,28 @@
    17.4      {left = (fn f => f o left), right = (fn f => f o right), init = I} len i init
    17.5  
    17.6  (* Sum types *)
    17.7 -fun mk_sumT LT RT = Type (@{type_name Sum_Type.sum}, [LT, RT])
    17.8 +fun mk_sumT LT RT = Type (\<^type_name>\<open>Sum_Type.sum\<close>, [LT, RT])
    17.9  fun mk_sumcase TL TR T l r =
   17.10 -  Const (@{const_name sum.case_sum}, (TL --> T) --> (TR --> T) --> mk_sumT TL TR --> T) $ l $ r
   17.11 +  Const (\<^const_name>\<open>sum.case_sum\<close>, (TL --> T) --> (TR --> T) --> mk_sumT TL TR --> T) $ l $ r
   17.12  
   17.13  val App = curry op $
   17.14  
   17.15  fun mk_inj ST n i =
   17.16    access_top_down
   17.17    { init = (ST, I : term -> term),
   17.18 -    left = (fn (T as Type (@{type_name Sum_Type.sum}, [LT, RT]), inj) =>
   17.19 -      (LT, inj o App (Const (@{const_name Inl}, LT --> T)))),
   17.20 -    right =(fn (T as Type (@{type_name Sum_Type.sum}, [LT, RT]), inj) =>
   17.21 -      (RT, inj o App (Const (@{const_name Inr}, RT --> T))))} n i
   17.22 +    left = (fn (T as Type (\<^type_name>\<open>Sum_Type.sum\<close>, [LT, RT]), inj) =>
   17.23 +      (LT, inj o App (Const (\<^const_name>\<open>Inl\<close>, LT --> T)))),
   17.24 +    right =(fn (T as Type (\<^type_name>\<open>Sum_Type.sum\<close>, [LT, RT]), inj) =>
   17.25 +      (RT, inj o App (Const (\<^const_name>\<open>Inr\<close>, RT --> T))))} n i
   17.26    |> snd
   17.27  
   17.28  fun mk_proj ST n i =
   17.29    access_top_down
   17.30    { init = (ST, I : term -> term),
   17.31 -    left = (fn (T as Type (@{type_name Sum_Type.sum}, [LT, RT]), proj) =>
   17.32 -      (LT, App (Const (@{const_name Sum_Type.projl}, T --> LT)) o proj)),
   17.33 -    right =(fn (T as Type (@{type_name Sum_Type.sum}, [LT, RT]), proj) =>
   17.34 -      (RT, App (Const (@{const_name Sum_Type.projr}, T --> RT)) o proj))} n i
   17.35 +    left = (fn (T as Type (\<^type_name>\<open>Sum_Type.sum\<close>, [LT, RT]), proj) =>
   17.36 +      (LT, App (Const (\<^const_name>\<open>Sum_Type.projl\<close>, T --> LT)) o proj)),
   17.37 +    right =(fn (T as Type (\<^type_name>\<open>Sum_Type.sum\<close>, [LT, RT]), proj) =>
   17.38 +      (RT, App (Const (\<^const_name>\<open>Sum_Type.projr\<close>, T --> RT)) o proj))} n i
   17.39    |> snd
   17.40  
   17.41  fun mk_sumcases T fs =
    18.1 --- a/src/HOL/Tools/Function/termination.ML	Wed Dec 06 19:34:59 2017 +0100
    18.2 +++ b/src/HOL/Tools/Function/termination.ML	Wed Dec 06 20:43:09 2017 +0100
    18.3 @@ -67,14 +67,14 @@
    18.4  
    18.5  
    18.6  (* concrete versions for sum types *)
    18.7 -fun is_inj (Const (@{const_name Sum_Type.Inl}, _) $ _) = true
    18.8 -  | is_inj (Const (@{const_name Sum_Type.Inr}, _) $ _) = true
    18.9 +fun is_inj (Const (\<^const_name>\<open>Sum_Type.Inl\<close>, _) $ _) = true
   18.10 +  | is_inj (Const (\<^const_name>\<open>Sum_Type.Inr\<close>, _) $ _) = true
   18.11    | is_inj _ = false
   18.12  
   18.13 -fun dest_inl (Const (@{const_name Sum_Type.Inl}, _) $ t) = SOME t
   18.14 +fun dest_inl (Const (\<^const_name>\<open>Sum_Type.Inl\<close>, _) $ t) = SOME t
   18.15    | dest_inl _ = NONE
   18.16  
   18.17 -fun dest_inr (Const (@{const_name Sum_Type.Inr}, _) $ t) = SOME t
   18.18 +fun dest_inr (Const (\<^const_name>\<open>Sum_Type.Inr\<close>, _) $ t) = SOME t
   18.19    | dest_inr _ = NONE
   18.20  
   18.21  
   18.22 @@ -92,7 +92,7 @@
   18.23    end
   18.24  
   18.25  (* compute list of types for nodes *)
   18.26 -fun node_types sk T = dest_tree (fn Type (@{type_name Sum_Type.sum}, [LT, RT]) => (LT, RT)) sk T |> map snd
   18.27 +fun node_types sk T = dest_tree (fn Type (\<^type_name>\<open>Sum_Type.sum\<close>, [LT, RT]) => (LT, RT)) sk T |> map snd
   18.28  
   18.29  (* find index and raw term *)
   18.30  fun dest_inj (SLeaf i) trm = (i, trm)
   18.31 @@ -125,11 +125,11 @@
   18.32  
   18.33  fun mk_sum_skel rel =
   18.34    let
   18.35 -    val cs = Function_Lib.dest_binop_list @{const_name Lattices.sup} rel
   18.36 -    fun collect_pats (Const (@{const_name Collect}, _) $ Abs (_, _, c)) =
   18.37 +    val cs = Function_Lib.dest_binop_list \<^const_name>\<open>Lattices.sup\<close> rel
   18.38 +    fun collect_pats (Const (\<^const_name>\<open>Collect\<close>, _) $ Abs (_, _, c)) =
   18.39        let
   18.40 -        val (Const (@{const_name HOL.conj}, _) $ (Const (@{const_name HOL.eq}, _) $ _ $ (Const (@{const_name Pair}, _) $ r $ l)) $ _)
   18.41 -          = Term.strip_qnt_body @{const_name Ex} c
   18.42 +        val (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ _ $ (Const (\<^const_name>\<open>Pair\<close>, _) $ r $ l)) $ _)
   18.43 +          = Term.strip_qnt_body \<^const_name>\<open>Ex\<close> c
   18.44        in cons r o cons l end
   18.45    in
   18.46      mk_skel (fold collect_pats cs [])
   18.47 @@ -138,8 +138,8 @@
   18.48  fun prove_chain ctxt chain_tac (c1, c2) =
   18.49    let
   18.50      val goal =
   18.51 -      HOLogic.mk_eq (HOLogic.mk_binop @{const_name Relation.relcomp} (c1, c2),
   18.52 -        Const (@{const_abbrev Set.empty}, fastype_of c1))
   18.53 +      HOLogic.mk_eq (HOLogic.mk_binop \<^const_name>\<open>Relation.relcomp\<close> (c1, c2),
   18.54 +        Const (\<^const_abbrev>\<open>Set.empty\<close>, fastype_of c1))
   18.55        |> HOLogic.mk_Trueprop (* "C1 O C2 = {}" *)
   18.56    in
   18.57      (case Function_Lib.try_proof ctxt (Thm.cterm_of ctxt goal) chain_tac of
   18.58 @@ -148,13 +148,13 @@
   18.59    end
   18.60  
   18.61  
   18.62 -fun dest_call' sk (Const (@{const_name Collect}, _) $ Abs (_, _, c)) =
   18.63 +fun dest_call' sk (Const (\<^const_name>\<open>Collect\<close>, _) $ Abs (_, _, c)) =
   18.64    let
   18.65 -    val vs = Term.strip_qnt_vars @{const_name Ex} c
   18.66 +    val vs = Term.strip_qnt_vars \<^const_name>\<open>Ex\<close> c
   18.67  
   18.68      (* FIXME: throw error "dest_call" for malformed terms *)
   18.69 -    val (Const (@{const_name HOL.conj}, _) $ (Const (@{const_name HOL.eq}, _) $ _ $ (Const (@{const_name Pair}, _) $ r $ l)) $ Gam)
   18.70 -      = Term.strip_qnt_body @{const_name Ex} c
   18.71 +    val (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ _ $ (Const (\<^const_name>\<open>Pair\<close>, _) $ r $ l)) $ Gam)
   18.72 +      = Term.strip_qnt_body \<^const_name>\<open>Ex\<close> c
   18.73      val (p, l') = dest_inj sk l
   18.74      val (q, r') = dest_inj sk r
   18.75    in
   18.76 @@ -170,16 +170,16 @@
   18.77        try_proof ctxt (Thm.cterm_of ctxt
   18.78          (Logic.list_all (vs,
   18.79             Logic.mk_implies (HOLogic.mk_Trueprop Gam,
   18.80 -             HOLogic.mk_Trueprop (Const (rel, @{typ "nat \<Rightarrow> nat \<Rightarrow> bool"})
   18.81 +             HOLogic.mk_Trueprop (Const (rel, \<^typ>\<open>nat \<Rightarrow> nat \<Rightarrow> bool\<close>)
   18.82                 $ (m2 $ r) $ (m1 $ l)))))) tac
   18.83    in
   18.84 -    (case try @{const_name Orderings.less} of
   18.85 +    (case try \<^const_name>\<open>Orderings.less\<close> of
   18.86        Solved thm => Less thm
   18.87      | Stuck thm =>
   18.88 -        (case try @{const_name Orderings.less_eq} of
   18.89 +        (case try \<^const_name>\<open>Orderings.less_eq\<close> of
   18.90            Solved thm2 => LessEq (thm2, thm)
   18.91          | Stuck thm2 =>
   18.92 -            if Thm.prems_of thm2 = [HOLogic.Trueprop $ @{term False}]
   18.93 +            if Thm.prems_of thm2 = [HOLogic.Trueprop $ \<^term>\<open>False\<close>]
   18.94              then False thm2 else None (thm2, thm)
   18.95          | _ => raise Match) (* FIXME *)
   18.96      | _ => raise Match)
   18.97 @@ -225,13 +225,13 @@
   18.98  fun CALLS tac i st =
   18.99    if Thm.no_prems st then all_tac st
  18.100    else case Thm.term_of (Thm.cprem_of st i) of
  18.101 -    (_ $ (_ $ rel)) => tac (Function_Lib.dest_binop_list @{const_name Lattices.sup} rel, i) st
  18.102 +    (_ $ (_ $ rel)) => tac (Function_Lib.dest_binop_list \<^const_name>\<open>Lattices.sup\<close> rel, i) st
  18.103    |_ => no_tac st
  18.104  
  18.105  type ttac = data -> int -> tactic
  18.106  
  18.107  fun TERMINATION ctxt atac tac =
  18.108 -  SUBGOAL (fn (_ $ (Const (@{const_name wf}, wfT) $ rel), i) =>
  18.109 +  SUBGOAL (fn (_ $ (Const (\<^const_name>\<open>wf\<close>, wfT) $ rel), i) =>
  18.110    let
  18.111      val (T, _) = HOLogic.dest_prodT (HOLogic.dest_setT (domain_type wfT))
  18.112    in
  18.113 @@ -258,7 +258,7 @@
  18.114      val pT = HOLogic.mk_prodT (T, T)
  18.115      val n = length qs
  18.116      val peq = HOLogic.eq_const pT $ Bound n $ (HOLogic.pair_const T T $ l $ r)
  18.117 -    val conds' = if null conds then [@{term True}] else conds
  18.118 +    val conds' = if null conds then [\<^term>\<open>True\<close>] else conds
  18.119    in
  18.120      HOLogic.Collect_const pT $
  18.121      Abs ("uu_", pT,
  18.122 @@ -284,9 +284,9 @@
  18.123  
  18.124      val relation =
  18.125        if null ineqs
  18.126 -      then Const (@{const_abbrev Set.empty}, fastype_of rel)
  18.127 +      then Const (\<^const_abbrev>\<open>Set.empty\<close>, fastype_of rel)
  18.128        else map mk_compr ineqs
  18.129 -        |> foldr1 (HOLogic.mk_binop @{const_name Lattices.sup})
  18.130 +        |> foldr1 (HOLogic.mk_binop \<^const_name>\<open>Lattices.sup\<close>)
  18.131  
  18.132      fun solve_membership_tac i =
  18.133        (EVERY' (replicate (i - 2) (resolve_tac ctxt @{thms UnI2}))  (* pick the right component of the union *)
    19.1 --- a/src/HOL/Tools/Meson/meson.ML	Wed Dec 06 19:34:59 2017 +0100
    19.2 +++ b/src/HOL/Tools/Meson/meson.ML	Wed Dec 06 20:43:09 2017 +0100
    19.3 @@ -48,11 +48,11 @@
    19.4  structure Meson : MESON =
    19.5  struct
    19.6  
    19.7 -val trace = Attrib.setup_config_bool @{binding meson_trace} (K false)
    19.8 +val trace = Attrib.setup_config_bool \<^binding>\<open>meson_trace\<close> (K false)
    19.9  
   19.10  fun trace_msg ctxt msg = if Config.get ctxt trace then tracing (msg ()) else ()
   19.11  
   19.12 -val max_clauses = Attrib.setup_config_int @{binding meson_max_clauses} (K 60)
   19.13 +val max_clauses = Attrib.setup_config_int \<^binding>\<open>meson_max_clauses\<close> (K 60)
   19.14  
   19.15  (*No known example (on 1-5-2007) needs even thirty*)
   19.16  val iter_deepen_limit = 50;
   19.17 @@ -100,7 +100,7 @@
   19.18      try (fn () =>
   19.19        let val thy = Proof_Context.theory_of ctxt
   19.20            val tmA = Thm.concl_of thA
   19.21 -          val Const(@{const_name Pure.imp},_) $ tmB $ _ = Thm.prop_of thB
   19.22 +          val Const(\<^const_name>\<open>Pure.imp\<close>,_) $ tmB $ _ = Thm.prop_of thB
   19.23            val tenv =
   19.24              Pattern.first_order_match thy (tmB, tmA)
   19.25                                            (Vartab.empty, Vartab.empty) |> snd
   19.26 @@ -121,18 +121,18 @@
   19.27  
   19.28  fun fix_bound_var_names old_t new_t =
   19.29    let
   19.30 -    fun quant_of @{const_name All} = SOME true
   19.31 -      | quant_of @{const_name Ball} = SOME true
   19.32 -      | quant_of @{const_name Ex} = SOME false
   19.33 -      | quant_of @{const_name Bex} = SOME false
   19.34 +    fun quant_of \<^const_name>\<open>All\<close> = SOME true
   19.35 +      | quant_of \<^const_name>\<open>Ball\<close> = SOME true
   19.36 +      | quant_of \<^const_name>\<open>Ex\<close> = SOME false
   19.37 +      | quant_of \<^const_name>\<open>Bex\<close> = SOME false
   19.38        | quant_of _ = NONE
   19.39      val flip_quant = Option.map not
   19.40      fun some_eq (SOME x) (SOME y) = x = y
   19.41        | some_eq _ _ = false
   19.42      fun add_names quant (Const (quant_s, _) $ Abs (s, _, t')) =
   19.43          add_names quant t' #> some_eq quant (quant_of quant_s) ? cons s
   19.44 -      | add_names quant (@{const Not} $ t) = add_names (flip_quant quant) t
   19.45 -      | add_names quant (@{const implies} $ t1 $ t2) =
   19.46 +      | add_names quant (\<^const>\<open>Not\<close> $ t) = add_names (flip_quant quant) t
   19.47 +      | add_names quant (\<^const>\<open>implies\<close> $ t1 $ t2) =
   19.48          add_names (flip_quant quant) t1 #> add_names quant t2
   19.49        | add_names quant (t1 $ t2) = fold (add_names quant) [t1, t2]
   19.50        | add_names _ _ = I
   19.51 @@ -169,7 +169,7 @@
   19.52     workaround is to instantiate "?P := (%c. ... c ... c ... c ...)" manually. *)
   19.53  fun quant_resolve_tac ctxt th i st =
   19.54    case (Thm.concl_of st, Thm.prop_of th) of
   19.55 -    (@{const Trueprop} $ (Var _ $ (c as Free _)), @{const Trueprop} $ _) =>
   19.56 +    (\<^const>\<open>Trueprop\<close> $ (Var _ $ (c as Free _)), \<^const>\<open>Trueprop\<close> $ _) =>
   19.57      let
   19.58        val cc = Thm.cterm_of ctxt c
   19.59        val ct = Thm.dest_arg (Thm.cprop_of th)
   19.60 @@ -197,21 +197,21 @@
   19.61  (*Are any of the logical connectives in "bs" present in the term?*)
   19.62  fun has_conns bs =
   19.63    let fun has (Const _) = false
   19.64 -        | has (Const(@{const_name Trueprop},_) $ p) = has p
   19.65 -        | has (Const(@{const_name Not},_) $ p) = has p
   19.66 -        | has (Const(@{const_name HOL.disj},_) $ p $ q) = member (op =) bs @{const_name HOL.disj} orelse has p orelse has q
   19.67 -        | has (Const(@{const_name HOL.conj},_) $ p $ q) = member (op =) bs @{const_name HOL.conj} orelse has p orelse has q
   19.68 -        | has (Const(@{const_name All},_) $ Abs(_,_,p)) = member (op =) bs @{const_name All} orelse has p
   19.69 -        | has (Const(@{const_name Ex},_) $ Abs(_,_,p)) = member (op =) bs @{const_name Ex} orelse has p
   19.70 +        | has (Const(\<^const_name>\<open>Trueprop\<close>,_) $ p) = has p
   19.71 +        | has (Const(\<^const_name>\<open>Not\<close>,_) $ p) = has p
   19.72 +        | has (Const(\<^const_name>\<open>HOL.disj\<close>,_) $ p $ q) = member (op =) bs \<^const_name>\<open>HOL.disj\<close> orelse has p orelse has q
   19.73 +        | has (Const(\<^const_name>\<open>HOL.conj\<close>,_) $ p $ q) = member (op =) bs \<^const_name>\<open>HOL.conj\<close> orelse has p orelse has q
   19.74 +        | has (Const(\<^const_name>\<open>All\<close>,_) $ Abs(_,_,p)) = member (op =) bs \<^const_name>\<open>All\<close> orelse has p
   19.75 +        | has (Const(\<^const_name>\<open>Ex\<close>,_) $ Abs(_,_,p)) = member (op =) bs \<^const_name>\<open>Ex\<close> orelse has p
   19.76          | has _ = false
   19.77    in  has  end;
   19.78  
   19.79  
   19.80  (**** Clause handling ****)
   19.81  
   19.82 -fun literals (Const(@{const_name Trueprop},_) $ P) = literals P
   19.83 -  | literals (Const(@{const_name HOL.disj},_) $ P $ Q) = literals P @ literals Q
   19.84 -  | literals (Const(@{const_name Not},_) $ P) = [(false,P)]
   19.85 +fun literals (Const(\<^const_name>\<open>Trueprop\<close>,_) $ P) = literals P
   19.86 +  | literals (Const(\<^const_name>\<open>HOL.disj\<close>,_) $ P $ Q) = literals P @ literals Q
   19.87 +  | literals (Const(\<^const_name>\<open>Not\<close>,_) $ P) = [(false,P)]
   19.88    | literals P = [(true,P)];
   19.89  
   19.90  (*number of literals in a term*)
   19.91 @@ -220,23 +220,23 @@
   19.92  
   19.93  (*** Tautology Checking ***)
   19.94  
   19.95 -fun signed_lits_aux (Const (@{const_name HOL.disj}, _) $ P $ Q) (poslits, neglits) =
   19.96 +fun signed_lits_aux (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ P $ Q) (poslits, neglits) =
   19.97        signed_lits_aux Q (signed_lits_aux P (poslits, neglits))
   19.98 -  | signed_lits_aux (Const(@{const_name Not},_) $ P) (poslits, neglits) = (poslits, P::neglits)
   19.99 +  | signed_lits_aux (Const(\<^const_name>\<open>Not\<close>,_) $ P) (poslits, neglits) = (poslits, P::neglits)
  19.100    | signed_lits_aux P (poslits, neglits) = (P::poslits, neglits);
  19.101  
  19.102  fun signed_lits th = signed_lits_aux (HOLogic.dest_Trueprop (Thm.concl_of th)) ([],[]);
  19.103  
  19.104  (*Literals like X=X are tautologous*)
  19.105 -fun taut_poslit (Const(@{const_name HOL.eq},_) $ t $ u) = t aconv u
  19.106 -  | taut_poslit (Const(@{const_name True},_)) = true
  19.107 +fun taut_poslit (Const(\<^const_name>\<open>HOL.eq\<close>,_) $ t $ u) = t aconv u
  19.108 +  | taut_poslit (Const(\<^const_name>\<open>True\<close>,_)) = true
  19.109    | taut_poslit _ = false;
  19.110  
  19.111  fun is_taut th =
  19.112    let val (poslits,neglits) = signed_lits th
  19.113    in  exists taut_poslit poslits
  19.114        orelse
  19.115 -      exists (member (op aconv) neglits) (@{term False} :: poslits)
  19.116 +      exists (member (op aconv) neglits) (\<^term>\<open>False\<close> :: poslits)
  19.117    end
  19.118    handle TERM _ => false;       (*probably dest_Trueprop on a weird theorem*)
  19.119  
  19.120 @@ -256,18 +256,18 @@
  19.121  fun refl_clause_aux 0 th = th
  19.122    | refl_clause_aux n th =
  19.123         case HOLogic.dest_Trueprop (Thm.concl_of th) of
  19.124 -          (Const (@{const_name HOL.disj}, _) $ (Const (@{const_name HOL.disj}, _) $ _ $ _) $ _) =>
  19.125 +          (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ _ $ _) $ _) =>
  19.126              refl_clause_aux n (th RS disj_assoc)    (*isolate an atom as first disjunct*)
  19.127 -        | (Const (@{const_name HOL.disj}, _) $ (Const(@{const_name Not},_) $ (Const(@{const_name HOL.eq},_) $ t $ u)) $ _) =>
  19.128 +        | (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ (Const(\<^const_name>\<open>Not\<close>,_) $ (Const(\<^const_name>\<open>HOL.eq\<close>,_) $ t $ u)) $ _) =>
  19.129              if eliminable(t,u)
  19.130              then refl_clause_aux (n-1) (th RS not_refl_disj_D)  (*Var inequation: delete*)
  19.131              else refl_clause_aux (n-1) (th RS disj_comm)  (*not between Vars: ignore*)
  19.132 -        | (Const (@{const_name HOL.disj}, _) $ _ $ _) => refl_clause_aux n (th RS disj_comm)
  19.133 +        | (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ _ $ _) => refl_clause_aux n (th RS disj_comm)
  19.134          | _ => (*not a disjunction*) th;
  19.135  
  19.136 -fun notequal_lits_count (Const (@{const_name HOL.disj}, _) $ P $ Q) =
  19.137 +fun notequal_lits_count (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ P $ Q) =
  19.138        notequal_lits_count P + notequal_lits_count Q
  19.139 -  | notequal_lits_count (Const(@{const_name Not},_) $ (Const(@{const_name HOL.eq},_) $ _ $ _)) = 1
  19.140 +  | notequal_lits_count (Const(\<^const_name>\<open>Not\<close>,_) $ (Const(\<^const_name>\<open>HOL.eq\<close>,_) $ _ $ _)) = 1
  19.141    | notequal_lits_count _ = 0;
  19.142  
  19.143  (*Simplify a clause by applying reflexivity to its negated equality literals*)
  19.144 @@ -312,26 +312,26 @@
  19.145    fun prod x y = if x < bound andalso y < bound then x*y else bound
  19.146    
  19.147    (*Estimate the number of clauses in order to detect infeasible theorems*)
  19.148 -  fun signed_nclauses b (Const(@{const_name Trueprop},_) $ t) = signed_nclauses b t
  19.149 -    | signed_nclauses b (Const(@{const_name Not},_) $ t) = signed_nclauses (not b) t
  19.150 -    | signed_nclauses b (Const(@{const_name HOL.conj},_) $ t $ u) =
  19.151 +  fun signed_nclauses b (Const(\<^const_name>\<open>Trueprop\<close>,_) $ t) = signed_nclauses b t
  19.152 +    | signed_nclauses b (Const(\<^const_name>\<open>Not\<close>,_) $ t) = signed_nclauses (not b) t
  19.153 +    | signed_nclauses b (Const(\<^const_name>\<open>HOL.conj\<close>,_) $ t $ u) =
  19.154          if b then sum (signed_nclauses b t) (signed_nclauses b u)
  19.155               else prod (signed_nclauses b t) (signed_nclauses b u)
  19.156 -    | signed_nclauses b (Const(@{const_name HOL.disj},_) $ t $ u) =
  19.157 +    | signed_nclauses b (Const(\<^const_name>\<open>HOL.disj\<close>,_) $ t $ u) =
  19.158          if b then prod (signed_nclauses b t) (signed_nclauses b u)
  19.159               else sum (signed_nclauses b t) (signed_nclauses b u)
  19.160 -    | signed_nclauses b (Const(@{const_name HOL.implies},_) $ t $ u) =
  19.161 +    | signed_nclauses b (Const(\<^const_name>\<open>HOL.implies\<close>,_) $ t $ u) =
  19.162          if b then prod (signed_nclauses (not b) t) (signed_nclauses b u)
  19.163               else sum (signed_nclauses (not b) t) (signed_nclauses b u)
  19.164 -    | signed_nclauses b (Const(@{const_name HOL.eq}, Type ("fun", [T, _])) $ t $ u) =
  19.165 +    | signed_nclauses b (Const(\<^const_name>\<open>HOL.eq\<close>, Type ("fun", [T, _])) $ t $ u) =
  19.166          if T = HOLogic.boolT then (*Boolean equality is if-and-only-if*)
  19.167              if b then sum (prod (signed_nclauses (not b) t) (signed_nclauses b u))
  19.168                            (prod (signed_nclauses (not b) u) (signed_nclauses b t))
  19.169                   else sum (prod (signed_nclauses b t) (signed_nclauses b u))
  19.170                            (prod (signed_nclauses (not b) t) (signed_nclauses (not b) u))
  19.171          else 1
  19.172 -    | signed_nclauses b (Const(@{const_name Ex}, _) $ Abs (_,_,t)) = signed_nclauses b t
  19.173 -    | signed_nclauses b (Const(@{const_name All},_) $ Abs (_,_,t)) = signed_nclauses b t
  19.174 +    | signed_nclauses b (Const(\<^const_name>\<open>Ex\<close>, _) $ Abs (_,_,t)) = signed_nclauses b t
  19.175 +    | signed_nclauses b (Const(\<^const_name>\<open>All\<close>,_) $ Abs (_,_,t)) = signed_nclauses b t
  19.176      | signed_nclauses _ _ = 1; (* literal *)
  19.177   in signed_nclauses true t end
  19.178  
  19.179 @@ -346,7 +346,7 @@
  19.180    val spec_var =
  19.181      Thm.dest_arg (Thm.dest_arg (#2 (Thm.dest_implies (Thm.cprop_of spec))))
  19.182      |> Thm.term_of |> dest_Var;
  19.183 -  fun name_of (Const (@{const_name All}, _) $ Abs(x, _, _)) = x | name_of _ = Name.uu;
  19.184 +  fun name_of (Const (\<^const_name>\<open>All\<close>, _) $ Abs(x, _, _)) = x | name_of _ = Name.uu;
  19.185  in  
  19.186    fun freeze_spec th ctxt =
  19.187      let
  19.188 @@ -370,18 +370,18 @@
  19.189    let val ctxt_ref = Unsynchronized.ref ctxt   (* FIXME ??? *)
  19.190        fun cnf_aux (th,ths) =
  19.191          if not (can HOLogic.dest_Trueprop (Thm.prop_of th)) then ths (*meta-level: ignore*)
  19.192 -        else if not (has_conns [@{const_name All}, @{const_name Ex}, @{const_name HOL.conj}] (Thm.prop_of th))
  19.193 +        else if not (has_conns [\<^const_name>\<open>All\<close>, \<^const_name>\<open>Ex\<close>, \<^const_name>\<open>HOL.conj\<close>] (Thm.prop_of th))
  19.194          then nodups ctxt th :: ths (*no work to do, terminate*)
  19.195          else case head_of (HOLogic.dest_Trueprop (Thm.concl_of th)) of
  19.196 -            Const (@{const_name HOL.conj}, _) => (*conjunction*)
  19.197 +            Const (\<^const_name>\<open>HOL.conj\<close>, _) => (*conjunction*)
  19.198                  cnf_aux (th RS conjunct1, cnf_aux (th RS conjunct2, ths))
  19.199 -          | Const (@{const_name All}, _) => (*universal quantifier*)
  19.200 +          | Const (\<^const_name>\<open>All\<close>, _) => (*universal quantifier*)
  19.201                  let val (th', ctxt') = freeze_spec th (! ctxt_ref)
  19.202                  in  ctxt_ref := ctxt'; cnf_aux (th', ths) end
  19.203 -          | Const (@{const_name Ex}, _) =>
  19.204 +          | Const (\<^const_name>\<open>Ex\<close>, _) =>
  19.205                (*existential quantifier: Insert Skolem functions*)
  19.206                cnf_aux (apply_skolem_theorem (! ctxt_ref) (th, old_skolem_ths), ths)
  19.207 -          | Const (@{const_name HOL.disj}, _) =>
  19.208 +          | Const (\<^const_name>\<open>HOL.disj\<close>, _) =>
  19.209                (*Disjunction of P, Q: Create new goal of proving ?P | ?Q and solve it using
  19.210                  all combinations of converting P, Q to CNF.*)
  19.211                (*There is one assumption, which gets bound to prem and then normalized via
  19.212 @@ -409,8 +409,8 @@
  19.213  
  19.214  (**** Generation of contrapositives ****)
  19.215  
  19.216 -fun is_left (Const (@{const_name Trueprop}, _) $
  19.217 -               (Const (@{const_name HOL.disj}, _) $ (Const (@{const_name HOL.disj}, _) $ _ $ _) $ _)) = true
  19.218 +fun is_left (Const (\<^const_name>\<open>Trueprop\<close>, _) $
  19.219 +               (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ _ $ _) $ _)) = true
  19.220    | is_left _ = false;
  19.221  
  19.222  (*Associate disjuctions to right -- make leftmost disjunct a LITERAL*)
  19.223 @@ -431,8 +431,8 @@
  19.224  
  19.225  fun rigid t = not (is_Var (head_of t));
  19.226  
  19.227 -fun ok4horn (Const (@{const_name Trueprop},_) $ (Const (@{const_name HOL.disj}, _) $ t $ _)) = rigid t
  19.228 -  | ok4horn (Const (@{const_name Trueprop},_) $ t) = rigid t
  19.229 +fun ok4horn (Const (\<^const_name>\<open>Trueprop\<close>,_) $ (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ t $ _)) = rigid t
  19.230 +  | ok4horn (Const (\<^const_name>\<open>Trueprop\<close>,_) $ t) = rigid t
  19.231    | ok4horn _ = false;
  19.232  
  19.233  (*Create a meta-level Horn clause*)
  19.234 @@ -466,7 +466,7 @@
  19.235  
  19.236  (***** MESON PROOF PROCEDURE *****)
  19.237  
  19.238 -fun rhyps (Const(@{const_name Pure.imp},_) $ (Const(@{const_name Trueprop},_) $ A) $ phi,
  19.239 +fun rhyps (Const(\<^const_name>\<open>Pure.imp\<close>,_) $ (Const(\<^const_name>\<open>Trueprop\<close>,_) $ A) $ phi,
  19.240             As) = rhyps(phi, A::As)
  19.241    | rhyps (_, As) = As;
  19.242  
  19.243 @@ -511,8 +511,8 @@
  19.244  val nnf_rls = [imp_to_disjD, iff_to_disjD, not_conjD, not_disjD,
  19.245                 not_impD, not_iffD, not_allD, not_exD, not_notD];
  19.246  
  19.247 -fun ok4nnf (Const (@{const_name Trueprop},_) $ (Const (@{const_name Not}, _) $ t)) = rigid t
  19.248 -  | ok4nnf (Const (@{const_name Trueprop},_) $ t) = rigid t
  19.249 +fun ok4nnf (Const (\<^const_name>\<open>Trueprop\<close>,_) $ (Const (\<^const_name>\<open>Not\<close>, _) $ t)) = rigid t
  19.250 +  | ok4nnf (Const (\<^const_name>\<open>Trueprop\<close>,_) $ t) = rigid t
  19.251    | ok4nnf _ = false;
  19.252  
  19.253  fun make_nnf1 ctxt th =
  19.254 @@ -537,13 +537,12 @@
  19.255  val nnf_ss =
  19.256    simpset_of (put_simpset HOL_basic_ss @{context}
  19.257      addsimps nnf_extra_simps
  19.258 -    addsimprocs [@{simproc defined_All}, @{simproc defined_Ex}, @{simproc neq},
  19.259 -                 @{simproc let_simp}])
  19.260 +    addsimprocs [\<^simproc>\<open>defined_All\<close>, \<^simproc>\<open>defined_Ex\<close>, \<^simproc>\<open>neq\<close>, \<^simproc>\<open>let_simp\<close>])
  19.261  
  19.262  val presimplified_consts =
  19.263 -  [@{const_name simp_implies}, @{const_name False}, @{const_name True},
  19.264 -   @{const_name Ex1}, @{const_name Ball}, @{const_name Bex}, @{const_name If},
  19.265 -   @{const_name Let}]
  19.266 +  [\<^const_name>\<open>simp_implies\<close>, \<^const_name>\<open>False\<close>, \<^const_name>\<open>True\<close>,
  19.267 +   \<^const_name>\<open>Ex1\<close>, \<^const_name>\<open>Ball\<close>, \<^const_name>\<open>Bex\<close>, \<^const_name>\<open>If\<close>,
  19.268 +   \<^const_name>\<open>Let\<close>]
  19.269  
  19.270  fun presimplify ctxt =
  19.271    rewrite_rule ctxt (map safe_mk_meta_eq nnf_simps)
  19.272 @@ -563,7 +562,7 @@
  19.273  fun skolemize_with_choice_theorems ctxt choice_ths =
  19.274    let
  19.275      fun aux th =
  19.276 -      if not (has_conns [@{const_name Ex}] (Thm.prop_of th)) then
  19.277 +      if not (has_conns [\<^const_name>\<open>Ex\<close>] (Thm.prop_of th)) then
  19.278          th
  19.279        else
  19.280          tryres (th, choice_ths @
  19.281 @@ -604,7 +603,7 @@
  19.282            end
  19.283        end
  19.284    in
  19.285 -    if T = @{typ bool} then
  19.286 +    if T = \<^typ>\<open>bool\<close> then
  19.287        NONE
  19.288      else case pat t u of
  19.289        (SOME T, p as _ $ _) => SOME (Abs (Name.uu, T, p))
  19.290 @@ -617,8 +616,8 @@
  19.291  (* Strengthens "f g ~= f h" to "f g ~= f h & (EX x. g x ~= h x)". *)
  19.292  fun cong_extensionalize_thm ctxt th =
  19.293    (case Thm.concl_of th of
  19.294 -    @{const Trueprop} $ (@{const Not}
  19.295 -        $ (Const (@{const_name HOL.eq}, Type (_, [T, _]))
  19.296 +    \<^const>\<open>Trueprop\<close> $ (\<^const>\<open>Not\<close>
  19.297 +        $ (Const (\<^const_name>\<open>HOL.eq\<close>, Type (_, [T, _]))
  19.298             $ (t as _ $ _) $ (u as _ $ _))) =>
  19.299      (case get_F_pattern T t u of
  19.300        SOME p => th RS infer_instantiate ctxt [(("F", 0), Thm.cterm_of ctxt p)] ext_cong_neq
  19.301 @@ -630,7 +629,7 @@
  19.302     proof in "Tarski" that relies on the current behavior. *)
  19.303  fun abs_extensionalize_conv ctxt ct =
  19.304    (case Thm.term_of ct of
  19.305 -    Const (@{const_name HOL.eq}, _) $ _ $ Abs _ =>
  19.306 +    Const (\<^const_name>\<open>HOL.eq\<close>, _) $ _ $ Abs _ =>
  19.307      ct |> (Conv.rewr_conv @{thm fun_eq_iff [THEN eq_reflection]}
  19.308             then_conv abs_extensionalize_conv ctxt)
  19.309    | _ $ _ => Conv.comb_conv (abs_extensionalize_conv ctxt) ct
    20.1 --- a/src/HOL/Tools/Meson/meson_clausify.ML	Wed Dec 06 19:34:59 2017 +0100
    20.2 +++ b/src/HOL/Tools/Meson/meson_clausify.ML	Wed Dec 06 20:43:09 2017 +0100
    20.3 @@ -35,8 +35,8 @@
    20.4  
    20.5  (**** Transformation of Elimination Rules into First-Order Formulas****)
    20.6  
    20.7 -val cfalse = Thm.cterm_of @{theory_context HOL} @{term False};
    20.8 -val ctp_false = Thm.cterm_of @{theory_context HOL} (HOLogic.mk_Trueprop @{term False});
    20.9 +val cfalse = Thm.cterm_of \<^theory_context>\<open>HOL\<close> \<^term>\<open>False\<close>;
   20.10 +val ctp_false = Thm.cterm_of \<^theory_context>\<open>HOL\<close> (HOLogic.mk_Trueprop \<^term>\<open>False\<close>);
   20.11  
   20.12  (* Converts an elim-rule into an equivalent theorem that does not have the
   20.13     predicate variable. Leaves other theorems unchanged. We simply instantiate
   20.14 @@ -44,9 +44,9 @@
   20.15     "Sledgehammer_Util".) *)
   20.16  fun transform_elim_theorem th =
   20.17    (case Thm.concl_of th of    (*conclusion variable*)
   20.18 -    @{const Trueprop} $ (Var (v as (_, @{typ bool}))) =>
   20.19 +    \<^const>\<open>Trueprop\<close> $ (Var (v as (_, \<^typ>\<open>bool\<close>))) =>
   20.20        Thm.instantiate ([], [(v, cfalse)]) th
   20.21 -  | Var (v as (_, @{typ prop})) =>
   20.22 +  | Var (v as (_, \<^typ>\<open>prop\<close>)) =>
   20.23        Thm.instantiate ([], [(v, ctp_false)]) th
   20.24    | _ => th)
   20.25  
   20.26 @@ -55,7 +55,7 @@
   20.27  
   20.28  fun mk_old_skolem_term_wrapper t =
   20.29    let val T = fastype_of t in
   20.30 -    Const (@{const_name Meson.skolem}, T --> T) $ t
   20.31 +    Const (\<^const_name>\<open>Meson.skolem\<close>, T --> T) $ t
   20.32    end
   20.33  
   20.34  fun beta_eta_in_abs_body (Abs (s, T, t')) = Abs (s, T, beta_eta_in_abs_body t')
   20.35 @@ -64,7 +64,7 @@
   20.36  (*Traverse a theorem, accumulating Skolem function definitions.*)
   20.37  fun old_skolem_defs th =
   20.38    let
   20.39 -    fun dec_sko (Const (@{const_name Ex}, _) $ (body as Abs (_, T, p))) rhss =
   20.40 +    fun dec_sko (Const (\<^const_name>\<open>Ex\<close>, _) $ (body as Abs (_, T, p))) rhss =
   20.41          (*Existential: declare a Skolem function, then insert into body and continue*)
   20.42          let
   20.43            val args = Misc_Legacy.term_frees body
   20.44 @@ -75,20 +75,20 @@
   20.45              |> mk_old_skolem_term_wrapper
   20.46            val comb = list_comb (rhs, args)
   20.47          in dec_sko (subst_bound (comb, p)) (rhs :: rhss) end
   20.48 -      | dec_sko (Const (@{const_name All},_) $ Abs (a, T, p)) rhss =
   20.49 +      | dec_sko (Const (\<^const_name>\<open>All\<close>,_) $ Abs (a, T, p)) rhss =
   20.50          (*Universal quant: insert a free variable into body and continue*)
   20.51          let val fname = singleton (Name.variant_list (Misc_Legacy.add_term_names (p, []))) a
   20.52          in dec_sko (subst_bound (Free(fname,T), p)) rhss end
   20.53 -      | dec_sko (@{const conj} $ p $ q) rhss = rhss |> dec_sko p |> dec_sko q
   20.54 -      | dec_sko (@{const disj} $ p $ q) rhss = rhss |> dec_sko p |> dec_sko q
   20.55 -      | dec_sko (@{const Trueprop} $ p) rhss = dec_sko p rhss
   20.56 +      | dec_sko (\<^const>\<open>conj\<close> $ p $ q) rhss = rhss |> dec_sko p |> dec_sko q
   20.57 +      | dec_sko (\<^const>\<open>disj\<close> $ p $ q) rhss = rhss |> dec_sko p |> dec_sko q
   20.58 +      | dec_sko (\<^const>\<open>Trueprop\<close> $ p) rhss = dec_sko p rhss
   20.59        | dec_sko _ rhss = rhss
   20.60    in  dec_sko (Thm.prop_of th) []  end;
   20.61  
   20.62  
   20.63  (**** REPLACING ABSTRACTIONS BY COMBINATORS ****)
   20.64  
   20.65 -fun is_quasi_lambda_free (Const (@{const_name Meson.skolem}, _) $ _) = true
   20.66 +fun is_quasi_lambda_free (Const (\<^const_name>\<open>Meson.skolem\<close>, _) $ _) = true
   20.67    | is_quasi_lambda_free (t1 $ t2) =
   20.68      is_quasi_lambda_free t1 andalso is_quasi_lambda_free t2
   20.69    | is_quasi_lambda_free (Abs _) = false
   20.70 @@ -98,7 +98,7 @@
   20.71  fun abstract ctxt ct =
   20.72    let
   20.73        val Abs(x,_,body) = Thm.term_of ct
   20.74 -      val Type (@{type_name fun}, [xT,bodyT]) = Thm.typ_of_cterm ct
   20.75 +      val Type (\<^type_name>\<open>fun\<close>, [xT,bodyT]) = Thm.typ_of_cterm ct
   20.76        val cxT = Thm.ctyp_of ctxt xT
   20.77        val cbodyT = Thm.ctyp_of ctxt bodyT
   20.78        fun makeK () =
   20.79 @@ -196,7 +196,7 @@
   20.80      val (hilbert, cabs) = ch |> Thm.dest_comb |>> Thm.term_of
   20.81      val T =
   20.82        case hilbert of
   20.83 -        Const (_, Type (@{type_name fun}, [_, T])) => T
   20.84 +        Const (_, Type (\<^type_name>\<open>fun\<close>, [_, T])) => T
   20.85        | _ => raise TERM ("old_skolem_theorem_of_def: expected \"Eps\"", [hilbert])
   20.86      val cex = Thm.cterm_of ctxt (HOLogic.exists_const T)
   20.87      val ex_tm = Thm.apply cTrueprop (Thm.apply cex cabs)
   20.88 @@ -238,10 +238,10 @@
   20.89      fun aux (cluster as (cluster_no, cluster_skolem)) index_no pos t =
   20.90        case t of
   20.91          (t1 as Const (s, _)) $ Abs (s', T, t') =>
   20.92 -        if s = @{const_name Pure.all} orelse s = @{const_name All} orelse
   20.93 -           s = @{const_name Ex} then
   20.94 +        if s = \<^const_name>\<open>Pure.all\<close> orelse s = \<^const_name>\<open>All\<close> orelse
   20.95 +           s = \<^const_name>\<open>Ex\<close> then
   20.96            let
   20.97 -            val skolem = (pos = (s = @{const_name Ex}))
   20.98 +            val skolem = (pos = (s = \<^const_name>\<open>Ex\<close>))
   20.99              val (cluster, index_no) =
  20.100                if skolem = cluster_skolem then (cluster, index_no)
  20.101                else ((cluster_no ||> cluster_skolem ? Integer.add 1, skolem), 0)
  20.102 @@ -250,17 +250,17 @@
  20.103          else
  20.104            t
  20.105        | (t1 as Const (s, _)) $ t2 $ t3 =>
  20.106 -        if s = @{const_name Pure.imp} orelse s = @{const_name HOL.implies} then
  20.107 +        if s = \<^const_name>\<open>Pure.imp\<close> orelse s = \<^const_name>\<open>HOL.implies\<close> then
  20.108            t1 $ aux cluster index_no (not pos) t2 $ aux cluster index_no pos t3
  20.109 -        else if s = @{const_name HOL.conj} orelse
  20.110 -                s = @{const_name HOL.disj} then
  20.111 +        else if s = \<^const_name>\<open>HOL.conj\<close> orelse
  20.112 +                s = \<^const_name>\<open>HOL.disj\<close> then
  20.113            t1 $ aux cluster index_no pos t2 $ aux cluster index_no pos t3
  20.114          else
  20.115            t
  20.116        | (t1 as Const (s, _)) $ t2 =>
  20.117 -        if s = @{const_name Trueprop} then
  20.118 +        if s = \<^const_name>\<open>Trueprop\<close> then
  20.119            t1 $ aux cluster index_no pos t2
  20.120 -        else if s = @{const_name Not} then
  20.121 +        else if s = \<^const_name>\<open>Not\<close> then
  20.122            t1 $ aux cluster index_no (not pos) t2
  20.123          else
  20.124            t
  20.125 @@ -271,28 +271,28 @@
  20.126    ct
  20.127    |> (case Thm.term_of ct of
  20.128          Const (s, _) $ Abs (s', _, _) =>
  20.129 -        if s = @{const_name Pure.all} orelse s = @{const_name All} orelse
  20.130 -           s = @{const_name Ex} then
  20.131 +        if s = \<^const_name>\<open>Pure.all\<close> orelse s = \<^const_name>\<open>All\<close> orelse
  20.132 +           s = \<^const_name>\<open>Ex\<close> then
  20.133            Thm.dest_comb #> snd #> Thm.dest_abs (SOME s') #> snd #> zap pos
  20.134          else
  20.135            Conv.all_conv
  20.136        | Const (s, _) $ _ $ _ =>
  20.137 -        if s = @{const_name Pure.imp} orelse s = @{const_name implies} then
  20.138 +        if s = \<^const_name>\<open>Pure.imp\<close> orelse s = \<^const_name>\<open>implies\<close> then
  20.139            Conv.combination_conv (Conv.arg_conv (zap (not pos))) (zap pos)
  20.140 -        else if s = @{const_name conj} orelse s = @{const_name disj} then
  20.141 +        else if s = \<^const_name>\<open>conj\<close> orelse s = \<^const_name>\<open>disj\<close> then
  20.142            Conv.combination_conv (Conv.arg_conv (zap pos)) (zap pos)
  20.143          else
  20.144            Conv.all_conv
  20.145        | Const (s, _) $ _ =>
  20.146 -        if s = @{const_name Trueprop} then Conv.arg_conv (zap pos)
  20.147 -        else if s = @{const_name Not} then Conv.arg_conv (zap (not pos))
  20.148 +        if s = \<^const_name>\<open>Trueprop\<close> then Conv.arg_conv (zap pos)
  20.149 +        else if s = \<^const_name>\<open>Not\<close> then Conv.arg_conv (zap (not pos))
  20.150          else Conv.all_conv
  20.151        | _ => Conv.all_conv)
  20.152  
  20.153  fun ss_only ths ctxt = clear_simpset (put_simpset HOL_basic_ss ctxt) addsimps ths
  20.154  
  20.155  val cheat_choice =
  20.156 -  @{prop "\<forall>x. \<exists>y. Q x y \<Longrightarrow> \<exists>f. \<forall>x. Q x (f x)"}
  20.157 +  \<^prop>\<open>\<forall>x. \<exists>y. Q x y \<Longrightarrow> \<exists>f. \<forall>x. Q x (f x)\<close>
  20.158    |> Logic.varify_global
  20.159    |> Skip_Proof.make_thm @{theory}
  20.160  
  20.161 @@ -374,7 +374,7 @@
  20.162         th ctxt
  20.163      val (cnf_ths, ctxt) = clausify nnf_th
  20.164      fun intr_imp ct th =
  20.165 -      Thm.instantiate ([], [((("i", 0), @{typ nat}), Thm.cterm_of ctxt (HOLogic.mk_nat ax_no))])
  20.166 +      Thm.instantiate ([], [((("i", 0), \<^typ>\<open>nat\<close>), Thm.cterm_of ctxt (HOLogic.mk_nat ax_no))])
  20.167                        (zero_var_indexes @{thm skolem_COMBK_D})
  20.168        RS Thm.implies_intr ct th
  20.169    in
    21.1 --- a/src/HOL/Tools/Meson/meson_tactic.ML	Wed Dec 06 19:34:59 2017 +0100
    21.2 +++ b/src/HOL/Tools/Meson/meson_tactic.ML	Wed Dec 06 20:43:09 2017 +0100
    21.3 @@ -19,7 +19,7 @@
    21.4  
    21.5  val _ =
    21.6    Theory.setup
    21.7 -    (Method.setup @{binding meson} (Attrib.thms >> (fn ths => fn ctxt =>
    21.8 +    (Method.setup \<^binding>\<open>meson\<close> (Attrib.thms >> (fn ths => fn ctxt =>
    21.9        SIMPLE_METHOD' (CHANGED_PROP o meson_general_tac ctxt ths)))
   21.10        "MESON resolution proof procedure")
   21.11  
    22.1 --- a/src/HOL/Tools/Quickcheck/abstract_generators.ML	Wed Dec 06 19:34:59 2017 +0100
    22.2 +++ b/src/HOL/Tools/Quickcheck/abstract_generators.ML	Wed Dec 06 20:43:09 2017 +0100
    22.3 @@ -45,14 +45,14 @@
    22.4        in (descr, vs, [tyco], name, ([name], []), ([Type (tyco, map TFree vs)], [])) end
    22.5      fun ensure_sort (sort, instantiate) =
    22.6        Quickcheck_Common.ensure_sort
    22.7 -        (((@{sort typerep}, @{sort term_of}), sort), (the_descr, instantiate))
    22.8 +        (((\<^sort>\<open>typerep\<close>, \<^sort>\<open>term_of\<close>), sort), (the_descr, instantiate))
    22.9          Old_Datatype_Aux.default_config [tyco]
   22.10    in
   22.11      thy
   22.12      |> ensure_sort
   22.13 -        (@{sort full_exhaustive}, Exhaustive_Generators.instantiate_full_exhaustive_datatype)
   22.14 -    |> ensure_sort (@{sort exhaustive}, Exhaustive_Generators.instantiate_exhaustive_datatype)
   22.15 -    |> ensure_sort (@{sort random}, Random_Generators.instantiate_random_datatype)
   22.16 +        (\<^sort>\<open>full_exhaustive\<close>, Exhaustive_Generators.instantiate_full_exhaustive_datatype)
   22.17 +    |> ensure_sort (\<^sort>\<open>exhaustive\<close>, Exhaustive_Generators.instantiate_exhaustive_datatype)
   22.18 +    |> ensure_sort (\<^sort>\<open>random\<close>, Random_Generators.instantiate_random_datatype)
   22.19      |> (case opt_pred of NONE => I
   22.20         | SOME t => Context.theory_map (Quickcheck_Common.register_predicate (t, tyco)))
   22.21    end
   22.22 @@ -65,11 +65,11 @@
   22.23      Syntax.read_term
   22.24  
   22.25  val _ =
   22.26 -  Outer_Syntax.command @{command_keyword quickcheck_generator}
   22.27 +  Outer_Syntax.command \<^command_keyword>\<open>quickcheck_generator\<close>
   22.28      "define quickcheck generators for abstract types"
   22.29      ((Parse.type_const --
   22.30 -      Scan.option (Args.$$$ "predicate" |-- @{keyword ":"} |-- Parse.term)) --
   22.31 -      (Args.$$$ "constructors" |-- @{keyword ":"} |-- Parse.list1 Parse.term)
   22.32 +      Scan.option (Args.$$$ "predicate" |-- \<^keyword>\<open>:\<close> |-- Parse.term)) --
   22.33 +      (Args.$$$ "constructors" |-- \<^keyword>\<open>:\<close> |-- Parse.list1 Parse.term)
   22.34        >> (fn ((tyco, opt_pred), constrs) =>
   22.35          Toplevel.theory (quickcheck_generator_cmd tyco opt_pred constrs)))
   22.36  
    23.1 --- a/src/HOL/Tools/Quickcheck/exhaustive_generators.ML	Wed Dec 06 19:34:59 2017 +0100
    23.2 +++ b/src/HOL/Tools/Quickcheck/exhaustive_generators.ML	Wed Dec 06 20:43:09 2017 +0100
    23.3 @@ -38,30 +38,30 @@
    23.4  
    23.5  (** dynamic options **)
    23.6  
    23.7 -val smart_quantifier = Attrib.setup_config_bool @{binding quickcheck_smart_quantifier} (K true)
    23.8 -val optimise_equality = Attrib.setup_config_bool @{binding quickcheck_optimise_equality} (K true)
    23.9 +val smart_quantifier = Attrib.setup_config_bool \<^binding>\<open>quickcheck_smart_quantifier\<close> (K true)
   23.10 +val optimise_equality = Attrib.setup_config_bool \<^binding>\<open>quickcheck_optimise_equality\<close> (K true)
   23.11  
   23.12 -val fast = Attrib.setup_config_bool @{binding quickcheck_fast} (K false)
   23.13 -val bounded_forall = Attrib.setup_config_bool @{binding quickcheck_bounded_forall} (K false)
   23.14 -val full_support = Attrib.setup_config_bool @{binding quickcheck_full_support} (K true)
   23.15 -val quickcheck_pretty = Attrib.setup_config_bool @{binding quickcheck_pretty} (K true)
   23.16 +val fast = Attrib.setup_config_bool \<^binding>\<open>quickcheck_fast\<close> (K false)
   23.17 +val bounded_forall = Attrib.setup_config_bool \<^binding>\<open>quickcheck_bounded_forall\<close> (K false)
   23.18 +val full_support = Attrib.setup_config_bool \<^binding>\<open>quickcheck_full_support\<close> (K true)
   23.19 +val quickcheck_pretty = Attrib.setup_config_bool \<^binding>\<open>quickcheck_pretty\<close> (K true)
   23.20  
   23.21  
   23.22  (** abstract syntax **)
   23.23  
   23.24 -fun termifyT T = HOLogic.mk_prodT (T, @{typ "unit \<Rightarrow> Code_Evaluation.term"})
   23.25 +fun termifyT T = HOLogic.mk_prodT (T, \<^typ>\<open>unit \<Rightarrow> Code_Evaluation.term\<close>)
   23.26  
   23.27 -val size = @{term "i :: natural"}
   23.28 -val size_pred = @{term "(i :: natural) - 1"}
   23.29 -val size_ge_zero = @{term "(i :: natural) > 0"}
   23.30 +val size = \<^term>\<open>i :: natural\<close>
   23.31 +val size_pred = \<^term>\<open>(i :: natural) - 1\<close>
   23.32 +val size_ge_zero = \<^term>\<open>(i :: natural) > 0\<close>
   23.33  
   23.34  fun mk_none_continuation (x, y) =
   23.35 -  let val (T as Type (@{type_name option}, _)) = fastype_of x
   23.36 -  in Const (@{const_name orelse}, T --> T --> T) $ x $ y end
   23.37 +  let val (T as Type (\<^type_name>\<open>option\<close>, _)) = fastype_of x
   23.38 +  in Const (\<^const_name>\<open>orelse\<close>, T --> T --> T) $ x $ y end
   23.39  
   23.40  fun mk_if (b, t, e) =
   23.41    let val T = fastype_of t
   23.42 -  in Const (@{const_name If}, @{typ bool} --> T --> T --> T) $ b $ t $ e end
   23.43 +  in Const (\<^const_name>\<open>If\<close>, \<^typ>\<open>bool\<close> --> T --> T --> T) $ b $ t $ e end
   23.44  
   23.45  
   23.46  (* handling inductive datatypes *)
   23.47 @@ -72,19 +72,19 @@
   23.48  
   23.49  exception Counterexample of term list
   23.50  
   23.51 -val resultT =  @{typ "(bool * term list) option"}
   23.52 +val resultT = \<^typ>\<open>(bool \<times> term list) option\<close>
   23.53  
   23.54  val exhaustiveN = "exhaustive"
   23.55  val full_exhaustiveN = "full_exhaustive"
   23.56  val bounded_forallN = "bounded_forall"
   23.57  
   23.58 -fun fast_exhaustiveT T = (T --> @{typ unit}) --> @{typ natural} --> @{typ unit}
   23.59 +fun fast_exhaustiveT T = (T --> \<^typ>\<open>unit\<close>) --> \<^typ>\<open>natural\<close> --> \<^typ>\<open>unit\<close>
   23.60  
   23.61 -fun exhaustiveT T = (T --> resultT) --> @{typ natural} --> resultT
   23.62 +fun exhaustiveT T = (T --> resultT) --> \<^typ>\<open>natural\<close> --> resultT
   23.63  
   23.64 -fun bounded_forallT T = (T --> @{typ bool}) --> @{typ natural} --> @{typ bool}
   23.65 +fun bounded_forallT T = (T --> \<^typ>\<open>bool\<close>) --> \<^typ>\<open>natural\<close> --> \<^typ>\<open>bool\<close>
   23.66  
   23.67 -fun full_exhaustiveT T = (termifyT T --> resultT) --> @{typ natural} --> resultT
   23.68 +fun full_exhaustiveT T = (termifyT T --> resultT) --> \<^typ>\<open>natural\<close> --> resultT
   23.69  
   23.70  fun check_allT T = (termifyT T --> resultT) --> resultT
   23.71  
   23.72 @@ -119,35 +119,35 @@
   23.73  fun mk_equations functerms =
   23.74    let
   23.75      fun test_function T = Free ("f", T --> resultT)
   23.76 -    val mk_call = gen_mk_call (fn T => Const (@{const_name exhaustive}, exhaustiveT T))
   23.77 +    val mk_call = gen_mk_call (fn T => Const (\<^const_name>\<open>exhaustive\<close>, exhaustiveT T))
   23.78      val mk_aux_call = gen_mk_aux_call functerms
   23.79      val mk_consexpr = gen_mk_consexpr test_function
   23.80      fun mk_rhs exprs =
   23.81 -      mk_if (size_ge_zero, foldr1 mk_none_continuation exprs, Const (@{const_name None}, resultT))
   23.82 +      mk_if (size_ge_zero, foldr1 mk_none_continuation exprs, Const (\<^const_name>\<open>None\<close>, resultT))
   23.83    in mk_equation_terms (mk_call, mk_aux_call, mk_consexpr, mk_rhs, test_function, functerms) end
   23.84  
   23.85  fun mk_bounded_forall_equations functerms =
   23.86    let
   23.87 -    fun test_function T = Free ("P", T --> @{typ bool})
   23.88 -    val mk_call = gen_mk_call (fn T => Const (@{const_name bounded_forall}, bounded_forallT T))
   23.89 +    fun test_function T = Free ("P", T --> \<^typ>\<open>bool\<close>)
   23.90 +    val mk_call = gen_mk_call (fn T => Const (\<^const_name>\<open>bounded_forall\<close>, bounded_forallT T))
   23.91      val mk_aux_call = gen_mk_aux_call functerms
   23.92      val mk_consexpr = gen_mk_consexpr test_function
   23.93 -    fun mk_rhs exprs = mk_if (size_ge_zero, foldr1 HOLogic.mk_conj exprs, @{term True})
   23.94 +    fun mk_rhs exprs = mk_if (size_ge_zero, foldr1 HOLogic.mk_conj exprs, \<^term>\<open>True\<close>)
   23.95    in mk_equation_terms (mk_call, mk_aux_call, mk_consexpr, mk_rhs, test_function, functerms) end
   23.96  
   23.97  fun mk_full_equations functerms =
   23.98    let
   23.99      fun test_function T = Free ("f", termifyT T --> resultT)
  23.100      fun case_prod_const T =
  23.101 -      HOLogic.case_prod_const (T, @{typ "unit \<Rightarrow> Code_Evaluation.term"}, resultT)
  23.102 +      HOLogic.case_prod_const (T, \<^typ>\<open>unit \<Rightarrow> Code_Evaluation.term\<close>, resultT)
  23.103      fun mk_call T =
  23.104        let
  23.105 -        val full_exhaustive = Const (@{const_name full_exhaustive}, full_exhaustiveT T)
  23.106 +        val full_exhaustive = Const (\<^const_name>\<open>full_exhaustive\<close>, full_exhaustiveT T)
  23.107        in
  23.108          (T,
  23.109            fn t =>
  23.110              full_exhaustive $
  23.111 -              (case_prod_const T $ absdummy T (absdummy @{typ "unit \<Rightarrow> Code_Evaluation.term"} t)) $
  23.112 +              (case_prod_const T $ absdummy T (absdummy \<^typ>\<open>unit \<Rightarrow> Code_Evaluation.term\<close> t)) $
  23.113                size_pred)
  23.114        end
  23.115      fun mk_aux_call fTs (k, _) (tyco, Ts) =
  23.116 @@ -158,7 +158,7 @@
  23.117          (T,
  23.118            fn t =>
  23.119              nth functerms k $
  23.120 -              (case_prod_const T $ absdummy T (absdummy @{typ "unit \<Rightarrow> Code_Evaluation.term"} t)) $
  23.121 +              (case_prod_const T $ absdummy T (absdummy \<^typ>\<open>unit \<Rightarrow> Code_Evaluation.term\<close> t)) $
  23.122                size_pred)
  23.123        end
  23.124      fun mk_consexpr simpleT (c, xs) =
  23.125 @@ -167,21 +167,21 @@
  23.126          val constr = Const (c, Ts ---> simpleT)
  23.127          val bounds = map (fn x => Bound (2 * x + 1)) (((length xs) - 1) downto 0)
  23.128          val Eval_App =
  23.129 -          Const (@{const_name Code_Evaluation.App},
  23.130 +          Const (\<^const_name>\<open>Code_Evaluation.App\<close>,
  23.131              HOLogic.termT --> HOLogic.termT --> HOLogic.termT)
  23.132          val Eval_Const =
  23.133 -          Const (@{const_name Code_Evaluation.Const},
  23.134 -            HOLogic.literalT --> @{typ typerep} --> HOLogic.termT)
  23.135 +          Const (\<^const_name>\<open>Code_Evaluation.Const\<close>,
  23.136 +            HOLogic.literalT --> \<^typ>\<open>typerep\<close> --> HOLogic.termT)
  23.137          val term =
  23.138 -          fold (fn u => fn t => Eval_App $ t $ (u $ @{term "()"}))
  23.139 +          fold (fn u => fn t => Eval_App $ t $ (u $ \<^term>\<open>()\<close>))
  23.140              bounds (Eval_Const $ HOLogic.mk_literal c $ HOLogic.mk_typerep (Ts ---> simpleT))
  23.141          val start_term =
  23.142            test_function simpleT $
  23.143 -            (HOLogic.pair_const simpleT @{typ "unit \<Rightarrow> Code_Evaluation.term"} $
  23.144 -              (list_comb (constr, bounds)) $ absdummy @{typ unit} term)
  23.145 +            (HOLogic.pair_const simpleT \<^typ>\<open>unit \<Rightarrow> Code_Evaluation.term\<close> $
  23.146 +              (list_comb (constr, bounds)) $ absdummy \<^typ>\<open>unit\<close> term)
  23.147        in fold_rev (fn f => fn t => f t) fns start_term end
  23.148      fun mk_rhs exprs =
  23.149 -      mk_if (size_ge_zero, foldr1 mk_none_continuation exprs, Const (@{const_name None}, resultT))
  23.150 +      mk_if (size_ge_zero, foldr1 mk_none_continuation exprs, Const (\<^const_name>\<open>None\<close>, resultT))
  23.151    in mk_equation_terms (mk_call, mk_aux_call, mk_consexpr, mk_rhs, test_function, functerms) end
  23.152  
  23.153  
  23.154 @@ -212,17 +212,17 @@
  23.155  
  23.156  val instantiate_bounded_forall_datatype =
  23.157    instantiate_datatype
  23.158 -    ("bounded universal quantifiers", bounded_forallN, @{sort bounded_forall},
  23.159 +    ("bounded universal quantifiers", bounded_forallN, \<^sort>\<open>bounded_forall\<close>,
  23.160        mk_bounded_forall_equations, bounded_forallT, ["P", "i"])
  23.161  
  23.162  val instantiate_exhaustive_datatype =
  23.163    instantiate_datatype
  23.164 -    ("exhaustive generators", exhaustiveN, @{sort exhaustive},
  23.165 +    ("exhaustive generators", exhaustiveN, \<^sort>\<open>exhaustive\<close>,
  23.166        mk_equations, exhaustiveT, ["f", "i"])
  23.167  
  23.168  val instantiate_full_exhaustive_datatype =
  23.169    instantiate_datatype
  23.170 -    ("full exhaustive generators", full_exhaustiveN, @{sort full_exhaustive},
  23.171 +    ("full exhaustive generators", full_exhaustiveN, \<^sort>\<open>full_exhaustive\<close>,
  23.172        mk_full_equations, full_exhaustiveT, ["f", "i"])
  23.173  
  23.174  
  23.175 @@ -230,15 +230,15 @@
  23.176  
  23.177  fun mk_let_expr (x, t, e) genuine =
  23.178    let val (T1, T2) = (fastype_of x, fastype_of (e genuine))
  23.179 -  in Const (@{const_name Let}, T1 --> (T1 --> T2) --> T2) $ t $ lambda x (e genuine) end
  23.180 +  in Const (\<^const_name>\<open>Let\<close>, T1 --> (T1 --> T2) --> T2) $ t $ lambda x (e genuine) end
  23.181  
  23.182  fun mk_safe_let_expr genuine_only none safe (x, t, e) genuine =
  23.183    let
  23.184      val (T1, T2) = (fastype_of x, fastype_of (e genuine))
  23.185 -    val if_t = Const (@{const_name If}, @{typ bool} --> T2 --> T2 --> T2)
  23.186 +    val if_t = Const (\<^const_name>\<open>If\<close>, \<^typ>\<open>bool\<close> --> T2 --> T2 --> T2)
  23.187    in
  23.188 -    Const (@{const_name Quickcheck_Random.catch_match}, T2 --> T2 --> T2) $
  23.189 -      (Const (@{const_name Let}, T1 --> (T1 --> T2) --> T2) $ t $ lambda x (e genuine)) $
  23.190 +    Const (\<^const_name>\<open>Quickcheck_Random.catch_match\<close>, T2 --> T2 --> T2) $
  23.191 +      (Const (\<^const_name>\<open>Let\<close>, T1 --> (T1 --> T2) --> T2) $ t $ lambda x (e genuine)) $
  23.192        (if_t $ genuine_only $ none $ safe false)
  23.193    end
  23.194  
  23.195 @@ -323,30 +323,30 @@
  23.196      val frees = map Free (Term.add_frees t [])
  23.197      fun lookup v = the (AList.lookup (op =) (names ~~ frees) v)
  23.198      val ([depth_name], _) = Variable.variant_fixes ["depth"] ctxt'
  23.199 -    val depth = Free (depth_name, @{typ natural})
  23.200 +    val depth = Free (depth_name, \<^typ>\<open>natural\<close>)
  23.201      fun return _ =
  23.202 -      @{term "throw_Counterexample :: term list \<Rightarrow> unit"} $
  23.203 -        (HOLogic.mk_list @{typ term}
  23.204 +      \<^term>\<open>throw_Counterexample :: term list \<Rightarrow> unit\<close> $
  23.205 +        (HOLogic.mk_list \<^typ>\<open>term\<close>
  23.206            (map (fn t => HOLogic.mk_term_of (fastype_of t) t) (frees @ eval_terms)))
  23.207      fun mk_exhaustive_closure (free as Free (_, T)) t =
  23.208 -      Const (@{const_name fast_exhaustive}, fast_exhaustiveT T) $ lambda free t $ depth
  23.209 -    val none_t = @{term "()"}
  23.210 +      Const (\<^const_name>\<open>fast_exhaustive\<close>, fast_exhaustiveT T) $ lambda free t $ depth
  23.211 +    val none_t = \<^term>\<open>()\<close>
  23.212      fun mk_safe_if (cond, then_t, else_t) genuine = mk_if (cond, then_t, else_t genuine)
  23.213      fun mk_let _ def v_opt t e = mk_let_expr (the_default def v_opt, t, e)
  23.214      val mk_test_term =
  23.215        mk_test_term lookup mk_exhaustive_closure mk_safe_if mk_let none_t return ctxt
  23.216 -  in lambda depth (@{term "catch_Counterexample :: unit => term list option"} $ mk_test_term t) end
  23.217 +  in lambda depth (\<^term>\<open>catch_Counterexample :: unit => term list option\<close> $ mk_test_term t) end
  23.218  
  23.219  fun mk_unknown_term T =
  23.220 -  HOLogic.reflect_term (Const (@{const_name unknown}, T))
  23.221 +  HOLogic.reflect_term (Const (\<^const_name>\<open>unknown\<close>, T))
  23.222  
  23.223  fun mk_safe_term t =
  23.224 -  @{term "Quickcheck_Random.catch_match :: term \<Rightarrow> term \<Rightarrow> term"} $
  23.225 +  \<^term>\<open>Quickcheck_Random.catch_match :: term \<Rightarrow> term \<Rightarrow> term\<close> $
  23.226      (HOLogic.mk_term_of (fastype_of t) t) $ mk_unknown_term (fastype_of t)
  23.227  
  23.228  fun mk_return t genuine =
  23.229 -  @{term "Some :: bool \<times> term list \<Rightarrow> (bool \<times> term list) option"} $
  23.230 -    (HOLogic.pair_const @{typ bool} @{typ "term list"} $
  23.231 +  \<^term>\<open>Some :: bool \<times> term list \<Rightarrow> (bool \<times> term list) option\<close> $
  23.232 +    (HOLogic.pair_const \<^typ>\<open>bool\<close> \<^typ>\<open>term list\<close> $
  23.233        Quickcheck_Common.reflect_bool genuine $ t)
  23.234  
  23.235  fun mk_generator_expr ctxt (t, eval_terms) =
  23.236 @@ -357,14 +357,14 @@
  23.237      fun lookup v = the (AList.lookup (op =) (names ~~ frees) v)
  23.238      val ([depth_name, genuine_only_name], _) =
  23.239        Variable.variant_fixes ["depth", "genuine_only"] ctxt'
  23.240 -    val depth = Free (depth_name, @{typ natural})
  23.241 -    val genuine_only = Free (genuine_only_name, @{typ bool})
  23.242 +    val depth = Free (depth_name, \<^typ>\<open>natural\<close>)
  23.243 +    val genuine_only = Free (genuine_only_name, \<^typ>\<open>bool\<close>)
  23.244      val return =
  23.245 -      mk_return (HOLogic.mk_list @{typ term}
  23.246 +      mk_return (HOLogic.mk_list \<^typ>\<open>term\<close>
  23.247          (map (fn t => HOLogic.mk_term_of (fastype_of t) t) frees @ map mk_safe_term eval_terms))
  23.248      fun mk_exhaustive_closure (free as Free (_, T)) t =
  23.249 -      Const (@{const_name exhaustive}, exhaustiveT T) $ lambda free t $ depth
  23.250 -    val none_t = Const (@{const_name None}, resultT)
  23.251 +      Const (\<^const_name>\<open>exhaustive\<close>, exhaustiveT T) $ lambda free t $ depth
  23.252 +    val none_t = Const (\<^const_name>\<open>None\<close>, resultT)
  23.253      val mk_if = Quickcheck_Common.mk_safe_if genuine_only none_t
  23.254      fun mk_let safe def v_opt t e =
  23.255        mk_safe_let_expr genuine_only none_t safe (the_default def v_opt, t, e)
  23.256 @@ -380,28 +380,28 @@
  23.257      val ([depth_name, genuine_only_name], ctxt'') =
  23.258        Variable.variant_fixes ["depth", "genuine_only"] ctxt'
  23.259      val (term_names, _) = Variable.variant_fixes (map (prefix "t_") names) ctxt''
  23.260 -    val depth = Free (depth_name, @{typ natural})
  23.261 -    val genuine_only = Free (genuine_only_name, @{typ bool})
  23.262 -    val term_vars = map (fn n => Free (n, @{typ "unit \<Rightarrow> term"})) term_names
  23.263 +    val depth = Free (depth_name, \<^typ>\<open>natural\<close>)
  23.264 +    val genuine_only = Free (genuine_only_name, \<^typ>\<open>bool\<close>)
  23.265 +    val term_vars = map (fn n => Free (n, \<^typ>\<open>unit \<Rightarrow> term\<close>)) term_names
  23.266      fun lookup v = the (AList.lookup (op =) (names ~~ (frees ~~ term_vars)) v)
  23.267      val return =
  23.268        mk_return
  23.269 -        (HOLogic.mk_list @{typ term}
  23.270 -          (map (fn v => v $ @{term "()"}) term_vars @ map mk_safe_term eval_terms))
  23.271 +        (HOLogic.mk_list \<^typ>\<open>term\<close>
  23.272 +          (map (fn v => v $ \<^term>\<open>()\<close>) term_vars @ map mk_safe_term eval_terms))
  23.273      fun mk_exhaustive_closure (free as Free (_, T), term_var) t =
  23.274 -      if Sign.of_sort thy (T, @{sort check_all}) then
  23.275 -        Const (@{const_name check_all}, check_allT T) $
  23.276 -          (HOLogic.case_prod_const (T, @{typ "unit \<Rightarrow> term"}, resultT) $
  23.277 +      if Sign.of_sort thy (T, \<^sort>\<open>check_all\<close>) then
  23.278 +        Const (\<^const_name>\<open>check_all\<close>, check_allT T) $
  23.279 +          (HOLogic.case_prod_const (T, \<^typ>\<open>unit \<Rightarrow> term\<close>, resultT) $
  23.280              lambda free (lambda term_var t))
  23.281        else
  23.282 -        Const (@{const_name full_exhaustive}, full_exhaustiveT T) $
  23.283 -          (HOLogic.case_prod_const (T, @{typ "unit \<Rightarrow> term"}, resultT) $
  23.284 +        Const (\<^const_name>\<open>full_exhaustive\<close>, full_exhaustiveT T) $
  23.285 +          (HOLogic.case_prod_const (T, \<^typ>\<open>unit \<Rightarrow> term\<close>, resultT) $
  23.286              lambda free (lambda term_var t)) $ depth
  23.287 -    val none_t = Const (@{const_name None}, resultT)
  23.288 +    val none_t = Const (\<^const_name>\<open>None\<close>, resultT)
  23.289      val mk_if = Quickcheck_Common.mk_safe_if genuine_only none_t
  23.290      fun mk_let safe _ (SOME (v, term_var)) t e =
  23.291            mk_safe_let_expr genuine_only none_t safe (v, t,
  23.292 -            e #> subst_free [(term_var, absdummy @{typ unit} (mk_safe_term t))])
  23.293 +            e #> subst_free [(term_var, absdummy \<^typ>\<open>unit\<close> (mk_safe_term t))])
  23.294        | mk_let safe v NONE t e = mk_safe_let_expr genuine_only none_t safe (v, t, e)
  23.295      val mk_test_term = mk_test_term lookup mk_exhaustive_closure mk_if mk_let none_t return ctxt
  23.296    in lambda genuine_only (lambda depth (mk_test_term t)) end
  23.297 @@ -409,37 +409,37 @@
  23.298  fun mk_parametric_generator_expr mk_generator_expr =
  23.299    Quickcheck_Common.gen_mk_parametric_generator_expr
  23.300      ((mk_generator_expr,
  23.301 -      absdummy @{typ bool} (absdummy @{typ natural} (Const (@{const_name None}, resultT)))),
  23.302 -      @{typ bool} --> @{typ natural} --> resultT)
  23.303 +      absdummy \<^typ>\<open>bool\<close> (absdummy \<^typ>\<open>natural\<close> (Const (\<^const_name>\<open>None\<close>, resultT)))),
  23.304 +      \<^typ>\<open>bool\<close> --> \<^typ>\<open>natural\<close> --> resultT)
  23.305  
  23.306  fun mk_validator_expr ctxt t =
  23.307    let
  23.308 -    fun bounded_forallT T = (T --> @{typ bool}) --> @{typ natural} --> @{typ bool}
  23.309 +    fun bounded_forallT T = (T --> \<^typ>\<open>bool\<close>) --> \<^typ>\<open>natural\<close> --> \<^typ>\<open>bool\<close>
  23.310      val ctxt' = Variable.auto_fixes t ctxt
  23.311      val names = Term.add_free_names t []
  23.312      val frees = map Free (Term.add_frees t [])
  23.313      fun lookup v = the (AList.lookup (op =) (names ~~ frees) v)
  23.314      val ([depth_name], _) = Variable.variant_fixes ["depth"] ctxt'
  23.315 -    val depth = Free (depth_name, @{typ natural})
  23.316 +    val depth = Free (depth_name, \<^typ>\<open>natural\<close>)
  23.317      fun mk_bounded_forall (Free (s, T)) t =
  23.318 -      Const (@{const_name bounded_forall}, bounded_forallT T) $ lambda (Free (s, T)) t $ depth
  23.319 +      Const (\<^const_name>\<open>bounded_forall\<close>, bounded_forallT T) $ lambda (Free (s, T)) t $ depth
  23.320      fun mk_safe_if (cond, then_t, else_t) genuine = mk_if (cond, then_t, else_t genuine)
  23.321      fun mk_let _ def v_opt t e = mk_let_expr (the_default def v_opt, t, e)
  23.322      val mk_test_term =
  23.323 -      mk_test_term lookup mk_bounded_forall mk_safe_if mk_let @{term True} (K @{term False}) ctxt
  23.324 +      mk_test_term lookup mk_bounded_forall mk_safe_if mk_let \<^term>\<open>True\<close> (K \<^term>\<open>False\<close>) ctxt
  23.325    in lambda depth (mk_test_term t) end
  23.326  
  23.327  fun mk_bounded_forall_generator_expr ctxt (t, eval_terms) =
  23.328    let
  23.329      val frees = Term.add_free_names t []
  23.330      val dummy_term =
  23.331 -      @{term "Code_Evaluation.Const (STR ''Pure.dummy_pattern'') (Typerep.Typerep (STR ''dummy'') [])"}
  23.332 +      \<^term>\<open>Code_Evaluation.Const (STR ''Pure.dummy_pattern'') (Typerep.Typerep (STR ''dummy'') [])\<close>
  23.333      val return =
  23.334 -      @{term "Some :: term list => term list option"} $
  23.335 -        (HOLogic.mk_list @{typ term} (replicate (length frees + length eval_terms) dummy_term))
  23.336 -    val wrap = absdummy @{typ bool}
  23.337 -      (@{term "If :: bool \<Rightarrow> term list option \<Rightarrow> term list option \<Rightarrow> term list option"} $
  23.338 -        Bound 0 $ @{term "None :: term list option"} $ return)
  23.339 +      \<^term>\<open>Some :: term list => term list option\<close> $
  23.340 +        (HOLogic.mk_list \<^typ>\<open>term\<close> (replicate (length frees + length eval_terms) dummy_term))
  23.341 +    val wrap = absdummy \<^typ>\<open>bool\<close>
  23.342 +      (\<^term>\<open>If :: bool \<Rightarrow> term list option \<Rightarrow> term list option \<Rightarrow> term list option\<close> $
  23.343 +        Bound 0 $ \<^term>\<open>None :: term list option\<close> $ return)
  23.344    in HOLogic.mk_comp (wrap, mk_validator_expr ctxt t) end
  23.345  
  23.346  
  23.347 @@ -504,7 +504,7 @@
  23.348          (get_counterexample_batch, put_counterexample_batch,
  23.349            "Exhaustive_Generators.put_counterexample_batch")
  23.350          ctxt (SOME target) (fn proc => map (fn g => g #> (Option.map o map) proc))
  23.351 -        (HOLogic.mk_list @{typ "natural => term list option"} ts') []
  23.352 +        (HOLogic.mk_list \<^typ>\<open>natural \<Rightarrow> term list option\<close> ts') []
  23.353    in
  23.354      map (fn compile => fn size =>
  23.355        compile size |> (Option.map o map) Quickcheck_Common.post_process_term) compiles
  23.356 @@ -518,14 +518,14 @@
  23.357    let val ts' = map (mk_validator_expr ctxt) ts in
  23.358      Code_Runtime.dynamic_value_strict
  23.359        (get_validator_batch, put_validator_batch, "Exhaustive_Generators.put_validator_batch")
  23.360 -      ctxt (SOME target) (K I) (HOLogic.mk_list @{typ "natural \<Rightarrow> bool"} ts') []
  23.361 +      ctxt (SOME target) (K I) (HOLogic.mk_list \<^typ>\<open>natural \<Rightarrow> bool\<close> ts') []
  23.362    end
  23.363  
  23.364  fun compile_validator_exprs ctxt ts =
  23.365    compile_validator_exprs_raw ctxt ts
  23.366    |> map (fn f => fn size => f (Code_Numeral.natural_of_integer size))
  23.367  
  23.368 -fun size_matters_for thy Ts = not (forall (fn T => Sign.of_sort thy (T,  @{sort check_all})) Ts)
  23.369 +fun size_matters_for thy Ts = not (forall (fn T => Sign.of_sort thy (T, \<^sort>\<open>check_all\<close>)) Ts)
  23.370  
  23.371  val test_goals =
  23.372    Quickcheck_Common.generator_test_goal_terms
  23.373 @@ -535,22 +535,22 @@
  23.374  (* setup *)
  23.375  
  23.376  val setup_exhaustive_datatype_interpretation =
  23.377 -  Quickcheck_Common.datatype_interpretation @{plugin quickcheck_exhaustive}
  23.378 -    (@{sort exhaustive}, instantiate_exhaustive_datatype)
  23.379 +  Quickcheck_Common.datatype_interpretation \<^plugin>\<open>quickcheck_exhaustive\<close>
  23.380 +    (\<^sort>\<open>exhaustive\<close>, instantiate_exhaustive_datatype)
  23.381  
  23.382  val setup_bounded_forall_datatype_interpretation =
  23.383 -  BNF_LFP_Compat.interpretation @{plugin quickcheck_bounded_forall} Quickcheck_Common.compat_prefs
  23.384 +  BNF_LFP_Compat.interpretation \<^plugin>\<open>quickcheck_bounded_forall\<close> Quickcheck_Common.compat_prefs
  23.385      (Quickcheck_Common.ensure_sort
  23.386 -       (((@{sort type}, @{sort type}), @{sort bounded_forall}),
  23.387 +       (((\<^sort>\<open>type\<close>, \<^sort>\<open>type\<close>), \<^sort>\<open>bounded_forall\<close>),
  23.388         (fn thy => BNF_LFP_Compat.the_descr thy Quickcheck_Common.compat_prefs,
  23.389          instantiate_bounded_forall_datatype)))
  23.390  
  23.391 -val active = Attrib.setup_config_bool @{binding quickcheck_exhaustive_active} (K true)
  23.392 +val active = Attrib.setup_config_bool \<^binding>\<open>quickcheck_exhaustive_active\<close> (K true)
  23.393  
  23.394  val _ =
  23.395    Theory.setup
  23.396 -   (Quickcheck_Common.datatype_interpretation @{plugin quickcheck_full_exhaustive}
  23.397 -      (@{sort full_exhaustive}, instantiate_full_exhaustive_datatype)
  23.398 +   (Quickcheck_Common.datatype_interpretation \<^plugin>\<open>quickcheck_full_exhaustive\<close>
  23.399 +      (\<^sort>\<open>full_exhaustive\<close>, instantiate_full_exhaustive_datatype)
  23.400      #> Context.theory_map (Quickcheck.add_tester ("exhaustive", (active, test_goals)))
  23.401      #> Context.theory_map (Quickcheck.add_batch_generator ("exhaustive", compile_generator_exprs))
  23.402      #> Context.theory_map (Quickcheck.add_batch_validator ("exhaustive", compile_validator_exprs)))
    24.1 --- a/src/HOL/Tools/Quickcheck/find_unused_assms.ML	Wed Dec 06 19:34:59 2017 +0100
    24.2 +++ b/src/HOL/Tools/Quickcheck/find_unused_assms.ML	Wed Dec 06 20:43:09 2017 +0100
    24.3 @@ -113,7 +113,7 @@
    24.4  end
    24.5  
    24.6  val _ =
    24.7 -  Outer_Syntax.command @{command_keyword find_unused_assms}
    24.8 +  Outer_Syntax.command \<^command_keyword>\<open>find_unused_assms\<close>
    24.9      "find theorems with (potentially) superfluous assumptions"
   24.10      (Scan.option Parse.name >> (fn name =>
   24.11        Toplevel.keep (fn state => print_unused_assms (Toplevel.context_of state) name)))
    25.1 --- a/src/HOL/Tools/Quickcheck/narrowing_generators.ML	Wed Dec 06 19:34:59 2017 +0100
    25.2 +++ b/src/HOL/Tools/Quickcheck/narrowing_generators.ML	Wed Dec 06 20:43:09 2017 +0100
    25.3 @@ -24,37 +24,37 @@
    25.4  
    25.5  (* configurations *)
    25.6  
    25.7 -val allow_existentials = Attrib.setup_config_bool @{binding quickcheck_allow_existentials} (K true)
    25.8 -val finite_functions = Attrib.setup_config_bool @{binding quickcheck_finite_functions} (K true)
    25.9 -val overlord = Attrib.setup_config_bool @{binding quickcheck_narrowing_overlord} (K false)
   25.10 -val ghc_options = Attrib.setup_config_string @{binding quickcheck_narrowing_ghc_options} (K "")
   25.11 +val allow_existentials = Attrib.setup_config_bool \<^binding>\<open>quickcheck_allow_existentials\<close> (K true)
   25.12 +val finite_functions = Attrib.setup_config_bool \<^binding>\<open>quickcheck_finite_functions\<close> (K true)
   25.13 +val overlord = Attrib.setup_config_bool \<^binding>\<open>quickcheck_narrowing_overlord\<close> (K false)
   25.14 +val ghc_options = Attrib.setup_config_string \<^binding>\<open>quickcheck_narrowing_ghc_options\<close> (K "")
   25.15  
   25.16  
   25.17  (* partial_term_of instances *)
   25.18  
   25.19  fun mk_partial_term_of (x, T) =
   25.20 -  Const (@{const_name Quickcheck_Narrowing.partial_term_of_class.partial_term_of},
   25.21 -    Term.itselfT T --> @{typ narrowing_term} --> @{typ Code_Evaluation.term}) $ Logic.mk_type T $ x
   25.22 +  Const (\<^const_name>\<open>Quickcheck_Narrowing.partial_term_of_class.partial_term_of\<close>,
   25.23 +    Term.itselfT T --> \<^typ>\<open>narrowing_term\<close> --> \<^typ>\<open>Code_Evaluation.term\<close>) $ Logic.mk_type T $ x
   25.24  
   25.25  
   25.26  (** formal definition **)
   25.27  
   25.28  fun add_partial_term_of tyco raw_vs thy =
   25.29    let
   25.30 -    val vs = map (fn (v, _) => (v, @{sort typerep})) raw_vs
   25.31 +    val vs = map (fn (v, _) => (v, \<^sort>\<open>typerep\<close>)) raw_vs
   25.32      val ty = Type (tyco, map TFree vs)
   25.33      val lhs =
   25.34 -      Const (@{const_name partial_term_of},
   25.35 -        Term.itselfT ty --> @{typ narrowing_term} --> @{typ Code_Evaluation.term}) $
   25.36 -      Free ("x", Term.itselfT ty) $ Free ("t", @{typ narrowing_term})
   25.37 -    val rhs = @{term "undefined :: Code_Evaluation.term"}
   25.38 +      Const (\<^const_name>\<open>partial_term_of\<close>,
   25.39 +        Term.itselfT ty --> \<^typ>\<open>narrowing_term\<close> --> \<^typ>\<open>Code_Evaluation.term\<close>) $
   25.40 +      Free ("x", Term.itselfT ty) $ Free ("t", \<^typ>\<open>narrowing_term\<close>)
   25.41 +    val rhs = \<^term>\<open>undefined :: Code_Evaluation.term\<close>
   25.42      val eq = HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs, rhs))
   25.43      fun triv_name_of t =
   25.44        (fst o dest_Free o fst o strip_comb o fst o HOLogic.dest_eq o HOLogic.dest_Trueprop) t ^
   25.45          "_triv"
   25.46    in
   25.47      thy
   25.48 -    |> Class.instantiation ([tyco], vs, @{sort partial_term_of})
   25.49 +    |> Class.instantiation ([tyco], vs, \<^sort>\<open>partial_term_of\<close>)
   25.50      |> `(fn lthy => Syntax.check_term lthy eq)
   25.51      |-> (fn eq => Specification.definition NONE [] [] ((Binding.name (triv_name_of eq), []), eq))
   25.52      |> snd
   25.53 @@ -63,8 +63,8 @@
   25.54  
   25.55  fun ensure_partial_term_of (tyco, (raw_vs, _)) thy =
   25.56    let
   25.57 -    val need_inst = not (Sorts.has_instance (Sign.classes_of thy) tyco @{sort partial_term_of})
   25.58 -      andalso Sorts.has_instance (Sign.classes_of thy) tyco @{sort typerep}
   25.59 +    val need_inst = not (Sorts.has_instance (Sign.classes_of thy) tyco \<^sort>\<open>partial_term_of\<close>)
   25.60 +      andalso Sorts.has_instance (Sign.classes_of thy) tyco \<^sort>\<open>typerep\<close>
   25.61    in if need_inst then add_partial_term_of tyco raw_vs thy else thy end
   25.62  
   25.63  
   25.64 @@ -72,14 +72,14 @@
   25.65  
   25.66  fun mk_partial_term_of_eq thy ty (i, (c, (_, tys))) =
   25.67    let
   25.68 -    val frees = map Free (Name.invent_names Name.context "a" (map (K @{typ narrowing_term}) tys))
   25.69 +    val frees = map Free (Name.invent_names Name.context "a" (map (K \<^typ>\<open>narrowing_term\<close>) tys))
   25.70      val narrowing_term =
   25.71 -      @{term Quickcheck_Narrowing.Narrowing_constructor} $ HOLogic.mk_number @{typ integer} i $
   25.72 -        HOLogic.mk_list @{typ narrowing_term} (rev frees)
   25.73 +      \<^term>\<open>Quickcheck_Narrowing.Narrowing_constructor\<close> $ HOLogic.mk_number \<^typ>\<open>integer\<close> i $
   25.74 +        HOLogic.mk_list \<^typ>\<open>narrowing_term\<close> (rev frees)
   25.75      val rhs =
   25.76 -      fold (fn u => fn t => @{term "Code_Evaluation.App"} $ t $ u)
   25.77 +      fold (fn u => fn t => \<^term>\<open>Code_Evaluation.App\<close> $ t $ u)
   25.78          (map mk_partial_term_of (frees ~~ tys))
   25.79 -        (@{term "Code_Evaluation.Const"} $ HOLogic.mk_literal c $ HOLogic.mk_typerep (tys ---> ty))
   25.80 +        (\<^term>\<open>Code_Evaluation.Const\<close> $ HOLogic.mk_literal c $ HOLogic.mk_typerep (tys ---> ty))
   25.81      val insts =
   25.82        map (SOME o Thm.global_cterm_of thy o Logic.unvarify_types_global o Logic.varify_global)
   25.83          [Free ("ty", Term.itselfT ty), narrowing_term, rhs]
   25.84 @@ -93,16 +93,16 @@
   25.85  fun add_partial_term_of_code tyco raw_vs raw_cs thy =
   25.86    let
   25.87      val algebra = Sign.classes_of thy
   25.88 -    val vs = map (fn (v, sort) => (v, curry (Sorts.inter_sort algebra) @{sort typerep} sort)) raw_vs
   25.89 +    val vs = map (fn (v, sort) => (v, curry (Sorts.inter_sort algebra) \<^sort>\<open>typerep\<close> sort)) raw_vs
   25.90      val ty = Type (tyco, map TFree vs)
   25.91      val cs =
   25.92        (map o apsnd o apsnd o map o map_atyps)
   25.93          (fn TFree (v, _) => TFree (v, (the o AList.lookup (op =) vs) v)) raw_cs
   25.94 -    val const = Axclass.param_of_inst thy (@{const_name partial_term_of}, tyco)
   25.95 +    val const = Axclass.param_of_inst thy (\<^const_name>\<open>partial_term_of\<close>, tyco)
   25.96      val var_insts =
   25.97        map (SOME o Thm.global_cterm_of thy o Logic.unvarify_types_global o Logic.varify_global)
   25.98 -        [Free ("ty", Term.itselfT ty), @{term "Quickcheck_Narrowing.Narrowing_variable p tt"},
   25.99 -          @{term "Code_Evaluation.Free (STR ''_'')"} $ HOLogic.mk_typerep ty]
  25.100 +        [Free ("ty", Term.itselfT ty), \<^term>\<open>Quickcheck_Narrowing.Narrowing_variable p tt\<close>,
  25.101 +          \<^term>\<open>Code_Evaluation.Free (STR ''_'')\<close> $ HOLogic.mk_typerep ty]
  25.102      val var_eq =
  25.103        @{thm partial_term_of_anything}
  25.104        |> Thm.instantiate' [SOME (Thm.global_ctyp_of thy ty)] var_insts
  25.105 @@ -114,7 +114,7 @@
  25.106    end
  25.107  
  25.108  fun ensure_partial_term_of_code (tyco, (raw_vs, cs)) thy =
  25.109 -  let val has_inst = Sorts.has_instance (Sign.classes_of thy) tyco @{sort partial_term_of}
  25.110 +  let val has_inst = Sorts.has_instance (Sign.classes_of thy) tyco \<^sort>\<open>partial_term_of\<close>
  25.111    in if has_inst then add_partial_term_of_code tyco raw_vs cs thy else thy end
  25.112  
  25.113  
  25.114 @@ -126,21 +126,21 @@
  25.115  
  25.116  val narrowingN = "narrowing"
  25.117  
  25.118 -fun narrowingT T = @{typ integer} --> Type (@{type_name Quickcheck_Narrowing.narrowing_cons}, [T])
  25.119 +fun narrowingT T = \<^typ>\<open>integer\<close> --> Type (\<^type_name>\<open>Quickcheck_Narrowing.narrowing_cons\<close>, [T])
  25.120  
  25.121 -fun mk_cons c T = Const (@{const_name Quickcheck_Narrowing.cons}, T --> narrowingT T) $ Const (c, T)
  25.122 +fun mk_cons c T = Const (\<^const_name>\<open>Quickcheck_Narrowing.cons\<close>, T --> narrowingT T) $ Const (c, T)
  25.123  
  25.124  fun mk_apply (T, t) (U, u) =
  25.125    let
  25.126      val (_, U') = dest_funT U
  25.127    in
  25.128 -    (U', Const (@{const_name Quickcheck_Narrowing.apply},
  25.129 +    (U', Const (\<^const_name>\<open>Quickcheck_Narrowing.apply\<close>,
  25.130        narrowingT U --> narrowingT T --> narrowingT U') $ u $ t)
  25.131    end
  25.132  
  25.133  fun mk_sum (t, u) =
  25.134    let val T = fastype_of t
  25.135 -  in Const (@{const_name Quickcheck_Narrowing.sum}, T --> T --> T) $ t $ u end
  25.136 +  in Const (\<^const_name>\<open>Quickcheck_Narrowing.sum\<close>, T --> T --> T) $ t $ u end
  25.137  
  25.138  
  25.139  (** deriving narrowing instances **)
  25.140 @@ -148,7 +148,7 @@
  25.141  fun mk_equations descr vs narrowings =
  25.142    let
  25.143      fun mk_call T =
  25.144 -      (T, Const (@{const_name "Quickcheck_Narrowing.narrowing_class.narrowing"}, narrowingT T))
  25.145 +      (T, Const (\<^const_name>\<open>Quickcheck_Narrowing.narrowing_class.narrowing\<close>, narrowingT T))
  25.146      fun mk_aux_call fTs (k, _) (tyco, Ts) =
  25.147        let
  25.148          val T = Type (tyco, Ts)
  25.149 @@ -181,7 +181,7 @@
  25.150    in
  25.151      if not (contains_recursive_type_under_function_types descr) then
  25.152        thy
  25.153 -      |> Class.instantiation (tycos, vs, @{sort narrowing})
  25.154 +      |> Class.instantiation (tycos, vs, \<^sort>\<open>narrowing\<close>)
  25.155        |> Quickcheck_Common.define_functions
  25.156          (fn narrowings => mk_equations descr vs narrowings, NONE)
  25.157          prfx [] narrowingsN (map narrowingT (Ts @ Us))
  25.158 @@ -348,29 +348,29 @@
  25.159    let
  25.160      val (names, boundTs) = split_list xTs
  25.161      fun mk_eval_ffun dT rT =
  25.162 -      Const (@{const_name "Quickcheck_Narrowing.eval_ffun"},
  25.163 -        Type (@{type_name "Quickcheck_Narrowing.ffun"}, [dT, rT]) --> dT --> rT)
  25.164 +      Const (\<^const_name>\<open>Quickcheck_Narrowing.eval_ffun\<close>,
  25.165 +        Type (\<^type_name>\<open>Quickcheck_Narrowing.ffun\<close>, [dT, rT]) --> dT --> rT)
  25.166      fun mk_eval_cfun dT rT =
  25.167 -      Const (@{const_name "Quickcheck_Narrowing.eval_cfun"},
  25.168 -        Type (@{type_name "Quickcheck_Narrowing.cfun"}, [rT]) --> dT --> rT)
  25.169 -    fun eval_function (Type (@{type_name fun}, [dT, rT])) =
  25.170 +      Const (\<^const_name>\<open>Quickcheck_Narrowing.eval_cfun\<close>,
  25.171 +        Type (\<^type_name>\<open>Quickcheck_Narrowing.cfun\<close>, [rT]) --> dT --> rT)
  25.172 +    fun eval_function (Type (\<^type_name>\<open>fun\<close>, [dT, rT])) =
  25.173            let
  25.174              val (rt', rT') = eval_function rT
  25.175            in
  25.176              (case dT of
  25.177 -              Type (@{type_name fun}, _) =>
  25.178 +              Type (\<^type_name>\<open>fun\<close>, _) =>
  25.179                  (fn t => absdummy dT (rt' (mk_eval_cfun dT rT' $ incr_boundvars 1 t $ Bound 0)),
  25.180 -                  Type (@{type_name "Quickcheck_Narrowing.cfun"}, [rT']))
  25.181 +                  Type (\<^type_name>\<open>Quickcheck_Narrowing.cfun\<close>, [rT']))
  25.182              | _ =>
  25.183                  (fn t => absdummy dT (rt' (mk_eval_ffun dT rT' $ incr_boundvars 1 t $ Bound 0)),
  25.184 -                  Type (@{type_name "Quickcheck_Narrowing.ffun"}, [dT, rT'])))
  25.185 +                  Type (\<^type_name>\<open>Quickcheck_Narrowing.ffun\<close>, [dT, rT'])))
  25.186            end
  25.187 -      | eval_function (T as Type (@{type_name prod}, [fT, sT])) =
  25.188 +      | eval_function (T as Type (\<^type_name>\<open>prod\<close>, [fT, sT])) =
  25.189            let
  25.190              val (ft', fT') = eval_function fT
  25.191              val (st', sT') = eval_function sT
  25.192 -            val T' = Type (@{type_name prod}, [fT', sT'])
  25.193 -            val map_const = Const (@{const_name map_prod}, (fT' --> fT) --> (sT' --> sT) --> T' --> T)
  25.194 +            val T' = Type (\<^type_name>\<open>prod\<close>, [fT', sT'])
  25.195 +            val map_const = Const (\<^const_name>\<open>map_prod\<close>, (fT' --> fT) --> (sT' --> sT) --> T' --> T)
  25.196              fun apply_dummy T t = absdummy T (t (Bound 0))
  25.197            in
  25.198              (fn t => list_comb (map_const, [apply_dummy fT' ft', apply_dummy sT' st', t]), T')
  25.199 @@ -382,11 +382,11 @@
  25.200      (names ~~ boundTs', t')
  25.201    end
  25.202  
  25.203 -fun dest_ffun (Type (@{type_name "Quickcheck_Narrowing.ffun"}, [dT, rT])) = (dT, rT)
  25.204 +fun dest_ffun (Type (\<^type_name>\<open>Quickcheck_Narrowing.ffun\<close>, [dT, rT])) = (dT, rT)
  25.205  
  25.206 -fun eval_finite_functions (Const (@{const_name "Quickcheck_Narrowing.ffun.Constant"}, T) $ value) =
  25.207 +fun eval_finite_functions (Const (\<^const_name>\<open>Quickcheck_Narrowing.ffun.Constant\<close>, T) $ value) =
  25.208        absdummy (fst (dest_ffun (body_type T))) (eval_finite_functions value)
  25.209 -  | eval_finite_functions (Const (@{const_name "Quickcheck_Narrowing.ffun.Update"}, T) $ a $ b $ f) =
  25.210 +  | eval_finite_functions (Const (\<^const_name>\<open>Quickcheck_Narrowing.ffun.Update\<close>, T) $ a $ b $ f) =
  25.211        let
  25.212          val (T1, T2) = dest_ffun (body_type T)
  25.213        in
  25.214 @@ -407,29 +407,29 @@
  25.215  
  25.216  fun make_pnf_term thy t = Pattern.rewrite_term thy rewrs [] t
  25.217  
  25.218 -fun strip_quantifiers (Const (@{const_name Ex}, _) $ Abs (x, T, t)) =
  25.219 -      apfst (cons (@{const_name Ex}, (x, T))) (strip_quantifiers t)
  25.220 -  | strip_quantifiers (Const (@{const_name All}, _) $ Abs (x, T, t)) =
  25.221 -      apfst (cons (@{const_name All}, (x, T))) (strip_quantifiers t)
  25.222 +fun strip_quantifiers (Const (\<^const_name>\<open>Ex\<close>, _) $ Abs (x, T, t)) =
  25.223 +      apfst (cons (\<^const_name>\<open>Ex\<close>, (x, T))) (strip_quantifiers t)
  25.224 +  | strip_quantifiers (Const (\<^const_name>\<open>All\<close>, _) $ Abs (x, T, t)) =
  25.225 +      apfst (cons (\<^const_name>\<open>All\<close>, (x, T))) (strip_quantifiers t)
  25.226    | strip_quantifiers t = ([], t)
  25.227  
  25.228  fun contains_existentials t =
  25.229 -  exists (fn (Q, _) => Q = @{const_name Ex}) (fst (strip_quantifiers t))
  25.230 +  exists (fn (Q, _) => Q = \<^const_name>\<open>Ex\<close>) (fst (strip_quantifiers t))
  25.231  
  25.232  fun mk_property qs t =
  25.233    let
  25.234 -    fun enclose (@{const_name Ex}, (x, T)) t =
  25.235 -          Const (@{const_name Quickcheck_Narrowing.exists},
  25.236 -            (T --> @{typ property}) --> @{typ property}) $ Abs (x, T, t)
  25.237 -      | enclose (@{const_name All}, (x, T)) t =
  25.238 -          Const (@{const_name Quickcheck_Narrowing.all},
  25.239 -            (T --> @{typ property}) --> @{typ property}) $ Abs (x, T, t)
  25.240 -  in fold_rev enclose qs (@{term Quickcheck_Narrowing.Property} $ t) end
  25.241 +    fun enclose (\<^const_name>\<open>Ex\<close>, (x, T)) t =
  25.242 +          Const (\<^const_name>\<open>Quickcheck_Narrowing.exists\<close>,
  25.243 +            (T --> \<^typ>\<open>property\<close>) --> \<^typ>\<open>property\<close>) $ Abs (x, T, t)
  25.244 +      | enclose (\<^const_name>\<open>All\<close>, (x, T)) t =
  25.245 +          Const (\<^const_name>\<open>Quickcheck_Narrowing.all\<close>,
  25.246 +            (T --> \<^typ>\<open>property\<close>) --> \<^typ>\<open>property\<close>) $ Abs (x, T, t)
  25.247 +  in fold_rev enclose qs (\<^term>\<open>Quickcheck_Narrowing.Property\<close> $ t) end
  25.248  
  25.249 -fun mk_case_term ctxt p ((@{const_name Ex}, (x, T)) :: qs') (Existential_Counterexample cs) =
  25.250 +fun mk_case_term ctxt p ((\<^const_name>\<open>Ex\<close>, (x, T)) :: qs') (Existential_Counterexample cs) =
  25.251        Case_Translation.make_case ctxt Case_Translation.Quiet Name.context (Free (x, T)) (map (fn (t, c) =>
  25.252          (t, mk_case_term ctxt (p - 1) qs' c)) cs)
  25.253 -  | mk_case_term ctxt p ((@{const_name All}, _) :: qs') (Universal_Counterexample (t, c)) =
  25.254 +  | mk_case_term ctxt p ((\<^const_name>\<open>All\<close>, _) :: qs') (Universal_Counterexample (t, c)) =
  25.255        if p = 0 then t else mk_case_term ctxt (p - 1) qs' c
  25.256  
  25.257  val post_process =
  25.258 @@ -437,7 +437,7 @@
  25.259  
  25.260  fun mk_terms ctxt qs result =
  25.261    let
  25.262 -    val ps = filter (fn (_, (@{const_name All}, _)) => true | _ => false) (map_index I qs)
  25.263 +    val ps = filter (fn (_, (\<^const_name>\<open>All\<close>, _)) => true | _ => false) (map_index I qs)
  25.264    in
  25.265      map (fn (p, (_, (x, _))) => (x, mk_case_term ctxt p qs result)) ps
  25.266      |> map (apsnd post_process)
  25.267 @@ -485,7 +485,7 @@
  25.268          fun wrap f t = uncurry (fold_rev Term.abs) (f (strip_abs t))
  25.269          val finitize = if Config.get ctxt finite_functions then wrap finitize_functions else I
  25.270          fun ensure_testable t =
  25.271 -          Const (@{const_name Quickcheck_Narrowing.ensure_testable},
  25.272 +          Const (\<^const_name>\<open>Quickcheck_Narrowing.ensure_testable\<close>,
  25.273              fastype_of t --> fastype_of t) $ t
  25.274          fun is_genuine (SOME (true, _)) = true
  25.275            | is_genuine _ = false
  25.276 @@ -531,14 +531,14 @@
  25.277  
  25.278  (* setup *)
  25.279  
  25.280 -val active = Attrib.setup_config_bool @{binding quickcheck_narrowing_active} (K false)
  25.281 +val active = Attrib.setup_config_bool \<^binding>\<open>quickcheck_narrowing_active\<close> (K false)
  25.282  
  25.283  val _ =
  25.284    Theory.setup
  25.285     (Code.datatype_interpretation ensure_partial_term_of
  25.286      #> Code.datatype_interpretation ensure_partial_term_of_code
  25.287 -    #> Quickcheck_Common.datatype_interpretation @{plugin quickcheck_narrowing}
  25.288 -      (@{sort narrowing}, instantiate_narrowing_datatype)
  25.289 +    #> Quickcheck_Common.datatype_interpretation \<^plugin>\<open>quickcheck_narrowing\<close>
  25.290 +      (\<^sort>\<open>narrowing\<close>, instantiate_narrowing_datatype)
  25.291      #> Context.theory_map (Quickcheck.add_tester ("narrowing", (active, test_goals))))
  25.292  
  25.293  end
    26.1 --- a/src/HOL/Tools/Quickcheck/quickcheck_common.ML	Wed Dec 06 19:34:59 2017 +0100
    26.2 +++ b/src/HOL/Tools/Quickcheck/quickcheck_common.ML	Wed Dec 06 20:43:09 2017 +0100
    26.3 @@ -56,12 +56,12 @@
    26.4  
    26.5  (* HOLogic's term functions *)
    26.6  
    26.7 -fun strip_imp (Const(@{const_name HOL.implies}, _) $ A $ B) = apfst (cons A) (strip_imp B)
    26.8 +fun strip_imp (Const(\<^const_name>\<open>HOL.implies\<close>, _) $ A $ B) = apfst (cons A) (strip_imp B)
    26.9    | strip_imp A = ([], A)
   26.10  
   26.11 -fun reflect_bool b = if b then @{term True} else @{term False}
   26.12 +fun reflect_bool b = if b then \<^term>\<open>True\<close> else \<^term>\<open>False\<close>
   26.13  
   26.14 -fun mk_undefined T = Const (@{const_name undefined}, T)
   26.15 +fun mk_undefined T = Const (\<^const_name>\<open>undefined\<close>, T)
   26.16  
   26.17  
   26.18  (* testing functions: testing with increasing sizes (and cardinalities) *)
   26.19 @@ -210,8 +210,8 @@
   26.20  
   26.21  fun get_finite_types ctxt =
   26.22    fst (chop (Config.get ctxt Quickcheck.finite_type_size)
   26.23 -    [@{typ Enum.finite_1}, @{typ Enum.finite_2}, @{typ Enum.finite_3},
   26.24 -     @{typ Enum.finite_4}, @{typ Enum.finite_5}])
   26.25 +    [\<^typ>\<open>Enum.finite_1\<close>, \<^typ>\<open>Enum.finite_2\<close>, \<^typ>\<open>Enum.finite_3\<close>,
   26.26 +     \<^typ>\<open>Enum.finite_4\<close>, \<^typ>\<open>Enum.finite_5\<close>])
   26.27  
   26.28  exception WELLSORTED of string
   26.29  
   26.30 @@ -233,7 +233,7 @@
   26.31  
   26.32  (* minimalistic preprocessing *)
   26.33  
   26.34 -fun strip_all (Const (@{const_name HOL.All}, _) $ Abs (a, T, t)) =
   26.35 +fun strip_all (Const (\<^const_name>\<open>HOL.All\<close>, _) $ Abs (a, T, t)) =
   26.36        let val (a', t') = strip_all t
   26.37        in ((a, T) :: a', t') end
   26.38    | strip_all t = ([], t)
   26.39 @@ -315,9 +315,9 @@
   26.40  fun mk_safe_if genuine_only none (cond, then_t, else_t) genuine =
   26.41    let
   26.42      val T = fastype_of then_t
   26.43 -    val if_t = Const (@{const_name If}, @{typ bool} --> T --> T --> T)
   26.44 +    val if_t = Const (\<^const_name>\<open>If\<close>, \<^typ>\<open>bool\<close> --> T --> T --> T)
   26.45    in
   26.46 -    Const (@{const_name "Quickcheck_Random.catch_match"}, T --> T --> T) $
   26.47 +    Const (\<^const_name>\<open>Quickcheck_Random.catch_match\<close>, T --> T --> T) $
   26.48        (if_t $ cond $ then_t $ else_t genuine) $
   26.49        (if_t $ genuine_only $ none $ else_t false)
   26.50    end
   26.51 @@ -429,7 +429,7 @@
   26.52      end)
   26.53  
   26.54  fun ensure_common_sort_datatype (sort, instantiate) =
   26.55 -  ensure_sort (((@{sort typerep}, @{sort term_of}), sort),
   26.56 +  ensure_sort (((\<^sort>\<open>typerep\<close>, \<^sort>\<open>term_of\<close>), sort),
   26.57      (fn thy => BNF_LFP_Compat.the_descr thy compat_prefs, instantiate))
   26.58  
   26.59  fun datatype_interpretation name =
   26.60 @@ -440,20 +440,20 @@
   26.61  
   26.62  fun gen_mk_parametric_generator_expr ((mk_generator_expr, out_of_bounds), T) ctxt ts =
   26.63    let
   26.64 -    val if_t = Const (@{const_name If}, @{typ bool} --> T --> T --> T)
   26.65 +    val if_t = Const (\<^const_name>\<open>If\<close>, \<^typ>\<open>bool\<close> --> T --> T --> T)
   26.66      fun mk_if (index, (t, eval_terms)) else_t =
   26.67 -      if_t $ (HOLogic.eq_const @{typ natural} $ Bound 0 $ HOLogic.mk_number @{typ natural} index) $
   26.68 +      if_t $ (HOLogic.eq_const \<^typ>\<open>natural\<close> $ Bound 0 $ HOLogic.mk_number \<^typ>\<open>natural\<close> index) $
   26.69          (mk_generator_expr ctxt (t, eval_terms)) $ else_t
   26.70 -  in absdummy @{typ natural} (fold_rev mk_if (1 upto (length ts) ~~ ts) out_of_bounds) end
   26.71 +  in absdummy \<^typ>\<open>natural\<close> (fold_rev mk_if (1 upto (length ts) ~~ ts) out_of_bounds) end
   26.72  
   26.73  
   26.74  (** post-processing of function terms **)
   26.75  
   26.76 -fun dest_fun_upd (Const (@{const_name fun_upd}, _) $ t0 $ t1 $ t2) = (t0, (t1, t2))
   26.77 +fun dest_fun_upd (Const (\<^const_name>\<open>fun_upd\<close>, _) $ t0 $ t1 $ t2) = (t0, (t1, t2))
   26.78    | dest_fun_upd t = raise TERM ("dest_fun_upd", [t])
   26.79  
   26.80  fun mk_fun_upd T1 T2 (t1, t2) t =
   26.81 -  Const (@{const_name fun_upd}, (T1 --> T2) --> T1 --> T2 --> T1 --> T2) $ t $ t1 $ t2
   26.82 +  Const (\<^const_name>\<open>fun_upd\<close>, (T1 --> T2) --> T1 --> T2 --> T1 --> T2) $ t $ t1 $ t2
   26.83  
   26.84  fun dest_fun_upds t =
   26.85    (case try dest_fun_upd t of
   26.86 @@ -465,26 +465,26 @@
   26.87  
   26.88  fun make_fun_upds T1 T2 (tps, t) = fold_rev (mk_fun_upd T1 T2) tps t
   26.89  
   26.90 -fun make_set T1 [] = Const (@{const_abbrev Set.empty}, T1 --> @{typ bool})
   26.91 -  | make_set T1 ((_, @{const False}) :: tps) = make_set T1 tps
   26.92 -  | make_set T1 ((t1, @{const True}) :: tps) =
   26.93 -      Const (@{const_name insert}, T1 --> (T1 --> @{typ bool}) --> T1 --> @{typ bool}) $
   26.94 +fun make_set T1 [] = Const (\<^const_abbrev>\<open>Set.empty\<close>, T1 --> \<^typ>\<open>bool\<close>)
   26.95 +  | make_set T1 ((_, \<^const>\<open>False\<close>) :: tps) = make_set T1 tps
   26.96 +  | make_set T1 ((t1, \<^const>\<open>True\<close>) :: tps) =
   26.97 +      Const (\<^const_name>\<open>insert\<close>, T1 --> (T1 --> \<^typ>\<open>bool\<close>) --> T1 --> \<^typ>\<open>bool\<close>) $
   26.98          t1 $ (make_set T1 tps)
   26.99    | make_set T1 ((_, t) :: _) = raise TERM ("make_set", [t])
  26.100  
  26.101 -fun make_coset T [] = Const (@{const_abbrev UNIV}, T --> @{typ bool})
  26.102 +fun make_coset T [] = Const (\<^const_abbrev>\<open>UNIV\<close>, T --> \<^typ>\<open>bool\<close>)
  26.103    | make_coset T tps =
  26.104      let
  26.105 -      val U = T --> @{typ bool}
  26.106 -      fun invert @{const False} = @{const True}
  26.107 -        | invert @{const True} = @{const False}
  26.108 +      val U = T --> \<^typ>\<open>bool\<close>
  26.109 +      fun invert \<^const>\<open>False\<close> = \<^const>\<open>True\<close>
  26.110 +        | invert \<^const>\<open>True\<close> = \<^const>\<open>False\<close>
  26.111      in
  26.112 -      Const (@{const_name "Groups.minus_class.minus"}, U --> U --> U) $
  26.113 -        Const (@{const_abbrev UNIV}, U) $ make_set T (map (apsnd invert) tps)
  26.114 +      Const (\<^const_name>\<open>Groups.minus_class.minus\<close>, U --> U --> U) $
  26.115 +        Const (\<^const_abbrev>\<open>UNIV\<close>, U) $ make_set T (map (apsnd invert) tps)
  26.116      end
  26.117  
  26.118 -fun make_map T1 T2 [] = Const (@{const_abbrev Map.empty}, T1 --> T2)
  26.119 -  | make_map T1 T2 ((_, Const (@{const_name None}, _)) :: tps) = make_map T1 T2 tps
  26.120 +fun make_map T1 T2 [] = Const (\<^const_abbrev>\<open>Map.empty\<close>, T1 --> T2)
  26.121 +  | make_map T1 T2 ((_, Const (\<^const_name>\<open>None\<close>, _)) :: tps) = make_map T1 T2 tps
  26.122    | make_map T1 T2 ((t1, t2) :: tps) = mk_fun_upd T1 T2 (t1, t2) (make_map T1 T2 tps)
  26.123  
  26.124  fun post_process_term t =
  26.125 @@ -498,21 +498,21 @@
  26.126          (c as Const (_, _), ts) => list_comb (c, map post_process_term ts))
  26.127    in
  26.128      (case fastype_of t of
  26.129 -      Type (@{type_name fun}, [T1, T2]) =>
  26.130 +      Type (\<^type_name>\<open>fun\<close>, [T1, T2]) =>
  26.131          (case try dest_fun_upds t of
  26.132            SOME (tps, t) =>
  26.133              (map (apply2 post_process_term) tps, map_Abs post_process_term t) |>
  26.134                (case T2 of
  26.135 -                @{typ bool} =>
  26.136 +                \<^typ>\<open>bool\<close> =>
  26.137                    (case t of
  26.138 -                     Abs(_, _, @{const False}) => fst #> rev #> make_set T1
  26.139 -                   | Abs(_, _, @{const True}) => fst #> rev #> make_coset T1
  26.140 -                   | Abs(_, _, Const (@{const_name undefined}, _)) => fst #> rev #> make_set T1
  26.141 +                     Abs(_, _, \<^const>\<open>False\<close>) => fst #> rev #> make_set T1
  26.142 +                   | Abs(_, _, \<^const>\<open>True\<close>) => fst #> rev #> make_coset T1
  26.143 +                   | Abs(_, _, Const (\<^const_name>\<open>undefined\<close>, _)) => fst #> rev #> make_set T1
  26.144                     | _ => raise TERM ("post_process_term", [t]))
  26.145 -              | Type (@{type_name option}, _) =>
  26.146 +              | Type (\<^type_name>\<open>option\<close>, _) =>
  26.147                    (case t of
  26.148 -                    Abs(_, _, Const (@{const_name None}, _)) => fst #> make_map T1 T2
  26.149 -                  | Abs(_, _, Const (@{const_name undefined}, _)) => fst #> make_map T1 T2
  26.150 +                    Abs(_, _, Const (\<^const_name>\<open>None\<close>, _)) => fst #> make_map T1 T2
  26.151 +                  | Abs(_, _, Const (\<^const_name>\<open>undefined\<close>, _)) => fst #> make_map T1 T2
  26.152                    | _ => make_fun_upds T1 T2)
  26.153                | _ => make_fun_upds T1 T2)
  26.154          | NONE => process_args t)
    27.1 --- a/src/HOL/Tools/Quickcheck/random_generators.ML	Wed Dec 06 19:34:59 2017 +0100
    27.2 +++ b/src/HOL/Tools/Quickcheck/random_generators.ML	Wed Dec 06 20:43:09 2017 +0100
    27.3 @@ -27,13 +27,13 @@
    27.4  
    27.5  (** abstract syntax **)
    27.6  
    27.7 -fun termifyT T = HOLogic.mk_prodT (T, @{typ "unit \<Rightarrow> term"})
    27.8 -val size = @{term "i::natural"};
    27.9 -val size_pred = @{term "(i::natural) - 1"};
   27.10 -val size' = @{term "j::natural"};
   27.11 -val seed = @{term "s::Random.seed"};
   27.12 +fun termifyT T = HOLogic.mk_prodT (T, \<^typ>\<open>unit \<Rightarrow> term\<close>)
   27.13 +val size = \<^term>\<open>i::natural\<close>;
   27.14 +val size_pred = \<^term>\<open>(i::natural) - 1\<close>;
   27.15 +val size' = \<^term>\<open>j::natural\<close>;
   27.16 +val seed = \<^term>\<open>s::Random.seed\<close>;
   27.17  
   27.18 -val resultT =  @{typ "(bool \<times> term list) option"};
   27.19 +val resultT =  \<^typ>\<open>(bool \<times> term list) option\<close>;
   27.20  
   27.21  
   27.22  (** typ "'a \<Rightarrow> 'b" **)
   27.23 @@ -42,7 +42,7 @@
   27.24  
   27.25  fun random_fun T1 T2 eq term_of random random_split seed =
   27.26    let
   27.27 -    val fun_upd = Const (@{const_name fun_upd}, (T1 --> T2) --> T1 --> T2 --> T1 --> T2);
   27.28 +    val fun_upd = Const (\<^const_name>\<open>fun_upd\<close>, (T1 --> T2) --> T1 --> T2 --> T1 --> T2);
   27.29      val ((_, t2), seed') = random seed;
   27.30      val (seed'', seed''') = random_split seed';
   27.31  
   27.32 @@ -96,8 +96,8 @@
   27.33      val inst = Thm.instantiate_cterm ([(a_v, icT)], []);
   27.34      fun subst_v t' = map_aterms (fn t as Free (w, _) => if v = w then t' else t | t => t);
   27.35      val t_rhs = lambda t_k proto_t_rhs;
   27.36 -    val eqs0 = [subst_v @{term "0::natural"} eq,
   27.37 -      subst_v (@{const Code_Numeral.Suc} $ t_k) eq];
   27.38 +    val eqs0 = [subst_v \<^term>\<open>0::natural\<close> eq,
   27.39 +      subst_v (\<^const>\<open>Code_Numeral.Suc\<close> $ t_k) eq];
   27.40      val eqs1 = map (Pattern.rewrite_term thy rew_ts []) eqs0;
   27.41      val ((_, (_, eqs2)), lthy') = lthy
   27.42        |> BNF_LFP_Compat.primrec_simple
   27.43 @@ -134,8 +134,8 @@
   27.44            (aux_lhs, foldr1 HOLogic.mk_prod rhss);
   27.45          fun mk_proj t [T] = [t]
   27.46            | mk_proj t (Ts as T :: (Ts' as _ :: _)) =
   27.47 -              Const (@{const_name fst}, foldr1 HOLogic.mk_prodT Ts --> T) $ t
   27.48 -                :: mk_proj (Const (@{const_name snd},
   27.49 +              Const (\<^const_name>\<open>fst\<close>, foldr1 HOLogic.mk_prodT Ts --> T) $ t
   27.50 +                :: mk_proj (Const (\<^const_name>\<open>snd\<close>,
   27.51                    foldr1 HOLogic.mk_prodT Ts --> foldr1 HOLogic.mk_prodT Ts') $ t) Ts';
   27.52          val projs = mk_proj (aux_lhs) Ts;
   27.53          val proj_eqs = map2 (fn v => fn proj => (v, lambda arg proj)) vs projs;
   27.54 @@ -193,9 +193,9 @@
   27.55      val mk_const = curry (Sign.mk_const thy);
   27.56      val random_auxsN = map (prefix (random_auxN ^ "_")) (names @ auxnames);
   27.57      val rTs = Ts @ Us;
   27.58 -    fun random_resultT T = @{typ Random.seed}
   27.59 -      --> HOLogic.mk_prodT (termifyT T,@{typ Random.seed});
   27.60 -    fun sizeT T = @{typ natural} --> @{typ natural} --> T;
   27.61 +    fun random_resultT T = \<^typ>\<open>Random.seed\<close>
   27.62 +      --> HOLogic.mk_prodT (termifyT T,\<^typ>\<open>Random.seed\<close>);
   27.63 +    fun sizeT T = \<^typ>\<open>natural\<close> --> \<^typ>\<open>natural\<close> --> T;
   27.64      val random_auxT = sizeT o random_resultT;
   27.65      val random_auxs = map2 (fn s => fn rT => Free (s, random_auxT rT))
   27.66        random_auxsN rTs;
   27.67 @@ -205,7 +205,7 @@
   27.68          val T = Type (tyco, Ts);
   27.69          fun mk_random_fun_lift [] t = t
   27.70            | mk_random_fun_lift (fT :: fTs) t =
   27.71 -              mk_const @{const_name random_fun_lift} [fTs ---> T, fT] $
   27.72 +              mk_const \<^const_name>\<open>random_fun_lift\<close> [fTs ---> T, fT] $
   27.73                  mk_random_fun_lift fTs t;
   27.74          val t = mk_random_fun_lift fTs (nth random_auxs k $ size_pred $ size');
   27.75          val size = Option.map snd (Old_Datatype_Aux.find_shortest_path descr k)
   27.76 @@ -221,16 +221,16 @@
   27.77          val is_rec = exists is_some ks;
   27.78          val k = fold (fn NONE => I | SOME k => Integer.max k) ks 0;
   27.79          val vs = Name.invent_names Name.context "x" (map snd simple_tTs);
   27.80 -        val tc = HOLogic.mk_return T @{typ Random.seed}
   27.81 +        val tc = HOLogic.mk_return T \<^typ>\<open>Random.seed\<close>
   27.82            (HOLogic.mk_valtermify_app c vs simpleT);
   27.83          val t = HOLogic.mk_ST
   27.84 -          (map2 (fn (t, _) => fn (v, T') => ((t, @{typ Random.seed}), SOME ((v, termifyT T')))) tTs vs)
   27.85 -            tc @{typ Random.seed} (SOME T, @{typ Random.seed});
   27.86 +          (map2 (fn (t, _) => fn (v, T') => ((t, \<^typ>\<open>Random.seed\<close>), SOME ((v, termifyT T')))) tTs vs)
   27.87 +            tc \<^typ>\<open>Random.seed\<close> (SOME T, \<^typ>\<open>Random.seed\<close>);
   27.88          val tk = if is_rec
   27.89            then if k = 0 then size
   27.90 -            else @{term "Quickcheck_Random.beyond :: natural \<Rightarrow> natural \<Rightarrow> natural"}
   27.91 -             $ HOLogic.mk_number @{typ natural} k $ size
   27.92 -          else @{term "1::natural"}
   27.93 +            else \<^term>\<open>Quickcheck_Random.beyond :: natural \<Rightarrow> natural \<Rightarrow> natural\<close>
   27.94 +             $ HOLogic.mk_number \<^typ>\<open>natural\<close> k $ size
   27.95 +          else \<^term>\<open>1::natural\<close>
   27.96        in (is_rec, HOLogic.mk_prod (tk, t)) end;
   27.97      fun sort_rec xs =
   27.98        map_filter (fn (true, t) => SOME t | _ =>  NONE) xs
   27.99 @@ -239,9 +239,9 @@
  27.100        |> (map o apfst) Type
  27.101        |> map (fn (T, cs) => (T, (sort_rec o map (mk_consexpr T)) cs));
  27.102      fun mk_select (rT, xs) =
  27.103 -      mk_const @{const_name Quickcheck_Random.collapse} [@{typ Random.seed}, termifyT rT]
  27.104 -      $ (mk_const @{const_name Random.select_weight} [random_resultT rT]
  27.105 -        $ HOLogic.mk_list (HOLogic.mk_prodT (@{typ natural}, random_resultT rT)) xs)
  27.106 +      mk_const \<^const_name>\<open>Quickcheck_Random.collapse\<close> [\<^typ>\<open>Random.seed\<close>, termifyT rT]
  27.107 +      $ (mk_const \<^const_name>\<open>Random.select_weight\<close> [random_resultT rT]
  27.108 +        $ HOLogic.mk_list (HOLogic.mk_prodT (\<^typ>\<open>natural\<close>, random_resultT rT)) xs)
  27.109            $ seed;
  27.110      val auxs_lhss = map (fn t => t $ size $ size' $ seed) random_auxs;
  27.111      val auxs_rhss = map mk_select gen_exprss;
  27.112 @@ -253,8 +253,8 @@
  27.113      val mk_prop_eq = HOLogic.mk_Trueprop o HOLogic.mk_eq;
  27.114      fun mk_size_arg k = case Old_Datatype_Aux.find_shortest_path descr k
  27.115       of SOME (_, l) => if l = 0 then size
  27.116 -          else @{term "max :: natural \<Rightarrow> natural \<Rightarrow> natural"}
  27.117 -            $ HOLogic.mk_number @{typ natural} l $ size
  27.118 +          else \<^term>\<open>max :: natural \<Rightarrow> natural \<Rightarrow> natural\<close>
  27.119 +            $ HOLogic.mk_number \<^typ>\<open>natural\<close> l $ size
  27.120        | NONE => size;
  27.121      val (random_auxs, auxs_eqs) = (apsnd o map) mk_prop_eq
  27.122        (mk_random_aux_eqs thy descr vs (names, auxnames) (Ts, Us));
  27.123 @@ -262,7 +262,7 @@
  27.124        (HOLogic.mk_random T size, nth random_auxs k $ mk_size_arg k $ size)) Ts;
  27.125    in
  27.126      thy
  27.127 -    |> Class.instantiation (tycos, vs, @{sort random})
  27.128 +    |> Class.instantiation (tycos, vs, \<^sort>\<open>random\<close>)
  27.129      |> random_aux_specification prfx random_auxN auxs_eqs
  27.130      |> `(fn lthy => map (Syntax.check_term lthy) random_defs)
  27.131      |-> (fn random_defs' => fold_map (fn random_def =>
  27.132 @@ -305,88 +305,88 @@
  27.133      val bounds = map_index (fn (i, ty) =>
  27.134        (2 * (bound_max - i) + 1, 2 * (bound_max - i), 2 * i, ty)) Ts;
  27.135      val result = list_comb (prop, map (fn (i, _, _, _) => Bound i) bounds);
  27.136 -    val terms = HOLogic.mk_list @{typ term} (map (fn (_, i, _, _) => Bound i $ @{term "()"}) bounds);
  27.137 +    val terms = HOLogic.mk_list \<^typ>\<open>term\<close> (map (fn (_, i, _, _) => Bound i $ \<^term>\<open>()\<close>) bounds);
  27.138      val ([genuine_only_name], _) = Variable.variant_fixes ["genuine_only"] ctxt
  27.139 -    val genuine_only = Free (genuine_only_name, @{typ bool})
  27.140 -    val none_t = Const (@{const_name "None"}, resultT)
  27.141 +    val genuine_only = Free (genuine_only_name, \<^typ>\<open>bool\<close>)
  27.142 +    val none_t = Const (\<^const_name>\<open>None\<close>, resultT)
  27.143      val check = Quickcheck_Common.mk_safe_if genuine_only none_t (result, none_t,
  27.144 -      fn genuine => @{term "Some :: bool * term list => (bool * term list) option"} $
  27.145 +      fn genuine => \<^term>\<open>Some :: bool \<times> term list => (bool \<times> term list) option\<close> $
  27.146          HOLogic.mk_prod (Quickcheck_Common.reflect_bool genuine, terms))
  27.147 -    val return = HOLogic.pair_const resultT @{typ Random.seed};
  27.148 +    val return = HOLogic.pair_const resultT \<^typ>\<open>Random.seed\<close>;
  27.149      fun liftT T sT = sT --> HOLogic.mk_prodT (T, sT);
  27.150 -    fun mk_termtyp T = HOLogic.mk_prodT (T, @{typ "unit => term"});
  27.151 -    fun mk_scomp T1 T2 sT f g = Const (@{const_name scomp},
  27.152 +    fun mk_termtyp T = HOLogic.mk_prodT (T, \<^typ>\<open>unit \<Rightarrow> term\<close>);
  27.153 +    fun mk_scomp T1 T2 sT f g = Const (\<^const_name>\<open>scomp\<close>,
  27.154        liftT T1 sT --> (T1 --> liftT T2 sT) --> liftT T2 sT) $ f $ g;
  27.155      fun mk_case_prod T = Sign.mk_const thy
  27.156 -      (@{const_name case_prod}, [T, @{typ "unit => term"}, liftT resultT @{typ Random.seed}]);
  27.157 +      (\<^const_name>\<open>case_prod\<close>, [T, \<^typ>\<open>unit \<Rightarrow> term\<close>, liftT resultT \<^typ>\<open>Random.seed\<close>]);
  27.158      fun mk_scomp_split T t t' =
  27.159 -      mk_scomp (mk_termtyp T) resultT @{typ Random.seed} t
  27.160 -        (mk_case_prod T $ Abs ("", T, Abs ("", @{typ "unit => term"}, t')));
  27.161 +      mk_scomp (mk_termtyp T) resultT \<^typ>\<open>Random.seed\<close> t
  27.162 +        (mk_case_prod T $ Abs ("", T, Abs ("", \<^typ>\<open>unit => term\<close>, t')));
  27.163      fun mk_bindclause (_, _, i, T) = mk_scomp_split T
  27.164 -      (Sign.mk_const thy (@{const_name Quickcheck_Random.random}, [T]) $ Bound i);
  27.165 +      (Sign.mk_const thy (\<^const_name>\<open>Quickcheck_Random.random\<close>, [T]) $ Bound i);
  27.166    in
  27.167      lambda genuine_only
  27.168 -      (Abs ("n", @{typ natural}, fold_rev mk_bindclause bounds (return $ check true)))
  27.169 +      (Abs ("n", \<^typ>\<open>natural\<close>, fold_rev mk_bindclause bounds (return $ check true)))
  27.170    end;
  27.171  
  27.172  fun mk_reporting_generator_expr ctxt (t, _) =
  27.173    let
  27.174      val thy = Proof_Context.theory_of ctxt
  27.175 -    val resultT = @{typ "(bool * term list) option * (bool list * bool)"}
  27.176 +    val resultT = \<^typ>\<open>(bool \<times> term list) option \<times> (bool list \<times> bool)\<close>
  27.177      val prop = fold_rev absfree (Term.add_frees t []) t
  27.178      val Ts = (map snd o fst o strip_abs) prop
  27.179      val bound_max = length Ts - 1
  27.180      val bounds = map_index (fn (i, ty) =>
  27.181        (2 * (bound_max - i) + 1, 2 * (bound_max - i), 2 * i, ty)) Ts;
  27.182      val prop' = betapplys (prop, map (fn (i, _, _, _) => Bound i) bounds);
  27.183 -    val terms = HOLogic.mk_list @{typ term} (map (fn (_, i, _, _) => Bound i $ @{term "()"}) bounds)
  27.184 +    val terms = HOLogic.mk_list \<^typ>\<open>term\<close> (map (fn (_, i, _, _) => Bound i $ \<^term>\<open>()\<close>) bounds)
  27.185      val (assms, concl) = Quickcheck_Common.strip_imp prop'
  27.186 -    val return = HOLogic.pair_const resultT @{typ Random.seed};
  27.187 +    val return = HOLogic.pair_const resultT \<^typ>\<open>Random.seed\<close>;
  27.188      fun mk_assms_report i =
  27.189 -      HOLogic.mk_prod (@{term "None :: (bool * term list) option"},
  27.190 +      HOLogic.mk_prod (\<^term>\<open>None :: (bool \<times> term list) option\<close>,
  27.191          HOLogic.mk_prod (HOLogic.mk_list HOLogic.boolT
  27.192 -          (replicate i @{term True} @ replicate (length assms - i) @{term False}),
  27.193 -        @{term False}))
  27.194 +          (replicate i \<^term>\<open>True\<close> @ replicate (length assms - i) \<^term>\<open>False\<close>),
  27.195 +        \<^term>\<open>False\<close>))
  27.196      fun mk_concl_report b =
  27.197 -      HOLogic.mk_prod (HOLogic.mk_list HOLogic.boolT (replicate (length assms) @{term True}),
  27.198 +      HOLogic.mk_prod (HOLogic.mk_list HOLogic.boolT (replicate (length assms) \<^term>\<open>True\<close>),
  27.199          Quickcheck_Common.reflect_bool b)
  27.200      val ([genuine_only_name], _) = Variable.variant_fixes ["genuine_only"] ctxt
  27.201 -    val genuine_only = Free (genuine_only_name, @{typ bool})
  27.202 -    val none_t = HOLogic.mk_prod (@{term "None :: (bool * term list) option"}, mk_concl_report true)
  27.203 +    val genuine_only = Free (genuine_only_name, \<^typ>\<open>bool\<close>)
  27.204 +    val none_t = HOLogic.mk_prod (\<^term>\<open>None :: (bool \<times> term list) option\<close>, mk_concl_report true)
  27.205      val concl_check = Quickcheck_Common.mk_safe_if genuine_only none_t (concl, none_t,
  27.206 -      fn genuine => HOLogic.mk_prod (@{term "Some :: bool * term list => (bool * term list) option"} $
  27.207 +      fn genuine => HOLogic.mk_prod (\<^term>\<open>Some :: bool \<times> term list => (bool \<times> term list) option\<close> $
  27.208          HOLogic.mk_prod (Quickcheck_Common.reflect_bool genuine, terms), mk_concl_report false))
  27.209      val check = fold_rev (fn (i, assm) => fn t => Quickcheck_Common.mk_safe_if genuine_only
  27.210        (mk_assms_report i) (HOLogic.mk_not assm, mk_assms_report i, t))
  27.211        (map_index I assms) concl_check
  27.212      fun liftT T sT = sT --> HOLogic.mk_prodT (T, sT);
  27.213 -    fun mk_termtyp T = HOLogic.mk_prodT (T, @{typ "unit => term"});
  27.214 -    fun mk_scomp T1 T2 sT f g = Const (@{const_name scomp},
  27.215 +    fun mk_termtyp T = HOLogic.mk_prodT (T, \<^typ>\<open>unit \<Rightarrow> term\<close>);
  27.216 +    fun mk_scomp T1 T2 sT f g = Const (\<^const_name>\<open>scomp\<close>,
  27.217        liftT T1 sT --> (T1 --> liftT T2 sT) --> liftT T2 sT) $ f $ g;
  27.218      fun mk_case_prod T = Sign.mk_const thy
  27.219 -      (@{const_name case_prod}, [T, @{typ "unit => term"}, liftT resultT @{typ Random.seed}]);
  27.220 +      (\<^const_name>\<open>case_prod\<close>, [T, \<^typ>\<open>unit \<Rightarrow> term\<close>, liftT resultT \<^typ>\<open>Random.seed\<close>]);
  27.221      fun mk_scomp_split T t t' =
  27.222 -      mk_scomp (mk_termtyp T) resultT @{typ Random.seed} t
  27.223 -        (mk_case_prod T $ Abs ("", T, Abs ("", @{typ "unit => term"}, t')));
  27.224 +      mk_scomp (mk_termtyp T) resultT \<^typ>\<open>Random.seed\<close> t
  27.225 +        (mk_case_prod T $ Abs ("", T, Abs ("", \<^typ>\<open>unit \<Rightarrow> term\<close>, t')));
  27.226      fun mk_bindclause (_, _, i, T) = mk_scomp_split T
  27.227 -      (Sign.mk_const thy (@{const_name Quickcheck_Random.random}, [T]) $ Bound i);
  27.228 +      (Sign.mk_const thy (\<^const_name>\<open>Quickcheck_Random.random\<close>, [T]) $ Bound i);
  27.229    in
  27.230      lambda genuine_only
  27.231 -      (Abs ("n", @{typ natural}, fold_rev mk_bindclause bounds (return $ check true)))
  27.232 +      (Abs ("n", \<^typ>\<open>natural\<close>, fold_rev mk_bindclause bounds (return $ check true)))
  27.233    end
  27.234  
  27.235  val mk_parametric_generator_expr = Quickcheck_Common.gen_mk_parametric_generator_expr 
  27.236    ((mk_generator_expr, 
  27.237 -    absdummy @{typ bool} (absdummy @{typ natural}
  27.238 -      @{term "Pair None :: Random.seed => (bool * term list) option * Random.seed"})),
  27.239 -    @{typ "bool => natural => Random.seed => (bool * term list) option * Random.seed"})
  27.240 +    absdummy \<^typ>\<open>bool\<close> (absdummy \<^typ>\<open>natural\<close>
  27.241 +      \<^term>\<open>Pair None :: Random.seed \<Rightarrow> (bool \<times> term list) option \<times> Random.seed\<close>)),
  27.242 +    \<^typ>\<open>bool \<Rightarrow> natural \<Rightarrow> Random.seed \<Rightarrow> (bool \<times> term list) option \<times> Random.seed\<close>)
  27.243  
  27.244  val mk_parametric_reporting_generator_expr = Quickcheck_Common.gen_mk_parametric_generator_expr 
  27.245    ((mk_reporting_generator_expr,
  27.246 -    absdummy @{typ bool} (absdummy @{typ natural}
  27.247 -      @{term "Pair (None, ([], False)) :: Random.seed =>
  27.248 -        ((bool * term list) option * (bool list * bool)) * Random.seed"})),
  27.249 -    @{typ "bool => natural => Random.seed => ((bool * term list) option * (bool list * bool)) * Random.seed"})
  27.250 +    absdummy \<^typ>\<open>bool\<close> (absdummy \<^typ>\<open>natural\<close>
  27.251 +      \<^term>\<open>Pair (None, ([], False)) :: Random.seed \<Rightarrow>
  27.252 +        ((bool \<times> term list) option \<times> (bool list \<times> bool)) \<times> Random.seed\<close>)),
  27.253 +    \<^typ>\<open>bool \<Rightarrow> natural \<Rightarrow> Random.seed \<Rightarrow> ((bool \<times> term list) option \<times> (bool list \<times> bool)) \<times> Random.seed\<close>)
  27.254      
  27.255      
  27.256  (* single quickcheck report *)
  27.257 @@ -468,8 +468,8 @@
  27.258      compiled genuine_only [Code_Numeral.natural_of_integer card, Code_Numeral.natural_of_integer size]
  27.259    end;
  27.260  
  27.261 -val size_types = [@{type_name Enum.finite_1}, @{type_name Enum.finite_2},
  27.262 -  @{type_name Enum.finite_3}, @{type_name Enum.finite_4}, @{type_name Enum.finite_5}];
  27.263 +val size_types = [\<^type_name>\<open>Enum.finite_1\<close>, \<^type_name>\<open>Enum.finite_2\<close>,
  27.264 +  \<^type_name>\<open>Enum.finite_3\<close>, \<^type_name>\<open>Enum.finite_4\<close>, \<^type_name>\<open>Enum.finite_5\<close>];
  27.265  
  27.266  fun size_matters_for _ Ts =
  27.267    not (forall (fn Type (tyco, []) => member (op =) size_types tyco | _ => false) Ts);
  27.268 @@ -480,12 +480,12 @@
  27.269    
  27.270  (** setup **)
  27.271  
  27.272 -val active = Attrib.setup_config_bool @{binding quickcheck_random_active} (K false);
  27.273 +val active = Attrib.setup_config_bool \<^binding>\<open>quickcheck_random_active\<close> (K false);
  27.274  
  27.275  val _ =
  27.276    Theory.setup
  27.277 -   (Quickcheck_Common.datatype_interpretation @{plugin quickcheck_random}
  27.278 -      (@{sort random}, instantiate_random_datatype) #>
  27.279 +   (Quickcheck_Common.datatype_interpretation \<^plugin>\<open>quickcheck_random\<close>
  27.280 +      (\<^sort>\<open>random\<close>, instantiate_random_datatype) #>
  27.281      Context.theory_map (Quickcheck.add_tester ("random", (active, test_goals))));
  27.282  
  27.283  end;
    28.1 --- a/src/HOL/Tools/SMT/conj_disj_perm.ML	Wed Dec 06 19:34:59 2017 +0100
    28.2 +++ b/src/HOL/Tools/SMT/conj_disj_perm.ML	Wed Dec 06 20:43:09 2017 +0100
    28.3 @@ -13,7 +13,7 @@
    28.4  struct
    28.5  
    28.6  fun with_assumption ct f =
    28.7 -  let val ct' = Thm.apply @{cterm HOL.Trueprop} ct
    28.8 +  let val ct' = Thm.apply \<^cterm>\<open>HOL.Trueprop\<close> ct
    28.9    in Thm.implies_intr ct' (f (Thm.assume ct')) end
   28.10  
   28.11  fun eq_from_impls thm1 thm2 = thm2 INCR_COMP (thm1 INCR_COMP @{thm iffI})
   28.12 @@ -25,9 +25,9 @@
   28.13  
   28.14  fun explode_thm thm =
   28.15    (case HOLogic.dest_Trueprop (Thm.prop_of thm) of
   28.16 -    @{const HOL.conj} $ _ $ _ => explode_conj_thm @{thm conjunct1} @{thm conjunct2} thm
   28.17 -  | @{const HOL.Not} $ (@{const HOL.disj} $ _ $ _) => explode_conj_thm ndisj1_rule ndisj2_rule thm
   28.18 -  | @{const HOL.Not} $ (@{const HOL.Not} $ _) => explode_thm (thm RS @{thm notnotD})
   28.19 +    \<^const>\<open>HOL.conj\<close> $ _ $ _ => explode_conj_thm @{thm conjunct1} @{thm conjunct2} thm
   28.20 +  | \<^const>\<open>HOL.Not\<close> $ (\<^const>\<open>HOL.disj\<close> $ _ $ _) => explode_conj_thm ndisj1_rule ndisj2_rule thm
   28.21 +  | \<^const>\<open>HOL.Not\<close> $ (\<^const>\<open>HOL.Not\<close> $ _) => explode_thm (thm RS @{thm notnotD})
   28.22    | _ => add_lit thm)
   28.23  
   28.24  and explode_conj_thm rule1 rule2 thm lits =
   28.25 @@ -36,7 +36,7 @@
   28.26  val not_false_rule = @{lemma "\<not>False" by auto}
   28.27  fun explode thm = explode_thm thm (add_lit not_false_rule (add_lit @{thm TrueI} Termtab.empty))
   28.28  
   28.29 -fun find_dual_lit lits (@{const HOL.Not} $ t, thm) = Termtab.lookup lits t |> Option.map (pair thm)
   28.30 +fun find_dual_lit lits (\<^const>\<open>HOL.Not\<close> $ t, thm) = Termtab.lookup lits t |> Option.map (pair thm)
   28.31    | find_dual_lit _ _ = NONE
   28.32  
   28.33  fun find_dual_lits lits = Termtab.get_first (find_dual_lit lits) lits
   28.34 @@ -49,10 +49,10 @@
   28.35      SOME thm => thm
   28.36    | NONE => join_term lits t)
   28.37  
   28.38 -and join_term lits (@{const HOL.conj} $ t $ u) = @{thm conjI} OF (map (join lits) [t, u])
   28.39 -  | join_term lits (@{const HOL.Not} $ (@{const HOL.disj} $ t $ u)) =
   28.40 +and join_term lits (\<^const>\<open>HOL.conj\<close> $ t $ u) = @{thm conjI} OF (map (join lits) [t, u])
   28.41 +  | join_term lits (\<^const>\<open>HOL.Not\<close> $ (\<^const>\<open>HOL.disj\<close> $ t $ u)) =
   28.42        ndisj_rule OF (map (join lits o HOLogic.mk_not) [t, u])
   28.43 -  | join_term lits (@{const HOL.Not} $ (@{const HOL.Not} $ t)) = join lits t RS not_not_rule
   28.44 +  | join_term lits (\<^const>\<open>HOL.Not\<close> $ (\<^const>\<open>HOL.Not\<close> $ t)) = join lits t RS not_not_rule
   28.45    | join_term _ t = raise TERM ("join_term", [t])
   28.46  
   28.47  fun prove_conj_disj_imp ct cu = with_assumption ct (fn thm => join (explode thm) (Thm.term_of cu))
   28.48 @@ -68,19 +68,19 @@
   28.49  
   28.50  fun prove_any_imp ct =
   28.51    (case Thm.term_of ct of
   28.52 -    @{const HOL.False} => @{thm FalseE}
   28.53 -  | @{const HOL.Not} $ (@{const HOL.Not} $ @{const HOL.False}) => not_not_false_rule
   28.54 -  | @{const HOL.Not} $ @{const HOL.True} => not_true_rule
   28.55 +    \<^const>\<open>HOL.False\<close> => @{thm FalseE}
   28.56 +  | \<^const>\<open>HOL.Not\<close> $ (\<^const>\<open>HOL.Not\<close> $ \<^const>\<open>HOL.False\<close>) => not_not_false_rule
   28.57 +  | \<^const>\<open>HOL.Not\<close> $ \<^const>\<open>HOL.True\<close> => not_true_rule
   28.58    | _ => raise CTERM ("prove_any_imp", [ct]))
   28.59  
   28.60  fun prove_contradiction_imp ct =
   28.61    with_assumption ct (fn thm =>
   28.62      let val lits = explode thm
   28.63      in
   28.64 -      (case Termtab.lookup lits @{const HOL.False} of
   28.65 +      (case Termtab.lookup lits \<^const>\<open>HOL.False\<close> of
   28.66          SOME thm' => thm' RS @{thm FalseE}
   28.67        | NONE =>
   28.68 -          (case Termtab.lookup lits (@{const HOL.Not} $ @{const HOL.True}) of
   28.69 +          (case Termtab.lookup lits (\<^const>\<open>HOL.Not\<close> $ \<^const>\<open>HOL.True\<close>) of
   28.70              SOME thm' => thm' RS not_true_rule
   28.71            | NONE =>
   28.72                (case find_dual_lits lits of
   28.73 @@ -99,13 +99,13 @@
   28.74  
   28.75  datatype kind = True | False | Conj | Disj | Other
   28.76  
   28.77 -fun choose t _ _ _ @{const HOL.True} = t
   28.78 -  | choose _ f _ _ @{const HOL.False} = f
   28.79 -  | choose _ _ c _ (@{const HOL.conj} $ _ $ _) = c
   28.80 -  | choose _ _ _ d (@{const HOL.disj} $ _ $ _) = d
   28.81 +fun choose t _ _ _ \<^const>\<open>HOL.True\<close> = t
   28.82 +  | choose _ f _ _ \<^const>\<open>HOL.False\<close> = f
   28.83 +  | choose _ _ c _ (\<^const>\<open>HOL.conj\<close> $ _ $ _) = c
   28.84 +  | choose _ _ _ d (\<^const>\<open>HOL.disj\<close> $ _ $ _) = d
   28.85    | choose _ _ _ _ _ = Other
   28.86  
   28.87 -fun kind_of (@{const HOL.Not} $ t) = choose False True Disj Conj t
   28.88 +fun kind_of (\<^const>\<open>HOL.Not\<close> $ t) = choose False True Disj Conj t
   28.89    | kind_of t = choose True False Conj Disj t
   28.90  
   28.91  fun prove_conj_disj_perm ct cp =
   28.92 @@ -120,7 +120,7 @@
   28.93  
   28.94  fun conj_disj_perm_tac ctxt = CSUBGOAL (fn (ct, i) => 
   28.95    (case Thm.term_of ct of
   28.96 -    @{const HOL.Trueprop} $ (@{const HOL.eq(bool)} $ _ $ _) =>
   28.97 +    \<^const>\<open>HOL.Trueprop\<close> $ (@{const HOL.eq(bool)} $ _ $ _) =>
   28.98        resolve_tac ctxt [prove_conj_disj_perm ct (Thm.dest_binop (Thm.dest_arg ct))] i
   28.99    | _ => no_tac))
  28.100  
    29.1 --- a/src/HOL/Tools/SMT/smt_builtin.ML	Wed Dec 06 19:34:59 2017 +0100
    29.2 +++ b/src/HOL/Tools/SMT/smt_builtin.ML	Wed Dec 06 20:43:09 2017 +0100
    29.3 @@ -180,8 +180,8 @@
    29.4  
    29.5  fun dest_builtin_eq ctxt t u =
    29.6    let
    29.7 -    val aT = TFree (Name.aT, @{sort type})
    29.8 -    val c = (@{const_name HOL.eq}, aT --> aT --> @{typ bool})
    29.9 +    val aT = TFree (Name.aT, \<^sort>\<open>type\<close>)
   29.10 +    val c = (\<^const_name>\<open>HOL.eq\<close>, aT --> aT --> \<^typ>\<open>bool\<close>)
   29.11      fun mk ts = Term.list_comb (HOLogic.eq_const (Term.fastype_of (hd ts)), ts)
   29.12    in
   29.13      dest_builtin_fun ctxt c []
   29.14 @@ -193,10 +193,10 @@
   29.15      dest_builtin_fun ctxt c ts
   29.16    else NONE
   29.17  
   29.18 -fun dest_builtin_pred ctxt = special_builtin_fun (equal @{typ bool} o fst) ctxt
   29.19 +fun dest_builtin_pred ctxt = special_builtin_fun (equal \<^typ>\<open>bool\<close> o fst) ctxt
   29.20  
   29.21  fun dest_builtin_conn ctxt =
   29.22 -  special_builtin_fun (forall (equal @{typ bool}) o (op ::)) ctxt
   29.23 +  special_builtin_fun (forall (equal \<^typ>\<open>bool\<close>) o (op ::)) ctxt
   29.24  
   29.25  fun dest_builtin ctxt c ts =
   29.26    let val t = Term.list_comb (Const c, ts)
    30.1 --- a/src/HOL/Tools/SMT/smt_config.ML	Wed Dec 06 19:34:59 2017 +0100
    30.2 +++ b/src/HOL/Tools/SMT/smt_config.ML	Wed Dec 06 20:43:09 2017 +0100
    30.3 @@ -106,7 +106,7 @@
    30.4      context
    30.5      |> Data.map (map_solvers (Symtab.update (name, (info, []))))
    30.6      |> Context.map_theory (Attrib.setup (Binding.name (name ^ "_options"))
    30.7 -        (Scan.lift (@{keyword "="} |-- Args.name) >>
    30.8 +        (Scan.lift (\<^keyword>\<open>=\<close> |-- Args.name) >>
    30.9            (Thm.declaration_attribute o K o set_solver_options o pair name))
   30.10          ("additional command line options for SMT solver " ^ quote name))
   30.11  
   30.12 @@ -164,30 +164,30 @@
   30.13    in solver_info_of (K []) all_options ctxt end
   30.14  
   30.15  val setup_solver =
   30.16 -  Attrib.setup @{binding smt_solver}
   30.17 -    (Scan.lift (@{keyword "="} |-- Args.name) >>
   30.18 +  Attrib.setup \<^binding>\<open>smt_solver\<close>
   30.19 +    (Scan.lift (\<^keyword>\<open>=\<close> |-- Args.name) >>
   30.20        (Thm.declaration_attribute o K o select_solver))
   30.21      "SMT solver configuration"
   30.22  
   30.23  
   30.24  (* options *)
   30.25  
   30.26 -val oracle = Attrib.setup_config_bool @{binding smt_oracle} (K true)
   30.27 -val timeout = Attrib.setup_config_real @{binding smt_timeout} (K 30.0)
   30.28 -val reconstruction_step_timeout = Attrib.setup_config_real @{binding smt_reconstruction_step_timeout} (K 10.0)
   30.29 -val random_seed = Attrib.setup_config_int @{binding smt_random_seed} (K 1)
   30.30 -val read_only_certificates = Attrib.setup_config_bool @{binding smt_read_only_certificates} (K false)
   30.31 -val verbose = Attrib.setup_config_bool @{binding smt_verbose} (K true)
   30.32 -val trace = Attrib.setup_config_bool @{binding smt_trace} (K false)
   30.33 -val statistics = Attrib.setup_config_bool @{binding smt_statistics} (K false)
   30.34 -val monomorph_limit = Attrib.setup_config_int @{binding smt_monomorph_limit} (K 10)
   30.35 -val monomorph_instances = Attrib.setup_config_int @{binding smt_monomorph_instances} (K 500)
   30.36 -val explicit_application = Attrib.setup_config_int @{binding smt_explicit_application} (K 1)
   30.37 -val higher_order = Attrib.setup_config_bool @{binding smt_higher_order} (K false)
   30.38 -val nat_as_int = Attrib.setup_config_bool @{binding smt_nat_as_int} (K false)
   30.39 -val infer_triggers = Attrib.setup_config_bool @{binding smt_infer_triggers} (K false)
   30.40 -val debug_files = Attrib.setup_config_string @{binding smt_debug_files} (K "")
   30.41 -val sat_solver = Attrib.setup_config_string @{binding smt_sat_solver} (K "cdclite")
   30.42 +val oracle = Attrib.setup_config_bool \<^binding>\<open>smt_oracle\<close> (K true)
   30.43 +val timeout = Attrib.setup_config_real \<^binding>\<open>smt_timeout\<close> (K 30.0)
   30.44 +val reconstruction_step_timeout = Attrib.setup_config_real \<^binding>\<open>smt_reconstruction_step_timeout\<close> (K 10.0)
   30.45 +val random_seed = Attrib.setup_config_int \<^binding>\<open>smt_random_seed\<close> (K 1)
   30.46 +val read_only_certificates = Attrib.setup_config_bool \<^binding>\<open>smt_read_only_certificates\<close> (K false)
   30.47 +val verbose = Attrib.setup_config_bool \<^binding>\<open>smt_verbose\<close> (K true)
   30.48 +val trace = Attrib.setup_config_bool \<^binding>\<open>smt_trace\<close> (K false)
   30.49 +val statistics = Attrib.setup_config_bool \<^binding>\<open>smt_statistics\<close> (K false)
   30.50 +val monomorph_limit = Attrib.setup_config_int \<^binding>\<open>smt_monomorph_limit\<close> (K 10)
   30.51 +val monomorph_instances = Attrib.setup_config_int \<^binding>\<open>smt_monomorph_instances\<close> (K 500)
   30.52 +val explicit_application = Attrib.setup_config_int \<^binding>\<open>smt_explicit_application\<close> (K 1)
   30.53 +val higher_order = Attrib.setup_config_bool \<^binding>\<open>smt_higher_order\<close> (K false)
   30.54 +val nat_as_int = Attrib.setup_config_bool \<^binding>\<open>smt_nat_as_int\<close> (K false)
   30.55 +val infer_triggers = Attrib.setup_config_bool \<^binding>\<open>smt_infer_triggers\<close> (K false)
   30.56 +val debug_files = Attrib.setup_config_string \<^binding>\<open>smt_debug_files\<close> (K "")
   30.57 +val sat_solver = Attrib.setup_config_string \<^binding>\<open>smt_sat_solver\<close> (K "cdclite")
   30.58  
   30.59  
   30.60  (* diagnostics *)
   30.61 @@ -222,8 +222,8 @@
   30.62      |> SOME o Cache_IO.unsynchronized_init))
   30.63  
   30.64  val setup_certificates =
   30.65 -  Attrib.setup @{binding smt_certificates}
   30.66 -    (Scan.lift (@{keyword "="} |-- Args.name) >>
   30.67 +  Attrib.setup \<^binding>\<open>smt_certificates\<close>
   30.68 +    (Scan.lift (\<^keyword>\<open>=\<close> |-- Args.name) >>
   30.69        (Thm.declaration_attribute o K o select_certificates))
   30.70      "SMT certificates configuration"
   30.71  
   30.72 @@ -263,7 +263,7 @@
   30.73    end
   30.74  
   30.75  val _ =
   30.76 -  Outer_Syntax.command @{command_keyword smt_status}
   30.77 +  Outer_Syntax.command \<^command_keyword>\<open>smt_status\<close>
   30.78      "show the available SMT solvers, the currently selected SMT solver, \
   30.79      \and the values of SMT configuration options"
   30.80      (Scan.succeed (Toplevel.keep (print_setup o Toplevel.context_of)))
    31.1 --- a/src/HOL/Tools/SMT/smt_datatypes.ML	Wed Dec 06 19:34:59 2017 +0100
    31.2 +++ b/src/HOL/Tools/SMT/smt_datatypes.ML	Wed Dec 06 20:43:09 2017 +0100
    31.3 @@ -100,7 +100,7 @@
    31.4               (http://church.cims.nyu.edu/bugzilla3/show_bug.cgi?id=597). It should be removed once
    31.5               the bug is fixed. *)
    31.6            if forall (forall (forall (is_homogenously_nested_co_recursive))) ctrXs_Tsss andalso
    31.7 -             forall (forall (forall (curry (op <>) @{typ bool})))
    31.8 +             forall (forall (forall (curry (op <>) \<^typ>\<open>bool\<close>)))
    31.9                 (map (map (map substAs)) ctrXs_Tsss) then
   31.10              get_ctr_sugar_decl ctr_sugar T Ts ctxt |>> map (pair fp)
   31.11            else
   31.12 @@ -127,9 +127,9 @@
   31.13  
   31.14      fun add (TFree _) = I
   31.15        | add (TVar _) = I
   31.16 -      | add (T as Type (@{type_name fun}, _)) =
   31.17 +      | add (T as Type (\<^type_name>\<open>fun\<close>, _)) =
   31.18            fold add (Term.body_type T :: Term.binder_types T)
   31.19 -      | add @{typ bool} = I
   31.20 +      | add \<^typ>\<open>bool\<close> = I
   31.21        | add (T as Type (n, Ts)) = (fn (dss, ctxt1) =>
   31.22            if declared T declss orelse declared' T dss then
   31.23              (dss, ctxt1)
    32.1 --- a/src/HOL/Tools/SMT/smt_normalize.ML	Wed Dec 06 19:34:59 2017 +0100
    32.2 +++ b/src/HOL/Tools/SMT/smt_normalize.ML	Wed Dec 06 20:43:09 2017 +0100
    32.3 @@ -31,7 +31,7 @@
    32.4  (** instantiate elimination rules **)
    32.5  
    32.6  local
    32.7 -  val (cpfalse, cfalse) = `SMT_Util.mk_cprop (Thm.cterm_of @{context} @{const False})
    32.8 +  val (cpfalse, cfalse) = `SMT_Util.mk_cprop (Thm.cterm_of @{context} \<^const>\<open>False\<close>)
    32.9  
   32.10    fun inst f ct thm =
   32.11      let val cv = f (Drule.strip_imp_concl (Thm.cprop_of thm))
   32.12 @@ -40,7 +40,7 @@
   32.13  
   32.14  fun instantiate_elim thm =
   32.15    (case Thm.concl_of thm of
   32.16 -    @{const Trueprop} $ Var (_, @{typ bool}) => inst Thm.dest_arg cfalse thm
   32.17 +    \<^const>\<open>Trueprop\<close> $ Var (_, \<^typ>\<open>bool\<close>) => inst Thm.dest_arg cfalse thm
   32.18    | Var _ => inst I cpfalse thm
   32.19    | _ => thm)
   32.20  
   32.21 @@ -51,9 +51,9 @@
   32.22  
   32.23  fun norm_def thm =
   32.24    (case Thm.prop_of thm of
   32.25 -    @{const Trueprop} $ (Const (@{const_name HOL.eq}, _) $ _ $ Abs _) =>
   32.26 +    \<^const>\<open>Trueprop\<close> $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ _ $ Abs _) =>
   32.27        norm_def (thm RS @{thm fun_cong})
   32.28 -  | Const (@{const_name Pure.eq}, _) $ _ $ Abs _ => norm_def (thm RS @{thm meta_eq_to_obj_eq})
   32.29 +  | Const (\<^const_name>\<open>Pure.eq\<close>, _) $ _ $ Abs _ => norm_def (thm RS @{thm meta_eq_to_obj_eq})
   32.30    | _ => thm)
   32.31  
   32.32  
   32.33 @@ -61,26 +61,26 @@
   32.34  
   32.35  fun atomize_conv ctxt ct =
   32.36    (case Thm.term_of ct of
   32.37 -    @{const Pure.imp} $ _ $ _ =>
   32.38 +    \<^const>\<open>Pure.imp\<close> $ _ $ _ =>
   32.39        Conv.binop_conv (atomize_conv ctxt) then_conv Conv.rewr_conv @{thm atomize_imp}
   32.40 -  | Const (@{const_name Pure.eq}, _) $ _ $ _ =>
   32.41 +  | Const (\<^const_name>\<open>Pure.eq\<close>, _) $ _ $ _ =>
   32.42        Conv.binop_conv (atomize_conv ctxt) then_conv Conv.rewr_conv @{thm atomize_eq}
   32.43 -  | Const (@{const_name Pure.all}, _) $ Abs _ =>
   32.44 +  | Const (\<^const_name>\<open>Pure.all\<close>, _) $ Abs _ =>
   32.45        Conv.binder_conv (atomize_conv o snd) ctxt then_conv Conv.rewr_conv @{thm atomize_all}
   32.46    | _ => Conv.all_conv) ct
   32.47    handle CTERM _ => Conv.all_conv ct
   32.48  
   32.49  val setup_atomize =
   32.50 -  fold SMT_Builtin.add_builtin_fun_ext'' [@{const_name Pure.imp}, @{const_name Pure.eq},
   32.51 -    @{const_name Pure.all}, @{const_name Trueprop}]
   32.52 +  fold SMT_Builtin.add_builtin_fun_ext'' [\<^const_name>\<open>Pure.imp\<close>, \<^const_name>\<open>Pure.eq\<close>,
   32.53 +    \<^const_name>\<open>Pure.all\<close>, \<^const_name>\<open>Trueprop\<close>]
   32.54  
   32.55  
   32.56  (** unfold special quantifiers **)
   32.57  
   32.58  val special_quant_table = [
   32.59 -  (@{const_name Ex1}, @{thm Ex1_def_raw}),
   32.60 -  (@{const_name Ball}, @{thm Ball_def_raw}),
   32.61 -  (@{const_name Bex}, @{thm Bex_def_raw})]
   32.62 +  (\<^const_name>\<open>Ex1\<close>, @{thm Ex1_def_raw}),
   32.63 +  (\<^const_name>\<open>Ball\<close>, @{thm Ball_def_raw}),
   32.64 +  (\<^const_name>\<open>Bex\<close>, @{thm Bex_def_raw})]
   32.65  
   32.66  local
   32.67    fun special_quant (Const (n, _)) = AList.lookup (op =) special_quant_table n
   32.68 @@ -105,8 +105,8 @@
   32.69  local
   32.70    (*** check trigger syntax ***)
   32.71  
   32.72 -  fun dest_trigger (Const (@{const_name pat}, _) $ _) = SOME true
   32.73 -    | dest_trigger (Const (@{const_name nopat}, _) $ _) = SOME false
   32.74 +  fun dest_trigger (Const (\<^const_name>\<open>pat\<close>, _) $ _) = SOME true
   32.75 +    | dest_trigger (Const (\<^const_name>\<open>nopat\<close>, _) $ _) = SOME false
   32.76      | dest_trigger _ = NONE
   32.77  
   32.78    fun eq_list [] = false
   32.79 @@ -120,9 +120,9 @@
   32.80  
   32.81    fun proper_quant inside f t =
   32.82      (case t of
   32.83 -      Const (@{const_name All}, _) $ Abs (_, _, u) => proper_quant true f u
   32.84 -    | Const (@{const_name Ex}, _) $ Abs (_, _, u) => proper_quant true f u
   32.85 -    | @{const trigger} $ p $ u =>
   32.86 +      Const (\<^const_name>\<open>All\<close>, _) $ Abs (_, _, u) => proper_quant true f u
   32.87 +    | Const (\<^const_name>\<open>Ex\<close>, _) $ Abs (_, _, u) => proper_quant true f u
   32.88 +    | \<^const>\<open>trigger\<close> $ p $ u =>
   32.89          (if inside then f p else false) andalso proper_quant false f u
   32.90      | Abs (_, _, u) => proper_quant false f u
   32.91      | u1 $ u2 => proper_quant false f u1 andalso proper_quant false f u2
   32.92 @@ -141,8 +141,8 @@
   32.93  
   32.94    fun dest_cond_eq ct =
   32.95      (case Thm.term_of ct of
   32.96 -      Const (@{const_name HOL.eq}, _) $ _ $ _ => Thm.dest_binop ct
   32.97 -    | @{const HOL.implies} $ _ $ _ => dest_cond_eq (Thm.dest_arg ct)
   32.98 +      Const (\<^const_name>\<open>HOL.eq\<close>, _) $ _ $ _ => Thm.dest_binop ct
   32.99 +    | \<^const>\<open>HOL.implies\<close> $ _ $ _ => dest_cond_eq (Thm.dest_arg ct)
  32.100      | _ => raise CTERM ("no equation", [ct]))
  32.101  
  32.102    fun get_constrs thy (Type (n, _)) = these (BNF_LFP_Compat.get_constrs thy n)
  32.103 @@ -186,14 +186,14 @@
  32.104              Pattern.matches thy (t', u) andalso not (t aconv u))
  32.105          in not (Term.exists_subterm some_match u) end
  32.106  
  32.107 -  val pat = SMT_Util.mk_const_pat @{theory} @{const_name pat} SMT_Util.destT1
  32.108 +  val pat = SMT_Util.mk_const_pat @{theory} \<^const_name>\<open>pat\<close> SMT_Util.destT1
  32.109    fun mk_pat ct = Thm.apply (SMT_Util.instT' ct pat) ct
  32.110  
  32.111    fun mk_clist T =
  32.112      apply2 (Thm.cterm_of @{context}) (SMT_Util.symb_cons_const T, SMT_Util.symb_nil_const T)
  32.113    fun mk_list (ccons, cnil) f cts = fold_rev (Thm.mk_binop ccons o f) cts cnil
  32.114 -  val mk_pat_list = mk_list (mk_clist @{typ pattern})
  32.115 -  val mk_mpat_list = mk_list (mk_clist @{typ "pattern symb_list"})
  32.116 +  val mk_pat_list = mk_list (mk_clist \<^typ>\<open>pattern\<close>)
  32.117 +  val mk_mpat_list = mk_list (mk_clist \<^typ>\<open>pattern symb_list\<close>)
  32.118    fun mk_trigger ctss = mk_mpat_list (mk_pat_list mk_pat) ctss
  32.119  
  32.120    val trigger_eq = mk_meta_eq @{lemma "p = trigger t p" by (simp add: trigger_def)}
  32.121 @@ -220,7 +220,7 @@
  32.122  
  32.123      in insert_trigger_conv (filter_mpats (get_mpats lhs)) ct end
  32.124  
  32.125 -  fun has_trigger (@{const trigger} $ _ $ _) = true
  32.126 +  fun has_trigger (\<^const>\<open>trigger\<close> $ _ $ _) = true
  32.127      | has_trigger _ = false
  32.128  
  32.129    fun try_trigger_conv cv ct =
  32.130 @@ -238,7 +238,7 @@
  32.131  
  32.132  val setup_trigger =
  32.133    fold SMT_Builtin.add_builtin_fun_ext''
  32.134 -    [@{const_name pat}, @{const_name nopat}, @{const_name trigger}]
  32.135 +    [\<^const_name>\<open>pat\<close>, \<^const_name>\<open>nopat\<close>, \<^const_name>\<open>trigger\<close>]
  32.136  
  32.137  end
  32.138  
  32.139 @@ -280,10 +280,10 @@
  32.140  
  32.141  (** rewrite bool case expressions as if expressions **)
  32.142  
  32.143 -val case_bool_entry = (@{const_name "bool.case_bool"}, @{thm case_bool_if})
  32.144 +val case_bool_entry = (\<^const_name>\<open>bool.case_bool\<close>, @{thm case_bool_if})
  32.145  
  32.146  local
  32.147 -  fun is_case_bool (Const (@{const_name "bool.case_bool"}, _)) = true
  32.148 +  fun is_case_bool (Const (\<^const_name>\<open>bool.case_bool\<close>, _)) = true
  32.149      | is_case_bool _ = false
  32.150  
  32.151    fun unfold_conv _ =
  32.152 @@ -294,7 +294,7 @@
  32.153  fun rewrite_case_bool_conv ctxt =
  32.154    SMT_Util.if_exists_conv is_case_bool (Conv.top_conv unfold_conv ctxt)
  32.155  
  32.156 -val setup_case_bool = SMT_Builtin.add_builtin_fun_ext'' @{const_name "bool.case_bool"}
  32.157 +val setup_case_bool = SMT_Builtin.add_builtin_fun_ext'' \<^const_name>\<open>bool.case_bool\<close>
  32.158  
  32.159  end
  32.160  
  32.161 @@ -302,12 +302,12 @@
  32.162  (** unfold abs, min and max **)
  32.163  
  32.164  val abs_min_max_table = [
  32.165 -  (@{const_name min}, @{thm min_def_raw}),
  32.166 -  (@{const_name max}, @{thm max_def_raw}),
  32.167 -  (@{const_name abs}, @{thm abs_if_raw})]
  32.168 +  (\<^const_name>\<open>min\<close>, @{thm min_def_raw}),
  32.169 +  (\<^const_name>\<open>max\<close>, @{thm max_def_raw}),
  32.170 +  (\<^const_name>\<open>abs\<close>, @{thm abs_if_raw})]
  32.171  
  32.172  local
  32.173 -  fun abs_min_max ctxt (Const (n, Type (@{type_name fun}, [T, _]))) =
  32.174 +  fun abs_min_max ctxt (Const (n, Type (\<^type_name>\<open>fun\<close>, [T, _]))) =
  32.175          (case AList.lookup (op =) abs_min_max_table n of
  32.176            NONE => NONE
  32.177          | SOME thm => if SMT_Builtin.is_builtin_typ_ext ctxt T then SOME thm else NONE)
  32.178 @@ -334,7 +334,7 @@
  32.179  
  32.180    val simple_nat_ops = [
  32.181      @{const less (nat)}, @{const less_eq (nat)},
  32.182 -    @{const Suc}, @{const plus (nat)}, @{const minus (nat)}]
  32.183 +    \<^const>\<open>Suc\<close>, @{const plus (nat)}, @{const minus (nat)}]
  32.184  
  32.185    val mult_nat_ops =
  32.186      [@{const times (nat)}, @{const divide (nat)}, @{const modulo (nat)}]
  32.187 @@ -344,7 +344,7 @@
  32.188    val nat_consts = nat_ops @ [@{const numeral (nat)},
  32.189      @{const zero_class.zero (nat)}, @{const one_class.one (nat)}]
  32.190  
  32.191 -  val nat_int_coercions = [@{const of_nat (int)}, @{const nat}]
  32.192 +  val nat_int_coercions = [@{const of_nat (int)}, \<^const>\<open>nat\<close>]
  32.193  
  32.194    val builtin_nat_ops = nat_int_coercions @ simple_nat_ops
  32.195  
  32.196 @@ -399,7 +399,7 @@
  32.197    if exists (uses_nat_int o Thm.prop_of) thms then (thms, nat_embedding) else (thms, [])
  32.198  
  32.199  val setup_nat_as_int =
  32.200 -  SMT_Builtin.add_builtin_typ_ext (@{typ nat},
  32.201 +  SMT_Builtin.add_builtin_typ_ext (\<^typ>\<open>nat\<close>,
  32.202      fn ctxt => K (Config.get ctxt SMT_Config.nat_as_int)) #>
  32.203    fold (SMT_Builtin.add_builtin_fun_ext' o Term.dest_Const) builtin_nat_ops
  32.204  
  32.205 @@ -414,9 +414,9 @@
  32.206      rewrite - 0 into 0
  32.207    *)
  32.208  
  32.209 -  fun is_irregular_number (Const (@{const_name numeral}, _) $ Const (@{const_name num.One}, _)) =
  32.210 +  fun is_irregular_number (Const (\<^const_name>\<open>numeral\<close>, _) $ Const (\<^const_name>\<open>num.One\<close>, _)) =
  32.211          true
  32.212 -    | is_irregular_number (Const (@{const_name uminus}, _) $ Const (@{const_name Groups.zero}, _)) =
  32.213 +    | is_irregular_number (Const (\<^const_name>\<open>uminus\<close>, _) $ Const (\<^const_name>\<open>Groups.zero\<close>, _)) =
  32.214          true
  32.215      | is_irregular_number _ = false
  32.216  
  32.217 @@ -478,12 +478,12 @@
  32.218    in burrow_ids (fold (fn e => e ctxt) es o rpair []) ithms end
  32.219  
  32.220  local
  32.221 -  val ignored = member (op =) [@{const_name All}, @{const_name Ex},
  32.222 -    @{const_name Let}, @{const_name If}, @{const_name HOL.eq}]
  32.223 +  val ignored = member (op =) [\<^const_name>\<open>All\<close>, \<^const_name>\<open>Ex\<close>,
  32.224 +    \<^const_name>\<open>Let\<close>, \<^const_name>\<open>If\<close>, \<^const_name>\<open>HOL.eq\<close>]
  32.225  
  32.226    val schematic_consts_of =
  32.227      let
  32.228 -      fun collect (@{const trigger} $ p $ t) = collect_trigger p #> collect t
  32.229 +      fun collect (\<^const>\<open>trigger\<close> $ p $ t) = collect_trigger p #> collect t
  32.230          | collect (t $ u) = collect t #> collect u
  32.231          | collect (Abs (_, _, t)) = collect t
  32.232          | collect (t as Const (n, _)) =
  32.233 @@ -492,8 +492,8 @@
  32.234        and collect_trigger t =
  32.235          let val dest = these o try SMT_Util.dest_symb_list
  32.236          in fold (fold collect_pat o dest) (dest t) end
  32.237 -      and collect_pat (Const (@{const_name pat}, _) $ t) = collect t
  32.238 -        | collect_pat (Const (@{const_name nopat}, _) $ t) = collect t
  32.239 +      and collect_pat (Const (\<^const_name>\<open>pat\<close>, _) $ t) = collect t
  32.240 +        | collect_pat (Const (\<^const_name>\<open>nopat\<close>, _) $ t) = collect t
  32.241          | collect_pat _ = I
  32.242      in (fn t => collect t Symtab.empty) end
  32.243  in
    33.1 --- a/src/HOL/Tools/SMT/smt_translate.ML	Wed Dec 06 19:34:59 2017 +0100
    33.2 +++ b/src/HOL/Tools/SMT/smt_translate.ML	Wed Dec 06 20:43:09 2017 +0100
    33.3 @@ -199,21 +199,21 @@
    33.4          SOME k => Term.list_comb (t, ts) |> k <> length ts ? expf k (length ts) T
    33.5        | NONE => Term.list_comb (t, ts))
    33.6  
    33.7 -    fun expand ((q as Const (@{const_name All}, _)) $ Abs a) = q $ abs_expand a
    33.8 -      | expand ((q as Const (@{const_name All}, T)) $ t) = q $ exp expand T t
    33.9 -      | expand (q as Const (@{const_name All}, T)) = exp2 T q
   33.10 -      | expand ((q as Const (@{const_name Ex}, _)) $ Abs a) = q $ abs_expand a
   33.11 -      | expand ((q as Const (@{const_name Ex}, T)) $ t) = q $ exp expand T t
   33.12 -      | expand (q as Const (@{const_name Ex}, T)) = exp2 T q
   33.13 -      | expand (Const (@{const_name Let}, T) $ t) =
   33.14 +    fun expand ((q as Const (\<^const_name>\<open>All\<close>, _)) $ Abs a) = q $ abs_expand a
   33.15 +      | expand ((q as Const (\<^const_name>\<open>All\<close>, T)) $ t) = q $ exp expand T t
   33.16 +      | expand (q as Const (\<^const_name>\<open>All\<close>, T)) = exp2 T q
   33.17 +      | expand ((q as Const (\<^const_name>\<open>Ex\<close>, _)) $ Abs a) = q $ abs_expand a
   33.18 +      | expand ((q as Const (\<^const_name>\<open>Ex\<close>, T)) $ t) = q $ exp expand T t
   33.19 +      | expand (q as Const (\<^const_name>\<open>Ex\<close>, T)) = exp2 T q
   33.20 +      | expand (Const (\<^const_name>\<open>Let\<close>, T) $ t) =
   33.21            let val U = Term.domain_type (Term.range_type T)
   33.22            in Abs (Name.uu, U, Bound 0 $ Term.incr_boundvars 1 t) end
   33.23 -      | expand (Const (@{const_name Let}, T)) =
   33.24 +      | expand (Const (\<^const_name>\<open>Let\<close>, T)) =
   33.25            let val U = Term.domain_type (Term.range_type T)
   33.26            in Abs (Name.uu, Term.domain_type T, Abs (Name.uu, U, Bound 0 $ Bound 1)) end
   33.27        | expand t =
   33.28            (case Term.strip_comb t of
   33.29 -            (Const (@{const_name Let}, _), t1 :: t2 :: ts) =>
   33.30 +            (Const (\<^const_name>\<open>Let\<close>, _), t1 :: t2 :: ts) =>
   33.31              Term.betapplys (Term.betapply (expand t2, expand t1), map expand ts)
   33.32            | (u as Const (c as (_, T)), ts) =>
   33.33                (case SMT_Builtin.dest_builtin ctxt c ts of
   33.34 @@ -252,12 +252,12 @@
   33.35  
   33.36    fun take_vars_into_account types t i =
   33.37      let
   33.38 -      fun find_min j (T as Type (@{type_name fun}, [_, T'])) =
   33.39 +      fun find_min j (T as Type (\<^type_name>\<open>fun\<close>, [_, T'])) =
   33.40            if j = i orelse Typtab.defined types T then j else find_min (j + 1) T'
   33.41          | find_min j _ = j
   33.42      in find_min 0 (Term.type_of t) end
   33.43  
   33.44 -  fun app u (t, T) = (Const (@{const_name fun_app}, T --> T) $ t $ u, Term.range_type T)
   33.45 +  fun app u (t, T) = (Const (\<^const_name>\<open>fun_app\<close>, T --> T) $ t $ u, Term.range_type T)
   33.46  
   33.47    fun apply i t T ts =
   33.48      let
   33.49 @@ -288,11 +288,11 @@
   33.50  
   33.51      fun traverse Ts t =
   33.52        (case Term.strip_comb t of
   33.53 -        (q as Const (@{const_name All}, _), [Abs (x, T, u)]) =>
   33.54 +        (q as Const (\<^const_name>\<open>All\<close>, _), [Abs (x, T, u)]) =>
   33.55            q $ Abs (x, T, in_trigger (T :: Ts) u)
   33.56 -      | (q as Const (@{const_name Ex}, _), [Abs (x, T, u)]) =>
   33.57 +      | (q as Const (\<^const_name>\<open>Ex\<close>, _), [Abs (x, T, u)]) =>
   33.58            q $ Abs (x, T, in_trigger (T :: Ts) u)
   33.59 -      | (q as Const (@{const_name Let}, _), [u1, u2 as Abs _]) =>
   33.60 +      | (q as Const (\<^const_name>\<open>Let\<close>, _), [u1, u2 as Abs _]) =>
   33.61            q $ traverse Ts u1 $ traverse Ts u2
   33.62        | (u as Const (c as (_, T)), ts) =>
   33.63            (case SMT_Builtin.dest_builtin ctxt c ts of
   33.64 @@ -306,12 +306,12 @@
   33.65        | (u as Bound i, ts) => apply 0 u (nth Ts i) (map (traverse Ts) ts)
   33.66        | (Abs (n, T, u), ts) => traverses Ts (Abs (n, T, traverse (T::Ts) u)) ts
   33.67        | (u, ts) => traverses Ts u ts)
   33.68 -    and in_trigger Ts ((c as @{const trigger}) $ p $ t) = c $ in_pats Ts p $ traverse Ts t
   33.69 +    and in_trigger Ts ((c as \<^const>\<open>trigger\<close>) $ p $ t) = c $ in_pats Ts p $ traverse Ts t
   33.70        | in_trigger Ts t = traverse Ts t
   33.71      and in_pats Ts ps =
   33.72 -      in_list @{typ "pattern symb_list"} (in_list @{typ pattern} (in_pat Ts)) ps
   33.73 -    and in_pat Ts ((p as Const (@{const_name pat}, _)) $ t) = p $ traverse Ts t
   33.74 -      | in_pat Ts ((p as Const (@{const_name nopat}, _)) $ t) = p $ traverse Ts t
   33.75 +      in_list \<^typ>\<open>pattern symb_list\<close> (in_list \<^typ>\<open>pattern\<close> (in_pat Ts)) ps
   33.76 +    and in_pat Ts ((p as Const (\<^const_name>\<open>pat\<close>, _)) $ t) = p $ traverse Ts t
   33.77 +      | in_pat Ts ((p as Const (\<^const_name>\<open>nopat\<close>, _)) $ t) = p $ traverse Ts t
   33.78        | in_pat _ t = raise TERM ("bad pattern", [t])
   33.79      and traverses Ts t ts = Term.list_comb (t, map (traverse Ts) ts)
   33.80    in map (traverse []) ts end
   33.81 @@ -324,7 +324,7 @@
   33.82  (** map HOL formulas to FOL formulas (i.e., separate formulas froms terms) **)
   33.83  
   33.84  local
   33.85 -  val is_quant = member (op =) [@{const_name All}, @{const_name Ex}]
   33.86 +  val is_quant = member (op =) [\<^const_name>\<open>All\<close>, \<^const_name>\<open>Ex\<close>]
   33.87  
   33.88    val fol_rules = [
   33.89      Let_def,
   33.90 @@ -343,9 +343,9 @@
   33.91  
   33.92      fun in_term pat t =
   33.93        (case Term.strip_comb t of
   33.94 -        (@{const True}, []) => t
   33.95 -      | (@{const False}, []) => t
   33.96 -      | (u as Const (@{const_name If}, _), [t1, t2, t3]) =>
   33.97 +        (\<^const>\<open>True\<close>, []) => t
   33.98 +      | (\<^const>\<open>False\<close>, []) => t
   33.99 +      | (u as Const (\<^const_name>\<open>If\<close>, _), [t1, t2, t3]) =>
  33.100            if pat then raise BAD_PATTERN () else u $ in_form t1 $ in_term pat t2 $ in_term pat t3
  33.101        | (Const (c as (n, _)), ts) =>
  33.102            if is_builtin_conn_or_pred ctxt c ts orelse is_quant n then
  33.103 @@ -355,16 +355,16 @@
  33.104        | (Free c, ts) => Term.list_comb (Free c, map (in_term pat) ts)
  33.105        | _ => t)
  33.106  
  33.107 -    and in_pat ((p as Const (@{const_name pat}, _)) $ t) =
  33.108 +    and in_pat ((p as Const (\<^const_name>\<open>pat\<close>, _)) $ t) =
  33.109            p $ in_term true t
  33.110 -      | in_pat ((p as Const (@{const_name nopat}, _)) $ t) =
  33.111 +      | in_pat ((p as Const (\<^const_name>\<open>nopat\<close>, _)) $ t) =
  33.112            p $ in_term true t
  33.113        | in_pat t = raise TERM ("bad pattern", [t])
  33.114  
  33.115      and in_pats ps =
  33.116 -      in_list @{typ "pattern symb_list"} (SOME o in_list @{typ pattern} (try in_pat)) ps
  33.117 +      in_list \<^typ>\<open>pattern symb_list\<close> (SOME o in_list \<^typ>\<open>pattern\<close> (try in_pat)) ps
  33.118  
  33.119 -    and in_trigger ((c as @{const trigger}) $ p $ t) = c $ in_pats p $ in_form t
  33.120 +    and in_trigger ((c as \<^const>\<open>trigger\<close>) $ p $ t) = c $ in_pats p $ in_form t
  33.121        | in_trigger t = in_form t
  33.122  
  33.123      and in_form t =
  33.124 @@ -393,16 +393,16 @@
  33.125  (** utility functions **)
  33.126  
  33.127  val quantifier = (fn
  33.128 -    @{const_name All} => SOME SForall
  33.129 -  | @{const_name Ex} => SOME SExists
  33.130 +    \<^const_name>\<open>All\<close> => SOME SForall
  33.131 +  | \<^const_name>\<open>Ex\<close> => SOME SExists
  33.132    | _ => NONE)
  33.133  
  33.134  fun group_quant qname Ts (t as Const (q, _) $ Abs (_, T, u)) =
  33.135        if q = qname then group_quant qname (T :: Ts) u else (Ts, t)
  33.136    | group_quant _ Ts t = (Ts, t)
  33.137  
  33.138 -fun dest_pat (Const (@{const_name pat}, _) $ t) = (t, true)
  33.139 -  | dest_pat (Const (@{const_name nopat}, _) $ t) = (t, false)
  33.140 +fun dest_pat (Const (\<^const_name>\<open>pat\<close>, _) $ t) = (t, true)
  33.141 +  | dest_pat (Const (\<^const_name>\<open>nopat\<close>, _) $ t) = (t, false)
  33.142    | dest_pat t = raise TERM ("bad pattern", [t])
  33.143  
  33.144  fun dest_pats [] = I
  33.145 @@ -412,7 +412,7 @@
  33.146        | (ps, [false]) => cons (SNoPat ps)
  33.147        | _ => raise TERM ("bad multi-pattern", ts))
  33.148  
  33.149 -fun dest_trigger (@{const trigger} $ tl $ t) =
  33.150 +fun dest_trigger (\<^const>\<open>trigger\<close> $ tl $ t) =
  33.151        (rev (fold (dest_pats o SMT_Util.dest_symb_list) (SMT_Util.dest_symb_list tl) []), t)
  33.152    | dest_trigger t = ([], t)
  33.153  
  33.154 @@ -501,17 +501,17 @@
  33.155        ((empty_tr_context, ctxt), ts1)
  33.156        |-> (if null fp_kinds then no_dtyps else collect_co_datatypes fp_kinds)
  33.157  
  33.158 -    fun is_binder (Const (@{const_name Let}, _) $ _) = true
  33.159 +    fun is_binder (Const (\<^const_name>\<open>Let\<close>, _) $ _) = true
  33.160        | is_binder t = Lambda_Lifting.is_quantifier t
  33.161  
  33.162 -    fun mk_trigger ((q as Const (@{const_name All}, _)) $ Abs (n, T, t)) =
  33.163 +    fun mk_trigger ((q as Const (\<^const_name>\<open>All\<close>, _)) $ Abs (n, T, t)) =
  33.164            q $ Abs (n, T, mk_trigger t)
  33.165 -      | mk_trigger (eq as (Const (@{const_name HOL.eq}, T) $ lhs $ _)) =
  33.166 -          Term.domain_type T --> @{typ pattern}
  33.167 -          |> (fn T => Const (@{const_name pat}, T) $ lhs)
  33.168 -          |> SMT_Util.mk_symb_list @{typ pattern} o single
  33.169 -          |> SMT_Util.mk_symb_list @{typ "pattern symb_list"} o single
  33.170 -          |> (fn t => @{const trigger} $ t $ eq)
  33.171 +      | mk_trigger (eq as (Const (\<^const_name>\<open>HOL.eq\<close>, T) $ lhs $ _)) =
  33.172 +          Term.domain_type T --> \<^typ>\<open>pattern\<close>
  33.173 +          |> (fn T => Const (\<^const_name>\<open>pat\<close>, T) $ lhs)
  33.174 +          |> SMT_Util.mk_symb_list \<^typ>\<open>pattern\<close> o single
  33.175 +          |> SMT_Util.mk_symb_list \<^typ>\<open>pattern symb_list\<close> o single
  33.176 +          |> (fn t => \<^const>\<open>trigger\<close> $ t $ eq)
  33.177        | mk_trigger t = t
  33.178  
  33.179      val (ctxt2, (ts3, ll_defs)) =
    34.1 --- a/src/HOL/Tools/arith_data.ML	Wed Dec 06 19:34:59 2017 +0100
    34.2 +++ b/src/HOL/Tools/arith_data.ML	Wed Dec 06 20:43:09 2017 +0100
    34.3 @@ -44,11 +44,11 @@
    34.4  
    34.5  val _ =
    34.6    Theory.setup
    34.7 -    (Method.setup @{binding arith}
    34.8 +    (Method.setup \<^binding>\<open>arith\<close>
    34.9        (Scan.succeed (fn ctxt =>
   34.10          METHOD (fn facts =>
   34.11            HEADGOAL
   34.12 -            (Method.insert_tac ctxt (rev (Named_Theorems.get ctxt @{named_theorems arith}) @ facts)
   34.13 +            (Method.insert_tac ctxt (rev (Named_Theorems.get ctxt \<^named_theorems>\<open>arith\<close>) @ facts)
   34.14                THEN' arith_tac ctxt))))
   34.15        "various arithmetic decision procedures");
   34.16  
   34.17 @@ -58,11 +58,11 @@
   34.18  fun mk_number T 1 = HOLogic.numeral_const T $ HOLogic.one_const
   34.19    | mk_number T n = HOLogic.mk_number T n;
   34.20  
   34.21 -val mk_plus = HOLogic.mk_binop @{const_name Groups.plus};
   34.22 +val mk_plus = HOLogic.mk_binop \<^const_name>\<open>Groups.plus\<close>;
   34.23  
   34.24  fun mk_minus t =
   34.25    let val T = Term.fastype_of t
   34.26 -  in Const (@{const_name Groups.uminus}, T --> T) $ t end;
   34.27 +  in Const (\<^const_name>\<open>Groups.uminus\<close>, T --> T) $ t end;
   34.28  
   34.29  (*Thus mk_sum[t] yields t+0; longer sums don't have a trailing zero*)
   34.30  fun mk_sum T [] = mk_number T 0
   34.31 @@ -74,9 +74,9 @@
   34.32    | long_mk_sum T (t :: ts) = mk_plus (t, long_mk_sum T ts);
   34.33  
   34.34  (*decompose additions AND subtractions as a sum*)
   34.35 -fun dest_summing (pos, Const (@{const_name Groups.plus}, _) $ t $ u, ts) =
   34.36 +fun dest_summing (pos, Const (\<^const_name>\<open>Groups.plus\<close>, _) $ t $ u, ts) =
   34.37        dest_summing (pos, t, dest_summing (pos, u, ts))
   34.38 -  | dest_summing (pos, Const (@{const_name Groups.minus}, _) $ t $ u, ts) =
   34.39 +  | dest_summing (pos, Const (\<^const_name>\<open>Groups.minus\<close>, _) $ t $ u, ts) =
   34.40        dest_summing (pos, t, dest_summing (not pos, u, ts))
   34.41    | dest_summing (pos, t, ts) = (if pos then t else mk_minus t) :: ts;
   34.42  
    35.1 --- a/src/HOL/Tools/boolean_algebra_cancel.ML	Wed Dec 06 19:34:59 2017 +0100
    35.2 +++ b/src/HOL/Tools/boolean_algebra_cancel.ML	Wed Dec 06 20:43:09 2017 +0100
    35.3 @@ -27,17 +27,17 @@
    35.4  
    35.5  fun move_to_front rule path = Conv.rewr_conv (Library.foldl (op RS) (rule, path))
    35.6  
    35.7 -fun add_atoms sup pos path (t as Const (@{const_name Lattices.sup}, _) $ x $ y) =
    35.8 +fun add_atoms sup pos path (t as Const (\<^const_name>\<open>Lattices.sup\<close>, _) $ x $ y) =
    35.9      if sup then
   35.10        add_atoms sup pos (sup1::path) x #> add_atoms sup pos (sup2::path) y
   35.11      else cons ((pos, t), path)
   35.12 -  | add_atoms sup pos path (t as Const (@{const_name Lattices.inf}, _) $ x $ y) =
   35.13 +  | add_atoms sup pos path (t as Const (\<^const_name>\<open>Lattices.inf\<close>, _) $ x $ y) =
   35.14      if not sup then
   35.15        add_atoms sup pos (inf1::path) x #> add_atoms sup pos (inf2::path) y
   35.16      else cons ((pos, t), path)
   35.17 -  | add_atoms _ _ _ (Const (@{const_name Orderings.bot}, _)) = I
   35.18 -  | add_atoms _ _ _ (Const (@{const_name Orderings.top}, _)) = I
   35.19 -  | add_atoms _ pos path (Const (@{const_name Groups.uminus}, _) $ x) = cons ((not pos, x), path)
   35.20 +  | add_atoms _ _ _ (Const (\<^const_name>\<open>Orderings.bot\<close>, _)) = I
   35.21 +  | add_atoms _ _ _ (Const (\<^const_name>\<open>Orderings.top\<close>, _)) = I
   35.22 +  | add_atoms _ pos path (Const (\<^const_name>\<open>Groups.uminus\<close>, _) $ x) = cons ((not pos, x), path)
   35.23    | add_atoms _ pos path x = cons ((pos, x), path);
   35.24  
   35.25  fun atoms sup pos t = add_atoms sup pos [] t []
    36.1 --- a/src/HOL/Tools/choice_specification.ML	Wed Dec 06 19:34:59 2017 +0100
    36.2 +++ b/src/HOL/Tools/choice_specification.ML	Wed Dec 06 20:43:09 2017 +0100
    36.3 @@ -18,7 +18,7 @@
    36.4  fun mk_definitional [] arg = arg
    36.5    | mk_definitional ((thname, cname, covld) :: cos) (thy, thm) =
    36.6        (case HOLogic.dest_Trueprop (Thm.concl_of thm) of
    36.7 -        Const (@{const_name Ex}, _) $ P =>
    36.8 +        Const (\<^const_name>\<open>Ex\<close>, _) $ P =>
    36.9            let
   36.10              val ctype = domain_type (type_of P)
   36.11              val cname_full = Sign.intern_const thy cname
   36.12 @@ -90,7 +90,7 @@
   36.13      fun proc_single prop =
   36.14        let
   36.15          val frees = Misc_Legacy.term_frees prop
   36.16 -        val _ = forall (fn v => Sign.of_sort thy (type_of v, @{sort type})) frees
   36.17 +        val _ = forall (fn v => Sign.of_sort thy (type_of v, \<^sort>\<open>type\<close>)) frees
   36.18            orelse error "Specificaton: Only free variables of sort 'type' allowed"
   36.19          val prop_closed = close_form prop
   36.20        in (prop_closed, frees) end
   36.21 @@ -194,12 +194,12 @@
   36.22  
   36.23  (* outer syntax *)
   36.24  
   36.25 -val opt_name = Scan.optional (Parse.name --| @{keyword ":"}) ""
   36.26 +val opt_name = Scan.optional (Parse.name --| \<^keyword>\<open>:\<close>) ""
   36.27  val opt_overloaded = Parse.opt_keyword "overloaded"
   36.28  
   36.29  val _ =
   36.30 -  Outer_Syntax.command @{command_keyword specification} "define constants by specification"
   36.31 -    (@{keyword "("} |-- Scan.repeat1 (opt_name -- Parse.term -- opt_overloaded) --| @{keyword ")"} --
   36.32 +  Outer_Syntax.command \<^command_keyword>\<open>specification\<close> "define constants by specification"
   36.33 +    (\<^keyword>\<open>(\<close> |-- Scan.repeat1 (opt_name -- Parse.term -- opt_overloaded) --| \<^keyword>\<open>)\<close> --
   36.34        Scan.repeat1 ((Parse_Spec.opt_thm_name ":" >> apfst Binding.name_of) -- Parse.prop)
   36.35        >> (fn (cos, alt_props) => Toplevel.theory_to_proof (process_spec cos alt_props)))
   36.36  
    37.1 --- a/src/HOL/Tools/cnf.ML	Wed Dec 06 19:34:59 2017 +0100
    37.2 +++ b/src/HOL/Tools/cnf.ML	Wed Dec 06 20:43:09 2017 +0100
    37.3 @@ -94,19 +94,19 @@
    37.4  
    37.5  val cnftac_eq_imp        = @{lemma "[| P = Q; P |] ==> Q" by auto};
    37.6  
    37.7 -fun is_atom (Const (@{const_name False}, _)) = false
    37.8 -  | is_atom (Const (@{const_name True}, _)) = false
    37.9 -  | is_atom (Const (@{const_name HOL.conj}, _) $ _ $ _) = false
   37.10 -  | is_atom (Const (@{const_name HOL.disj}, _) $ _ $ _) = false
   37.11 -  | is_atom (Const (@{const_name HOL.implies}, _) $ _ $ _) = false
   37.12 -  | is_atom (Const (@{const_name HOL.eq}, Type ("fun", @{typ bool} :: _)) $ _ $ _) = false
   37.13 -  | is_atom (Const (@{const_name Not}, _) $ _) = false
   37.14 +fun is_atom (Const (\<^const_name>\<open>False\<close>, _)) = false
   37.15 +  | is_atom (Const (\<^const_name>\<open>True\<close>, _)) = false
   37.16 +  | is_atom (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ _ $ _) = false
   37.17 +  | is_atom (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ _ $ _) = false
   37.18 +  | is_atom (Const (\<^const_name>\<open>HOL.implies\<close>, _) $ _ $ _) = false
   37.19 +  | is_atom (Const (\<^const_name>\<open>HOL.eq\<close>, Type ("fun", \<^typ>\<open>bool\<close> :: _)) $ _ $ _) = false
   37.20 +  | is_atom (Const (\<^const_name>\<open>Not\<close>, _) $ _) = false
   37.21    | is_atom _ = true;
   37.22  
   37.23 -fun is_literal (Const (@{const_name Not}, _) $ x) = is_atom x
   37.24 +fun is_literal (Const (\<^const_name>\<open>Not\<close>, _) $ x) = is_atom x
   37.25    | is_literal x = is_atom x;
   37.26  
   37.27 -fun is_clause (Const (@{const_name HOL.disj}, _) $ x $ y) = is_clause x andalso is_clause y
   37.28 +fun is_clause (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ x $ y) = is_clause x andalso is_clause y
   37.29    | is_clause x = is_literal x;
   37.30  
   37.31  (* ------------------------------------------------------------------------- *)
   37.32 @@ -116,7 +116,7 @@
   37.33  
   37.34  fun clause_is_trivial c =
   37.35    let
   37.36 -    fun dual (Const (@{const_name Not}, _) $ x) = x
   37.37 +    fun dual (Const (\<^const_name>\<open>Not\<close>, _) $ x) = x
   37.38        | dual x = HOLogic.Not $ x
   37.39      fun has_duals [] = false
   37.40        | has_duals (x::xs) = member (op =) xs (dual x) orelse has_duals xs
   37.41 @@ -178,28 +178,28 @@
   37.42  (*      eliminated (possibly causing an exponential blowup)                  *)
   37.43  (* ------------------------------------------------------------------------- *)
   37.44  
   37.45 -fun make_nnf_thm thy (Const (@{const_name HOL.conj}, _) $ x $ y) =
   37.46 +fun make_nnf_thm thy (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x $ y) =
   37.47        let
   37.48          val thm1 = make_nnf_thm thy x
   37.49          val thm2 = make_nnf_thm thy y
   37.50        in
   37.51          conj_cong OF [thm1, thm2]
   37.52        end
   37.53 -  | make_nnf_thm thy (Const (@{const_name HOL.disj}, _) $ x $ y) =
   37.54 +  | make_nnf_thm thy (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ x $ y) =
   37.55        let
   37.56          val thm1 = make_nnf_thm thy x
   37.57          val thm2 = make_nnf_thm thy y
   37.58        in
   37.59          disj_cong OF [thm1, thm2]
   37.60        end
   37.61 -  | make_nnf_thm thy (Const (@{const_name HOL.implies}, _) $ x $ y) =
   37.62 +  | make_nnf_thm thy (Const (\<^const_name>\<open>HOL.implies\<close>, _) $ x $ y) =
   37.63        let
   37.64          val thm1 = make_nnf_thm thy (HOLogic.Not $ x)
   37.65          val thm2 = make_nnf_thm thy y
   37.66        in
   37.67          make_nnf_imp OF [thm1, thm2]
   37.68        end
   37.69 -  | make_nnf_thm thy (Const (@{const_name HOL.eq}, Type ("fun", @{typ bool} :: _)) $ x $ y) =
   37.70 +  | make_nnf_thm thy (Const (\<^const_name>\<open>HOL.eq\<close>, Type ("fun", \<^typ>\<open>bool\<close> :: _)) $ x $ y) =
   37.71        let
   37.72          val thm1 = make_nnf_thm thy x
   37.73          val thm2 = make_nnf_thm thy (HOLogic.Not $ x)
   37.74 @@ -208,18 +208,18 @@
   37.75        in
   37.76          make_nnf_iff OF [thm1, thm2, thm3, thm4]
   37.77        end
   37.78 -  | make_nnf_thm _ (Const (@{const_name Not}, _) $ Const (@{const_name False}, _)) =
   37.79 +  | make_nnf_thm _ (Const (\<^const_name>\<open>Not\<close>, _) $ Const (\<^const_name>\<open>False\<close>, _)) =
   37.80        make_nnf_not_false
   37.81 -  | make_nnf_thm _ (Const (@{const_name Not}, _) $ Const (@{const_name True}, _)) =
   37.82 +  | make_nnf_thm _ (Const (\<^const_name>\<open>Not\<close>, _) $ Const (\<^const_name>\<open>True\<close>, _)) =
   37.83        make_nnf_not_true
   37.84 -  | make_nnf_thm thy (Const (@{const_name Not}, _) $ (Const (@{const_name HOL.conj}, _) $ x $ y)) =
   37.85 +  | make_nnf_thm thy (Const (\<^const_name>\<open>Not\<close>, _) $ (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x $ y)) =
   37.86        let
   37.87          val thm1 = make_nnf_thm thy (HOLogic.Not $ x)
   37.88          val thm2 = make_nnf_thm thy (HOLogic.Not $ y)
   37.89        in
   37.90          make_nnf_not_conj OF [thm1, thm2]
   37.91        end
   37.92 -  | make_nnf_thm thy (Const (@{const_name Not}, _) $ (Const (@{const_name HOL.disj}, _) $ x $ y)) =
   37.93 +  | make_nnf_thm thy (Const (\<^const_name>\<open>Not\<close>, _) $ (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ x $ y)) =
   37.94        let
   37.95          val thm1 = make_nnf_thm thy (HOLogic.Not $ x)
   37.96          val thm2 = make_nnf_thm thy (HOLogic.Not $ y)
   37.97 @@ -227,8 +227,7 @@
   37.98          make_nnf_not_disj OF [thm1, thm2]
   37.99        end
  37.100    | make_nnf_thm thy
  37.101 -      (Const (@{const_name Not}, _) $
  37.102 -        (Const (@{const_name HOL.implies}, _) $ x $ y)) =
  37.103 +      (Const (\<^const_name>\<open>Not\<close>, _) $ (Const (\<^const_name>\<open>HOL.implies\<close>, _) $ x $ y)) =
  37.104        let
  37.105          val thm1 = make_nnf_thm thy x
  37.106          val thm2 = make_nnf_thm thy (HOLogic.Not $ y)
  37.107 @@ -236,8 +235,8 @@
  37.108          make_nnf_not_imp OF [thm1, thm2]
  37.109        end
  37.110    | make_nnf_thm thy
  37.111 -      (Const (@{const_name Not}, _) $
  37.112 -        (Const (@{const_name HOL.eq}, Type ("fun", @{typ bool} :: _)) $ x $ y)) =
  37.113 +      (Const (\<^const_name>\<open>Not\<close>, _) $
  37.114 +        (Const (\<^const_name>\<open>HOL.eq\<close>, Type ("fun", \<^typ>\<open>bool\<close> :: _)) $ x $ y)) =
  37.115        let
  37.116          val thm1 = make_nnf_thm thy x
  37.117          val thm2 = make_nnf_thm thy (HOLogic.Not $ x)
  37.118 @@ -246,7 +245,7 @@
  37.119        in
  37.120          make_nnf_not_iff OF [thm1, thm2, thm3, thm4]
  37.121        end
  37.122 -  | make_nnf_thm thy (Const (@{const_name Not}, _) $ (Const (@{const_name Not}, _) $ x)) =
  37.123 +  | make_nnf_thm thy (Const (\<^const_name>\<open>Not\<close>, _) $ (Const (\<^const_name>\<open>Not\<close>, _) $ x)) =
  37.124        let
  37.125          val thm1 = make_nnf_thm thy x
  37.126        in
  37.127 @@ -289,45 +288,45 @@
  37.128  
  37.129  (* Theory.theory -> Term.term -> Thm.thm *)
  37.130  
  37.131 -fun simp_True_False_thm thy (Const (@{const_name HOL.conj}, _) $ x $ y) =
  37.132 +fun simp_True_False_thm thy (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x $ y) =
  37.133        let
  37.134          val thm1 = simp_True_False_thm thy x
  37.135          val x'= (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop o Thm.prop_of) thm1
  37.136        in
  37.137 -        if x' = @{term False} then
  37.138 +        if x' = \<^term>\<open>False\<close> then
  37.139            simp_TF_conj_False_l OF [thm1]  (* (x & y) = False *)
  37.140          else
  37.141            let
  37.142              val thm2 = simp_True_False_thm thy y
  37.143              val y' = (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop o Thm.prop_of) thm2
  37.144            in
  37.145 -            if x' = @{term True} then
  37.146 +            if x' = \<^term>\<open>True\<close> then
  37.147                simp_TF_conj_True_l OF [thm1, thm2]  (* (x & y) = y' *)
  37.148 -            else if y' = @{term False} then
  37.149 +            else if y' = \<^term>\<open>False\<close> then
  37.150                simp_TF_conj_False_r OF [thm2]  (* (x & y) = False *)
  37.151 -            else if y' = @{term True} then
  37.152 +            else if y' = \<^term>\<open>True\<close> then
  37.153                simp_TF_conj_True_r OF [thm1, thm2]  (* (x & y) = x' *)
  37.154              else
  37.155                conj_cong OF [thm1, thm2]  (* (x & y) = (x' & y') *)
  37.156            end
  37.157        end
  37.158 -  | simp_True_False_thm thy (Const (@{const_name HOL.disj}, _) $ x $ y) =
  37.159 +  | simp_True_False_thm thy (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ x $ y) =
  37.160        let
  37.161          val thm1 = simp_True_False_thm thy x
  37.162          val x' = (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop o Thm.prop_of) thm1
  37.163        in
  37.164 -        if x' = @{term True} then
  37.165 +        if x' = \<^term>\<open>True\<close> then
  37.166            simp_TF_disj_True_l OF [thm1]  (* (x | y) = True *)
  37.167          else
  37.168            let
  37.169              val thm2 = simp_True_False_thm thy y
  37.170              val y' = (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop o Thm.prop_of) thm2
  37.171            in
  37.172 -            if x' = @{term False} then
  37.173 +            if x' = \<^term>\<open>False\<close> then
  37.174                simp_TF_disj_False_l OF [thm1, thm2]  (* (x | y) = y' *)
  37.175 -            else if y' = @{term True} then
  37.176 +            else if y' = \<^term>\<open>True\<close> then
  37.177                simp_TF_disj_True_r OF [thm2]  (* (x | y) = True *)
  37.178 -            else if y' = @{term False} then
  37.179 +            else if y' = \<^term>\<open>False\<close> then
  37.180                simp_TF_disj_False_r OF [thm1, thm2]  (* (x | y) = x' *)
  37.181              else
  37.182                disj_cong OF [thm1, thm2]  (* (x | y) = (x' | y') *)
  37.183 @@ -344,24 +343,24 @@
  37.184  fun make_cnf_thm ctxt t =
  37.185    let
  37.186      val thy = Proof_Context.theory_of ctxt
  37.187 -    fun make_cnf_thm_from_nnf (Const (@{const_name HOL.conj}, _) $ x $ y) =
  37.188 +    fun make_cnf_thm_from_nnf (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x $ y) =
  37.189            let
  37.190              val thm1 = make_cnf_thm_from_nnf x
  37.191              val thm2 = make_cnf_thm_from_nnf y
  37.192            in
  37.193              conj_cong OF [thm1, thm2]
  37.194            end
  37.195 -      | make_cnf_thm_from_nnf (Const (@{const_name HOL.disj}, _) $ x $ y) =
  37.196 +      | make_cnf_thm_from_nnf (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ x $ y) =
  37.197            let
  37.198              (* produces a theorem "(x' | y') = t'", where x', y', and t' are in CNF *)
  37.199 -            fun make_cnf_disj_thm (Const (@{const_name HOL.conj}, _) $ x1 $ x2) y' =
  37.200 +            fun make_cnf_disj_thm (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x1 $ x2) y' =
  37.201                    let
  37.202                      val thm1 = make_cnf_disj_thm x1 y'
  37.203                      val thm2 = make_cnf_disj_thm x2 y'
  37.204                    in
  37.205                      make_cnf_disj_conj_l OF [thm1, thm2]  (* ((x1 & x2) | y') = ((x1 | y')' & (x2 | y')') *)
  37.206                    end
  37.207 -              | make_cnf_disj_thm x' (Const (@{const_name HOL.conj}, _) $ y1 $ y2) =
  37.208 +              | make_cnf_disj_thm x' (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ y1 $ y2) =
  37.209                    let
  37.210                      val thm1 = make_cnf_disj_thm x' y1
  37.211                      val thm2 = make_cnf_disj_thm x' y2
  37.212 @@ -417,35 +416,35 @@
  37.213      val var_id = Unsynchronized.ref 0  (* properly initialized below *)
  37.214      fun new_free () =
  37.215        Free ("cnfx_" ^ string_of_int (Unsynchronized.inc var_id), HOLogic.boolT)
  37.216 -    fun make_cnfx_thm_from_nnf (Const (@{const_name HOL.conj}, _) $ x $ y) : thm =
  37.217 +    fun make_cnfx_thm_from_nnf (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x $ y) : thm =
  37.218            let
  37.219              val thm1 = make_cnfx_thm_from_nnf x
  37.220              val thm2 = make_cnfx_thm_from_nnf y
  37.221            in
  37.222              conj_cong OF [thm1, thm2]
  37.223            end
  37.224 -      | make_cnfx_thm_from_nnf (Const (@{const_name HOL.disj}, _) $ x $ y) =
  37.225 +      | make_cnfx_thm_from_nnf (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ x $ y) =
  37.226            if is_clause x andalso is_clause y then
  37.227              inst_thm thy [HOLogic.mk_disj (x, y)] iff_refl
  37.228            else if is_literal y orelse is_literal x then
  37.229              let
  37.230                (* produces a theorem "(x' | y') = t'", where x', y', and t' are *)
  37.231                (* almost in CNF, and x' or y' is a literal                      *)
  37.232 -              fun make_cnfx_disj_thm (Const (@{const_name HOL.conj}, _) $ x1 $ x2) y' =
  37.233 +              fun make_cnfx_disj_thm (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x1 $ x2) y' =
  37.234                      let
  37.235                        val thm1 = make_cnfx_disj_thm x1 y'
  37.236                        val thm2 = make_cnfx_disj_thm x2 y'
  37.237                      in
  37.238                        make_cnf_disj_conj_l OF [thm1, thm2]  (* ((x1 & x2) | y') = ((x1 | y')' & (x2 | y')') *)
  37.239                      end
  37.240 -                | make_cnfx_disj_thm x' (Const (@{const_name HOL.conj}, _) $ y1 $ y2) =
  37.241 +                | make_cnfx_disj_thm x' (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ y1 $ y2) =
  37.242                      let
  37.243                        val thm1 = make_cnfx_disj_thm x' y1
  37.244                        val thm2 = make_cnfx_disj_thm x' y2
  37.245                      in
  37.246                        make_cnf_disj_conj_r OF [thm1, thm2]  (* (x' | (y1 & y2)) = ((x' | y1)' & (x' | y2)') *)
  37.247                      end
  37.248 -                | make_cnfx_disj_thm (@{term "Ex::(bool => bool) => bool"} $ x') y' =
  37.249 +                | make_cnfx_disj_thm (\<^term>\<open>Ex :: (bool \<Rightarrow> bool) \<Rightarrow> bool\<close> $ x') y' =
  37.250                      let
  37.251                        val thm1 = inst_thm thy [x', y'] make_cnfx_disj_ex_l   (* ((Ex x') | y') = (Ex (x' | y')) *)
  37.252                        val var = new_free ()
  37.253 @@ -456,7 +455,7 @@
  37.254                      in
  37.255                        iff_trans OF [thm1, thm5]  (* ((Ex x') | y') = (Ex v. body') *)
  37.256                      end
  37.257 -                | make_cnfx_disj_thm x' (@{term "Ex::(bool => bool) => bool"} $ y') =
  37.258 +                | make_cnfx_disj_thm x' (\<^term>\<open>Ex :: (bool \<Rightarrow> bool) \<Rightarrow> bool\<close> $ y') =
  37.259                      let
  37.260                        val thm1 = inst_thm thy [x', y'] make_cnfx_disj_ex_r   (* (x' | (Ex y')) = (Ex (x' | y')) *)
  37.261                        val var = new_free ()
    38.1 --- a/src/HOL/Tools/code_evaluation.ML	Wed Dec 06 19:34:59 2017 +0100
    38.2 +++ b/src/HOL/Tools/code_evaluation.ML	Wed Dec 06 20:43:09 2017 +0100
    38.3 @@ -23,17 +23,16 @@
    38.4  fun add_term_of_inst tyco thy =
    38.5    let
    38.6      val ((raw_vs, _), _) = Code.get_type thy tyco;
    38.7 -    val vs = map (fn (v, _) => (v, @{sort typerep})) raw_vs;
    38.8 +    val vs = map (fn (v, _) => (v, \<^sort>\<open>typerep\<close>)) raw_vs;
    38.9      val ty = Type (tyco, map TFree vs);
   38.10 -    val lhs = Const (@{const_name term_of}, ty --> @{typ term})
   38.11 -      $ Free ("x", ty);
   38.12 -    val rhs = @{term "undefined :: term"};
   38.13 +    val lhs = Const (\<^const_name>\<open>term_of\<close>, ty --> \<^typ>\<open>term\<close>) $ Free ("x", ty);
   38.14 +    val rhs = \<^term>\<open>undefined :: term\<close>;
   38.15      val eq = HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs, rhs));
   38.16      fun triv_name_of t = (fst o dest_Free o fst o strip_comb o fst
   38.17        o HOLogic.dest_eq o HOLogic.dest_Trueprop) t ^ "_triv";
   38.18    in
   38.19      thy
   38.20 -    |> Class.instantiation ([tyco], vs, @{sort term_of})
   38.21 +    |> Class.instantiation ([tyco], vs, \<^sort>\<open>term_of\<close>)
   38.22      |> `(fn lthy => Syntax.check_term lthy eq)
   38.23      |-> (fn eq => Specification.definition NONE [] [] ((Binding.name (triv_name_of eq), []), eq))
   38.24      |> snd
   38.25 @@ -42,15 +41,15 @@
   38.26  
   38.27  fun ensure_term_of_inst tyco thy =
   38.28    let
   38.29 -    val need_inst = not (Sorts.has_instance (Sign.classes_of thy) tyco @{sort term_of})
   38.30 -      andalso Sorts.has_instance (Sign.classes_of thy) tyco @{sort typerep};
   38.31 +    val need_inst = not (Sorts.has_instance (Sign.classes_of thy) tyco \<^sort>\<open>term_of\<close>)
   38.32 +      andalso Sorts.has_instance (Sign.classes_of thy) tyco \<^sort>\<open>typerep\<close>;
   38.33    in if need_inst then add_term_of_inst tyco thy else thy end;
   38.34  
   38.35  fun for_term_of_instance tyco vs f thy =
   38.36    let
   38.37      val algebra = Sign.classes_of thy;
   38.38    in
   38.39 -    case try (Sorts.mg_domain algebra tyco) @{sort term_of} of
   38.40 +    case try (Sorts.mg_domain algebra tyco) \<^sort>\<open>term_of\<close> of
   38.41        NONE => thy
   38.42      | SOME sorts => f tyco (map2 (fn (v, sort) => fn sort' =>
   38.43          (v, Sorts.inter_sort algebra (sort, sort'))) vs sorts) thy
   38.44 @@ -95,7 +94,7 @@
   38.45  fun mk_abs_term_of_eq thy ty abs ty_rep proj =
   38.46    let
   38.47      val arg = Var (("x", 0), ty);
   38.48 -    val rhs = Abs ("y", @{typ term}, HOLogic.reflect_term (Const (abs, ty_rep --> ty) $ Bound 0)) $
   38.49 +    val rhs = Abs ("y", \<^typ>\<open>term\<close>, HOLogic.reflect_term (Const (abs, ty_rep --> ty) $ Bound 0)) $
   38.50        (HOLogic.mk_term_of ty_rep (Const (proj, ty --> ty_rep) $ arg))
   38.51        |> Thm.global_cterm_of thy;
   38.52      val cty = Thm.global_ctyp_of thy ty;
   38.53 @@ -139,7 +138,7 @@
   38.54      else NONE
   38.55    end;
   38.56  
   38.57 -fun subst_termify_app (Const (@{const_name termify}, _), [t]) =
   38.58 +fun subst_termify_app (Const (\<^const_name>\<open>termify\<close>, _), [t]) =
   38.59        if not (Term.exists_subterm (fn Abs _ => true | _ => false) t)
   38.60        then if fold_aterms (fn Const _ => I | _ => K false) t true
   38.61          then SOME (HOLogic.reflect_term t)
    39.1 --- a/src/HOL/Tools/coinduction.ML	Wed Dec 06 19:34:59 2017 +0100
    39.2 +++ b/src/HOL/Tools/coinduction.ML	Wed Dec 06 20:43:09 2017 +0100
    39.3 @@ -82,7 +82,7 @@
    39.4                names Ts raw_eqs;
    39.5              val phi = eqs @ map (HOLogic.dest_Trueprop o Thm.prop_of) prems
    39.6                |> try (Library.foldr1 HOLogic.mk_conj)
    39.7 -              |> the_default @{term True}
    39.8 +              |> the_default \<^term>\<open>True\<close>
    39.9                |> Ctr_Sugar_Util.list_exists_free vars
   39.10                |> Term.map_abs_vars (Variable.revert_fixed ctxt)
   39.11                |> fold_rev Term.absfree (names ~~ Ts)
   39.12 @@ -159,7 +159,7 @@
   39.13  
   39.14  val _ =
   39.15    Theory.setup
   39.16 -    (Method.setup @{binding coinduction}
   39.17 +    (Method.setup \<^binding>\<open>coinduction\<close>
   39.18        (arbitrary -- Scan.option coinduct_rules >>
   39.19          (fn (arbitrary, opt_rules) => fn _ => fn facts =>
   39.20            Seq.DETERM (coinduction_context_tactic arbitrary opt_rules facts 1)))
    40.1 --- a/src/HOL/Tools/functor.ML	Wed Dec 06 19:34:59 2017 +0100
    40.2 +++ b/src/HOL/Tools/functor.ML	Wed Dec 06 20:43:09 2017 +0100
    40.3 @@ -275,8 +275,8 @@
    40.4  val functor_cmd = gen_functor Syntax.read_term;
    40.5  
    40.6  val _ =
    40.7 -  Outer_Syntax.local_theory_to_proof @{command_keyword functor}
    40.8 +  Outer_Syntax.local_theory_to_proof \<^command_keyword>\<open>functor\<close>
    40.9      "register operations managing the functorial structure of a type"
   40.10 -    (Scan.option (Parse.name --| @{keyword ":"}) -- Parse.term >> uncurry functor_cmd);
   40.11 +    (Scan.option (Parse.name --| \<^keyword>\<open>:\<close>) -- Parse.term >> uncurry functor_cmd);
   40.12  
   40.13  end;
    41.1 --- a/src/HOL/Tools/groebner.ML	Wed Dec 06 19:34:59 2017 +0100
    41.2 +++ b/src/HOL/Tools/groebner.ML	Wed Dec 06 20:43:09 2017 +0100
    41.3 @@ -327,7 +327,7 @@
    41.4  (* Produce Strong Nullstellensatz certificate for a power of pol.            *)
    41.5  
    41.6  fun grobner_strong vars pols pol =
    41.7 -    let val vars' = @{cterm "True"}::vars
    41.8 +    let val vars' = \<^cterm>\<open>True\<close>::vars
    41.9          val grob_z = [(@1, 1::(map (K 0) vars))]
   41.10          val grob_1 = [(@1, (map (K 0) vars'))]
   41.11          fun augment p= map (fn (c,m) => (c,0::m)) p
   41.12 @@ -349,7 +349,7 @@
   41.13  
   41.14  fun refute_disj rfn tm =
   41.15   case Thm.term_of tm of
   41.16 -  Const(@{const_name HOL.disj},_)$_$_ =>
   41.17 +  Const(\<^const_name>\<open>HOL.disj\<close>,_)$_$_ =>
   41.18     Drule.compose
   41.19      (refute_disj rfn (Thm.dest_arg tm), 2,
   41.20        Drule.compose (refute_disj rfn (Thm.dest_arg1 tm), 2, disjE))
   41.21 @@ -360,11 +360,11 @@
   41.22  
   41.23  fun is_neg t =
   41.24      case Thm.term_of t of
   41.25 -      (Const(@{const_name Not},_)$_) => true
   41.26 +      (Const(\<^const_name>\<open>Not\<close>,_)$_) => true
   41.27      | _  => false;
   41.28  fun is_eq t =
   41.29   case Thm.term_of t of
   41.30 - (Const(@{const_name HOL.eq},_)$_$_) => true
   41.31 + (Const(\<^const_name>\<open>HOL.eq\<close>,_)$_$_) => true
   41.32  | _  => false;
   41.33  
   41.34  fun end_itlist f l =
   41.35 @@ -385,7 +385,7 @@
   41.36  val strip_exists =
   41.37   let fun h (acc, t) =
   41.38        case Thm.term_of t of
   41.39 -       Const (@{const_name Ex}, _) $ Abs _ =>
   41.40 +       Const (\<^const_name>\<open>Ex\<close>, _) $ Abs _ =>
   41.41          h (Thm.dest_abs NONE (Thm.dest_arg t) |>> (fn v => v::acc))
   41.42       | _ => (acc,t)
   41.43   in fn t => h ([],t)
   41.44 @@ -393,7 +393,7 @@
   41.45  
   41.46  fun is_forall t =
   41.47   case Thm.term_of t of
   41.48 -  (Const(@{const_name All},_)$Abs(_,_,_)) => true
   41.49 +  (Const(\<^const_name>\<open>All\<close>,_)$Abs(_,_,_)) => true
   41.50  | _ => false;
   41.51  
   41.52  val mk_object_eq = fn th => th COMP meta_eq_to_obj_eq;
   41.53 @@ -412,9 +412,9 @@
   41.54  
   41.55  val specl = fold_rev (fn x => fn th => Thm.instantiate' [] [SOME x] (th RS spec));
   41.56  
   41.57 -val cTrp = @{cterm "Trueprop"};
   41.58 -val cConj = @{cterm HOL.conj};
   41.59 -val (cNot,false_tm) = (@{cterm "Not"}, @{cterm "False"});
   41.60 +val cTrp = \<^cterm>\<open>Trueprop\<close>;
   41.61 +val cConj = \<^cterm>\<open>HOL.conj\<close>;
   41.62 +val (cNot,false_tm) = (\<^cterm>\<open>Not\<close>, \<^cterm>\<open>False\<close>);
   41.63  val assume_Trueprop = Thm.apply cTrp #> Thm.assume;
   41.64  val list_mk_conj = list_mk_binop cConj;
   41.65  val conjs = list_dest_binop cConj;
   41.66 @@ -438,7 +438,7 @@
   41.67    (* FIXME : copied from cqe.ML -- complex QE*)
   41.68  fun conjuncts ct =
   41.69   case Thm.term_of ct of
   41.70 -  @{term HOL.conj}$_$_ => (Thm.dest_arg1 ct)::(conjuncts (Thm.dest_arg ct))
   41.71 +  \<^term>\<open>HOL.conj\<close>$_$_ => (Thm.dest_arg1 ct)::(conjuncts (Thm.dest_arg ct))
   41.72  | _ => [ct];
   41.73  
   41.74  fun fold1 f = foldr1 (uncurry f);
   41.75 @@ -446,12 +446,12 @@
   41.76  fun mk_conj_tab th =
   41.77   let fun h acc th =
   41.78     case Thm.prop_of th of
   41.79 -   @{term "Trueprop"}$(@{term HOL.conj}$_$_) =>
   41.80 +   \<^term>\<open>Trueprop\<close>$(\<^term>\<open>HOL.conj\<close>$_$_) =>
   41.81       h (h acc (th RS conjunct2)) (th RS conjunct1)
   41.82 -  | @{term "Trueprop"}$p => (p,th)::acc
   41.83 +  | \<^term>\<open>Trueprop\<close>$p => (p,th)::acc
   41.84  in fold (Termtab.insert Thm.eq_thm) (h [] th) Termtab.empty end;
   41.85  
   41.86 -fun is_conj (@{term HOL.conj}$_$_) = true
   41.87 +fun is_conj (\<^term>\<open>HOL.conj\<close>$_$_) = true
   41.88    | is_conj _ = false;
   41.89  
   41.90  fun prove_conj tab cjs =
   41.91 @@ -462,8 +462,8 @@
   41.92  fun conj_ac_rule eq =
   41.93   let
   41.94    val (l,r) = Thm.dest_equals eq
   41.95 -  val ctabl = mk_conj_tab (Thm.assume (Thm.apply @{cterm Trueprop} l))
   41.96 -  val ctabr = mk_conj_tab (Thm.assume (Thm.apply @{cterm Trueprop} r))
   41.97 +  val ctabl = mk_conj_tab (Thm.assume (Thm.apply \<^cterm>\<open>Trueprop\<close> l))
   41.98 +  val ctabr = mk_conj_tab (Thm.assume (Thm.apply \<^cterm>\<open>Trueprop\<close> r))
   41.99    fun tabl c = the (Termtab.lookup ctabl (Thm.term_of c))
  41.100    fun tabr c = the (Termtab.lookup ctabr (Thm.term_of c))
  41.101    val thl  = prove_conj tabl (conjuncts r) |> implies_intr_hyps
  41.102 @@ -475,24 +475,24 @@
  41.103  
  41.104     (* Conversion for the equivalence of existential statements where
  41.105        EX quantifiers are rearranged differently *)
  41.106 -fun ext ctxt T = Thm.cterm_of ctxt (Const (@{const_name Ex}, (T --> @{typ bool}) --> @{typ bool}))
  41.107 +fun ext ctxt T = Thm.cterm_of ctxt (Const (\<^const_name>\<open>Ex\<close>, (T --> \<^typ>\<open>bool\<close>) --> \<^typ>\<open>bool\<close>))
  41.108  fun mk_ex ctxt v t = Thm.apply (ext ctxt (Thm.typ_of_cterm v)) (Thm.lambda v t)
  41.109  
  41.110  fun choose v th th' = case Thm.concl_of th of
  41.111 -  @{term Trueprop} $ (Const(@{const_name Ex},_)$_) =>
  41.112 +  \<^term>\<open>Trueprop\<close> $ (Const(\<^const_name>\<open>Ex\<close>,_)$_) =>
  41.113     let
  41.114      val p = (funpow 2 Thm.dest_arg o Thm.cprop_of) th
  41.115      val T = (hd o Thm.dest_ctyp o Thm.ctyp_of_cterm) p
  41.116      val th0 = Conv.fconv_rule (Thm.beta_conversion true)
  41.117          (Thm.instantiate' [SOME T] [SOME p, (SOME o Thm.dest_arg o Thm.cprop_of) th'] exE)
  41.118      val pv = (Thm.rhs_of o Thm.beta_conversion true)
  41.119 -          (Thm.apply @{cterm Trueprop} (Thm.apply p v))
  41.120 +          (Thm.apply \<^cterm>\<open>Trueprop\<close> (Thm.apply p v))
  41.121      val th1 = Thm.forall_intr v (Thm.implies_intr pv th')
  41.122     in Thm.implies_elim (Thm.implies_elim th0 th) th1  end
  41.123  | _ => error ""  (* FIXME ? *)
  41.124  
  41.125  fun simple_choose ctxt v th =
  41.126 -   choose v (Thm.assume ((Thm.apply @{cterm Trueprop} o mk_ex ctxt v)
  41.127 +   choose v (Thm.assume ((Thm.apply \<^cterm>\<open>Trueprop\<close> o mk_ex ctxt v)
  41.128      (Thm.dest_arg (hd (Thm.chyps_of th))))) th
  41.129  
  41.130  
  41.131 @@ -509,7 +509,7 @@
  41.132    val (p0,q0) = Thm.dest_binop t
  41.133    val (vs',P) = strip_exists p0
  41.134    val (vs,_) = strip_exists q0
  41.135 -   val th = Thm.assume (Thm.apply @{cterm Trueprop} P)
  41.136 +   val th = Thm.assume (Thm.apply \<^cterm>\<open>Trueprop\<close> P)
  41.137     val th1 = implies_intr_hyps (fold (simple_choose ctxt) vs' (fold mkexi vs th))
  41.138     val th2 = implies_intr_hyps (fold (simple_choose ctxt) vs (fold mkexi vs' th))
  41.139     val p = (Thm.dest_arg o Thm.dest_arg1 o Thm.cprop_of) th1
  41.140 @@ -523,7 +523,7 @@
  41.141    Free(s,_) => s
  41.142   | Var ((s,_),_) => s
  41.143   | _ => "x"
  41.144 - fun mk_eq s t = Thm.apply (Thm.apply @{cterm "op == :: bool => _"} s) t
  41.145 + fun mk_eq s t = Thm.apply (Thm.apply \<^cterm>\<open>op \<equiv> :: bool \<Rightarrow> _\<close> s) t
  41.146   fun mk_exists ctxt v th = Drule.arg_cong_rule (ext ctxt (Thm.typ_of_cterm v))
  41.147     (Thm.abstract_rule (getname v) v th)
  41.148   fun simp_ex_conv ctxt =
  41.149 @@ -552,12 +552,12 @@
  41.150    val (ring_sub_tm, ring_neg_tm) =
  41.151      (case r_ops of
  41.152       [sub_pat, neg_pat] => (Thm.dest_fun2 sub_pat, Thm.dest_fun neg_pat)
  41.153 -    |_  => (@{cterm "True"}, @{cterm "True"}));
  41.154 +    |_  => (\<^cterm>\<open>True\<close>, \<^cterm>\<open>True\<close>));
  41.155  
  41.156    val (field_div_tm, field_inv_tm) =
  41.157      (case f_ops of
  41.158         [div_pat, inv_pat] => (Thm.dest_fun2 div_pat, Thm.dest_fun inv_pat)
  41.159 -     | _ => (@{cterm "True"}, @{cterm "True"}));
  41.160 +     | _ => (\<^cterm>\<open>True\<close>, \<^cterm>\<open>True\<close>));
  41.161  
  41.162    val [idom_thm, neq_thm] = idom;
  41.163    val [idl_sub, idl_add0] =
  41.164 @@ -653,7 +653,7 @@
  41.165  
  41.166  val holify_polynomial =
  41.167   let fun holify_varpow (v,n) =
  41.168 -  if n = 1 then v else ring_mk_pow v (Numeral.mk_cnumber @{ctyp nat} n)  (* FIXME *)
  41.169 +  if n = 1 then v else ring_mk_pow v (Numeral.mk_cnumber \<^ctyp>\<open>nat\<close> n)  (* FIXME *)
  41.170   fun holify_monomial vars (c,m) =
  41.171    let val xps = map holify_varpow (filter (fn (_,n) => n <> 0) (vars ~~ m))
  41.172     in end_itlist ring_mk_mul (mk_const c :: xps)
  41.173 @@ -737,7 +737,7 @@
  41.174    fun mk_forall x p =
  41.175      let
  41.176        val T = Thm.typ_of_cterm x;
  41.177 -      val all = Thm.cterm_of ctxt (Const (@{const_name All}, (T --> @{typ bool}) --> @{typ bool}))
  41.178 +      val all = Thm.cterm_of ctxt (Const (\<^const_name>\<open>All\<close>, (T --> \<^typ>\<open>bool\<close>) --> \<^typ>\<open>bool\<close>))
  41.179      in Thm.apply all (Thm.lambda x p) end
  41.180    val avs = Drule.cterm_add_frees tm []
  41.181    val P' = fold mk_forall avs tm
  41.182 @@ -819,15 +819,15 @@
  41.183   fun unwind_polys_conv ctxt tm =
  41.184   let
  41.185    val (vars,bod) = strip_exists tm
  41.186 -  val cjs = striplist (dest_binary @{cterm HOL.conj}) bod
  41.187 +  val cjs = striplist (dest_binary \<^cterm>\<open>HOL.conj\<close>) bod
  41.188    val th1 = (the (get_first (try (isolate_variable vars)) cjs)
  41.189               handle Option.Option => raise CTERM ("unwind_polys_conv",[tm]))
  41.190    val eq = Thm.lhs_of th1
  41.191 -  val bod' = list_mk_binop @{cterm HOL.conj} (eq::(remove op aconvc eq cjs))
  41.192 +  val bod' = list_mk_binop \<^cterm>\<open>HOL.conj\<close> (eq::(remove op aconvc eq cjs))
  41.193    val th2 = conj_ac_rule (mk_eq bod bod')
  41.194    val th3 =
  41.195      Thm.transitive th2
  41.196 -      (Drule.binop_cong_rule @{cterm HOL.conj} th1
  41.197 +      (Drule.binop_cong_rule \<^cterm>\<open>HOL.conj\<close> th1
  41.198          (Thm.reflexive (Thm.dest_arg (Thm.rhs_of th2))))
  41.199    val v = Thm.dest_arg1(Thm.dest_arg1(Thm.rhs_of th3))
  41.200    val th4 = Conv.fconv_rule (Conv.arg_conv (simp_ex_conv ctxt)) (mk_exists ctxt v th3)
  41.201 @@ -890,18 +890,18 @@
  41.202  
  41.203  fun find_term bounds tm =
  41.204    (case Thm.term_of tm of
  41.205 -    Const (@{const_name HOL.eq}, T) $ _ $ _ =>
  41.206 +    Const (\<^const_name>\<open>HOL.eq\<close>, T) $ _ $ _ =>
  41.207        if domain_type T = HOLogic.boolT then find_args bounds tm
  41.208        else Thm.dest_arg tm
  41.209 -  | Const (@{const_name Not}, _) $ _ => find_term bounds (Thm.dest_arg tm)
  41.210 -  | Const (@{const_name All}, _) $ _ => find_body bounds (Thm.dest_arg tm)
  41.211 -  | Const (@{const_name Ex}, _) $ _ => find_body bounds (Thm.dest_arg tm)
  41.212 -  | Const (@{const_name HOL.conj}, _) $ _ $ _ => find_args bounds tm
  41.213 -  | Const (@{const_name HOL.disj}, _) $ _ $ _ => find_args bounds tm
  41.214 -  | Const (@{const_name HOL.implies}, _) $ _ $ _ => find_args bounds tm
  41.215 -  | @{term "op ==>"} $_$_ => find_args bounds tm
  41.216 -  | Const("op ==",_)$_$_ => find_args bounds tm
  41.217 -  | @{term Trueprop}$_ => find_term bounds (Thm.dest_arg tm)
  41.218 +  | Const (\<^const_name>\<open>Not\<close>, _) $ _ => find_term bounds (Thm.dest_arg tm)
  41.219 +  | Const (\<^const_name>\<open>All\<close>, _) $ _ => find_body bounds (Thm.dest_arg tm)
  41.220 +  | Const (\<^const_name>\<open>Ex\<close>, _) $ _ => find_body bounds (Thm.dest_arg tm)
  41.221 +  | Const (\<^const_name>\<open>HOL.conj\<close>, _) $ _ $ _ => find_args bounds tm
  41.222 +  | Const (\<^const_name>\<open>HOL.disj\<close>, _) $ _ $ _ => find_args bounds tm
  41.223 +  | Const (\<^const_name>\<open>HOL.implies\<close>, _) $ _ $ _ => find_args bounds tm
  41.224 +  | \<^term>\<open>op \<Longrightarrow>\<close> $_$_ => find_args bounds tm
  41.225 +  | Const("op ==",_)$_$_ => find_args bounds tm  (* FIXME proper const name *)
  41.226 +  | \<^term>\<open>Trueprop\<close>$_ => find_term bounds (Thm.dest_arg tm)
  41.227    | _ => raise TERM ("find_term", []))
  41.228  and find_args bounds tm =
  41.229    let val (t, u) = Thm.dest_binop tm
  41.230 @@ -925,7 +925,7 @@
  41.231  
  41.232  fun presimplify ctxt add_thms del_thms =
  41.233    asm_full_simp_tac (put_simpset HOL_basic_ss ctxt
  41.234 -    addsimps (Named_Theorems.get ctxt @{named_theorems algebra})
  41.235 +    addsimps (Named_Theorems.get ctxt \<^named_theorems>\<open>algebra\<close>)
  41.236      delsimps del_thms addsimps add_thms);
  41.237  
  41.238  fun ring_tac add_ths del_ths ctxt =
  41.239 @@ -943,7 +943,7 @@
  41.240  
  41.241  local
  41.242   fun lhs t = case Thm.term_of t of
  41.243 -  Const(@{const_name HOL.eq},_)$_$_ => Thm.dest_arg1 t
  41.244 +  Const(\<^const_name>\<open>HOL.eq\<close>,_)$_$_ => Thm.dest_arg1 t
  41.245   | _=> raise CTERM ("ideal_tac - lhs",[t])
  41.246   fun exitac _ NONE = no_tac
  41.247     | exitac ctxt (SOME y) =
    42.1 --- a/src/HOL/Tools/group_cancel.ML	Wed Dec 06 19:34:59 2017 +0100
    42.2 +++ b/src/HOL/Tools/group_cancel.ML	Wed Dec 06 20:43:09 2017 +0100
    42.3 @@ -36,13 +36,13 @@
    42.4      [Conv.rewr_conv (Library.foldl (op RS) (rule0, path)),
    42.5       Conv.arg1_conv (Conv.repeat_conv (Conv.rewr_conv minus_minus))]
    42.6  
    42.7 -fun add_atoms pos path (Const (@{const_name Groups.plus}, _) $ x $ y) =
    42.8 +fun add_atoms pos path (Const (\<^const_name>\<open>Groups.plus\<close>, _) $ x $ y) =
    42.9        add_atoms pos (add1::path) x #> add_atoms pos (add2::path) y
   42.10 -  | add_atoms pos path (Const (@{const_name Groups.minus}, _) $ x $ y) =
   42.11 +  | add_atoms pos path (Const (\<^const_name>\<open>Groups.minus\<close>, _) $ x $ y) =
   42.12        add_atoms pos (sub1::path) x #> add_atoms (not pos) (sub2::path) y
   42.13 -  | add_atoms pos path (Const (@{const_name Groups.uminus}, _) $ x) =
   42.14 +  | add_atoms pos path (Const (\<^const_name>\<open>Groups.uminus\<close>, _) $ x) =
   42.15        add_atoms (not pos) (neg1::path) x
   42.16 -  | add_atoms _ _ (Const (@{const_name Groups.zero}, _)) = I
   42.17 +  | add_atoms _ _ (Const (\<^const_name>\<open>Groups.zero\<close>, _)) = I
   42.18    | add_atoms pos path x = cons ((pos, x), path)
   42.19  
   42.20  fun atoms t = add_atoms true [] t []
    43.1 --- a/src/HOL/Tools/hologic.ML	Wed Dec 06 19:34:59 2017 +0100
    43.2 +++ b/src/HOL/Tools/hologic.ML	Wed Dec 06 20:43:09 2017 +0100
    43.3 @@ -187,16 +187,16 @@
    43.4  
    43.5  (* logic *)
    43.6  
    43.7 -val Trueprop = Const (@{const_name Trueprop}, boolT --> propT);
    43.8 +val Trueprop = Const (\<^const_name>\<open>Trueprop\<close>, boolT --> propT);
    43.9  
   43.10  fun mk_Trueprop P = Trueprop $ P;
   43.11  
   43.12 -fun dest_Trueprop (Const (@{const_name Trueprop}, _) $ P) = P
   43.13 +fun dest_Trueprop (Const (\<^const_name>\<open>Trueprop\<close>, _) $ P) = P
   43.14    | dest_Trueprop t = raise TERM ("dest_Trueprop", [t]);
   43.15  
   43.16  fun Trueprop_conv cv ct =
   43.17    (case Thm.term_of ct of
   43.18 -    Const (@{const_name Trueprop}, _) $ _ => Conv.arg_conv cv ct
   43.19 +    Const (\<^const_name>\<open>Trueprop\<close>, _) $ _ => Conv.arg_conv cv ct
   43.20    | _ => raise CTERM ("Trueprop_conv", [ct]))
   43.21  
   43.22  
   43.23 @@ -220,10 +220,10 @@
   43.24    let val (th1, th2) = conj_elim ctxt th
   43.25    in conj_elims ctxt th1 @ conj_elims ctxt th2 end handle THM _ => [th];
   43.26  
   43.27 -val conj = @{term HOL.conj}
   43.28 -and disj = @{term HOL.disj}
   43.29 -and imp = @{term implies}
   43.30 -and Not = @{term Not};
   43.31 +val conj = \<^term>\<open>HOL.conj\<close>
   43.32 +and disj = \<^term>\<open>HOL.disj\<close>
   43.33 +and imp = \<^term>\<open>implies\<close>
   43.34 +and Not = \<^term>\<open>Not\<close>;
   43.35  
   43.36  fun mk_conj (t1, t2) = conj $ t1 $ t2
   43.37  and mk_disj (t1, t2) = disj $ t1 $ t2
   43.38 @@ -257,21 +257,21 @@
   43.39  
   43.40  fun conj_conv cv1 cv2 ct =
   43.41    (case Thm.term_of ct of
   43.42 -    Const (@{const_name HOL.conj}, _) $ _ $ _ =>
   43.43 +    Const (\<^const_name>\<open>HOL.conj\<close>, _) $ _ $ _ =>
   43.44        Conv.combination_conv (Conv.arg_conv cv1) cv2 ct
   43.45    | _ => raise CTERM ("conj_conv", [ct]));
   43.46  
   43.47  
   43.48 -fun eq_const T = Const (@{const_name HOL.eq}, T --> T --> boolT);
   43.49 +fun eq_const T = Const (\<^const_name>\<open>HOL.eq\<close>, T --> T --> boolT);
   43.50  
   43.51  fun mk_eq (t, u) = eq_const (fastype_of t) $ t $ u;
   43.52  
   43.53 -fun dest_eq (Const (@{const_name HOL.eq}, _) $ lhs $ rhs) = (lhs, rhs)
   43.54 +fun dest_eq (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ lhs $ rhs) = (lhs, rhs)
   43.55    | dest_eq t = raise TERM ("dest_eq", [t])
   43.56  
   43.57  fun eq_conv cv1 cv2 ct =
   43.58    (case Thm.term_of ct of
   43.59 -    Const (@{const_name HOL.eq}, _) $ _ $ _ => Conv.combination_conv (Conv.arg_conv cv1) cv2 ct
   43.60 +    Const (\<^const_name>\<open>HOL.eq\<close>, _) $ _ $ _ => Conv.combination_conv (Conv.arg_conv cv1) cv2 ct
   43.61    | _ => raise CTERM ("eq_conv", [ct]));
   43.62  
   43.63  
    44.1 --- a/src/HOL/Tools/inductive.ML	Wed Dec 06 19:34:59 2017 +0100
    44.2 +++ b/src/HOL/Tools/inductive.ML	Wed Dec 06 20:43:09 2017 +0100
    44.3 @@ -125,7 +125,7 @@
    44.4  
    44.5  (** misc utilities **)
    44.6  
    44.7 -val inductive_internals = Attrib.setup_config_bool @{binding inductive_internals} (K false);
    44.8 +val inductive_internals = Attrib.setup_config_bool \<^binding>\<open>inductive_internals\<close> (K false);
    44.9  
   44.10  fun message quiet_mode s = if quiet_mode then () else writeln s;
   44.11  
   44.12 @@ -142,7 +142,7 @@
   44.13        (if i mod 2 = 0 then f x else g x) :: make_bool_args f g xs (i div 2);
   44.14  
   44.15  fun make_bool_args' xs =
   44.16 -  make_bool_args (K @{term False}) (K @{term True}) xs;
   44.17 +  make_bool_args (K \<^term>\<open>False\<close>) (K \<^term>\<open>True\<close>) xs;
   44.18  
   44.19  fun arg_types_of k c = drop k (binder_types (fastype_of c));
   44.20  
   44.21 @@ -154,7 +154,7 @@
   44.22        else apsnd (cons p) (find_arg T x ps);
   44.23  
   44.24  fun make_args Ts xs =
   44.25 -  map (fn (T, (NONE, ())) => Const (@{const_name undefined}, T) | (_, (SOME t, ())) => t)
   44.26 +  map (fn (T, (NONE, ())) => Const (\<^const_name>\<open>undefined\<close>, T) | (_, (SOME t, ())) => t)
   44.27      (fold (fn (t, T) => snd o find_arg T t) xs (map (rpair (NONE, ())) Ts));
   44.28  
   44.29  fun make_args' Ts xs Us =
   44.30 @@ -280,9 +280,9 @@
   44.31        handle THM _ => thm RS @{thm le_boolD}
   44.32    in
   44.33      (case Thm.concl_of thm of
   44.34 -      Const (@{const_name Pure.eq}, _) $ _ $ _ => eq_to_mono (thm RS meta_eq_to_obj_eq)
   44.35 -    | _ $ (Const (@{const_name HOL.eq}, _) $ _ $ _) => eq_to_mono thm
   44.36 -    | _ $ (Const (@{const_name Orderings.less_eq}, _) $ _ $ _) =>
   44.37 +      Const (\<^const_name>\<open>Pure.eq\<close>, _) $ _ $ _ => eq_to_mono (thm RS meta_eq_to_obj_eq)
   44.38 +    | _ $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ _ $ _) => eq_to_mono thm
   44.39 +    | _ $ (Const (\<^const_name>\<open>Orderings.less_eq\<close>, _) $ _ $ _) =>
   44.40        dest_less_concl (Seq.hd (REPEAT (FIRSTGOAL
   44.41          (resolve_tac ctxt [@{thm le_funI}, @{thm le_boolI'}])) thm))
   44.42      | _ => thm)
   44.43 @@ -300,7 +300,7 @@
   44.44  
   44.45  val _ =
   44.46    Theory.setup
   44.47 -    (Attrib.setup @{binding mono} (Attrib.add_del mono_add mono_del)
   44.48 +    (Attrib.setup \<^binding>\<open>mono\<close> (Attrib.add_del mono_add mono_del)
   44.49        "declaration of monotonicity rule");
   44.50  
   44.51  
   44.52 @@ -370,7 +370,7 @@
   44.53  
   44.54      val _ =
   44.55        (case concl of
   44.56 -        Const (@{const_name Trueprop}, _) $ t =>
   44.57 +        Const (\<^const_name>\<open>Trueprop\<close>, _) $ t =>
   44.58            if member (op =) cs (head_of t) then
   44.59             (check_ind (err_in_rule ctxt binding rule') t;
   44.60              List.app check_prem (prems ~~ aprems))
   44.61 @@ -400,7 +400,7 @@
   44.62    (if skip_mono then Goal.prove_sorry else Goal.prove_future) ctxt
   44.63      [] []
   44.64      (HOLogic.mk_Trueprop
   44.65 -      (Const (@{const_name Orderings.mono}, (predT --> predT) --> HOLogic.boolT) $ fp_fun))
   44.66 +      (Const (\<^const_name>\<open>Orderings.mono\<close>, (predT --> predT) --> HOLogic.boolT) $ fp_fun))
   44.67      (fn _ => EVERY [resolve_tac ctxt @{thms monoI} 1,
   44.68        REPEAT (resolve_tac ctxt [@{thm le_funI}, @{thm le_boolI'}] 1),
   44.69        REPEAT (FIRST
   44.70 @@ -510,11 +510,11 @@
   44.71                    HOLogic.exists_const T $ Abs (a, T, list_ex (vars, t));
   44.72              val conjs = map2 (curry HOLogic.mk_eq) frees us @ map HOLogic.dest_Trueprop ts;
   44.73            in
   44.74 -            list_ex (params', if null conjs then @{term True} else foldr1 HOLogic.mk_conj conjs)
   44.75 +            list_ex (params', if null conjs then \<^term>\<open>True\<close> else foldr1 HOLogic.mk_conj conjs)
   44.76            end;
   44.77          val lhs = list_comb (c, params @ frees);
   44.78          val rhs =
   44.79 -          if null c_intrs then @{term False}
   44.80 +          if null c_intrs then \<^term>\<open>False\<close>
   44.81            else foldr1 HOLogic.mk_disj (map mk_intr_conj c_intrs);
   44.82          val eq = HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs, rhs));
   44.83          fun prove_intr1 (i, _) = Subgoal.FOCUS_PREMS (fn {context = ctxt'', params, prems, ...} =>
   44.84 @@ -567,7 +567,7 @@
   44.85  local
   44.86  
   44.87  (*delete needless equality assumptions*)
   44.88 -val refl_thin = Goal.prove_global @{theory HOL} [] [] @{prop "!!P. a = a ==> P ==> P"}
   44.89 +val refl_thin = Goal.prove_global @{theory HOL} [] [] \<^prop>\<open>\<And>P. a = a \<Longrightarrow> P \<Longrightarrow> P\<close>
   44.90    (fn {context = ctxt, ...} => assume_tac ctxt 1);
   44.91  val elim_rls = [asm_rl, FalseE, refl_thin, conjE, exE];
   44.92  fun elim_tac ctxt = REPEAT o eresolve_tac ctxt elim_rls;
   44.93 @@ -630,7 +630,7 @@
   44.94  
   44.95  val _ =
   44.96    Theory.setup
   44.97 -    (Method.setup @{binding ind_cases}
   44.98 +    (Method.setup \<^binding>\<open>ind_cases\<close>
   44.99        (Scan.lift (Scan.repeat1 Parse.prop -- Parse.for_fixes) >>
  44.100          (fn (props, fixes) => fn ctxt =>
  44.101            Method.erule ctxt 0 (ind_cases_rules ctxt props fixes)))
  44.102 @@ -705,7 +705,7 @@
  44.103                  val P = list_comb (nth preds i, map (incr_boundvars k) ys @ bs);
  44.104                  val Q =
  44.105                    fold_rev Term.abs (mk_names "x" k ~~ Ts)
  44.106 -                    (HOLogic.mk_binop @{const_name HOL.induct_conj}
  44.107 +                    (HOLogic.mk_binop \<^const_name>\<open>HOL.induct_conj\<close>
  44.108                        (list_comb (incr_boundvars k s, bs), P));
  44.109                in (Q, case Ts of [] => SOME (s, P) | _ => NONE) end
  44.110            | NONE =>
  44.111 @@ -753,7 +753,7 @@
  44.112  
  44.113      val ind_concl =
  44.114        HOLogic.mk_Trueprop
  44.115 -        (HOLogic.mk_binrel @{const_name Orderings.less_eq} (rec_const, ind_pred));
  44.116 +        (HOLogic.mk_binrel \<^const_name>\<open>Orderings.less_eq\<close> (rec_const, ind_pred));
  44.117  
  44.118      val raw_fp_induct = mono RS (fp_def RS @{thm def_lfp_induct});
  44.119  
  44.120 @@ -791,7 +791,7 @@
  44.121  
  44.122  (* prove coinduction rule *)
  44.123  
  44.124 -fun If_const T = Const (@{const_name If}, HOLogic.boolT --> T --> T --> T);
  44.125 +fun If_const T = Const (\<^const_name>\<open>If\<close>, HOLogic.boolT --> T --> T --> T);
  44.126  fun mk_If p t f = let val T = fastype_of t in If_const T $ p $ t $ f end;
  44.127  
  44.128  fun prove_coindrule quiet_mode preds cs argTs bs xs params intr_ts mono
  44.129 @@ -803,20 +803,20 @@
  44.130        make_args' argTs xs (arg_types_of (length params) pred) |> `length) preds;
  44.131      val xTss = map (map fastype_of) xss;
  44.132      val (Rs_names, names_ctxt) = Variable.variant_fixes (mk_names "X" n) ctxt;
  44.133 -    val Rs = map2 (fn name => fn Ts => Free (name, Ts ---> @{typ bool})) Rs_names xTss;
  44.134 +    val Rs = map2 (fn name => fn Ts => Free (name, Ts ---> \<^typ>\<open>bool\<close>)) Rs_names xTss;
  44.135      val Rs_applied = map2 (curry list_comb) Rs xss;
  44.136      val preds_applied = map2 (curry list_comb) (map (fn p => list_comb (p, params)) preds) xss;
  44.137      val abstract_list = fold_rev (absfree o dest_Free);
  44.138      val bss = map (make_bool_args
  44.139 -      (fn b => HOLogic.mk_eq (b, @{term False}))
  44.140 -      (fn b => HOLogic.mk_eq (b, @{term True})) bs) (0 upto n - 1);
  44.141 +      (fn b => HOLogic.mk_eq (b, \<^term>\<open>False\<close>))
  44.142 +      (fn b => HOLogic.mk_eq (b, \<^term>\<open>True\<close>)) bs) (0 upto n - 1);
  44.143      val eq_undefinedss = map (fn ys => map (fn x =>
  44.144 -        HOLogic.mk_eq (x, Const (@{const_name undefined}, fastype_of x)))
  44.145 +        HOLogic.mk_eq (x, Const (\<^const_name>\<open>undefined\<close>, fastype_of x)))
  44.146        (subtract (op =) ys xs)) xss;
  44.147      val R =
  44.148        @{fold 3} (fn bs => fn eqs => fn R => fn t => if null bs andalso null eqs then R else
  44.149          mk_If (Library.foldr1 HOLogic.mk_conj (bs @ eqs)) R t)
  44.150 -      bss eq_undefinedss Rs_applied @{term False}
  44.151 +      bss eq_undefinedss Rs_applied \<^term>\<open>False\<close>
  44.152        |> abstract_list (bs @ xs);
  44.153  
  44.154      fun subst t =
  44.155 @@ -847,7 +847,7 @@
  44.156        in
  44.157          (i, fold_rev (fn (x, T) => fn P => HOLogic.exists_const T $ Abs (x, T, P))
  44.158            (Logic.strip_params r)
  44.159 -          (if null ps then @{term True} else foldr1 HOLogic.mk_conj ps))
  44.160 +          (if null ps then \<^term>\<open>True\<close> else foldr1 HOLogic.mk_conj ps))
  44.161        end;
  44.162  
  44.163      fun mk_prem i Ps = Logic.mk_implies
  44.164 @@ -908,7 +908,7 @@
  44.165  
  44.166  fun mk_ind_def quiet_mode skip_mono alt_name coind cs intr_ts monos params cnames_syn lthy =
  44.167    let
  44.168 -    val fp_name = if coind then @{const_name Inductive.gfp} else @{const_name Inductive.lfp};
  44.169 +    val fp_name = if coind then \<^const_name>\<open>Inductive.gfp\<close> else \<^const_name>\<open>Inductive.lfp\<close>;
  44.170  
  44.171      val argTs = fold (combine (op =) o arg_types_of (length params)) cs [];
  44.172      val k = log 2 1 (length cs);
  44.173 @@ -954,14 +954,14 @@
  44.174        in
  44.175          fold_rev (fn (x, T) => fn P => HOLogic.exists_const T $ Abs (x, T, P))
  44.176            (Logic.strip_params r)
  44.177 -          (if null ps then @{term True} else foldr1 HOLogic.mk_conj ps)
  44.178 +          (if null ps then \<^term>\<open>True\<close> else foldr1 HOLogic.mk_conj ps)
  44.179        end;
  44.180  
  44.181      (* make a disjunction of all introduction rules *)
  44.182  
  44.183      val fp_fun =
  44.184        fold_rev lambda (p :: bs @ xs)
  44.185 -        (if null intr_ts then @{term False}
  44.186 +        (if null intr_ts then \<^term>\<open>False\<close>
  44.187           else foldr1 HOLogic.mk_disj (map transform_rule intr_ts));
  44.188  
  44.189      (* add definition of recursive predicates to theory *)
  44.190 @@ -1296,32 +1296,32 @@
  44.191  fun gen_ind_decl mk_def coind =
  44.192    Parse.vars -- Parse.for_fixes --
  44.193    Scan.optional Parse_Spec.where_multi_specs [] --
  44.194 -  Scan.optional (@{keyword "monos"} |-- Parse.!!! Parse.thms1) []
  44.195 +  Scan.optional (\<^keyword>\<open>monos\<close> |-- Parse.!!! Parse.thms1) []
  44.196    >> (fn (((preds, params), specs), monos) =>
  44.197        (snd o gen_add_inductive mk_def true coind preds params specs monos));
  44.198  
  44.199  val ind_decl = gen_ind_decl add_ind_def;
  44.200  
  44.201  val _ =
  44.202 -  Outer_Syntax.local_theory @{command_keyword inductive} "define inductive predicates"
  44.203 +  Outer_Syntax.local_theory \<^command_keyword>\<open>inductive\<close> "define inductive predicates"
  44.204      (ind_decl false);
  44.205  
  44.206  val _ =
  44.207 -  Outer_Syntax.local_theory @{command_keyword coinductive} "define coinductive predicates"
  44.208 +  Outer_Syntax.local_theory \<^command_keyword>\<open>coinductive\<close> "define coinductive predicates"
  44.209      (ind_decl true);
  44.210  
  44.211  val _ =
  44.212 -  Outer_Syntax.local_theory @{command_keyword inductive_cases}
  44.213 +  Outer_Syntax.local_theory \<^command_keyword>\<open>inductive_cases\<close>
  44.214      "create simplified instances of elimination rules"
  44.215      (Parse.and_list1 Parse_Spec.simple_specs >> (snd oo inductive_cases));
  44.216  
  44.217  val _ =
  44.218 -  Outer_Syntax.local_theory @{command_keyword inductive_simps}
  44.219 +  Outer_Syntax.local_theory \<^command_keyword>\<open>inductive_simps\<close>
  44.220      "create simplification rules for inductive predicates"
  44.221      (Parse.and_list1 Parse_Spec.simple_specs >> (snd oo inductive_simps));
  44.222  
  44.223  val _ =
  44.224 -  Outer_Syntax.command @{command_keyword print_inductives}
  44.225 +  Outer_Syntax.command \<^command_keyword>\<open>print_inductives\<close>
  44.226      "print (co)inductive definitions and monotonicity rules"
  44.227      (Parse.opt_bang >> (fn b => Toplevel.keep (print_inductives b o Toplevel.context_of)));
  44.228  
    45.1 --- a/src/HOL/Tools/inductive_realizer.ML	Wed Dec 06 19:34:59 2017 +0100
    45.2 +++ b/src/HOL/Tools/inductive_realizer.ML	Wed Dec 06 20:43:09 2017 +0100
    45.3 @@ -515,7 +515,7 @@
    45.4        | SOME (SOME sets') => subtract (op =) sets' sets)
    45.5    end I);
    45.6  
    45.7 -val _ = Theory.setup (Attrib.setup @{binding ind_realizer}
    45.8 +val _ = Theory.setup (Attrib.setup \<^binding>\<open>ind_realizer\<close>
    45.9    ((Scan.option (Scan.lift (Args.$$$ "irrelevant") |--
   45.10      Scan.option (Scan.lift (Args.colon) |--
   45.11        Scan.repeat1 (Args.const {proper = true, strict = true})))) >> rlz_attrib)
    46.1 --- a/src/HOL/Tools/inductive_set.ML	Wed Dec 06 19:34:59 2017 +0100
    46.2 +++ b/src/HOL/Tools/inductive_set.ML	Wed Dec 06 20:43:09 2017 +0100
    46.3 @@ -39,7 +39,7 @@
    46.4  
    46.5  fun strong_ind_simproc tab =
    46.6    Simplifier.make_simproc @{context} "strong_ind"
    46.7 -   {lhss = [@{term "x::'a::{}"}],
    46.8 +   {lhss = [\<^term>\<open>x::'a::{}\<close>],
    46.9      proc = fn _ => fn ctxt => fn ct =>
   46.10        let
   46.11          fun close p t f =
   46.12 @@ -47,20 +47,20 @@
   46.13            in Thm.instantiate' [] (rev (map (SOME o Thm.cterm_of ctxt o Var) vs))
   46.14              (p (fold (Logic.all o Var) vs t) f)
   46.15            end;
   46.16 -        fun mkop @{const_name HOL.conj} T x =
   46.17 -              SOME (Const (@{const_name Lattices.inf}, T --> T --> T), x)
   46.18 -          | mkop @{const_name HOL.disj} T x =
   46.19 -              SOME (Const (@{const_name Lattices.sup}, T --> T --> T), x)
   46.20 +        fun mkop \<^const_name>\<open>HOL.conj\<close> T x =
   46.21 +              SOME (Const (\<^const_name>\<open>Lattices.inf\<close>, T --> T --> T), x)
   46.22 +          | mkop \<^const_name>\<open>HOL.disj\<close> T x =
   46.23 +              SOME (Const (\<^const_name>\<open>Lattices.sup\<close>, T --> T --> T), x)
   46.24            | mkop _ _ _ = NONE;
   46.25          fun mk_collect p T t =
   46.26            let val U = HOLogic.dest_setT T
   46.27            in HOLogic.Collect_const U $
   46.28              HOLogic.mk_ptupleabs (HOLogic.flat_tuple_paths p) U HOLogic.boolT t
   46.29            end;
   46.30 -        fun decomp (Const (s, _) $ ((m as Const (@{const_name Set.member},
   46.31 +        fun decomp (Const (s, _) $ ((m as Const (\<^const_name>\<open>Set.member\<close>,
   46.32                Type (_, [_, Type (_, [T, _])]))) $ p $ S) $ u) =
   46.33                  mkop s T (m, p, S, mk_collect p T (head_of u))
   46.34 -          | decomp (Const (s, _) $ u $ ((m as Const (@{const_name Set.member},
   46.35 +          | decomp (Const (s, _) $ u $ ((m as Const (\<^const_name>\<open>Set.member\<close>,
   46.36                Type (_, [_, Type (_, [T, _])]))) $ p $ S)) =
   46.37                  mkop s T (m, p, mk_collect p T (head_of u), S)
   46.38            | decomp _ = NONE;
   46.39 @@ -241,7 +241,7 @@
   46.40    in
   46.41      Simplifier.simplify
   46.42        (put_simpset HOL_basic_ss ctxt addsimps @{thms mem_Collect_eq case_prod_conv}
   46.43 -        addsimprocs [@{simproc Collect_mem}]) thm''
   46.44 +        addsimprocs [\<^simproc>\<open>Collect_mem\<close>]) thm''
   46.45        |> zero_var_indexes |> eta_contract_thm ctxt (equal p)
   46.46    end;
   46.47  
   46.48 @@ -252,14 +252,14 @@
   46.49  
   46.50  fun add context thm (tab as {to_set_simps, to_pred_simps, set_arities, pred_arities}) =
   46.51    (case Thm.prop_of thm of
   46.52 -    Const (@{const_name Trueprop}, _) $ (Const (@{const_name HOL.eq}, Type (_, [T, _])) $ lhs $ rhs) =>
   46.53 +    Const (\<^const_name>\<open>Trueprop\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, Type (_, [T, _])) $ lhs $ rhs) =>
   46.54        (case body_type T of
   46.55 -         @{typ bool} =>
   46.56 +         \<^typ>\<open>bool\<close> =>
   46.57             let
   46.58               val thy = Context.theory_of context;
   46.59               val ctxt = Context.proof_of context;
   46.60               fun factors_of t fs = case strip_abs_body t of
   46.61 -                 Const (@{const_name Set.member}, _) $ u $ S =>
   46.62 +                 Const (\<^const_name>\<open>Set.member\<close>, _) $ u $ S =>
   46.63                     if is_Free S orelse is_Var S then
   46.64                       let val ps = HOLogic.flat_tuple_paths u
   46.65                       in (SOME ps, (S, ps) :: fs) end
   46.66 @@ -269,7 +269,7 @@
   46.67               val (pfs, fs) = fold_map factors_of ts [];
   46.68               val ((h', ts'), fs') = (case rhs of
   46.69                   Abs _ => (case strip_abs_body rhs of
   46.70 -                     Const (@{const_name Set.member}, _) $ u $ S =>
   46.71 +                     Const (\<^const_name>\<open>Set.member\<close>, _) $ u $ S =>
   46.72                         (strip_comb S, SOME (HOLogic.flat_tuple_paths u))
   46.73                     | _ => raise Malformed "member symbol on right-hand side expected")
   46.74                 | _ => (strip_comb rhs, NONE))
   46.75 @@ -384,7 +384,7 @@
   46.76      thm |>
   46.77      Thm.instantiate ([], insts) |>
   46.78      Simplifier.full_simplify (put_simpset HOL_basic_ss ctxt addsimps to_set_simps
   46.79 -        addsimprocs [strong_ind_simproc pred_arities, @{simproc Collect_mem}]) |>
   46.80 +        addsimprocs [strong_ind_simproc pred_arities, \<^simproc>\<open>Collect_mem\<close>]) |>
   46.81      Rule_Cases.save thm
   46.82    end;
   46.83  
   46.84 @@ -401,7 +401,7 @@
   46.85      val {set_arities, pred_arities, to_pred_simps, ...} =
   46.86        Data.get (Context.Proof lthy);
   46.87      fun infer (Abs (_, _, t)) = infer t
   46.88 -      | infer (Const (@{const_name Set.member}, _) $ t $ u) =
   46.89 +      | infer (Const (\<^const_name>\<open>Set.member\<close>, _) $ t $ u) =
   46.90            infer_arities thy set_arities (SOME (HOLogic.flat_tuple_paths t), u)
   46.91        | infer (t $ u) = infer t #> infer u
   46.92        | infer _ = I;
   46.93 @@ -534,13 +534,13 @@
   46.94  
   46.95  val _ =
   46.96    Theory.setup
   46.97 -   (Attrib.setup @{binding pred_set_conv} (Scan.succeed pred_set_conv_att)
   46.98 +   (Attrib.setup \<^binding>\<open>pred_set_conv\<close> (Scan.succeed pred_set_conv_att)
   46.99        "declare rules for converting between predicate and set notation" #>
  46.100 -    Attrib.setup @{binding to_set} (Attrib.thms >> to_set_att)
  46.101 +    Attrib.setup \<^binding>\<open>to_set\<close> (Attrib.thms >> to_set_att)
  46.102        "convert rule to set notation" #>
  46.103 -    Attrib.setup @{binding to_pred} (Attrib.thms >> to_pred_att)
  46.104 +    Attrib.setup \<^binding>\<open>to_pred\<close> (Attrib.thms >> to_pred_att)
  46.105        "convert rule to predicate notation" #>
  46.106 -    Attrib.setup @{binding mono_set} (Attrib.add_del mono_add mono_del)
  46.107 +    Attrib.setup \<^binding>\<open>mono_set\<close> (Attrib.add_del mono_add mono_del)
  46.108        "declare of monotonicity rule for set operators");
  46.109  
  46.110  
  46.111 @@ -549,11 +549,11 @@
  46.112  val ind_set_decl = Inductive.gen_ind_decl add_ind_set_def;
  46.113  
  46.114  val _ =
  46.115 -  Outer_Syntax.local_theory @{command_keyword inductive_set} "define inductive sets"
  46.116 +  Outer_Syntax.local_theory \<^command_keyword>\<open>inductive_set\<close> "define inductive sets"
  46.117      (ind_set_decl false);
  46.118  
  46.119  val _ =
  46.120 -  Outer_Syntax.local_theory @{command_keyword coinductive_set} "define coinductive sets"
  46.121 +  Outer_Syntax.local_theory \<^command_keyword>\<open>coinductive_set\<close> "define coinductive sets"
  46.122      (ind_set_decl true);
  46.123  
  46.124  end;
    47.1 --- a/src/HOL/Tools/int_arith.ML	Wed Dec 06 19:34:59 2017 +0100
    47.2 +++ b/src/HOL/Tools/int_arith.ML	Wed Dec 06 20:43:09 2017 +0100
    47.3 @@ -24,10 +24,10 @@
    47.4  
    47.5  val zero_to_of_int_zero_simproc =
    47.6    Simplifier.make_simproc @{context} "zero_to_of_int_zero_simproc"
    47.7 -   {lhss = [@{term "0::'a::ring"}],
    47.8 +   {lhss = [\<^term>\<open>0::'a::ring\<close>],
    47.9      proc = fn _ => fn ctxt => fn ct =>
   47.10        let val T = Thm.ctyp_of_cterm ct in
   47.11 -        if Thm.typ_of T = @{typ int} then NONE
   47.12 +        if Thm.typ_of T = \<^typ>\<open>int\<close> then NONE
   47.13          else SOME (Thm.instantiate' [SOME T] [] zeroth)
   47.14        end};
   47.15  
   47.16 @@ -35,20 +35,20 @@
   47.17  
   47.18  val one_to_of_int_one_simproc =
   47.19    Simplifier.make_simproc @{context} "one_to_of_int_one_simproc"
   47.20 -   {lhss = [@{term "1::'a::ring_1"}],
   47.21 +   {lhss = [\<^term>\<open>1::'a::ring_1\<close>],
   47.22      proc = fn _ => fn ctxt => fn ct =>
   47.23        let val T = Thm.ctyp_of_cterm ct in
   47.24 -        if Thm.typ_of T = @{typ int} then NONE
   47.25 +        if Thm.typ_of T = \<^typ>\<open>int\<close> then NONE
   47.26          else SOME (Thm.instantiate' [SOME T] [] oneth)
   47.27        end};
   47.28  
   47.29 -fun check (Const (@{const_name Groups.one}, @{typ int})) = false
   47.30 -  | check (Const (@{const_name Groups.one}, _)) = true
   47.31 -  | check (Const (s, _)) = member (op =) [@{const_name HOL.eq},
   47.32 -      @{const_name Groups.times}, @{const_name Groups.uminus},
   47.33 -      @{const_name Groups.minus}, @{const_name Groups.plus},
   47.34 -      @{const_name Groups.zero},
   47.35 -      @{const_name Orderings.less}, @{const_name Orderings.less_eq}] s
   47.36 +fun check (Const (\<^const_name>\<open>Groups.one\<close>, \<^typ>\<open>int\<close>)) = false
   47.37 +  | check (Const (\<^const_name>\<open>Groups.one\<close>, _)) = true
   47.38 +  | check (Const (s, _)) = member (op =) [\<^const_name>\<open>HOL.eq\<close>,
   47.39 +      \<^const_name>\<open>Groups.times\<close>, \<^const_name>\<open>Groups.uminus\<close>,
   47.40 +      \<^const_name>\<open>Groups.minus\<close>, \<^const_name>\<open>Groups.plus\<close>,
   47.41 +      \<^const_name>\<open>Groups.zero\<close>,
   47.42 +      \<^const_name>\<open>Orderings.less\<close>, \<^const_name>\<open>Orderings.less_eq\<close>] s
   47.43    | check (a $ b) = check a andalso check b
   47.44    | check _ = false;
   47.45  
   47.46 @@ -63,9 +63,9 @@
   47.47  val zero_one_idom_simproc =
   47.48    Simplifier.make_simproc @{context} "zero_one_idom_simproc"
   47.49     {lhss =
   47.50 -      [@{term "(x::'a::ring_char_0) = y"},
   47.51 -       @{term "(x::'a::linordered_idom) < y"},
   47.52 -       @{term "(x::'a::linordered_idom) \<le> y"}],
   47.53 +      [\<^term>\<open>(x::'a::ring_char_0) = y\<close>,
   47.54 +       \<^term>\<open>(x::'a::linordered_idom) < y\<close>,
   47.55 +       \<^term>\<open>(x::'a::linordered_idom) \<le> y\<close>],
   47.56      proc = fn _ => fn ctxt => fn ct =>
   47.57        if check (Thm.term_of ct)
   47.58        then SOME (Simplifier.rewrite (put_simpset conv_ss ctxt) ct)
   47.59 @@ -73,7 +73,7 @@
   47.60  
   47.61  
   47.62  fun number_of ctxt T n =
   47.63 -  if not (Sign.of_sort (Proof_Context.theory_of ctxt) (T, @{sort numeral}))
   47.64 +  if not (Sign.of_sort (Proof_Context.theory_of ctxt) (T, \<^sort>\<open>numeral\<close>))
   47.65    then raise CTERM ("number_of", [])
   47.66    else Numeral.mk_cnumber (Thm.ctyp_of ctxt T) n;
   47.67  
   47.68 @@ -85,7 +85,7 @@
   47.69        [@{thm of_int_numeral}, @{thm nat_0}, @{thm nat_1}, @{thm diff_nat_numeral}, @{thm nat_numeral}]
   47.70    #> Lin_Arith.add_simprocs [zero_one_idom_simproc]
   47.71    #> Lin_Arith.set_number_of number_of
   47.72 -  #> Lin_Arith.add_inj_const (@{const_name of_nat}, HOLogic.natT --> HOLogic.intT)
   47.73 -  #> Lin_Arith.add_discrete_type @{type_name Int.int}
   47.74 +  #> Lin_Arith.add_inj_const (\<^const_name>\<open>of_nat\<close>, HOLogic.natT --> HOLogic.intT)
   47.75 +  #> Lin_Arith.add_discrete_type \<^type_name>\<open>Int.int\<close>
   47.76  
   47.77  end;
    48.1 --- a/src/HOL/Tools/lin_arith.ML	Wed Dec 06 19:34:59 2017 +0100
    48.2 +++ b/src/HOL/Tools/lin_arith.ML	Wed Dec 06 20:43:09 2017 +0100
    48.3 @@ -45,17 +45,17 @@
    48.4  val mk_Trueprop = HOLogic.mk_Trueprop;
    48.5  
    48.6  fun atomize thm = case Thm.prop_of thm of
    48.7 -    Const (@{const_name Trueprop}, _) $ (Const (@{const_name HOL.conj}, _) $ _ $ _) =>
    48.8 +    Const (\<^const_name>\<open>Trueprop\<close>, _) $ (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ _ $ _) =>
    48.9      atomize (thm RS conjunct1) @ atomize (thm RS conjunct2)
   48.10    | _ => [thm];
   48.11  
   48.12 -fun neg_prop ((TP as Const(@{const_name Trueprop}, _)) $ (Const (@{const_name Not}, _) $ t)) = TP $ t
   48.13 -  | neg_prop ((TP as Const(@{const_name Trueprop}, _)) $ t) = TP $ (HOLogic.Not $t)
   48.14 +fun neg_prop ((TP as Const(\<^const_name>\<open>Trueprop\<close>, _)) $ (Const (\<^const_name>\<open>Not\<close>, _) $ t)) = TP $ t
   48.15 +  | neg_prop ((TP as Const(\<^const_name>\<open>Trueprop\<close>, _)) $ t) = TP $ (HOLogic.Not $t)
   48.16    | neg_prop t = raise TERM ("neg_prop", [t]);
   48.17  
   48.18  fun is_False thm =
   48.19    let val _ $ t = Thm.prop_of thm
   48.20 -  in t = @{term False} end;
   48.21 +  in t = \<^term>\<open>False\<close> end;
   48.22  
   48.23  fun is_nat t = (fastype_of1 t = HOLogic.natT);
   48.24  
   48.25 @@ -97,9 +97,9 @@
   48.26    {splits = splits, inj_consts = update (op =) c inj_consts,
   48.27     discrete = discrete});
   48.28  
   48.29 -val split_limit = Attrib.setup_config_int @{binding linarith_split_limit} (K 9);
   48.30 -val neq_limit = Attrib.setup_config_int @{binding linarith_neq_limit} (K 9);
   48.31 -val trace = Attrib.setup_config_bool @{binding linarith_trace} (K false);
   48.32 +val split_limit = Attrib.setup_config_int \<^binding>\<open>linarith_split_limit\<close> (K 9);
   48.33 +val neq_limit = Attrib.setup_config_int \<^binding>\<open>linarith_neq_limit\<close> (K 9);
   48.34 +val trace = Attrib.setup_config_bool \<^binding>\<open>linarith_trace\<close> (K false);
   48.35  
   48.36  
   48.37  structure LA_Data: LIN_ARITH_DATA =
   48.38 @@ -134,12 +134,12 @@
   48.39  
   48.40     returns either (SOME term, associated multiplicity) or (NONE, constant)
   48.41  *)
   48.42 -fun of_field_sort thy U = Sign.of_sort thy (U, @{sort inverse});
   48.43 +fun of_field_sort thy U = Sign.of_sort thy (U, \<^sort>\<open>inverse\<close>);
   48.44  
   48.45  fun demult thy (inj_consts : (string * typ) list) : term * Rat.rat -> term option * Rat.rat =
   48.46  let
   48.47 -  fun demult ((mC as Const (@{const_name Groups.times}, _)) $ s $ t, m) =
   48.48 -      (case s of Const (@{const_name Groups.times}, _) $ s1 $ s2 =>
   48.49 +  fun demult ((mC as Const (\<^const_name>\<open>Groups.times\<close>, _)) $ s $ t, m) =
   48.50 +      (case s of Const (\<^const_name>\<open>Groups.times\<close>, _) $ s1 $ s2 =>
   48.51          (* bracketing to the right: '(s1 * s2) * t' becomes 's1 * (s2 * t)' *)
   48.52          demult (mC $ s1 $ (mC $ s2 $ t), m)
   48.53        | _ =>
   48.54 @@ -150,7 +150,7 @@
   48.55                (SOME t', m'') => (SOME (mC $ s' $ t'), m'')
   48.56              | (NONE,    m'') => (SOME s', m''))
   48.57          | (NONE,    m') => demult (t, m')))
   48.58 -    | demult (atom as (mC as Const (@{const_name Rings.divide}, T)) $ s $ t, m) =
   48.59 +    | demult (atom as (mC as Const (\<^const_name>\<open>Rings.divide\<close>, T)) $ s $ t, m) =
   48.60        (* FIXME: Shouldn't we simplify nested quotients, e.g. '(s/t)/u' could
   48.61           become 's/(t*u)', and '(s*t)/u' could become 's*(t/u)' ?   Note that
   48.62           if we choose to do so here, the simpset used by arith must be able to
   48.63 @@ -165,15 +165,15 @@
   48.64              (SOME s', SOME t') => SOME (mC $ s' $ t')
   48.65            | (SOME s', NONE) => SOME s'
   48.66            | (NONE, SOME t') =>
   48.67 -               SOME (mC $ Const (@{const_name Groups.one}, domain_type (snd (dest_Const mC))) $ t')
   48.68 +               SOME (mC $ Const (\<^const_name>\<open>Groups.one\<close>, domain_type (snd (dest_Const mC))) $ t')
   48.69            | (NONE, NONE) => NONE,
   48.70            Rat.mult m' (Rat.inv p))
   48.71          end
   48.72        else (SOME atom, m)
   48.73      (* terms that evaluate to numeric constants *)
   48.74 -    | demult (Const (@{const_name Groups.uminus}, _) $ t, m) = demult (t, ~ m)
   48.75 -    | demult (Const (@{const_name Groups.zero}, _), _) = (NONE, @0)
   48.76 -    | demult (Const (@{const_name Groups.one}, _), m) = (NONE, m)
   48.77 +    | demult (Const (\<^const_name>\<open>Groups.uminus\<close>, _) $ t, m) = demult (t, ~ m)
   48.78 +    | demult (Const (\<^const_name>\<open>Groups.zero\<close>, _), _) = (NONE, @0)
   48.79 +    | demult (Const (\<^const_name>\<open>Groups.one\<close>, _), m) = (NONE, m)
   48.80      (*Warning: in rare cases (neg_)numeral encloses a non-numeral,
   48.81        in which case dest_numeral raises TERM; hence all the handles below.
   48.82        Same for Suc-terms that turn out not to be numerals -
   48.83 @@ -181,7 +181,7 @@
   48.84      | demult (t as Const ("Num.numeral_class.numeral", _) (*DYNAMIC BINDING!*) $ n, m) =
   48.85        ((NONE, Rat.mult m (Rat.of_int (HOLogic.dest_numeral n)))
   48.86          handle TERM _ => (SOME t, m))
   48.87 -    | demult (t as Const (@{const_name Suc}, _) $ _, m) =
   48.88 +    | demult (t as Const (\<^const_name>\<open>Suc\<close>, _) $ _, m) =
   48.89        ((NONE, Rat.mult m (Rat.of_int (HOLogic.dest_nat t)))
   48.90          handle TERM _ => (SOME t, m))
   48.91      (* injection constants are ignored *)
   48.92 @@ -197,27 +197,27 @@
   48.93    (* Turns a term 'all' and associated multiplicity 'm' into a list 'p' of
   48.94       summands and associated multiplicities, plus a constant 'i' (with implicit
   48.95       multiplicity 1) *)
   48.96 -  fun poly (Const (@{const_name Groups.plus}, _) $ s $ t,
   48.97 +  fun poly (Const (\<^const_name>\<open>Groups.plus\<close>, _) $ s $ t,
   48.98          m : Rat.rat, pi : (term * Rat.rat) list * Rat.rat) = poly (s, m, poly (t, m, pi))
   48.99 -    | poly (all as Const (@{const_name Groups.minus}, T) $ s $ t, m, pi) =
  48.100 +    | poly (all as Const (\<^const_name>\<open>Groups.minus\<close>, T) $ s $ t, m, pi) =
  48.101          if nT T then add_atom all m pi else poly (s, m, poly (t, ~ m, pi))
  48.102 -    | poly (all as Const (@{const_name Groups.uminus}, T) $ t, m, pi) =
  48.103 +    | poly (all as Const (\<^const_name>\<open>Groups.uminus\<close>, T) $ t, m, pi) =
  48.104          if nT T then add_atom all m pi else poly (t, ~ m, pi)
  48.105 -    | poly (Const (@{const_name Groups.zero}, _), _, pi) =
  48.106 +    | poly (Const (\<^const_name>\<open>Groups.zero\<close>, _), _, pi) =
  48.107          pi
  48.108 -    | poly (Const (@{const_name Groups.one}, _), m, (p, i)) =
  48.109 +    | poly (Const (\<^const_name>\<open>Groups.one\<close>, _), m, (p, i)) =
  48.110          (p, Rat.add i m)
  48.111      | poly (all as Const ("Num.numeral_class.numeral", _) (*DYNAMIC BINDING!*) $ t, m, pi as (p, i)) =
  48.112          (let val k = HOLogic.dest_numeral t
  48.113          in (p, Rat.add i (Rat.mult m (Rat.of_int k))) end
  48.114          handle TERM _ => add_atom all m pi)
  48.115 -    | poly (Const (@{const_name Suc}, _) $ t, m, (p, i)) =
  48.116 +    | poly (Const (\<^const_name>\<open>Suc\<close>, _) $ t, m, (p, i)) =
  48.117          poly (t, m, (p, Rat.add i m))
  48.118 -    | poly (all as Const (@{const_name Groups.times}, _) $ _ $ _, m, pi as (p, i)) =
  48.119 +    | poly (all as Const (\<^const_name>\<open>Groups.times\<close>, _) $ _ $ _, m, pi as (p, i)) =
  48.120          (case demult thy inj_consts (all, m) of
  48.121             (NONE,   m') => (p, Rat.add i m')
  48.122           | (SOME u, m') => add_atom u m' pi)
  48.123 -    | poly (all as Const (@{const_name Rings.divide}, T) $ _ $ _, m, pi as (p, i)) =
  48.124 +    | poly (all as Const (\<^const_name>\<open>Rings.divide\<close>, T) $ _ $ _, m, pi as (p, i)) =
  48.125          if of_field_sort thy (domain_type T) then 
  48.126            (case demult thy inj_consts (all, m) of
  48.127               (NONE,   m') => (p, Rat.add i m')
  48.128 @@ -231,14 +231,14 @@
  48.129    val (q, j) = poly (rhs, @1, ([], @0))
  48.130  in
  48.131    case rel of
  48.132 -    @{const_name Orderings.less}    => SOME (p, i, "<", q, j)
  48.133 -  | @{const_name Orderings.less_eq} => SOME (p, i, "<=", q, j)
  48.134 -  | @{const_name HOL.eq}            => SOME (p, i, "=", q, j)
  48.135 +    \<^const_name>\<open>Orderings.less\<close>    => SOME (p, i, "<", q, j)
  48.136 +  | \<^const_name>\<open>Orderings.less_eq\<close> => SOME (p, i, "<=", q, j)
  48.137 +  | \<^const_name>\<open>HOL.eq\<close>            => SOME (p, i, "=", q, j)
  48.138    | _                   => NONE
  48.139  end handle General.Div => NONE;
  48.140  
  48.141  fun of_lin_arith_sort thy U =
  48.142 -  Sign.of_sort thy (U, @{sort Rings.linordered_idom});
  48.143 +  Sign.of_sort thy (U, \<^sort>\<open>Rings.linordered_idom\<close>);
  48.144  
  48.145  fun allows_lin_arith thy (discrete : string list) (U as Type (D, [])) : bool * bool =
  48.146        if of_lin_arith_sort thy U then (true, member (op =) discrete D)
  48.147 @@ -261,10 +261,10 @@
  48.148    | negate NONE                        = NONE;
  48.149  
  48.150  fun decomp_negation thy data
  48.151 -      ((Const (@{const_name Trueprop}, _)) $ (Const (rel, T) $ lhs $ rhs)) : decomp option =
  48.152 +      ((Const (\<^const_name>\<open>Trueprop\<close>, _)) $ (Const (rel, T) $ lhs $ rhs)) : decomp option =
  48.153        decomp_typecheck thy data (T, (rel, lhs, rhs))
  48.154    | decomp_negation thy data
  48.155 -      ((Const (@{const_name Trueprop}, _)) $ (Const (@{const_name Not}, _) $ (Const (rel, T) $ lhs $ rhs))) =
  48.156 +      ((Const (\<^const_name>\<open>Trueprop\<close>, _)) $ (Const (\<^const_name>\<open>Not\<close>, _) $ (Const (rel, T) $ lhs $ rhs))) =
  48.157        negate (decomp_typecheck thy data (T, (rel, lhs, rhs)))
  48.158    | decomp_negation _ _ _ =
  48.159        NONE;
  48.160 @@ -276,7 +276,7 @@
  48.161    in decomp_negation thy (discrete, inj_consts) end;
  48.162  
  48.163  fun domain_is_nat (_ $ (Const (_, T) $ _ $ _)) = nT T
  48.164 -  | domain_is_nat (_ $ (Const (@{const_name Not}, _) $ (Const (_, T) $ _ $ _))) = nT T
  48.165 +  | domain_is_nat (_ $ (Const (\<^const_name>\<open>Not\<close>, _) $ (Const (_, T) $ _ $ _))) = nT T
  48.166    | domain_is_nat _ = false;
  48.167  
  48.168  
  48.169 @@ -313,24 +313,24 @@
  48.170    let val {inj_consts, ...} = get_arith_data ctxt
  48.171    in member (op =) inj_consts f end
  48.172  
  48.173 -fun abstract_arith ((c as Const (@{const_name Groups.plus}, _)) $ u1 $ u2) cx =
  48.174 +fun abstract_arith ((c as Const (\<^const_name>\<open>Groups.plus\<close>, _)) $ u1 $ u2) cx =
  48.175        with2 abstract_arith c u1 u2 cx
  48.176 -  | abstract_arith (t as (c as Const (@{const_name Groups.minus}, T)) $ u1 $ u2) cx =
  48.177 +  | abstract_arith (t as (c as Const (\<^const_name>\<open>Groups.minus\<close>, T)) $ u1 $ u2) cx =
  48.178        if nT T then abstract_atom t cx else with2 abstract_arith c u1 u2 cx
  48.179 -  | abstract_arith (t as (c as Const (@{const_name Groups.uminus}, T)) $ u) cx =
  48.180 +  | abstract_arith (t as (c as Const (\<^const_name>\<open>Groups.uminus\<close>, T)) $ u) cx =
  48.181        if nT T then abstract_atom t cx else abstract_arith u cx |>> apply c
  48.182 -  | abstract_arith ((c as Const (@{const_name Suc}, _)) $ u) cx = abstract_arith u cx |>> apply c
  48.183 -  | abstract_arith ((c as Const (@{const_name Groups.times}, _)) $ u1 $ u2) cx =
  48.184 +  | abstract_arith ((c as Const (\<^const_name>\<open>Suc\<close>, _)) $ u) cx = abstract_arith u cx |>> apply c
  48.185 +  | abstract_arith ((c as Const (\<^const_name>\<open>Groups.times\<close>, _)) $ u1 $ u2) cx =
  48.186        with2 abstract_arith c u1 u2 cx
  48.187 -  | abstract_arith (t as (c as Const (@{const_name Rings.divide}, T)) $ u1 $ u2) cx =
  48.188 +  | abstract_arith (t as (c as Const (\<^const_name>\<open>Rings.divide\<close>, T)) $ u1 $ u2) cx =
  48.189        if is_field_sort cx T then with2 abstract_arith c u1 u2 cx else abstract_atom t cx
  48.190    | abstract_arith (t as (c as Const f) $ u) cx =
  48.191        if is_inj_const cx f then abstract_arith u cx |>> apply c else abstract_num t cx
  48.192    | abstract_arith t cx = abstract_num t cx
  48.193  
  48.194 -fun is_lin_arith_rel @{const_name Orderings.less} = true
  48.195 -  | is_lin_arith_rel @{const_name Orderings.less_eq} = true
  48.196 -  | is_lin_arith_rel @{const_name HOL.eq} = true
  48.197 +fun is_lin_arith_rel \<^const_name>\<open>Orderings.less\<close> = true
  48.198 +  | is_lin_arith_rel \<^const_name>\<open>Orderings.less_eq\<close> = true
  48.199 +  | is_lin_arith_rel \<^const_name>\<open>HOL.eq\<close> = true
  48.200    | is_lin_arith_rel _ = false
  48.201  
  48.202  fun is_lin_arith_type (_, ctxt) T =
  48.203 @@ -342,10 +342,10 @@
  48.204        else abstract_atom t cx
  48.205    | abstract_rel t cx = abstract_atom t cx
  48.206  
  48.207 -fun abstract_neg ((c as Const (@{const_name Not}, _)) $ t) cx = abstract_rel t cx |>> apply c
  48.208 +fun abstract_neg ((c as Const (\<^const_name>\<open>Not\<close>, _)) $ t) cx = abstract_rel t cx |>> apply c
  48.209    | abstract_neg t cx = abstract_rel t cx
  48.210  
  48.211 -fun abstract ((c as Const (@{const_name Trueprop}, _)) $ t) cx = abstract_neg t cx |>> apply c
  48.212 +fun abstract ((c as Const (\<^const_name>\<open>Trueprop\<close>, _)) $ t) cx = abstract_neg t cx |>> apply c
  48.213    | abstract t cx = abstract_atom t cx
  48.214  
  48.215  
  48.216 @@ -363,13 +363,13 @@
  48.217      (case head_of lhs of
  48.218        Const (a, _) =>
  48.219          member (op =)
  48.220 -         [@{const_name Orderings.max},
  48.221 -          @{const_name Orderings.min},
  48.222 -          @{const_name Groups.abs},
  48.223 -          @{const_name Groups.minus},
  48.224 +         [\<^const_name>\<open>Orderings.max\<close>,
  48.225 +          \<^const_name>\<open>Orderings.min\<close>,
  48.226 +          \<^const_name>\<open>Groups.abs\<close>,
  48.227 +          \<^const_name>\<open>Groups.minus\<close>,
  48.228            "Int.nat" (*DYNAMIC BINDING!*),
  48.229 -          @{const_name Rings.modulo},
  48.230 -          @{const_name Rings.divide}] a
  48.231 +          \<^const_name>\<open>Rings.modulo\<close>,
  48.232 +          \<^const_name>\<open>Rings.divide\<close>] a
  48.233      | _ =>
  48.234        (if Context_Position.is_visible ctxt then
  48.235          warning ("Lin. Arith.: wrong format for split rule " ^ Thm.string_of_thm ctxt thm)
  48.236 @@ -417,8 +417,7 @@
  48.237    (*   tn' --> ... --> t1' --> False  ,                                      *)
  48.238    (* where ti' = HOLogic.dest_Trueprop ti                                    *)
  48.239    fun REPEAT_DETERM_etac_rev_mp tms =
  48.240 -    fold (curry HOLogic.mk_imp) (map HOLogic.dest_Trueprop tms)
  48.241 -      @{term False}
  48.242 +    fold (curry HOLogic.mk_imp) (map HOLogic.dest_Trueprop tms) \<^term>\<open>False\<close>
  48.243    val split_thms  = filter (is_split_thm ctxt) (#splits (get_arith_data ctxt))
  48.244    val cmap        = Splitter.cmap_of_split_thms split_thms
  48.245    val goal_tm     = REPEAT_DETERM_etac_rev_mp terms
  48.246 @@ -441,72 +440,72 @@
  48.247      (* ignore all but the first possible split                               *)
  48.248      (case strip_comb split_term of
  48.249      (* ?P (max ?i ?j) = ((?i <= ?j --> ?P ?j) & (~ ?i <= ?j --> ?P ?i)) *)
  48.250 -      (Const (@{const_name Orderings.max}, _), [t1, t2]) =>
  48.251 +      (Const (\<^const_name>\<open>Orderings.max\<close>, _), [t1, t2]) =>
  48.252        let
  48.253          val rev_terms     = rev terms
  48.254          val terms1        = map (subst_term [(split_term, t1)]) rev_terms
  48.255          val terms2        = map (subst_term [(split_term, t2)]) rev_terms
  48.256 -        val t1_leq_t2     = Const (@{const_name Orderings.less_eq},
  48.257 +        val t1_leq_t2     = Const (\<^const_name>\<open>Orderings.less_eq\<close>,
  48.258                                      split_type --> split_type --> HOLogic.boolT) $ t1 $ t2
  48.259          val not_t1_leq_t2 = HOLogic.Not $ t1_leq_t2
  48.260 -        val not_false     = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  48.261 +        val not_false     = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  48.262          val subgoal1      = (HOLogic.mk_Trueprop t1_leq_t2) :: terms2 @ [not_false]
  48.263          val subgoal2      = (HOLogic.mk_Trueprop not_t1_leq_t2) :: terms1 @ [not_false]
  48.264        in
  48.265          SOME [(Ts, subgoal1), (Ts, subgoal2)]
  48.266        end
  48.267      (* ?P (min ?i ?j) = ((?i <= ?j --> ?P ?i) & (~ ?i <= ?j --> ?P ?j)) *)
  48.268 -    | (Const (@{const_name Orderings.min}, _), [t1, t2]) =>
  48.269 +    | (Const (\<^const_name>\<open>Orderings.min\<close>, _), [t1, t2]) =>
  48.270        let
  48.271          val rev_terms     = rev terms
  48.272          val terms1        = map (subst_term [(split_term, t1)]) rev_terms
  48.273          val terms2        = map (subst_term [(split_term, t2)]) rev_terms
  48.274 -        val t1_leq_t2     = Const (@{const_name Orderings.less_eq},
  48.275 +        val t1_leq_t2     = Const (\<^const_name>\<open>Orderings.less_eq\<close>,
  48.276                                      split_type --> split_type --> HOLogic.boolT) $ t1 $ t2
  48.277          val not_t1_leq_t2 = HOLogic.Not $ t1_leq_t2
  48.278 -        val not_false     = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  48.279 +        val not_false     = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  48.280          val subgoal1      = (HOLogic.mk_Trueprop t1_leq_t2) :: terms1 @ [not_false]
  48.281          val subgoal2      = (HOLogic.mk_Trueprop not_t1_leq_t2) :: terms2 @ [not_false]
  48.282        in
  48.283          SOME [(Ts, subgoal1), (Ts, subgoal2)]
  48.284        end
  48.285      (* ?P (abs ?a) = ((0 <= ?a --> ?P ?a) & (?a < 0 --> ?P (- ?a))) *)
  48.286 -    | (Const (@{const_name Groups.abs}, _), [t1]) =>
  48.287 +    | (Const (\<^const_name>\<open>Groups.abs\<close>, _), [t1]) =>
  48.288        let
  48.289          val rev_terms   = rev terms
  48.290          val terms1      = map (subst_term [(split_term, t1)]) rev_terms
  48.291 -        val terms2      = map (subst_term [(split_term, Const (@{const_name Groups.uminus},
  48.292 +        val terms2      = map (subst_term [(split_term, Const (\<^const_name>\<open>Groups.uminus\<close>,
  48.293                              split_type --> split_type) $ t1)]) rev_terms
  48.294 -        val zero        = Const (@{const_name Groups.zero}, split_type)
  48.295 -        val zero_leq_t1 = Const (@{const_name Orderings.less_eq},
  48.296 +        val zero        = Const (\<^const_name>\<open>Groups.zero\<close>, split_type)
  48.297 +        val zero_leq_t1 = Const (\<^const_name>\<open>Orderings.less_eq\<close>,
  48.298                              split_type --> split_type --> HOLogic.boolT) $ zero $ t1
  48.299 -        val t1_lt_zero  = Const (@{const_name Orderings.less},
  48.300 +        val t1_lt_zero  = Const (\<^const_name>\<open>Orderings.less\<close>,
  48.301                              split_type --> split_type --> HOLogic.boolT) $ t1 $ zero
  48.302 -        val not_false   = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  48.303 +        val not_false   = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  48.304          val subgoal1    = (HOLogic.mk_Trueprop zero_leq_t1) :: terms1 @ [not_false]
  48.305          val subgoal2    = (HOLogic.mk_Trueprop t1_lt_zero) :: terms2 @ [not_false]
  48.306        in
  48.307          SOME [(Ts, subgoal1), (Ts, subgoal2)]
  48.308        end
  48.309      (* ?P (?a - ?b) = ((?a < ?b --> ?P 0) & (ALL d. ?a = ?b + d --> ?P d)) *)
  48.310 -    | (Const (@{const_name Groups.minus}, _), [t1, t2]) =>
  48.311 +    | (Const (\<^const_name>\<open>Groups.minus\<close>, _), [t1, t2]) =>
  48.312        let
  48.313          (* "d" in the above theorem becomes a new bound variable after NNF   *)
  48.314          (* transformation, therefore some adjustment of indices is necessary *)
  48.315          val rev_terms       = rev terms
  48.316 -        val zero            = Const (@{const_name Groups.zero}, split_type)
  48.317 +        val zero            = Const (\<^const_name>\<open>Groups.zero\<close>, split_type)
  48.318          val d               = Bound 0
  48.319          val terms1          = map (subst_term [(split_term, zero)]) rev_terms
  48.320          val terms2          = map (subst_term [(incr_boundvars 1 split_term, d)])
  48.321                                  (map (incr_boundvars 1) rev_terms)
  48.322          val t1'             = incr_boundvars 1 t1
  48.323          val t2'             = incr_boundvars 1 t2
  48.324 -        val t1_lt_t2        = Const (@{const_name Orderings.less},
  48.325 +        val t1_lt_t2        = Const (\<^const_name>\<open>Orderings.less\<close>,
  48.326                                  split_type --> split_type --> HOLogic.boolT) $ t1 $ t2
  48.327 -        val t1_eq_t2_plus_d = Const (@{const_name HOL.eq}, split_type --> split_type --> HOLogic.boolT) $ t1' $
  48.328 -                                (Const (@{const_name Groups.plus},
  48.329 +        val t1_eq_t2_plus_d = Const (\<^const_name>\<open>HOL.eq\<close>, split_type --> split_type --> HOLogic.boolT) $ t1' $
  48.330 +                                (Const (\<^const_name>\<open>Groups.plus\<close>,
  48.331                                    split_type --> split_type --> split_type) $ t2' $ d)
  48.332 -        val not_false       = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  48.333 +        val not_false       = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  48.334          val subgoal1        = (HOLogic.mk_Trueprop t1_lt_t2) :: terms1 @ [not_false]
  48.335          val subgoal2        = (HOLogic.mk_Trueprop t1_eq_t2_plus_d) :: terms2 @ [not_false]
  48.336        in
  48.337 @@ -516,18 +515,18 @@
  48.338      | (Const ("Int.nat", _), (*DYNAMIC BINDING!*) [t1]) =>
  48.339        let
  48.340          val rev_terms   = rev terms
  48.341 -        val zero_int    = Const (@{const_name Groups.zero}, HOLogic.intT)
  48.342 -        val zero_nat    = Const (@{const_name Groups.zero}, HOLogic.natT)
  48.343 +        val zero_int    = Const (\<^const_name>\<open>Groups.zero\<close>, HOLogic.intT)
  48.344 +        val zero_nat    = Const (\<^const_name>\<open>Groups.zero\<close>, HOLogic.natT)
  48.345          val n           = Bound 0
  48.346          val terms1      = map (subst_term [(incr_boundvars 1 split_term, n)])
  48.347                              (map (incr_boundvars 1) rev_terms)
  48.348          val terms2      = map (subst_term [(split_term, zero_nat)]) rev_terms
  48.349          val t1'         = incr_boundvars 1 t1
  48.350 -        val t1_eq_nat_n = Const (@{const_name HOL.eq}, HOLogic.intT --> HOLogic.intT --> HOLogic.boolT) $ t1' $
  48.351 -                            (Const (@{const_name of_nat}, HOLogic.natT --> HOLogic.intT) $ n)
  48.352 -        val t1_lt_zero  = Const (@{const_name Orderings.less},
  48.353 +        val t1_eq_nat_n = Const (\<^const_name>\<open>HOL.eq\<close>, HOLogic.intT --> HOLogic.intT --> HOLogic.boolT) $ t1' $
  48.354 +                            (Const (\<^const_name>\<open>of_nat\<close>, HOLogic.natT --> HOLogic.intT) $ n)
  48.355 +        val t1_lt_zero  = Const (\<^const_name>\<open>Orderings.less\<close>,
  48.356                              HOLogic.intT --> HOLogic.intT --> HOLogic.boolT) $ t1 $ zero_int
  48.357 -        val not_false   = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  48.358 +        val not_false   = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  48.359          val subgoal1    = (HOLogic.mk_Trueprop t1_eq_nat_n) :: terms1 @ [not_false]
  48.360          val subgoal2    = (HOLogic.mk_Trueprop t1_lt_zero) :: terms2 @ [not_false]
  48.361        in
  48.362 @@ -536,10 +535,10 @@
  48.363      (* ?P ((?n::nat) mod (numeral ?k)) =
  48.364           ((numeral ?k = 0 --> ?P ?n) & (~ (numeral ?k = 0) -->
  48.365             (ALL i j. j < numeral ?k --> ?n = numeral ?k * i + j --> ?P j))) *)
  48.366 -    | (Const (@{const_name Rings.modulo}, Type ("fun", [@{typ nat}, _])), [t1, t2]) =>
  48.367 +    | (Const (\<^const_name>\<open>Rings.modulo\<close>, Type ("fun", [\<^typ>\<open>nat\<close>, _])), [t1, t2]) =>
  48.368        let
  48.369          val rev_terms               = rev terms
  48.370 -        val zero                    = Const (@{const_name Groups.zero}, split_type)
  48.371 +        val zero                    = Const (\<^const_name>\<open>Groups.zero\<close>, split_type)
  48.372          val i                       = Bound 1
  48.373          val j                       = Bound 0
  48.374          val terms1                  = map (subst_term [(split_term, t1)]) rev_terms
  48.375 @@ -547,17 +546,17 @@
  48.376                                          (map (incr_boundvars 2) rev_terms)
  48.377          val t1'                     = incr_boundvars 2 t1
  48.378          val t2'                     = incr_boundvars 2 t2
  48.379 -        val t2_eq_zero              = Const (@{const_name HOL.eq},
  48.380 +        val t2_eq_zero              = Const (\<^const_name>\<open>HOL.eq\<close>,
  48.381                                          split_type --> split_type --> HOLogic.boolT) $ t2 $ zero
  48.382 -        val t2_neq_zero             = HOLogic.mk_not (Const (@{const_name HOL.eq},
  48.383 +        val t2_neq_zero             = HOLogic.mk_not (Const (\<^const_name>\<open>HOL.eq\<close>,
  48.384                                          split_type --> split_type --> HOLogic.boolT) $ t2' $ zero)
  48.385 -        val j_lt_t2                 = Const (@{const_name Orderings.less},
  48.386 +        val j_lt_t2                 = Const (\<^const_name>\<open>Orderings.less\<close>,
  48.387                                          split_type --> split_type--> HOLogic.boolT) $ j $ t2'
  48.388 -        val t1_eq_t2_times_i_plus_j = Const (@{const_name HOL.eq}, split_type --> split_type --> HOLogic.boolT) $ t1' $
  48.389 -                                       (Const (@{const_name Groups.plus}, split_type --> split_type --> split_type) $
  48.390 -                                         (Const (@{const_name Groups.times},
  48.391 +        val t1_eq_t2_times_i_plus_j = Const (\<^const_name>\<open>HOL.eq\<close>, split_type --> split_type --> HOLogic.boolT) $ t1' $
  48.392 +                                       (Const (\<^const_name>\<open>Groups.plus\<close>, split_type --> split_type --> split_type) $
  48.393 +                                         (Const (\<^const_name>\<open>Groups.times\<close>,
  48.394                                             split_type --> split_type --> split_type) $ t2' $ i) $ j)
  48.395 -        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  48.396 +        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  48.397          val subgoal1                = (HOLogic.mk_Trueprop t2_eq_zero) :: terms1 @ [not_false]
  48.398          val subgoal2                = (map HOLogic.mk_Trueprop
  48.399                                          [t2_neq_zero, j_lt_t2, t1_eq_t2_times_i_plus_j])
  48.400 @@ -568,10 +567,10 @@
  48.401      (* ?P ((?n::nat) div (numeral ?k)) =
  48.402           ((numeral ?k = 0 --> ?P 0) & (~ (numeral ?k = 0) -->
  48.403             (ALL i j. j < numeral ?k --> ?n = numeral ?k * i + j --> ?P i))) *)
  48.404 -    | (Const (@{const_name Rings.divide}, Type ("fun", [@{typ nat}, _])), [t1, t2]) =>
  48.405 +    | (Const (\<^const_name>\<open>Rings.divide\<close>, Type ("fun", [\<^typ>\<open>nat\<close>, _])), [t1, t2]) =>
  48.406        let
  48.407          val rev_terms               = rev terms
  48.408 -        val zero                    = Const (@{const_name Groups.zero}, split_type)
  48.409 +        val zero                    = Const (\<^const_name>\<open>Groups.zero\<close>, split_type)
  48.410          val i                       = Bound 1
  48.411          val j                       = Bound 0
  48.412          val terms1                  = map (subst_term [(split_term, zero)]) rev_terms
  48.413 @@ -579,17 +578,17 @@
  48.414                                          (map (incr_boundvars 2) rev_terms)
  48.415          val t1'                     = incr_boundvars 2 t1
  48.416          val t2'                     = incr_boundvars 2 t2
  48.417 -        val t2_eq_zero              = Const (@{const_name HOL.eq},
  48.418 +        val t2_eq_zero              = Const (\<^const_name>\<open>HOL.eq\<close>,
  48.419                                          split_type --> split_type --> HOLogic.boolT) $ t2 $ zero
  48.420 -        val t2_neq_zero             = HOLogic.mk_not (Const (@{const_name HOL.eq},
  48.421 +        val t2_neq_zero             = HOLogic.mk_not (Const (\<^const_name>\<open>HOL.eq\<close>,
  48.422                                          split_type --> split_type --> HOLogic.boolT) $ t2' $ zero)
  48.423 -        val j_lt_t2                 = Const (@{const_name Orderings.less},
  48.424 +        val j_lt_t2                 = Const (\<^const_name>\<open>Orderings.less\<close>,
  48.425                                          split_type --> split_type--> HOLogic.boolT) $ j $ t2'
  48.426 -        val t1_eq_t2_times_i_plus_j = Const (@{const_name HOL.eq}, split_type --> split_type --> HOLogic.boolT) $ t1' $
  48.427 -                                       (Const (@{const_name Groups.plus}, split_type --> split_type --> split_type) $
  48.428 -                                         (Const (@{const_name Groups.times},
  48.429 +        val t1_eq_t2_times_i_plus_j = Const (\<^const_name>\<open>HOL.eq\<close>, split_type --> split_type --> HOLogic.boolT) $ t1' $
  48.430 +                                       (Const (\<^const_name>\<open>Groups.plus\<close>, split_type --> split_type --> split_type) $
  48.431 +                                         (Const (\<^const_name>\<open>Groups.times\<close>,
  48.432                                             split_type --> split_type --> split_type) $ t2' $ i) $ j)
  48.433 -        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  48.434 +        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  48.435          val subgoal1                = (HOLogic.mk_Trueprop t2_eq_zero) :: terms1 @ [not_false]
  48.436          val subgoal2                = (map HOLogic.mk_Trueprop
  48.437                                          [t2_neq_zero, j_lt_t2, t1_eq_t2_times_i_plus_j])
  48.438 @@ -605,11 +604,11 @@
  48.439            (numeral ?k < 0 -->
  48.440              (ALL i j.
  48.441                numeral ?k < j & j <= 0 & ?n = numeral ?k * i + j --> ?P j))) *)
  48.442 -    | (Const (@{const_name Rings.modulo},
  48.443 +    | (Const (\<^const_name>\<open>Rings.modulo\<close>,
  48.444          Type ("fun", [Type ("Int.int", []), _])), (*DYNAMIC BINDING!*) [t1, t2]) =>
  48.445        let
  48.446          val rev_terms               = rev terms
  48.447 -        val zero                    = Const (@{const_name Groups.zero}, split_type)
  48.448 +        val zero                    = Const (\<^const_name>\<open>Groups.zero\<close>, split_type)
  48.449          val i                       = Bound 1
  48.450          val j                       = Bound 0
  48.451          val terms1                  = map (subst_term [(split_term, t1)]) rev_terms
  48.452 @@ -617,25 +616,25 @@
  48.453                                          (map (incr_boundvars 2) rev_terms)
  48.454          val t1'                     = incr_boundvars 2 t1
  48.455          val t2'                     = incr_boundvars 2 t2
  48.456 -        val t2_eq_zero              = Const (@{const_name HOL.eq},
  48.457 +        val t2_eq_zero              = Const (\<^const_name>\<open>HOL.eq\<close>,
  48.458                                          split_type --> split_type --> HOLogic.boolT) $ t2 $ zero
  48.459 -        val zero_lt_t2              = Const (@{const_name Orderings.less},
  48.460 +        val zero_lt_t2              = Const (\<^const_name>\<open>Orderings.less\<close>,
  48.461                                          split_type --> split_type --> HOLogic.boolT) $ zero $ t2'
  48.462 -        val t2_lt_zero              = Const (@{const_name Orderings.less},
  48.463 +        val t2_lt_zero              = Const (\<^const_name>\<open>Orderings.less\<close>,
  48.464                                          split_type --> split_type --> HOLogic.boolT) $ t2' $ zero
  48.465 -        val zero_leq_j              = Const (@{const_name Orderings.less_eq},
  48.466 +        val zero_leq_j              = Const (\<^const_name>\<open>Orderings.less_eq\<close>,
  48.467                                          split_type --> split_type --> HOLogic.boolT) $ zero $ j
  48.468 -        val j_leq_zero              = Const (@{const_name Orderings.less_eq},
  48.469 +        val j_leq_zero              = Const (\<^const_name>\<open>Orderings.less_eq\<close>,
  48.470                                          split_type --> split_type --> HOLogic.boolT) $ j $ zero
  48.471 -        val j_lt_t2                 = Const (@{const_name Orderings.less},
  48.472 +        val j_lt_t2                 = Const (\<^const_name>\<open>Orderings.less\<close>,
  48.473                                          split_type --> split_type--> HOLogic.boolT) $ j $ t2'
  48.474 -        val t2_lt_j                 = Const (@{const_name Orderings.less},
  48.475 +        val t2_lt_j                 = Const (\<^const_name>\<open>Orderings.less\<close>,
  48.476                                          split_type --> split_type--> HOLogic.boolT) $ t2' $ j
  48.477 -        val t1_eq_t2_times_i_plus_j = Const (@{const_name HOL.eq}, split_type --> split_type --> HOLogic.boolT) $ t1' $
  48.478 -                                       (Const (@{const_name Groups.plus}, split_type --> split_type --> split_type) $
  48.479 -                                         (Const (@{const_name Groups.times},
  48.480 +        val t1_eq_t2_times_i_plus_j = Const (\<^const_name>\<open>HOL.eq\<close>, split_type --> split_type --> HOLogic.boolT) $ t1' $
  48.481 +                                       (Const (\<^const_name>\<open>Groups.plus\<close>, split_type --> split_type --> split_type) $
  48.482 +                                         (Const (\<^const_name>\<open>Groups.times\<close>,
  48.483                                             split_type --> split_type --> split_type) $ t2' $ i) $ j)
  48.484 -        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  48.485 +        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  48.486          val subgoal1                = (HOLogic.mk_Trueprop t2_eq_zero) :: terms1 @ [not_false]
  48.487          val subgoal2                = (map HOLogic.mk_Trueprop [zero_lt_t2, zero_leq_j])
  48.488                                          @ hd terms2_3
  48.489 @@ -659,11 +658,11 @@
  48.490            (numeral ?k < 0 -->
  48.491              (ALL i j.
  48.492                numeral ?k < j & j <= 0 & ?n = numeral ?k * i + j --> ?P i))) *)
  48.493 -    | (Const (@{const_name Rings.divide},
  48.494 +    | (Const (\<^const_name>\<open>Rings.divide\<close>,
  48.495          Type ("fun", [Type ("Int.int", []), _])), (*DYNAMIC BINDING!*) [t1, t2]) =>
  48.496        let
  48.497          val rev_terms               = rev terms
  48.498 -        val zero                    = Const (@{const_name Groups.zero}, split_type)
  48.499 +        val zero                    = Const (\<^const_name>\<open>Groups.zero\<close>, split_type)
  48.500          val i                       = Bound 1
  48.501          val j                       = Bound 0
  48.502          val terms1                  = map (subst_term [(split_term, zero)]) rev_terms
  48.503 @@ -671,25 +670,25 @@
  48.504                                          (map (incr_boundvars 2) rev_terms)
  48.505          val t1'                     = incr_boundvars 2 t1
  48.506          val t2'                     = incr_boundvars 2 t2
  48.507 -        val t2_eq_zero              = Const (@{const_name HOL.eq},
  48.508 +        val t2_eq_zero              = Const (\<^const_name>\<open>HOL.eq\<close>,
  48.509                                          split_type --> split_type --> HOLogic.boolT) $ t2 $ zero
  48.510 -        val zero_lt_t2              = Const (@{const_name Orderings.less},
  48.511 +        val zero_lt_t2              = Const (\<^const_name>\<open>Orderings.less\<close>,
  48.512                                          split_type --> split_type --> HOLogic.boolT) $ zero $ t2'
  48.513 -        val t2_lt_zero              = Const (@{const_name Orderings.less},
  48.514 +        val t2_lt_zero              = Const (\<^const_name>\<open>Orderings.less\<close>,
  48.515                                          split_type --> split_type --> HOLogic.boolT) $ t2' $ zero
  48.516 -        val zero_leq_j              = Const (@{const_name Orderings.less_eq},
  48.517 +        val zero_leq_j              = Const (\<^const_name>\<open>Orderings.less_eq\<close>,
  48.518                                          split_type --> split_type --> HOLogic.boolT) $ zero $ j
  48.519 -        val j_leq_zero              = Const (@{const_name Orderings.less_eq},
  48.520 +        val j_leq_zero              = Const (\<^const_name>\<open>Orderings.less_eq\<close>,
  48.521                                          split_type --> split_type --> HOLogic.boolT) $ j $ zero
  48.522 -        val j_lt_t2                 = Const (@{const_name Orderings.less},
  48.523 +        val j_lt_t2                 = Const (\<^const_name>\<open>Orderings.less\<close>,
  48.524                                          split_type --> split_type--> HOLogic.boolT) $ j $ t2'
  48.525 -        val t2_lt_j                 = Const (@{const_name Orderings.less},
  48.526 +        val t2_lt_j                 = Const (\<^const_name>\<open>Orderings.less\<close>,
  48.527                                          split_type --> split_type--> HOLogic.boolT) $ t2' $ j
  48.528 -        val t1_eq_t2_times_i_plus_j = Const (@{const_name HOL.eq}, split_type --> split_type --> HOLogic.boolT) $ t1' $
  48.529 -                                       (Const (@{const_name Groups.plus}, split_type --> split_type --> split_type) $
  48.530 -                                         (Const (@{const_name Groups.times},
  48.531 +        val t1_eq_t2_times_i_plus_j = Const (\<^const_name>\<open>HOL.eq\<close>, split_type --> split_type --> HOLogic.boolT) $ t1' $
  48.532 +                                       (Const (\<^const_name>\<open>Groups.plus\<close>, split_type --> split_type --> split_type) $
  48.533 +                                         (Const (\<^const_name>\<open>Groups.times\<close>,
  48.534                                             split_type --> split_type --> split_type) $ t2' $ i) $ j)
  48.535 -        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  48.536 +        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  48.537          val subgoal1                = (HOLogic.mk_Trueprop t2_eq_zero) :: terms1 @ [not_false]
  48.538          val subgoal2                = (map HOLogic.mk_Trueprop [zero_lt_t2, zero_leq_j])
  48.539                                          @ hd terms2_3
  48.540 @@ -734,7 +733,7 @@
  48.541  
  48.542  fun negated_term_occurs_positively (terms : term list) : bool =
  48.543    exists
  48.544 -    (fn (Trueprop $ (Const (@{const_name Not}, _) $ t)) =>
  48.545 +    (fn (Trueprop $ (Const (\<^const_name>\<open>Not\<close>, _) $ t)) =>
  48.546        member Envir.aeconv terms (Trueprop $ t)
  48.547        | _ => false)
  48.548      terms;
  48.549 @@ -959,9 +958,9 @@
  48.550  val global_setup =
  48.551    map_theory_simpset (fn ctxt => ctxt
  48.552      addSolver (mk_solver "lin_arith" (add_arith_facts #> Fast_Arith.prems_lin_arith_tac))) #>
  48.553 -  Attrib.setup @{binding arith_split} (Scan.succeed (Thm.declaration_attribute add_split))
  48.554 +  Attrib.setup \<^binding>\<open>arith_split\<close> (Scan.succeed (Thm.declaration_attribute add_split))
  48.555      "declaration of split rules for arithmetic procedure" #>
  48.556 -  Method.setup @{binding linarith}
  48.557 +  Method.setup \<^binding>\<open>linarith\<close>
  48.558      (Scan.succeed (fn ctxt =>
  48.559        METHOD (fn facts =>
  48.560          HEADGOAL
  48.561 @@ -972,7 +971,7 @@
  48.562  
  48.563  val setup =
  48.564    init_arith_data
  48.565 -  #> add_discrete_type @{type_name nat}
  48.566 +  #> add_discrete_type \<^type_name>\<open>nat\<close>
  48.567    #> add_lessD @{thm Suc_leI}
  48.568    #> add_simps (@{thms simp_thms} @ @{thms ring_distribs} @ [@{thm if_True}, @{thm if_False},
  48.569        @{thm minus_diff_eq},
  48.570 @@ -982,11 +981,11 @@
  48.571    #> add_simps [@{thm add_Suc}, @{thm add_Suc_right}, @{thm nat.inject},
  48.572        @{thm Suc_le_mono}, @{thm Suc_less_eq}, @{thm Zero_not_Suc},
  48.573        @{thm Suc_not_Zero}, @{thm le_0_eq}, @{thm One_nat_def}]
  48.574 -  #> add_simprocs [@{simproc group_cancel_add}, @{simproc group_cancel_diff},
  48.575 -      @{simproc group_cancel_eq}, @{simproc group_cancel_le},
  48.576 -      @{simproc group_cancel_less}]
  48.577 +  #> add_simprocs [\<^simproc>\<open>group_cancel_add\<close>, \<^simproc>\<open>group_cancel_diff\<close>,
  48.578 +      \<^simproc>\<open>group_cancel_eq\<close>, \<^simproc>\<open>group_cancel_le\<close>,
  48.579 +      \<^simproc>\<open>group_cancel_less\<close>]
  48.580       (*abel_cancel helps it work in abstract algebraic domains*)
  48.581 -  #> add_simprocs [@{simproc nateq_cancel_sums},@{simproc natless_cancel_sums},
  48.582 -      @{simproc natle_cancel_sums}];
  48.583 +  #> add_simprocs [\<^simproc>\<open>nateq_cancel_sums\<close>,\<^simproc>\<open>natless_cancel_sums\<close>,
  48.584 +      \<^simproc>\<open>natle_cancel_sums\<close>];
  48.585  
  48.586  end;
    49.1 --- a/src/HOL/Tools/monomorph.ML	Wed Dec 06 19:34:59 2017 +0100
    49.2 +++ b/src/HOL/Tools/monomorph.ML	Wed Dec 06 20:43:09 2017 +0100
    49.3 @@ -63,16 +63,16 @@
    49.4  
    49.5  (* configuration options *)
    49.6  
    49.7 -val max_rounds = Attrib.setup_config_int @{binding monomorph_max_rounds} (K 5)
    49.8 +val max_rounds = Attrib.setup_config_int \<^binding>\<open>monomorph_max_rounds\<close> (K 5)
    49.9  
   49.10  val max_new_instances =
   49.11 -  Attrib.setup_config_int @{binding monomorph_max_new_instances} (K 500)
   49.12 +  Attrib.setup_config_int \<^binding>\<open>monomorph_max_new_instances\<close> (K 500)
   49.13  
   49.14  val max_thm_instances =
   49.15 -  Attrib.setup_config_int @{binding monomorph_max_thm_instances} (K 20)
   49.16 +  Attrib.setup_config_int \<^binding>\<open>monomorph_max_thm_instances\<close> (K 20)
   49.17  
   49.18  val max_new_const_instances_per_round =
   49.19 -  Attrib.setup_config_int @{binding monomorph_max_new_const_instances_per_round} (K 5)
   49.20 +  Attrib.setup_config_int \<^binding>\<open>monomorph_max_new_const_instances_per_round\<close> (K 5)
   49.21  
   49.22  fun limit_rounds ctxt f =
   49.23    let
    50.1 --- a/src/HOL/Tools/nat_arith.ML	Wed Dec 06 19:34:59 2017 +0100
    50.2 +++ b/src/HOL/Tools/nat_arith.ML	Wed Dec 06 20:43:09 2017 +0100
    50.3 @@ -30,11 +30,11 @@
    50.4      [Conv.rewr_conv (Library.foldl (op RS) (rule0, path)),
    50.5       Conv.arg_conv (Raw_Simplifier.rewrite ctxt false norm_rules)]
    50.6  
    50.7 -fun add_atoms path (Const (@{const_name Groups.plus}, _) $ x $ y) =
    50.8 +fun add_atoms path (Const (\<^const_name>\<open>Groups.plus\<close>, _) $ x $ y) =
    50.9        add_atoms (add1::path) x #> add_atoms (add2::path) y
   50.10 -  | add_atoms path (Const (@{const_name Nat.Suc}, _) $ x) =
   50.11 +  | add_atoms path (Const (\<^const_name>\<open>Nat.Suc\<close>, _) $ x) =
   50.12        add_atoms (suc1::path) x
   50.13 -  | add_atoms _ (Const (@{const_name Groups.zero}, _)) = I
   50.14 +  | add_atoms _ (Const (\<^const_name>\<open>Groups.zero\<close>, _)) = I
   50.15    | add_atoms path x = cons (x, path)
   50.16  
   50.17  fun atoms t = add_atoms [] t []
    51.1 --- a/src/HOL/Tools/record.ML	Wed Dec 06 19:34:59 2017 +0100
    51.2 +++ b/src/HOL/Tools/record.ML	Wed Dec 06 20:43:09 2017 +0100
    51.3 @@ -73,7 +73,7 @@
    51.4  val iso_tuple_intro = @{thm isomorphic_tuple_intro};
    51.5  val iso_tuple_intros = Tactic.build_net @{thms isomorphic_tuple.intros};
    51.6  
    51.7 -val tuple_iso_tuple = (@{const_name Record.tuple_iso_tuple}, @{thm tuple_iso_tuple});
    51.8 +val tuple_iso_tuple = (\<^const_name>\<open>Record.tuple_iso_tuple\<close>, @{thm tuple_iso_tuple});
    51.9  
   51.10  structure Iso_Tuple_Thms = Theory_Data
   51.11  (
   51.12 @@ -111,13 +111,13 @@
   51.13    let
   51.14      val (leftT, rightT) = (fastype_of left, fastype_of right);
   51.15      val prodT = HOLogic.mk_prodT (leftT, rightT);
   51.16 -    val isomT = Type (@{type_name tuple_isomorphism}, [prodT, leftT, rightT]);
   51.17 +    val isomT = Type (\<^type_name>\<open>tuple_isomorphism\<close>, [prodT, leftT, rightT]);
   51.18    in
   51.19 -    Const (@{const_name Record.iso_tuple_cons}, isomT --> leftT --> rightT --> prodT) $
   51.20 +    Const (\<^const_name>\<open>Record.iso_tuple_cons\<close>, isomT --> leftT --> rightT --> prodT) $
   51.21        Const (fst tuple_iso_tuple, isomT) $ left $ right
   51.22    end;
   51.23  
   51.24 -fun dest_cons_tuple (Const (@{const_name Record.iso_tuple_cons}, _) $ Const _ $ t $ u) = (t, u)
   51.25 +fun dest_cons_tuple (Const (\<^const_name>\<open>Record.iso_tuple_cons\<close>, _) $ Const _ $ t $ u) = (t, u)
   51.26    | dest_cons_tuple t = raise TERM ("dest_cons_tuple", [t]);
   51.27  
   51.28  fun add_iso_tuple_type overloaded (b, alphas) (leftT, rightT) thy =
   51.29 @@ -149,7 +149,7 @@
   51.30          [((Binding.concealed (Thm.def_binding isom_binding), Logic.mk_equals (isom, body)), [])];
   51.31  
   51.32      val iso_tuple = isom_def RS (abs_inverse RS (rep_inject RS iso_tuple_intro));
   51.33 -    val cons = Const (@{const_name Record.iso_tuple_cons}, isomT --> leftT --> rightT --> absT);
   51.34 +    val cons = Const (\<^const_name>\<open>Record.iso_tuple_cons\<close>, isomT --> leftT --> rightT --> absT);
   51.35  
   51.36      val thm_thy =
   51.37        cdef_thy
   51.38 @@ -171,8 +171,8 @@
   51.39        val goal' = Envir.beta_eta_contract goal;
   51.40        val is =
   51.41          (case goal' of
   51.42 -          Const (@{const_name Trueprop}, _) $
   51.43 -            (Const (@{const_name isomorphic_tuple}, _) $ Const is) => is
   51.44 +          Const (\<^const_name>\<open>Trueprop\<close>, _) $
   51.45 +            (Const (\<^const_name>\<open>isomorphic_tuple\<close>, _) $ Const is) => is
   51.46          | _ => err "unexpected goal format" goal');
   51.47        val isthm =
   51.48          (case Symtab.lookup isthms (#1 is) of
   51.49 @@ -202,7 +202,7 @@
   51.50  val updacc_cong_triv = @{thm update_accessor_cong_assist_triv};
   51.51  val updacc_cong_from_eq = @{thm iso_tuple_update_accessor_cong_from_eq};
   51.52  
   51.53 -val codegen = Attrib.setup_config_bool @{binding record_codegen} (K true);
   51.54 +val codegen = Attrib.setup_config_bool \<^binding>\<open>record_codegen\<close> (K true);
   51.55  
   51.56  
   51.57  (** name components **)
   51.58 @@ -229,7 +229,7 @@
   51.59  
   51.60  (* timing *)
   51.61  
   51.62 -val timing = Attrib.setup_config_bool @{binding record_timing} (K false);
   51.63 +val timing = Attrib.setup_config_bool \<^binding>\<open>record_timing\<close> (K false);
   51.64  fun timeit_msg ctxt s x = if Config.get ctxt timing then (warning s; timeit x) else x ();
   51.65  fun timing_msg ctxt s = if Config.get ctxt timing then warning s else ();
   51.66  
   51.67 @@ -628,11 +628,11 @@
   51.68    | split_args (_ :: _) [] = raise Fail "expecting more fields"
   51.69    | split_args _ _ = ([], []);
   51.70  
   51.71 -fun field_type_tr ((Const (@{syntax_const "_field_type"}, _) $ Const (name, _) $ arg)) =
   51.72 +fun field_type_tr ((Const (\<^syntax_const>\<open>_field_type\<close>, _) $ Const (name, _) $ arg)) =
   51.73        (name, arg)
   51.74    | field_type_tr t = raise TERM ("field_type_tr", [t]);
   51.75  
   51.76 -fun field_types_tr (Const (@{syntax_const "_field_types"}, _) $ t $ u) =
   51.77 +fun field_types_tr (Const (\<^syntax_const>\<open>_field_types\<close>, _) $ t $ u) =
   51.78        field_type_tr t :: field_types_tr u
   51.79    | field_types_tr t = [field_type_tr t];
   51.80  
   51.81 @@ -673,17 +673,17 @@
   51.82      mk_ext (field_types_tr t)
   51.83    end;
   51.84  
   51.85 -fun record_type_tr ctxt [t] = record_field_types_tr (Syntax.const @{type_syntax unit}) ctxt t
   51.86 +fun record_type_tr ctxt [t] = record_field_types_tr (Syntax.const \<^type_syntax>\<open>unit\<close>) ctxt t
   51.87    | record_type_tr _ ts = raise TERM ("record_type_tr", ts);
   51.88  
   51.89  fun record_type_scheme_tr ctxt [t, more] = record_field_types_tr more ctxt t
   51.90    | record_type_scheme_tr _ ts = raise TERM ("record_type_scheme_tr", ts);
   51.91  
   51.92  
   51.93 -fun field_tr ((Const (@{syntax_const "_field"}, _) $ Const (name, _) $ arg)) = (name, arg)
   51.94 +fun field_tr ((Const (\<^syntax_const>\<open>_field\<close>, _) $ Const (name, _) $ arg)) = (name, arg)
   51.95    | field_tr t = raise TERM ("field_tr", [t]);
   51.96  
   51.97 -fun fields_tr (Const (@{syntax_const "_fields"}, _) $ t $ u) = field_tr t :: fields_tr u
   51.98 +fun fields_tr (Const (\<^syntax_const>\<open>_fields\<close>, _) $ t $ u) = field_tr t :: fields_tr u
   51.99    | fields_tr t = [field_tr t];
  51.100  
  51.101  fun record_fields_tr more ctxt t =
  51.102 @@ -706,18 +706,18 @@
  51.103        | mk_ext [] = more;
  51.104    in mk_ext (fields_tr t) end;
  51.105  
  51.106 -fun record_tr ctxt [t] = record_fields_tr (Syntax.const @{const_syntax Unity}) ctxt t
  51.107 +fun record_tr ctxt [t] = record_fields_tr (Syntax.const \<^const_syntax>\<open>Unity\<close>) ctxt t
  51.108    | record_tr _ ts = raise TERM ("record_tr", ts);
  51.109  
  51.110  fun record_scheme_tr ctxt [t, more] = record_fields_tr more ctxt t
  51.111    | record_scheme_tr _ ts = raise TERM ("record_scheme_tr", ts);
  51.112  
  51.113  
  51.114 -fun field_update_tr (Const (@{syntax_const "_field_update"}, _) $ Const (name, _) $ arg) =
  51.115 +fun field_update_tr (Const (\<^syntax_const>\<open>_field_update\<close>, _) $ Const (name, _) $ arg) =
  51.116        Syntax.const (suffix updateN name) $ Abs (Name.uu_, dummyT, arg)
  51.117    | field_update_tr t = raise TERM ("field_update_tr", [t]);
  51.118  
  51.119 -fun field_updates_tr (Const (@{syntax_const "_field_updates"}, _) $ t $ u) =
  51.120 +fun field_updates_tr (Const (\<^syntax_const>\<open>_field_updates\<close>, _) $ t $ u) =
  51.121        field_update_tr t :: field_updates_tr u
  51.122    | field_updates_tr t = [field_update_tr t];
  51.123  
  51.124 @@ -729,28 +729,28 @@
  51.125  val _ =
  51.126    Theory.setup
  51.127     (Sign.parse_translation
  51.128 -     [(@{syntax_const "_record_update"}, K record_update_tr),
  51.129 -      (@{syntax_const "_record"}, record_tr),
  51.130 -      (@{syntax_const "_record_scheme"}, record_scheme_tr),
  51.131 -      (@{syntax_const "_record_type"}, record_type_tr),
  51.132 -      (@{syntax_const "_record_type_scheme"}, record_type_scheme_tr)]);
  51.133 +     [(\<^syntax_const>\<open>_record_update\<close>, K record_update_tr),
  51.134 +      (\<^syntax_const>\<open>_record\<close>, record_tr),
  51.135 +      (\<^syntax_const>\<open>_record_scheme\<close>, record_scheme_tr),
  51.136 +      (\<^syntax_const>\<open>_record_type\<close>, record_type_tr),
  51.137 +      (\<^syntax_const>\<open>_record_type_scheme\<close>, record_type_scheme_tr)]);
  51.138  
  51.139  end;
  51.140  
  51.141  
  51.142  (* print translations *)
  51.143  
  51.144 -val type_abbr = Attrib.setup_config_bool @{binding record_type_abbr} (K true);
  51.145 -val type_as_fields = Attrib.setup_config_bool @{binding record_type_as_fields} (K true);
  51.146 +val type_abbr = Attrib.setup_config_bool \<^binding>\<open>record_type_abbr\<close> (K true);
  51.147 +val type_as_fields = Attrib.setup_config_bool \<^binding>\<open>record_type_as_fields\<close> (K true);
  51.148  
  51.149  
  51.150  local
  51.151  
  51.152  (* FIXME early extern (!??) *)
  51.153  (* FIXME Syntax.free (??) *)
  51.154 -fun field_type_tr' (c, t) = Syntax.const @{syntax_const "_field_type"} $ Syntax.const c $ t;
  51.155 -
  51.156 -fun field_types_tr' (t, u) = Syntax.const @{syntax_const "_field_types"} $ t $ u;
  51.157 +fun field_type_tr' (c, t) = Syntax.const \<^syntax_const>\<open>_field_type\<close> $ Syntax.const c $ t;
  51.158 +
  51.159 +fun field_types_tr' (t, u) = Syntax.const \<^syntax_const>\<open>_field_types\<close> $ t $ u;
  51.160  
  51.161  fun record_type_tr' ctxt t =
  51.162    let
  51.163 @@ -791,9 +791,9 @@
  51.164          (map (field_type_tr' o apsnd (Syntax_Phases.term_of_typ ctxt)) fields);
  51.165    in
  51.166      if not (Config.get ctxt type_as_fields) orelse null fields then raise Match
  51.167 -    else if moreT = HOLogic.unitT then Syntax.const @{syntax_const "_record_type"} $ u
  51.168 +    else if moreT = HOLogic.unitT then Syntax.const \<^syntax_const>\<open>_record_type\<close> $ u
  51.169      else
  51.170 -      Syntax.const @{syntax_const "_record_type_scheme"} $ u $
  51.171 +      Syntax.const \<^syntax_const>\<open>_record_type_scheme\<close> $ u $
  51.172          Syntax_Phases.term_of_typ ctxt moreT
  51.173    end;
  51.174  
  51.175 @@ -847,8 +847,8 @@
  51.176  local
  51.177  
  51.178  (* FIXME Syntax.free (??) *)
  51.179 -fun field_tr' (c, t) = Syntax.const @{syntax_const "_field"} $ Syntax.const c $ t;
  51.180 -fun fields_tr' (t, u) = Syntax.const @{syntax_const "_fields"} $ t $ u;
  51.181 +fun field_tr' (c, t) = Syntax.const \<^syntax_const>\<open>_field\<close> $ Syntax.const c $ t;
  51.182 +fun fields_tr' (t, u) = Syntax.const \<^syntax_const>\<open>_fields\<close> $ t $ u;
  51.183  
  51.184  fun record_tr' ctxt t =
  51.185    let
  51.186 @@ -876,8 +876,8 @@
  51.187      val u = foldr1 fields_tr' (map field_tr' fields);
  51.188    in
  51.189      (case more of
  51.190 -      Const (@{const_syntax Unity}, _) => Syntax.const @{syntax_const "_record"} $ u
  51.191 -    | _ => Syntax.const @{syntax_const "_record_scheme"} $ u $ more)
  51.192 +      Const (\<^const_syntax>\<open>Unity\<close>, _) => Syntax.const \<^syntax_const>\<open>_record\<close> $ u
  51.193 +    | _ => Syntax.const \<^syntax_const>\<open>_record_scheme\<close> $ u $ more)
  51.194    end;
  51.195  
  51.196  in
  51.197 @@ -903,7 +903,7 @@
  51.198          SOME name =>
  51.199            (case try Syntax_Trans.const_abs_tr' k of
  51.200              SOME t =>
  51.201 -              apfst (cons (Syntax.const @{syntax_const "_field_update"} $ Syntax.free name $ t))
  51.202 +              apfst (cons (Syntax.const \<^syntax_const>\<open>_field_update\<close> $ Syntax.free name $ t))
  51.203                  (field_updates_tr' ctxt u)
  51.204            | NONE => ([], tm))
  51.205        | NONE => ([], tm))
  51.206 @@ -913,8 +913,8 @@
  51.207    (case field_updates_tr' ctxt tm of
  51.208      ([], _) => raise Match
  51.209    | (ts, u) =>
  51.210 -      Syntax.const @{syntax_const "_record_update"} $ u $
  51.211 -        foldr1 (fn (v, w) => Syntax.const @{syntax_const "_field_updates"} $ v $ w) (rev ts));
  51.212 +      Syntax.const \<^syntax_const>\<open>_record_update\<close> $ u $
  51.213 +        foldr1 (fn (v, w) => Syntax.const \<^syntax_const>\<open>_field_updates\<close> $ v $ w) (rev ts));
  51.214  
  51.215  in
  51.216  
  51.217 @@ -938,7 +938,7 @@
  51.218  
  51.219  fun mk_comp_id f =
  51.220    let val T = range_type (fastype_of f)
  51.221 -  in HOLogic.mk_comp (Const (@{const_name Fun.id}, T --> T), f) end;
  51.222 +  in HOLogic.mk_comp (Const (\<^const_name>\<open>Fun.id\<close>, T --> T), f) end;
  51.223  
  51.224  fun get_upd_funs (upd $ _ $ t) = upd :: get_upd_funs t
  51.225    | get_upd_funs _ = [];
  51.226 @@ -1063,7 +1063,7 @@
  51.227  *)
  51.228  val simproc =
  51.229    Simplifier.make_simproc @{context} "record"
  51.230 -   {lhss = [@{term "x::'a::{}"}],
  51.231 +   {lhss = [\<^term>\<open>x::'a::{}\<close>],
  51.232      proc = fn _ => fn ctxt => fn ct =>
  51.233        let
  51.234          val thy = Proof_Context.theory_of ctxt;
  51.235 @@ -1147,7 +1147,7 @@
  51.236    both a more update and an update to a field within it.*)
  51.237  val upd_simproc =
  51.238    Simplifier.make_simproc @{context} "record_upd"
  51.239 -   {lhss = [@{term "x::'a::{}"}],
  51.240 +   {lhss = [\<^term>\<open>x::'a::{}\<close>],
  51.241      proc = fn _ => fn ctxt => fn ct =>
  51.242        let
  51.243          val thy = Proof_Context.theory_of ctxt;
  51.244 @@ -1218,7 +1218,7 @@
  51.245                  val (isnoop, skelf') = is_upd_noop s f term;
  51.246                  val funT = domain_type T;
  51.247                  fun mk_comp_local (f, f') =
  51.248 -                  Const (@{const_name Fun.comp}, funT --> funT --> funT) $ f $ f';
  51.249 +                  Const (\<^const_name>\<open>Fun.comp\<close>, funT --> funT --> funT) $ f $ f';
  51.250                in
  51.251                  if isnoop then
  51.252                    (upd $ skelf' $ lhs, rhs, vars,
  51.253 @@ -1270,10 +1270,10 @@
  51.254  *)
  51.255  val eq_simproc =
  51.256    Simplifier.make_simproc @{context} "record_eq"
  51.257 -   {lhss = [@{term "r = s"}],
  51.258 +   {lhss = [\<^term>\<open>r = s\<close>],
  51.259      proc = fn _ => fn ctxt => fn ct =>
  51.260        (case Thm.term_of ct of
  51.261 -        Const (@{const_name HOL.eq}, Type (_, [T, _])) $ _ $ _ =>
  51.262 +        Const (\<^const_name>\<open>HOL.eq\<close>, Type (_, [T, _])) $ _ $ _ =>
  51.263            (case rec_id ~1 T of
  51.264              "" => NONE
  51.265            | name =>
  51.266 @@ -1292,13 +1292,13 @@
  51.267      P t > 0: split up to given bound of record extensions.*)
  51.268  fun split_simproc P =
  51.269    Simplifier.make_simproc @{context} "record_split"
  51.270 -   {lhss = [@{term "x::'a::{}"}],
  51.271 +   {lhss = [\<^term>\<open>x::'a::{}\<close>],
  51.272      proc = fn _ => fn ctxt => fn ct =>
  51.273        (case Thm.term_of ct of
  51.274          Const (quantifier, Type (_, [Type (_, [T, _]), _])) $ _ =>
  51.275 -          if quantifier = @{const_name Pure.all} orelse
  51.276 -            quantifier = @{const_name All} orelse
  51.277 -            quantifier = @{const_name Ex}
  51.278 +          if quantifier = \<^const_name>\<open>Pure.all\<close> orelse
  51.279 +            quantifier = \<^const_name>\<open>All\<close> orelse
  51.280 +            quantifier = \<^const_name>\<open>Ex\<close>
  51.281            then
  51.282              (case rec_id ~1 T of
  51.283                "" => NONE
  51.284 @@ -1310,9 +1310,9 @@
  51.285                      | SOME (all_thm, All_thm, Ex_thm, _) =>
  51.286                          SOME
  51.287                            (case quantifier of
  51.288 -                            @{const_name Pure.all} => all_thm
  51.289 -                          | @{const_name All} => All_thm RS @{thm eq_reflection}
  51.290 -                          | @{const_name Ex} => Ex_thm RS @{thm eq_reflection}
  51.291 +                            \<^const_name>\<open>Pure.all\<close> => all_thm
  51.292 +                          | \<^const_name>\<open>All\<close> => All_thm RS @{thm eq_reflection}
  51.293 +                          | \<^const_name>\<open>Ex\<close> => Ex_thm RS @{thm eq_reflection}
  51.294                            | _ => raise Fail "split_simproc"))
  51.295                    else NONE
  51.296                  end)
  51.297 @@ -1321,7 +1321,7 @@
  51.298  
  51.299  val ex_sel_eq_simproc =
  51.300    Simplifier.make_simproc @{context} "ex_sel_eq"
  51.301 -   {lhss = [@{term "Ex t"}],
  51.302 +   {lhss = [\<^term>\<open>Ex t\<close>],
  51.303      proc = fn _ => fn ctxt => fn ct =>
  51.304        let
  51.305          val thy = Proof_Context.theory_of ctxt;
  51.306 @@ -1335,23 +1335,23 @@
  51.307                  else raise TERM ("", [x]);
  51.308                val sel' = Const (sel, Tsel) $ Bound 0;
  51.309                val (l, r) = if lr then (sel', x') else (x', sel');
  51.310 -            in Const (@{const_name HOL.eq}, Teq) $ l $ r end
  51.311 +            in Const (\<^const_name>\<open>HOL.eq\<close>, Teq) $ l $ r end
  51.312            else raise TERM ("", [Const (sel, Tsel)]);
  51.313  
  51.314 -        fun dest_sel_eq (Const (@{const_name HOL.eq}, Teq) $ (Const (sel, Tsel) $ Bound 0) $ X) =
  51.315 +        fun dest_sel_eq (Const (\<^const_name>\<open>HOL.eq\<close>, Teq) $ (Const (sel, Tsel) $ Bound 0) $ X) =
  51.316                (true, Teq, (sel, Tsel), X)
  51.317 -          | dest_sel_eq (Const (@{const_name HOL.eq}, Teq) $ X $ (Const (sel, Tsel) $ Bound 0)) =
  51.318 +          | dest_sel_eq (Const (\<^const_name>\<open>HOL.eq\<close>, Teq) $ X $ (Const (sel, Tsel) $ Bound 0)) =
  51.319                (false, Teq, (sel, Tsel), X)
  51.320            | dest_sel_eq _ = raise TERM ("", []);
  51.321        in
  51.322          (case t of
  51.323 -          Const (@{const_name Ex}, Tex) $ Abs (s, T, t) =>
  51.324 +          Const (\<^const_name>\<open>Ex\<close>, Tex) $ Abs (s, T, t) =>
  51.325             (let
  51.326               val eq = mkeq (dest_sel_eq t) 0;
  51.327               val prop =
  51.328                 Logic.list_all ([("r", T)],
  51.329                   Logic.mk_equals
  51.330 -                  (Const (@{const_name Ex}, Tex) $ Abs (s, T, eq), @{term True}));
  51.331 +                  (Const (\<^const_name>\<open>Ex\<close>, Tex) $ Abs (s, T, eq), \<^term>\<open>True\<close>));
  51.332              in
  51.333                SOME (Goal.prove_sorry_global thy [] [] prop
  51.334                  (fn _ => simp_tac (put_simpset (get_simpset thy) ctxt
  51.335 @@ -1379,7 +1379,7 @@
  51.336  
  51.337      val has_rec = exists_Const
  51.338        (fn (s, Type (_, [Type (_, [T, _]), _])) =>
  51.339 -          (s = @{const_name Pure.all} orelse s = @{const_name All} orelse s = @{const_name Ex})
  51.340 +          (s = \<^const_name>\<open>Pure.all\<close> orelse s = \<^const_name>\<open>All\<close> orelse s = \<^const_name>\<open>Ex\<close>)
  51.341              andalso is_recT T
  51.342          | _ => false);
  51.343  
  51.344 @@ -1427,11 +1427,11 @@
  51.345  
  51.346      val has_rec = exists_Const
  51.347        (fn (s, Type (_, [Type (_, [T, _]), _])) =>
  51.348 -          (s = @{const_name Pure.all} orelse s = @{const_name All}) andalso is_recT T
  51.349 +          (s = \<^const_name>\<open>Pure.all\<close> orelse s = \<^const_name>\<open>All\<close>) andalso is_recT T
  51.350          | _ => false);
  51.351  
  51.352 -    fun is_all (Const (@{const_name Pure.all}, _) $ _) = ~1
  51.353 -      | is_all (Const (@{const_name All}, _) $ _) = ~1
  51.354 +    fun is_all (Const (\<^const_name>\<open>Pure.all\<close>, _) $ _) = ~1
  51.355 +      | is_all (Const (\<^const_name>\<open>All\<close>, _) $ _) = ~1
  51.356        | is_all _ = 0;
  51.357    in
  51.358      if has_rec goal then
  51.359 @@ -1586,10 +1586,10 @@
  51.360      val inject_prop =  (* FIXME local x x' *)
  51.361        let val vars_more' = map (fn (Free (x, T)) => Free (x ^ "'", T)) vars_more in
  51.362          HOLogic.mk_conj (HOLogic.eq_const extT $
  51.363 -          mk_ext vars_more $ mk_ext vars_more', @{term True})
  51.364 +          mk_ext vars_more $ mk_ext vars_more', \<^term>\<open>True\<close>)
  51.365          ===
  51.366          foldr1 HOLogic.mk_conj
  51.367 -          (map HOLogic.mk_eq (vars_more ~~ vars_more') @ [@{term True}])
  51.368 +          (map HOLogic.mk_eq (vars_more ~~ vars_more') @ [\<^term>\<open>True\<close>])
  51.369        end;
  51.370  
  51.371      val induct_prop = (fold_rev Logic.all vars_more (Trueprop (P $ ext)), Trueprop (P $ s));
  51.372 @@ -1688,19 +1688,19 @@
  51.373  fun mk_random_eq tyco vs extN Ts =
  51.374    let
  51.375      (* FIXME local i etc. *)
  51.376 -    val size = @{term "i::natural"};
  51.377 -    fun termifyT T = HOLogic.mk_prodT (T, @{typ "unit => term"});
  51.378 +    val size = \<^term>\<open>i::natural\<close>;
  51.379 +    fun termifyT T = HOLogic.mk_prodT (T, \<^typ>\<open>unit \<Rightarrow> term\<close>);
  51.380      val T = Type (tyco, map TFree vs);
  51.381      val Tm = termifyT T;
  51.382      val params = Name.invent_names Name.context "x" Ts;
  51.383      val lhs = HOLogic.mk_random T size;
  51.384 -    val tc = HOLogic.mk_return Tm @{typ Random.seed}
  51.385 +    val tc = HOLogic.mk_return Tm \<^typ>\<open>Random.seed\<close>
  51.386        (HOLogic.mk_valtermify_app extN params T);
  51.387      val rhs =
  51.388        HOLogic.mk_ST
  51.389          (map (fn (v, T') =>
  51.390 -          ((HOLogic.mk_random T' size, @{typ Random.seed}), SOME (v, termifyT T'))) params)
  51.391 -        tc @{typ Random.seed} (SOME Tm, @{typ Random.seed});
  51.392 +          ((HOLogic.mk_random T' size, \<^typ>\<open>Random.seed\<close>), SOME (v, termifyT T'))) params)
  51.393 +        tc \<^typ>\<open>Random.seed\<close> (SOME Tm, \<^typ>\<open>Random.seed\<close>);
  51.394    in
  51.395      (lhs, rhs)
  51.396    end
  51.397 @@ -1708,16 +1708,16 @@
  51.398  fun mk_full_exhaustive_eq tyco vs extN Ts =
  51.399    let
  51.400      (* FIXME local i etc. *)
  51.401 -    val size = @{term "i::natural"};
  51.402 -    fun termifyT T = HOLogic.mk_prodT (T, @{typ "unit => term"});
  51.403 +    val size = \<^term>\<open>i::natural\<close>;
  51.404 +    fun termifyT T = HOLogic.mk_prodT (T, \<^typ>\<open>unit \<Rightarrow> term\<close>);
  51.405      val T = Type (tyco, map TFree vs);
  51.406 -    val test_function = Free ("f", termifyT T --> @{typ "(bool * term list) option"});
  51.407 +    val test_function = Free ("f", termifyT T --> \<^typ>\<open>(bool \<times> term list) option\<close>);
  51.408      val params = Name.invent_names Name.context "x" Ts;
  51.409      fun full_exhaustiveT T =
  51.410 -      (termifyT T --> @{typ "(bool * Code_Evaluation.term list) option"}) -->
  51.411 -        @{typ natural} --> @{typ "(bool * Code_Evaluation.term list) option"};
  51.412 +      (termifyT T --> \<^typ>\<open>(bool \<times> Code_Evaluation.term list) option\<close>) -->
  51.413 +        \<^typ>\<open>natural\<close> --> \<^typ>\<open>(bool \<times> Code_Evaluation.term list) option\<close>;
  51.414      fun mk_full_exhaustive T =
  51.415 -      Const (@{const_name "Quickcheck_Exhaustive.full_exhaustive_class.full_exhaustive"},
  51.416 +      Const (\<^const_name>\<open>Quickcheck_Exhaustive.full_exhaustive_class.full_exhaustive\<close>,
  51.417          full_exhaustiveT T);
  51.418      val lhs = mk_full_exhaustive T $ test_function $ size;
  51.419      val tc = test_function $ (HOLogic.mk_valtermify_app extN params T);
  51.420 @@ -1758,8 +1758,8 @@
  51.421      let
  51.422        val eq =
  51.423          HOLogic.mk_Trueprop (HOLogic.mk_eq
  51.424 -          (Const (@{const_name HOL.equal}, extT --> extT --> HOLogic.boolT),
  51.425 -           Const (@{const_name HOL.eq}, extT --> extT --> HOLogic.boolT)));
  51.426 +          (Const (\<^const_name>\<open>HOL.equal\<close>, extT --> extT --> HOLogic.boolT),
  51.427 +           Const (\<^const_name>\<open>HOL.eq\<close>, extT --> extT --> HOLogic.boolT)));
  51.428        fun tac ctxt eq_def =
  51.429          Class.intro_classes_tac ctxt []
  51.430          THEN rewrite_goals_tac ctxt [Simpdata.mk_eq eq_def]
  51.431 @@ -1770,11 +1770,11 @@
  51.432        fun mk_eq_refl ctxt =
  51.433          @{thm equal_refl}
  51.434          |> Thm.instantiate
  51.435 -          ([((("'a", 0), @{sort equal}), Thm.ctyp_of ctxt (Logic.varifyT_global extT))], [])
  51.436 +          ([((("'a", 0), \<^sort>\<open>equal\<close>), Thm.ctyp_of ctxt (Logic.varifyT_global extT))], [])
  51.437          |> Axclass.unoverload ctxt;
  51.438 -      val ensure_random_record = ensure_sort_record (@{sort random}, mk_random_eq);
  51.439 +      val ensure_random_record = ensure_sort_record (\<^sort>\<open>random\<close>, mk_random_eq);
  51.440        val ensure_exhaustive_record =
  51.441 -        ensure_sort_record (@{sort full_exhaustive}, mk_full_exhaustive_eq);
  51.442 +        ensure_sort_record (\<^sort>\<open>full_exhaustive\<close>, mk_full_exhaustive_eq);
  51.443        fun add_code eq_def thy =
  51.444          let
  51.445            val ctxt = Proof_Context.init_global thy;
  51.446 @@ -1808,8 +1808,8 @@
  51.447       distinct_discsss = [], exhaust_discs = [], exhaust_sels = [], collapses = [], expands = [],
  51.448       split_sels = [], split_sel_asms = [], case_eq_ifs = []};
  51.449  
  51.450 -fun lhs_of_equation (Const (@{const_name Pure.eq}, _) $ t $ _) = t
  51.451 -  | lhs_of_equation (@{const Trueprop} $ (Const (@{const_name HOL.eq}, _) $ t $ _)) = t;
  51.452 +fun lhs_of_equation (Const (\<^const_name>\<open>Pure.eq\<close>, _) $ t $ _) = t
  51.453 +  | lhs_of_equation (\<^const>\<open>Trueprop\<close> $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ t $ _)) = t;
  51.454  
  51.455  fun add_spec_rule rule =
  51.456    let val head = head_of (lhs_of_equation (Thm.prop_of rule)) in
  51.457 @@ -1858,7 +1858,7 @@
  51.458      val all_vars = parent_vars @ vars;
  51.459      val all_named_vars = (parent_names ~~ parent_vars) @ named_vars;
  51.460  
  51.461 -    val zeta = (singleton (Name.variant_list (map #1 alphas)) "'z", @{sort type});
  51.462 +    val zeta = (singleton (Name.variant_list (map #1 alphas)) "'z", \<^sort>\<open>type\<close>);
  51.463      val moreT = TFree zeta;
  51.464      val more = Free (moreN, moreT);
  51.465      val full_moreN = full (Binding.name moreN);
  51.466 @@ -2408,18 +2408,18 @@
  51.467  (* outer syntax *)
  51.468  
  51.469  val _ =
  51.470 -  Outer_Syntax.command @{command_keyword record} "define extensible record"
  51.471 +  Outer_Syntax.command \<^command_keyword>\<open>record\<close> "define extensible record"
  51.472      (Parse_Spec.overloaded -- (Parse.type_args_constrained -- Parse.binding) --
  51.473 -      (@{keyword "="} |-- Scan.option (Parse.typ --| @{keyword "+"}) --
  51.474 +      (\<^keyword>\<open>=\<close> |-- Scan.option (Parse.typ --| \<^keyword>\<open>+\<close>) --
  51.475          Scan.repeat1 Parse.const_binding)
  51.476      >> (fn ((overloaded, x), (y, z)) =>
  51.477          Toplevel.theory (add_record_cmd {overloaded = overloaded} x y z)));
  51.478  
  51.479  val opt_modes =
  51.480 -  Scan.optional (@{keyword "("} |-- Parse.!!! (Scan.repeat1 Parse.name --| @{keyword ")"})) []
  51.481 +  Scan.optional (\<^keyword>\<open>(\<close> |-- Parse.!!! (Scan.repeat1 Parse.name --| \<^keyword>\<open>)\<close>)) []
  51.482  
  51.483  val _ =
  51.484 -  Outer_Syntax.command @{command_keyword print_record} "print record definiton"
  51.485 +  Outer_Syntax.command \<^command_keyword>\<open>print_record\<close> "print record definiton"
  51.486      (opt_modes -- Parse.typ >> print_record);
  51.487  
  51.488  end
    52.1 --- a/src/HOL/Tools/sat.ML	Wed Dec 06 19:34:59 2017 +0100
    52.2 +++ b/src/HOL/Tools/sat.ML	Wed Dec 06 20:43:09 2017 +0100
    52.3 @@ -60,12 +60,12 @@
    52.4  structure SAT : SAT =
    52.5  struct
    52.6  
    52.7 -val trace = Attrib.setup_config_bool @{binding sat_trace} (K false);
    52.8 +val trace = Attrib.setup_config_bool \<^binding>\<open>sat_trace\<close> (K false);
    52.9  
   52.10  fun cond_tracing ctxt msg =
   52.11    if Config.get ctxt trace then tracing (msg ()) else ();
   52.12  
   52.13 -val solver = Attrib.setup_config_string @{binding sat_solver} (K "cdclite");
   52.14 +val solver = Attrib.setup_config_string \<^binding>\<open>sat_solver\<close> (K "cdclite");
   52.15    (*see HOL/Tools/sat_solver.ML for possible values*)
   52.16  
   52.17  val counter = Unsynchronized.ref 0;
   52.18 @@ -212,7 +212,7 @@
   52.19    let
   52.20      fun index_of_literal chyp =
   52.21        (case (HOLogic.dest_Trueprop o Thm.term_of) chyp of
   52.22 -        (Const (@{const_name Not}, _) $ atom) =>
   52.23 +        (Const (\<^const_name>\<open>Not\<close>, _) $ atom) =>
   52.24            SOME (~ (the (Termtab.lookup atom_table atom)))
   52.25        | atom => SOME (the (Termtab.lookup atom_table atom)))
   52.26        handle TERM _ => NONE;  (* 'chyp' is not a literal *)
   52.27 @@ -281,7 +281,7 @@
   52.28    let
   52.29      (* remove premises that equal "True" *)
   52.30      val clauses' = filter (fn clause =>
   52.31 -      (not_equal @{term True} o HOLogic.dest_Trueprop o Thm.term_of) clause
   52.32 +      (not_equal \<^term>\<open>True\<close> o HOLogic.dest_Trueprop o Thm.term_of) clause
   52.33          handle TERM ("dest_Trueprop", _) => true) clauses
   52.34      (* remove non-clausal premises -- of course this shouldn't actually   *)
   52.35      (* remove anything as long as 'rawsat_tac' is only called after the   *)
   52.36 @@ -321,7 +321,7 @@
   52.37          val _ =
   52.38            cond_tracing ctxt
   52.39              (fn () => "quick_and_dirty is set: proof reconstruction skipped, using oracle instead")
   52.40 -        val False_thm = Skip_Proof.make_thm_cterm @{cprop False}
   52.41 +        val False_thm = Skip_Proof.make_thm_cterm \<^cprop>\<open>False\<close>
   52.42        in
   52.43          (* 'fold Thm.weaken (rev sorted_clauses)' is linear, while 'fold    *)
   52.44          (* Thm.weaken sorted_clauses' would be quadratic, since we sorted   *)
    53.1 --- a/src/HOL/Tools/split_rule.ML	Wed Dec 06 19:34:59 2017 +0100
    53.2 +++ b/src/HOL/Tools/split_rule.ML	Wed Dec 06 20:43:09 2017 +0100
    53.3 @@ -17,7 +17,7 @@
    53.4  (** split rules **)
    53.5  
    53.6  fun internal_case_prod_const (Ta, Tb, Tc) =
    53.7 -  Const (@{const_name Product_Type.internal_case_prod},
    53.8 +  Const (\<^const_name>\<open>Product_Type.internal_case_prod\<close>,
    53.9      [[Ta, Tb] ---> Tc, HOLogic.mk_prodT (Ta, Tb)] ---> Tc);
   53.10  
   53.11  fun eval_internal_split ctxt =
   53.12 @@ -30,7 +30,7 @@
   53.13  (*In ap_split S T u, term u expects separate arguments for the factors of S,
   53.14    with result type T.  The call creates a new term expecting one argument
   53.15    of type S.*)
   53.16 -fun ap_split (Type (@{type_name Product_Type.prod}, [T1, T2])) T3 u =
   53.17 +fun ap_split (Type (\<^type_name>\<open>Product_Type.prod\<close>, [T1, T2])) T3 u =
   53.18        internal_case_prod_const (T1, T2, T3) $
   53.19        Abs ("v", T1,
   53.20            ap_split T2 T3
   53.21 @@ -111,11 +111,11 @@
   53.22  
   53.23  val _ =
   53.24    Theory.setup
   53.25 -   (Attrib.setup @{binding split_format}
   53.26 +   (Attrib.setup \<^binding>\<open>split_format\<close>
   53.27        (Scan.lift (Args.parens (Args.$$$ "complete")
   53.28          >> K (Thm.rule_attribute [] (complete_split_rule o Context.proof_of))))
   53.29        "split pair-typed subterms in premises, or function arguments" #>
   53.30 -    Attrib.setup @{binding split_rule}
   53.31 +    Attrib.setup \<^binding>\<open>split_rule\<close>
   53.32        (Scan.succeed (Thm.rule_attribute [] (split_rule o Context.proof_of)))
   53.33        "curries ALL function variables occurring in a rule's conclusion");
   53.34  
    54.1 --- a/src/HOL/Tools/try0.ML	Wed Dec 06 19:34:59 2017 +0100
    54.2 +++ b/src/HOL/Tools/try0.ML	Wed Dec 06 20:43:09 2017 +0100
    54.3 @@ -182,11 +182,11 @@
    54.4     || Scan.repeat parse_attr >> (fn quad => fold merge_attrs quad ([], [], [], []))) x;
    54.5  
    54.6  val _ =
    54.7 -  Outer_Syntax.command @{command_keyword try0} "try a combination of proof methods"
    54.8 +  Outer_Syntax.command \<^command_keyword>\<open>try0\<close> "try a combination of proof methods"
    54.9      (Scan.optional parse_attrs ([], [], [], []) #>> try0_trans);
   54.10  
   54.11  fun try_try0 auto = generic_try0 (if auto then Auto_Try else Try) NONE ([], [], [], []);
   54.12  
   54.13 -val _ = Try.tool_setup (try0N, (30, @{system_option auto_methods}, try_try0));
   54.14 +val _ = Try.tool_setup (try0N, (30, \<^system_option>\<open>auto_methods\<close>, try_try0));
   54.15  
   54.16  end;
    55.1 --- a/src/HOL/Tools/typedef.ML	Wed Dec 06 19:34:59 2017 +0100
    55.2 +++ b/src/HOL/Tools/typedef.ML	Wed Dec 06 20:43:09 2017 +0100
    55.3 @@ -85,7 +85,7 @@
    55.4  
    55.5  structure Typedef_Plugin = Plugin(type T = string);
    55.6  
    55.7 -val typedef_plugin = Plugin_Name.declare_setup @{binding typedef};
    55.8 +val typedef_plugin = Plugin_Name.declare_setup \<^binding>\<open>typedef\<close>;
    55.9  
   55.10  fun interpretation f =
   55.11    Typedef_Plugin.interpretation typedef_plugin
   55.12 @@ -99,7 +99,7 @@
   55.13  
   55.14  (* primitive typedef axiomatization -- for fresh typedecl *)
   55.15  
   55.16 -val typedef_overloaded = Attrib.setup_config_bool @{binding typedef_overloaded} (K false);
   55.17 +val typedef_overloaded = Attrib.setup_config_bool \<^binding>\<open>typedef_overloaded\<close> (K false);
   55.18  
   55.19  fun mk_inhabited A =
   55.20    let val T = HOLogic.dest_setT (Term.fastype_of A)
   55.21 @@ -108,7 +108,7 @@
   55.22  fun mk_typedef newT oldT RepC AbsC A =
   55.23    let
   55.24      val typedefC =
   55.25 -      Const (@{const_name type_definition},
   55.26 +      Const (\<^const_name>\<open>type_definition\<close>,
   55.27          (newT --> oldT) --> (oldT --> newT) --> HOLogic.mk_setT oldT --> HOLogic.boolT);
   55.28    in Logic.mk_implies (mk_inhabited A, HOLogic.mk_Trueprop (typedefC $ RepC $ AbsC $ A)) end;
   55.29  
   55.30 @@ -336,11 +336,11 @@
   55.31  (** outer syntax **)
   55.32  
   55.33  val _ =
   55.34 -  Outer_Syntax.local_theory_to_proof @{command_keyword typedef}
   55.35 +  Outer_Syntax.local_theory_to_proof \<^command_keyword>\<open>typedef\<close>
   55.36      "HOL type definition (requires non-emptiness proof)"
   55.37      (Parse_Spec.overloaded -- Parse.type_args_constrained -- Parse.binding -- Parse.opt_mixfix --
   55.38 -      (@{keyword "="} |-- Parse.term) --
   55.39 -      Scan.option (@{keyword "morphisms"} |-- Parse.!!! (Parse.binding -- Parse.binding))
   55.40 +      (\<^keyword>\<open>=\<close> |-- Parse.term) --
   55.41 +      Scan.option (\<^keyword>\<open>morphisms\<close> |-- Parse.!!! (Parse.binding -- Parse.binding))
   55.42      >> (fn (((((overloaded, vs), t), mx), A), opt_morphs) => fn lthy =>
   55.43          typedef_cmd {overloaded = overloaded} (t, vs, mx) A
   55.44            (SOME (make_morphisms t opt_morphs)) lthy));
    56.1 --- a/src/HOL/Tools/value_command.ML	Wed Dec 06 19:34:59 2017 +0100
    56.2 +++ b/src/HOL/Tools/value_command.ML	Wed Dec 06 20:43:09 2017 +0100
    56.3 @@ -62,18 +62,18 @@
    56.4    in Pretty.writeln p end;
    56.5  
    56.6  val opt_modes =
    56.7 -  Scan.optional (@{keyword "("} |-- Parse.!!! (Scan.repeat1 Parse.name --| @{keyword ")"})) [];
    56.8 +  Scan.optional (\<^keyword>\<open>(\<close> |-- Parse.!!! (Scan.repeat1 Parse.name --| \<^keyword>\<open>)\<close>)) [];
    56.9  
   56.10  val opt_evaluator =
   56.11 -  Scan.option (@{keyword "["} |-- Parse.name --| @{keyword "]"})
   56.12 +  Scan.option (\<^keyword>\<open>[\<close> |-- Parse.name --| \<^keyword>\<open>]\<close>)
   56.13    
   56.14  val _ =
   56.15 -  Outer_Syntax.command @{command_keyword value} "evaluate and print term"
   56.16 +  Outer_Syntax.command \<^command_keyword>\<open>value\<close> "evaluate and print term"
   56.17      (opt_evaluator -- opt_modes -- Parse.term
   56.18        >> (fn ((some_name, modes), t) => Toplevel.keep (value_cmd some_name modes t)));
   56.19  
   56.20  val _ = Theory.setup
   56.21 -  (Thy_Output.antiquotation @{binding value}
   56.22 +  (Thy_Output.antiquotation \<^binding>\<open>value\<close>
   56.23      (Scan.lift opt_evaluator -- Term_Style.parse -- Args.term)
   56.24      (fn {source, context, ...} => fn ((some_name, style), t) => Thy_Output.output context
   56.25        (Thy_Output.maybe_pretty_source Thy_Output.pretty_term context source
    57.1 --- a/src/HOL/Topological_Spaces.thy	Wed Dec 06 19:34:59 2017 +0100
    57.2 +++ b/src/HOL/Topological_Spaces.thy	Wed Dec 06 20:43:09 2017 +0100
    57.3 @@ -688,7 +688,7 @@
    57.4  
    57.5  named_theorems tendsto_intros "introduction rules for tendsto"
    57.6  setup \<open>
    57.7 -  Global_Theory.add_thms_dynamic (@{binding tendsto_eq_intros},
    57.8 +  Global_Theory.add_thms_dynamic (\<^binding>\<open>tendsto_eq_intros\<close>,
    57.9      fn context =>
   57.10        Named_Theorems.get (Context.proof_of context) @{named_theorems tendsto_intros}
   57.11        |> map_filter (try (fn thm => @{thm tendsto_eq_rhs} OF [thm])))
    58.1 --- a/src/Tools/atomize_elim.ML	Wed Dec 06 19:34:59 2017 +0100
    58.2 +++ b/src/Tools/atomize_elim.ML	Wed Dec 06 20:43:09 2017 +0100
    58.3 @@ -19,7 +19,7 @@
    58.4  val named_theorems =
    58.5    Context.>>> (Context.map_theory_result
    58.6     (Named_Target.theory_init #>
    58.7 -    Named_Theorems.declare @{binding atomize_elim} "atomize_elim rewrite rule" ##>
    58.8 +    Named_Theorems.declare \<^binding>\<open>atomize_elim\<close> "atomize_elim rewrite rule" ##>
    58.9      Local_Theory.exit_global));
   58.10  
   58.11  
   58.12 @@ -129,7 +129,7 @@
   58.13  
   58.14  val _ =
   58.15    Theory.setup
   58.16 -    (Method.setup @{binding atomize_elim} (Scan.succeed (SIMPLE_METHOD' o atomize_elim_tac))
   58.17 +    (Method.setup \<^binding>\<open>atomize_elim\<close> (Scan.succeed (SIMPLE_METHOD' o atomize_elim_tac))
   58.18        "convert obtains statement to atomic object logic goal")
   58.19  
   58.20  end
    59.1 --- a/src/Tools/case_product.ML	Wed Dec 06 19:34:59 2017 +0100
    59.2 +++ b/src/Tools/case_product.ML	Wed Dec 06 20:43:09 2017 +0100
    59.3 @@ -108,7 +108,7 @@
    59.4  
    59.5  val _ =
    59.6    Theory.setup
    59.7 -   (Attrib.setup @{binding case_product}
    59.8 +   (Attrib.setup \<^binding>\<open>case_product\<close>
    59.9        let
   59.10          fun combine_list ctxt = fold (fn x => fn y => combine_annotated ctxt y x)
   59.11        in
    60.1 --- a/src/Tools/coherent.ML	Wed Dec 06 19:34:59 2017 +0100
    60.2 +++ b/src/Tools/coherent.ML	Wed Dec 06 20:43:09 2017 +0100
    60.3 @@ -29,7 +29,7 @@
    60.4  
    60.5  (** misc tools **)
    60.6  
    60.7 -val (trace, trace_setup) = Attrib.config_bool @{binding coherent_trace} (K false);
    60.8 +val (trace, trace_setup) = Attrib.config_bool \<^binding>\<open>coherent_trace\<close> (K false);
    60.9  fun cond_trace ctxt msg = if Config.get ctxt trace then tracing (msg ()) else ();
   60.10  
   60.11  datatype cl_prf =
   60.12 @@ -227,7 +227,7 @@
   60.13  
   60.14  val _ = Theory.setup
   60.15    (trace_setup #>
   60.16 -   Method.setup @{binding coherent}
   60.17 +   Method.setup \<^binding>\<open>coherent\<close>
   60.18      (Attrib.thms >> (fn rules => fn ctxt =>
   60.19          METHOD (fn facts => HEADGOAL (coherent_tac ctxt (facts @ rules)))))
   60.20        "prove coherent formula");
    61.1 --- a/src/Tools/eqsubst.ML	Wed Dec 06 19:34:59 2017 +0100
    61.2 +++ b/src/Tools/eqsubst.ML	Wed Dec 06 20:43:09 2017 +0100
    61.3 @@ -413,7 +413,7 @@
    61.4     the goal) as well as the theorems to use *)
    61.5  val _ =
    61.6    Theory.setup
    61.7 -    (Method.setup @{binding subst}
    61.8 +    (Method.setup \<^binding>\<open>subst\<close>
    61.9        (Scan.lift (Args.mode "asm" -- Scan.optional (Args.parens (Scan.repeat Parse.nat)) [0]) --
   61.10          Attrib.thms >> (fn ((asm, occs), inthms) => fn ctxt =>
   61.11            SIMPLE_METHOD' ((if asm then eqsubst_asm_tac else eqsubst_tac) ctxt occs inthms)))
    62.1 --- a/src/Tools/induct.ML	Wed Dec 06 19:34:59 2017 +0100
    62.2 +++ b/src/Tools/induct.ML	Wed Dec 06 20:43:09 2017 +0100
    62.3 @@ -266,7 +266,7 @@
    62.4    end;
    62.5  
    62.6  val _ =
    62.7 -  Outer_Syntax.command @{command_keyword print_induct_rules}
    62.8 +  Outer_Syntax.command \<^command_keyword>\<open>print_induct_rules\<close>
    62.9      "print induction and cases rules"
   62.10      (Scan.succeed (Toplevel.keep (print_rules o Toplevel.context_of)));
   62.11  
   62.12 @@ -384,13 +384,13 @@
   62.13  
   62.14  val _ =
   62.15    Theory.local_setup
   62.16 -   (Attrib.local_setup @{binding cases} (attrib cases_type cases_pred cases_del)
   62.17 +   (Attrib.local_setup \<^binding>\<open>cases\<close> (attrib cases_type cases_pred cases_del)
   62.18        "declaration of cases rule" #>
   62.19 -    Attrib.local_setup @{binding induct} (attrib induct_type induct_pred induct_del)
   62.20 +    Attrib.local_setup \<^binding>\<open>induct\<close> (attrib induct_type induct_pred induct_del)
   62.21        "declaration of induction rule" #>
   62.22 -    Attrib.local_setup @{binding coinduct} (attrib coinduct_type coinduct_pred coinduct_del)
   62.23 +    Attrib.local_setup \<^binding>\<open>coinduct\<close> (attrib coinduct_type coinduct_pred coinduct_del)
   62.24        "declaration of coinduction rule" #>
   62.25 -    Attrib.local_setup @{binding induct_simp} (Attrib.add_del induct_simp_add induct_simp_del)
   62.26 +    Attrib.local_setup \<^binding>\<open>induct_simp\<close> (Attrib.add_del induct_simp_add induct_simp_del)
   62.27        "declaration of rules for simplifying induction or cases rules");
   62.28  
   62.29  end;
   62.30 @@ -953,15 +953,15 @@
   62.31  
   62.32  val _ =
   62.33    Theory.local_setup
   62.34 -    (Method.local_setup @{binding cases}
   62.35 +    (Method.local_setup \<^binding>\<open>cases\<close>
   62.36        (Scan.lift (Args.mode no_simpN) --
   62.37          (Parse.and_list' (Scan.repeat (unless_more_args inst)) -- Scan.option cases_rule) >>
   62.38          (fn (no_simp, (insts, opt_rule)) => fn _ =>
   62.39            CONTEXT_METHOD (fn facts =>
   62.40              Seq.DETERM (cases_context_tactic (not no_simp) insts opt_rule facts 1))))
   62.41        "case analysis on types or predicates/sets" #>
   62.42 -    gen_induct_setup @{binding induct} induct_context_tactic #>
   62.43 -     Method.local_setup @{binding coinduct}
   62.44 +    gen_induct_setup \<^binding>\<open>induct\<close> induct_context_tactic #>
   62.45 +     Method.local_setup \<^binding>\<open>coinduct\<close>
   62.46        (Scan.repeat (unless_more_args inst) -- taking -- Scan.option coinduct_rule >>
   62.47          (fn ((insts, taking), opt_rule) => fn _ => fn facts =>
   62.48            Seq.DETERM (coinduct_context_tactic insts taking opt_rule facts 1)))
    63.1 --- a/src/Tools/induct_tacs.ML	Wed Dec 06 19:34:59 2017 +0100
    63.2 +++ b/src/Tools/induct_tacs.ML	Wed Dec 06 20:43:09 2017 +0100
    63.3 @@ -128,11 +128,11 @@
    63.4  
    63.5  val _ =
    63.6    Theory.setup
    63.7 -   (Method.setup @{binding case_tac}
    63.8 +   (Method.setup \<^binding>\<open>case_tac\<close>
    63.9        (Args.goal_spec -- Scan.lift (Args.embedded_inner_syntax -- Parse.for_fixes) -- opt_rule >>
   63.10          (fn ((quant, (s, xs)), r) => fn ctxt => SIMPLE_METHOD'' quant (case_tac ctxt s xs r)))
   63.11        "unstructured case analysis on types" #>
   63.12 -    Method.setup @{binding induct_tac}
   63.13 +    Method.setup \<^binding>\<open>induct_tac\<close>
   63.14        (Args.goal_spec -- varss -- opt_rules >>
   63.15          (fn ((quant, vs), rs) => fn ctxt => SIMPLE_METHOD'' quant (induct_tac ctxt vs rs)))
   63.16        "unstructured induction on types");
    64.1 --- a/src/Tools/induction.ML	Wed Dec 06 19:34:59 2017 +0100
    64.2 +++ b/src/Tools/induction.ML	Wed Dec 06 20:43:09 2017 +0100
    64.3 @@ -50,6 +50,6 @@
    64.4    Method.NO_CONTEXT_TACTIC ctxt (induction_context_tactic x1 x2 x3 x4 x5 x6 x7);
    64.5  
    64.6  val _ =
    64.7 -  Theory.local_setup (Induct.gen_induct_setup @{binding induction} induction_context_tactic);
    64.8 +  Theory.local_setup (Induct.gen_induct_setup \<^binding>\<open>induction\<close> induction_context_tactic);
    64.9  
   64.10  end
    65.1 --- a/src/Tools/nbe.ML	Wed Dec 06 19:34:59 2017 +0100
    65.2 +++ b/src/Tools/nbe.ML	Wed Dec 06 20:43:09 2017 +0100
    65.3 @@ -35,7 +35,7 @@
    65.4  
    65.5  (* generic non-sense *)
    65.6  
    65.7 -val trace = Attrib.setup_config_bool @{binding "nbe_trace"} (K false);
    65.8 +val trace = Attrib.setup_config_bool \<^binding>\<open>nbe_trace\<close> (K false);
    65.9  fun traced ctxt f x = if Config.get ctxt trace then (tracing (f x); x) else x;
   65.10  
   65.11  
   65.12 @@ -80,7 +80,7 @@
   65.13  val get_triv_classes = map fst o Triv_Class_Data.get;
   65.14  
   65.15  val (_, triv_of_class) = Context.>>> (Context.map_theory_result
   65.16 -  (Thm.add_oracle (@{binding triv_of_class}, fn (thy, T, class) =>
   65.17 +  (Thm.add_oracle (\<^binding>\<open>triv_of_class\<close>, fn (thy, T, class) =>
   65.18      Thm.global_cterm_of thy (Logic.mk_of_class (T, class)))));
   65.19  
   65.20  in
   65.21 @@ -594,7 +594,7 @@
   65.22    in Thm.mk_binop eq lhs rhs end;
   65.23  
   65.24  val (_, raw_oracle) = Context.>>> (Context.map_theory_result
   65.25 -  (Thm.add_oracle (@{binding normalization_by_evaluation},
   65.26 +  (Thm.add_oracle (\<^binding>\<open>normalization_by_evaluation\<close>,
   65.27      fn (nbe_program_idx_tab, ctxt, vs_ty_t, deps, ct) =>
   65.28        mk_equals ctxt ct (normalize_term nbe_program_idx_tab ctxt (Thm.term_of ct) vs_ty_t deps))));
   65.29  
    66.1 --- a/src/Tools/quickcheck.ML	Wed Dec 06 19:34:59 2017 +0100
    66.2 +++ b/src/Tools/quickcheck.ML	Wed Dec 06 20:43:09 2017 +0100
    66.3 @@ -160,30 +160,30 @@
    66.4    if expect1 = expect2 then expect1 else No_Expectation;
    66.5  
    66.6  (*quickcheck configuration -- default parameters, test generators*)
    66.7 -val batch_tester = Attrib.setup_config_string @{binding quickcheck_batch_tester} (K "");
    66.8 -val size = Attrib.setup_config_int @{binding quickcheck_size} (K 10);
    66.9 -val iterations = Attrib.setup_config_int @{binding quickcheck_iterations} (K 100);
   66.10 -val depth = Attrib.setup_config_int @{binding quickcheck_depth} (K 10);
   66.11 +val batch_tester = Attrib.setup_config_string \<^binding>\<open>quickcheck_batch_tester\<close> (K "");
   66.12 +val size = Attrib.setup_config_int \<^binding>\<open>quickcheck_size\<close> (K 10);
   66.13 +val iterations = Attrib.setup_config_int \<^binding>\<open>quickcheck_iterations\<close> (K 100);
   66.14 +val depth = Attrib.setup_config_int \<^binding>\<open>quickcheck_depth\<close> (K 10);
   66.15  
   66.16 -val no_assms = Attrib.setup_config_bool @{binding quickcheck_no_assms} (K false);
   66.17 -val locale = Attrib.setup_config_string @{binding quickcheck_locale} (K "interpret expand");
   66.18 -val report = Attrib.setup_config_bool @{binding quickcheck_report} (K true);
   66.19 -val timing = Attrib.setup_config_bool @{binding quickcheck_timing} (K false);
   66.20 -val timeout = Attrib.setup_config_real @{binding quickcheck_timeout} (K 30.0);
   66.21 +val no_assms = Attrib.setup_config_bool \<^binding>\<open>quickcheck_no_assms\<close> (K false);
   66.22 +val locale = Attrib.setup_config_string \<^binding>\<open>quickcheck_locale\<close> (K "interpret expand");
   66.23 +val report = Attrib.setup_config_bool \<^binding>\<open>quickcheck_report\<close> (K true);
   66.24 +val timing = Attrib.setup_config_bool \<^binding>\<open>quickcheck_timing\<close> (K false);
   66.25 +val timeout = Attrib.setup_config_real \<^binding>\<open>quickcheck_timeout\<close> (K 30.0);
   66.26  
   66.27 -val genuine_only = Attrib.setup_config_bool @{binding quickcheck_genuine_only} (K false);
   66.28 -val abort_potential = Attrib.setup_config_bool @{binding quickcheck_abort_potential} (K false);
   66.29 +val genuine_only = Attrib.setup_config_bool \<^binding>\<open>quickcheck_genuine_only\<close> (K false);
   66.30 +val abort_potential = Attrib.setup_config_bool \<^binding>\<open>quickcheck_abort_potential\<close> (K false);
   66.31  
   66.32 -val quiet = Attrib.setup_config_bool @{binding quickcheck_quiet} (K false);
   66.33 -val verbose = Attrib.setup_config_bool @{binding quickcheck_verbose} (K false);
   66.34 -val tag = Attrib.setup_config_string @{binding quickcheck_tag} (K "");
   66.35 +val quiet = Attrib.setup_config_bool \<^binding>\<open>quickcheck_quiet\<close> (K false);
   66.36 +val verbose = Attrib.setup_config_bool \<^binding>\<open>quickcheck_verbose\<close> (K false);
   66.37 +val tag = Attrib.setup_config_string \<^binding>\<open>quickcheck_tag\<close> (K "");
   66.38  
   66.39 -val use_subtype = Attrib.setup_config_bool @{binding quickcheck_use_subtype} (K false);
   66.40 +val use_subtype = Attrib.setup_config_bool \<^binding>\<open>quickcheck_use_subtype\<close> (K false);
   66.41  
   66.42  val allow_function_inversion =
   66.43 -  Attrib.setup_config_bool @{binding quickcheck_allow_function_inversion} (K false);
   66.44 -val finite_types = Attrib.setup_config_bool @{binding quickcheck_finite_types} (K true);
   66.45 -val finite_type_size = Attrib.setup_config_int @{binding quickcheck_finite_type_size} (K 3);
   66.46 +  Attrib.setup_config_bool \<^binding>\<open>quickcheck_allow_function_inversion\<close> (K false);
   66.47 +val finite_types = Attrib.setup_config_bool \<^binding>\<open>quickcheck_finite_types\<close> (K true);
   66.48 +val finite_type_size = Attrib.setup_config_int \<^binding>\<open>quickcheck_finite_type_size\<close> (K 3);
   66.49  
   66.50  datatype test_params = Test_Params of
   66.51    {default_type: typ list, expect : expectation};
   66.52 @@ -343,7 +343,7 @@
   66.53      val ctxt = Proof.context_of state;
   66.54      val thy = Proof.theory_of state;
   66.55  
   66.56 -    fun strip (Const (@{const_name Pure.all}, _) $ Abs (_, _, t)) = strip t
   66.57 +    fun strip (Const (\<^const_name>\<open>Pure.all\<close>, _) $ Abs (_, _, t)) = strip t
   66.58        | strip t = t;
   66.59      val {goal = st, ...} = Proof.raw_goal state;
   66.60      val (gi, frees) = Logic.goal_params (Thm.prop_of st) i;
   66.61 @@ -522,19 +522,19 @@
   66.62  
   66.63  val parse_arg =
   66.64    Parse.name --
   66.65 -    (Scan.optional (@{keyword "="} |--
   66.66 +    (Scan.optional (\<^keyword>\<open>=\<close> |--
   66.67        (((Parse.name || Parse.float_number) >> single) ||
   66.68 -        (@{keyword "["} |-- Parse.list1 Parse.name --| @{keyword "]"}))) ["true"]);
   66.69 +        (\<^keyword>\<open>[\<close> |-- Parse.list1 Parse.name --| \<^keyword>\<open>]\<close>))) ["true"]);
   66.70  
   66.71  val parse_args =
   66.72 -  @{keyword "["} |-- Parse.list1 parse_arg --| @{keyword "]"} || Scan.succeed [];
   66.73 +  \<^keyword>\<open>[\<close> |-- Parse.list1 parse_arg --| \<^keyword>\<open>]\<close> || Scan.succeed [];
   66.74  
   66.75  val _ =
   66.76 -  Outer_Syntax.command @{command_keyword quickcheck_params} "set parameters for random testing"
   66.77 +  Outer_Syntax.command \<^command_keyword>\<open>quickcheck_params\<close> "set parameters for random testing"
   66.78      (parse_args >> (fn args => Toplevel.theory (quickcheck_params_cmd args)));
   66.79  
   66.80  val _ =
   66.81 -  Outer_Syntax.command @{command_keyword quickcheck}
   66.82 +  Outer_Syntax.command \<^command_keyword>\<open>quickcheck\<close>
   66.83      "try to find counterexample for subgoal"
   66.84      (parse_args -- Scan.optional Parse.nat 1 >>
   66.85        (fn (args, i) => Toplevel.keep_proof (quickcheck_cmd args i)));
   66.86 @@ -565,7 +565,7 @@
   66.87    end
   66.88    |> `(fn (outcome_code, _) => outcome_code = genuineN);
   66.89  
   66.90 -val _ = Try.tool_setup (quickcheckN, (20, @{system_option auto_quickcheck}, try_quickcheck));
   66.91 +val _ = Try.tool_setup (quickcheckN, (20, \<^system_option>\<open>auto_quickcheck\<close>, try_quickcheck));
   66.92  
   66.93  end;
   66.94  
    67.1 --- a/src/Tools/solve_direct.ML	Wed Dec 06 19:34:59 2017 +0100
    67.2 +++ b/src/Tools/solve_direct.ML	Wed Dec 06 20:43:09 2017 +0100
    67.3 @@ -33,8 +33,8 @@
    67.4  
    67.5  (* preferences *)
    67.6  
    67.7 -val max_solutions = Attrib.setup_config_int @{binding solve_direct_max_solutions} (K 5);
    67.8 -val strict_warnings = Attrib.setup_config_bool @{binding solve_direct_strict_warnings} (K false);
    67.9 +val max_solutions = Attrib.setup_config_int \<^binding>\<open>solve_direct_max_solutions\<close> (K 5);
   67.10 +val strict_warnings = Attrib.setup_config_bool \<^binding>\<open>solve_direct_strict_warnings\<close> (K false);
   67.11  
   67.12  
   67.13  (* solve_direct command *)
   67.14 @@ -90,7 +90,7 @@
   67.15  val solve_direct = do_solve_direct Normal
   67.16  
   67.17  val _ =
   67.18 -  Outer_Syntax.command @{command_keyword solve_direct}
   67.19 +  Outer_Syntax.command \<^command_keyword>\<open>solve_direct\<close>
   67.20      "try to solve conjectures directly with existing theorems"
   67.21      (Scan.succeed (Toplevel.keep_proof (ignore o solve_direct o Toplevel.proof_of)));
   67.22  
    68.1 --- a/src/Tools/subtyping.ML	Wed Dec 06 19:34:59 2017 +0100
    68.2 +++ b/src/Tools/subtyping.ML	Wed Dec 06 20:43:09 2017 +0100
    68.3 @@ -882,7 +882,7 @@
    68.4  
    68.5  (* term check *)
    68.6  
    68.7 -val coercion_enabled = Attrib.setup_config_bool @{binding coercion_enabled} (K false);
    68.8 +val coercion_enabled = Attrib.setup_config_bool \<^binding>\<open>coercion_enabled\<close> (K false);
    68.9  
   68.10  val _ =
   68.11    Theory.setup
   68.12 @@ -1097,16 +1097,16 @@
   68.13  
   68.14  val _ =
   68.15    Theory.setup
   68.16 -   (Attrib.setup @{binding coercion}
   68.17 +   (Attrib.setup \<^binding>\<open>coercion\<close>
   68.18        (Args.term >> (fn t => Thm.declaration_attribute (K (add_coercion t))))
   68.19        "declaration of new coercions" #>
   68.20 -    Attrib.setup @{binding coercion_delete}
   68.21 +    Attrib.setup \<^binding>\<open>coercion_delete\<close>
   68.22        (Args.term >> (fn t => Thm.declaration_attribute (K (delete_coercion t))))
   68.23        "deletion of coercions" #>
   68.24 -    Attrib.setup @{binding coercion_map}
   68.25 +    Attrib.setup \<^binding>\<open>coercion_map\<close>
   68.26        (Args.term >> (fn t => Thm.declaration_attribute (K (add_type_map t))))
   68.27        "declaration of new map functions" #>
   68.28 -    Attrib.setup @{binding coercion_args}
   68.29 +    Attrib.setup \<^binding>\<open>coercion_args\<close>
   68.30        (Args.const {proper = false, strict = false} -- Scan.lift (Scan.repeat1 parse_coerce_args) >>
   68.31          (fn spec => Thm.declaration_attribute (K (map_coerce_args (Symtab.update spec)))))
   68.32        "declaration of new constants with coercion-invariant arguments");
   68.33 @@ -1115,7 +1115,7 @@
   68.34  (* outer syntax commands *)
   68.35  
   68.36  val _ =
   68.37 -  Outer_Syntax.command @{command_keyword print_coercions}
   68.38 +  Outer_Syntax.command \<^command_keyword>\<open>print_coercions\<close>
   68.39      "print information about coercions"
   68.40      (Scan.succeed (Toplevel.keep (print_coercions o Toplevel.context_of)));
   68.41  
    69.1 --- a/src/Tools/try.ML	Wed Dec 06 19:34:59 2017 +0100
    69.2 +++ b/src/Tools/try.ML	Wed Dec 06 20:43:09 2017 +0100
    69.3 @@ -73,7 +73,7 @@
    69.4      |> tap (fn NONE => writeln "Tried in vain" | _ => ());
    69.5  
    69.6  val _ =
    69.7 -  Outer_Syntax.command @{command_keyword try}
    69.8 +  Outer_Syntax.command \<^command_keyword>\<open>try\<close>
    69.9      "try a combination of automatic proving and disproving tools"
   69.10      (Scan.succeed (Toplevel.keep_proof (ignore o try_tools o Toplevel.proof_of)));
   69.11