merged
authorwenzelm
Wed Dec 06 21:01:01 2017 +0100 (7 months ago)
changeset 67150ecbd8ff928c5
parent 67144 cef9a1514ed0
parent 67149 e61557884799
child 67151 d1ace598c026
merged
     1.1 --- a/NEWS	Wed Dec 06 16:01:15 2017 +0100
     1.2 +++ b/NEWS	Wed Dec 06 21:01:01 2017 +0100
     1.3 @@ -78,6 +78,11 @@
     1.4  tagged as "document" and visible by default. This avoids the application
     1.5  of option "document_tags" to these commands.
     1.6  
     1.7 +* Isabelle names are mangled into LaTeX macro names to allow the full
     1.8 +identifier syntax with underscore, prime, digits. This is relevant for
     1.9 +antiquotations in control symbol notation, e.g. \<^const_name> becomes
    1.10 +\isactrlconstUNDERSCOREname.
    1.11 +
    1.12  
    1.13  *** HOL ***
    1.14  
     2.1 --- a/lib/texinputs/isabelle.sty	Wed Dec 06 16:01:15 2017 +0100
     2.2 +++ b/lib/texinputs/isabelle.sty	Wed Dec 06 21:01:01 2017 +0100
     2.3 @@ -125,6 +125,9 @@
     2.4  \def\isacharbraceleft{\{}\def\isacharbraceright{\}}#1}}
     2.5  \newcommand{\isacommand}[1]{\isakeyword{#1}}
     2.6  
     2.7 +\newcommand{\isakeywordcontrol}[1]
     2.8 +{\emph{\bf\itshape\def\isacharunderscore{\isacharunderscorekeyword}#1\,}}
     2.9 +
    2.10  \newcommand{\isamarkupheader}[1]{\section{#1}}
    2.11  \newcommand{\isamarkupchapter}[1]{\chapter{#1}}
    2.12  \newcommand{\isamarkupsection}[1]{\section{#1}}
     3.1 --- a/lib/texinputs/isabellesym.sty	Wed Dec 06 16:01:15 2017 +0100
     3.2 +++ b/lib/texinputs/isabellesym.sty	Wed Dec 06 21:01:01 2017 +0100
     3.3 @@ -367,7 +367,46 @@
     3.4  \newcommand{\isasymnewline}{\isatext{\fbox{$\hookleftarrow$}}}
     3.5  \newcommand{\isasymcomment}{\isatext{---}}
     3.6  \newcommand{\isasymproof}{\isamath{\,\langle\mathit{proof}\rangle}}
     3.7 -\newcommand{\isactrlundefined}{\isakeyword{undefined}\ }
     3.8 -\newcommand{\isactrlfile}{\isakeyword{file}\ }
     3.9 -\newcommand{\isactrldir}{\isakeyword{dir}\ }
    3.10 -\newcommand{\isactrlhere}{\isakeyword{here}\ }
    3.11 +
    3.12 +\newcommand{\isactrlassert}{\isakeywordcontrol{assert}}
    3.13 +\newcommand{\isactrlbinding}{\isakeywordcontrol{binding}}
    3.14 +\newcommand{\isactrlclass}{\isakeywordcontrol{class}}
    3.15 +\newcommand{\isactrlclassUNDERSCOREsyntax}{\isakeywordcontrol{class{\isacharunderscore}syntax}}
    3.16 +\newcommand{\isactrlcommandUNDERSCOREkeyword}{\isakeywordcontrol{command{\isacharunderscore}keyword}}
    3.17 +\newcommand{\isactrlconstUNDERSCOREabbrev}{\isakeywordcontrol{const{\isacharunderscore}abbrev}}
    3.18 +\newcommand{\isactrlconstUNDERSCOREname}{\isakeywordcontrol{const{\isacharunderscore}name}}
    3.19 +\newcommand{\isactrlconstUNDERSCOREsyntax}{\isakeywordcontrol{const{\isacharunderscore}syntax}}
    3.20 +\newcommand{\isactrlcontext}{\isakeywordcontrol{context}}
    3.21 +\newcommand{\isactrlcprop}{\isakeywordcontrol{cprop}}
    3.22 +\newcommand{\isactrlcterm}{\isakeywordcontrol{cterm}}
    3.23 +\newcommand{\isactrlctyp}{\isakeywordcontrol{ctyp}}
    3.24 +\newcommand{\isactrldir}{\isakeywordcontrol{dir}}
    3.25 +\newcommand{\isactrlfile}{\isakeywordcontrol{file}}
    3.26 +\newcommand{\isactrlhere}{\isakeywordcontrol{here}}
    3.27 +\newcommand{\isactrlkeyword}{\isakeywordcontrol{keyword}}
    3.28 +\newcommand{\isactrllocale}{\isakeywordcontrol{locale}}
    3.29 +\newcommand{\isactrlmakeUNDERSCOREstring}{\isakeywordcontrol{make{\isacharunderscore}string}}
    3.30 +\newcommand{\isactrlmethod}{\isakeywordcontrol{method}}
    3.31 +\newcommand{\isactrlnamedUNDERSCOREtheorems}{\isakeywordcontrol{named{\isacharunderscore}theorems}}
    3.32 +\newcommand{\isactrlnonterminal}{\isakeywordcontrol{nonterminal}}
    3.33 +\newcommand{\isactrlpath}{\isakeywordcontrol{path}}
    3.34 +\newcommand{\isactrlplugin}{\isakeywordcontrol{plugin}}
    3.35 +\newcommand{\isactrlprint}{\isakeywordcontrol{print}}
    3.36 +\newcommand{\isactrlprop}{\isakeywordcontrol{prop}}
    3.37 +\newcommand{\isactrlsimproc}{\isakeywordcontrol{simproc}}
    3.38 +\newcommand{\isactrlsort}{\isakeywordcontrol{sort}}
    3.39 +\newcommand{\isactrlsyntaxUNDERSCOREconst}{\isakeywordcontrol{syntax{\isacharunderscore}const}}
    3.40 +\newcommand{\isactrlsystemUNDERSCOREoption}{\isakeywordcontrol{system{\isacharunderscore}option}}
    3.41 +\newcommand{\isactrlterm}{\isakeywordcontrol{term}}
    3.42 +\newcommand{\isactrltheory}{\isakeywordcontrol{theory}}
    3.43 +\newcommand{\isactrltheoryUNDERSCOREcontext}{\isakeywordcontrol{theory{\isacharunderscore}context}}
    3.44 +\newcommand{\isactrltyp}{\isakeywordcontrol{typ}}
    3.45 +\newcommand{\isactrltypeUNDERSCOREabbrev}{\isakeywordcontrol{type{\isacharunderscore}abbrev}}
    3.46 +\newcommand{\isactrltypeUNDERSCOREname}{\isakeywordcontrol{type{\isacharunderscore}name}}
    3.47 +\newcommand{\isactrltypeUNDERSCOREsyntax}{\isakeywordcontrol{type{\isacharunderscore}syntax}}
    3.48 +\newcommand{\isactrlundefined}{\isakeywordcontrol{undefined}}
    3.49 +
    3.50 +\newcommand{\isactrlcode}{\isakeywordcontrol{code}}
    3.51 +\newcommand{\isactrlcomputation}{\isakeywordcontrol{computation}}
    3.52 +\newcommand{\isactrlcomputationUNDERSCOREconv}{\isakeywordcontrol{computation{\isacharunderscore}conv}}
    3.53 +\newcommand{\isactrlcomputationUNDERSCOREcheck}{\isakeywordcontrol{computation{\isacharunderscore}check}}
     4.1 --- a/src/Doc/Implementation/Logic.thy	Wed Dec 06 16:01:15 2017 +0100
     4.2 +++ b/src/Doc/Implementation/Logic.thy	Wed Dec 06 21:01:01 2017 +0100
     4.3 @@ -171,13 +171,13 @@
     4.4    \end{matharray}
     4.5  
     4.6    @{rail \<open>
     4.7 -  @@{ML_antiquotation class} name
     4.8 +  @@{ML_antiquotation class} embedded
     4.9    ;
    4.10    @@{ML_antiquotation sort} sort
    4.11    ;
    4.12    (@@{ML_antiquotation type_name} |
    4.13     @@{ML_antiquotation type_abbrev} |
    4.14 -   @@{ML_antiquotation nonterminal}) name
    4.15 +   @@{ML_antiquotation nonterminal}) embedded
    4.16    ;
    4.17    @@{ML_antiquotation typ} type
    4.18    \<close>}
    4.19 @@ -392,7 +392,7 @@
    4.20  
    4.21    @{rail \<open>
    4.22    (@@{ML_antiquotation const_name} |
    4.23 -   @@{ML_antiquotation const_abbrev}) name
    4.24 +   @@{ML_antiquotation const_abbrev}) embedded
    4.25    ;
    4.26    @@{ML_antiquotation const} ('(' (type + ',') ')')?
    4.27    ;
     5.1 --- a/src/Doc/Implementation/ML.thy	Wed Dec 06 16:01:15 2017 +0100
     5.2 +++ b/src/Doc/Implementation/ML.thy	Wed Dec 06 21:01:01 2017 +0100
     5.3 @@ -695,7 +695,7 @@
     5.4    @{rail \<open>
     5.5    @@{ML_antiquotation make_string}
     5.6    ;
     5.7 -  @@{ML_antiquotation print} @{syntax name}?
     5.8 +  @@{ML_antiquotation print} embedded?
     5.9    \<close>}
    5.10  
    5.11    \<^descr> \<open>@{make_string}\<close> inlines a function to print arbitrary values similar to
     6.1 --- a/src/Doc/Implementation/Prelim.thy	Wed Dec 06 16:01:15 2017 +0100
     6.2 +++ b/src/Doc/Implementation/Prelim.thy	Wed Dec 06 21:01:01 2017 +0100
     6.3 @@ -142,9 +142,9 @@
     6.4    \end{matharray}
     6.5  
     6.6    @{rail \<open>
     6.7 -  @@{ML_antiquotation theory} name?
     6.8 +  @@{ML_antiquotation theory} embedded?
     6.9    ;
    6.10 -  @@{ML_antiquotation theory_context} name
    6.11 +  @@{ML_antiquotation theory_context} embedded
    6.12    \<close>}
    6.13  
    6.14    \<^descr> \<open>@{theory}\<close> refers to the background theory of the current context --- as
    6.15 @@ -938,7 +938,7 @@
    6.16    \end{matharray}
    6.17  
    6.18    @{rail \<open>
    6.19 -  @@{ML_antiquotation binding} name
    6.20 +  @@{ML_antiquotation binding} embedded
    6.21    \<close>}
    6.22  
    6.23    \<^descr> \<open>@{binding name}\<close> produces a binding with base name \<open>name\<close> and the source
     7.1 --- a/src/Doc/Isar_Ref/Inner_Syntax.thy	Wed Dec 06 16:01:15 2017 +0100
     7.2 +++ b/src/Doc/Isar_Ref/Inner_Syntax.thy	Wed Dec 06 21:01:01 2017 +0100
     7.3 @@ -1307,7 +1307,7 @@
     7.4    (@@{ML_antiquotation class_syntax} |
     7.5     @@{ML_antiquotation type_syntax} |
     7.6     @@{ML_antiquotation const_syntax} |
     7.7 -   @@{ML_antiquotation syntax_const}) name
     7.8 +   @@{ML_antiquotation syntax_const}) embedded
     7.9    \<close>}
    7.10  
    7.11    \<^descr> @{command parse_translation} etc. declare syntax translation functions to
     8.1 --- a/src/Doc/Isar_Ref/document/showsymbols	Wed Dec 06 16:01:15 2017 +0100
     8.2 +++ b/src/Doc/Isar_Ref/document/showsymbols	Wed Dec 06 21:01:01 2017 +0100
     8.3 @@ -5,13 +5,8 @@
     8.4  $eol = "&";
     8.5  
     8.6  while (<ARGV>) {
     8.7 -    if (m/^\\newcommand\{\\(isasym|isactrl)([A-Za-z]+)\}/) {
     8.8 -        if ($1 eq "isasym") {
     8.9 -            print "\\verb,\\<$2>, & {\\isasym$2} $eol\n";
    8.10 -        }
    8.11 -        else {
    8.12 -            print "\\verb,\\<^$2>, & {\\isactrl$2} $eol\n";
    8.13 -        }
    8.14 +    if (m/^\\newcommand\{\\isasym([A-Za-z]+)\}/) {
    8.15 +        print "\\verb,\\<$1>, & {\\isasym$1} $eol\n";
    8.16          if ("$eol" eq "&") {
    8.17              $eol = "\\\\";
    8.18          } else {
     9.1 --- a/src/HOL/Deriv.thy	Wed Dec 06 16:01:15 2017 +0100
     9.2 +++ b/src/HOL/Deriv.thy	Wed Dec 06 21:01:01 2017 +0100
     9.3 @@ -51,7 +51,7 @@
     9.4      fun eq_rule thm = get_first (try (fn eq_thm => eq_thm OF [thm])) eq_thms
     9.5    in
     9.6      Global_Theory.add_thms_dynamic
     9.7 -      (@{binding derivative_eq_intros},
     9.8 +      (\<^binding>\<open>derivative_eq_intros\<close>,
     9.9          fn context =>
    9.10            Named_Theorems.get (Context.proof_of context) @{named_theorems derivative_intros}
    9.11            |> map_filter eq_rule)
    10.1 --- a/src/HOL/HOL.thy	Wed Dec 06 16:01:15 2017 +0100
    10.2 +++ b/src/HOL/HOL.thy	Wed Dec 06 21:01:01 2017 +0100
    10.3 @@ -28,23 +28,23 @@
    10.4  ML_file "~~/src/Provers/quantifier1.ML"
    10.5  ML_file "~~/src/Tools/atomize_elim.ML"
    10.6  ML_file "~~/src/Tools/cong_tac.ML"
    10.7 -ML_file "~~/src/Tools/intuitionistic.ML" setup \<open>Intuitionistic.method_setup @{binding iprover}\<close>
    10.8 +ML_file "~~/src/Tools/intuitionistic.ML" setup \<open>Intuitionistic.method_setup \<^binding>\<open>iprover\<close>\<close>
    10.9  ML_file "~~/src/Tools/project_rule.ML"
   10.10  ML_file "~~/src/Tools/subtyping.ML"
   10.11  ML_file "~~/src/Tools/case_product.ML"
   10.12  
   10.13  
   10.14 -ML \<open>Plugin_Name.declare_setup @{binding extraction}\<close>
   10.15 +ML \<open>Plugin_Name.declare_setup \<^binding>\<open>extraction\<close>\<close>
   10.16  
   10.17  ML \<open>
   10.18 -  Plugin_Name.declare_setup @{binding quickcheck_random};
   10.19 -  Plugin_Name.declare_setup @{binding quickcheck_exhaustive};
   10.20 -  Plugin_Name.declare_setup @{binding quickcheck_bounded_forall};
   10.21 -  Plugin_Name.declare_setup @{binding quickcheck_full_exhaustive};
   10.22 -  Plugin_Name.declare_setup @{binding quickcheck_narrowing};
   10.23 +  Plugin_Name.declare_setup \<^binding>\<open>quickcheck_random\<close>;
   10.24 +  Plugin_Name.declare_setup \<^binding>\<open>quickcheck_exhaustive\<close>;
   10.25 +  Plugin_Name.declare_setup \<^binding>\<open>quickcheck_bounded_forall\<close>;
   10.26 +  Plugin_Name.declare_setup \<^binding>\<open>quickcheck_full_exhaustive\<close>;
   10.27 +  Plugin_Name.declare_setup \<^binding>\<open>quickcheck_narrowing\<close>;
   10.28  \<close>
   10.29  ML \<open>
   10.30 -  Plugin_Name.define_setup @{binding quickcheck}
   10.31 +  Plugin_Name.define_setup \<^binding>\<open>quickcheck\<close>
   10.32     [@{plugin quickcheck_exhaustive},
   10.33      @{plugin quickcheck_random},
   10.34      @{plugin quickcheck_bounded_forall},
   10.35 @@ -66,7 +66,7 @@
   10.36  
   10.37  subsubsection \<open>Core syntax\<close>
   10.38  
   10.39 -setup \<open>Axclass.class_axiomatization (@{binding type}, [])\<close>
   10.40 +setup \<open>Axclass.class_axiomatization (\<^binding>\<open>type\<close>, [])\<close>
   10.41  default_sort type
   10.42  setup \<open>Object_Logic.add_base_sort @{sort type}\<close>
   10.43  
    11.1 --- a/src/HOL/Tools/Argo/argo_real.ML	Wed Dec 06 16:01:15 2017 +0100
    11.2 +++ b/src/HOL/Tools/Argo/argo_real.ML	Wed Dec 06 21:01:01 2017 +0100
    11.3 @@ -9,7 +9,7 @@
    11.4  
    11.5  (* translating input terms *)
    11.6  
    11.7 -fun trans_type _ @{typ Real.real} tcx = SOME (Argo_Expr.Real, tcx)
    11.8 +fun trans_type _ \<^typ>\<open>Real.real\<close> tcx = SOME (Argo_Expr.Real, tcx)
    11.9    | trans_type _ _ _ = NONE
   11.10  
   11.11  fun trans_term f (@{const Groups.uminus_class.uminus (real)} $ t) tcx =
   11.12 @@ -34,7 +34,7 @@
   11.13        tcx |> f t1 ||>> f t2 |>> uncurry Argo_Expr.mk_le |> SOME
   11.14    | trans_term _ t tcx =
   11.15        (case try HOLogic.dest_number t of
   11.16 -        SOME (@{typ Real.real}, n) => SOME (Argo_Expr.mk_num (Rat.of_int n), tcx)
   11.17 +        SOME (\<^typ>\<open>Real.real\<close>, n) => SOME (Argo_Expr.mk_num (Rat.of_int n), tcx)
   11.18        | _ => NONE)
   11.19  
   11.20  
   11.21 @@ -47,7 +47,7 @@
   11.22  fun mk_le t1 t2 = @{const Orderings.ord_class.less_eq (real)} $ t1 $ t2
   11.23  fun mk_lt t1 t2 = @{const Orderings.ord_class.less (real)} $ t1 $ t2
   11.24  
   11.25 -fun mk_real_num i = HOLogic.mk_number @{typ Real.real} i
   11.26 +fun mk_real_num i = HOLogic.mk_number \<^typ>\<open>Real.real\<close> i
   11.27  
   11.28  fun mk_number n =
   11.29    let val (p, q) = Rat.dest n
   11.30 @@ -93,7 +93,7 @@
   11.31  fun inv_num_conv ctxt = nums_conv mk_divide (fn (_, n) => Rat.inv n) ctxt @1
   11.32  
   11.33  fun cmp_nums_conv ctxt b ct =
   11.34 -  let val t = if b then @{const HOL.True} else @{const HOL.False}
   11.35 +  let val t = if b then \<^const>\<open>HOL.True\<close> else \<^const>\<open>HOL.False\<close>
   11.36    in simp_conv ctxt (HOLogic.mk_eq (Thm.term_of ct, t)) ct end
   11.37  
   11.38  local
    12.1 --- a/src/HOL/Tools/Argo/argo_tactic.ML	Wed Dec 06 16:01:15 2017 +0100
    12.2 +++ b/src/HOL/Tools/Argo/argo_tactic.ML	Wed Dec 06 21:01:01 2017 +0100
    12.3 @@ -62,7 +62,7 @@
    12.4    | requires_mode Basic = [Basic, Full]
    12.5    | requires_mode Full = [Full]
    12.6  
    12.7 -val trace = Attrib.setup_config_string @{binding argo_trace} (K (string_of_mode None))
    12.8 +val trace = Attrib.setup_config_string \<^binding>\<open>argo_trace\<close> (K (string_of_mode None))
    12.9  
   12.10  fun allows_mode ctxt = exists (equal (Config.get ctxt trace) o string_of_mode) o requires_mode
   12.11  
   12.12 @@ -77,7 +77,7 @@
   12.13  
   12.14  (* timeout *)
   12.15  
   12.16 -val timeout = Attrib.setup_config_real @{binding argo_timeout} (K 10.0)
   12.17 +val timeout = Attrib.setup_config_real \<^binding>\<open>argo_timeout\<close> (K 10.0)
   12.18  
   12.19  fun time_of_timeout ctxt = Time.fromReal (Config.get ctxt timeout)
   12.20  
   12.21 @@ -144,8 +144,8 @@
   12.22      SOME ty => (ty, tcx)
   12.23    | NONE => add_new_type T tcx)
   12.24  
   12.25 -fun trans_type _ @{typ HOL.bool} = pair Argo_Expr.Bool
   12.26 -  | trans_type ctxt (Type (@{type_name "fun"}, [T1, T2])) =
   12.27 +fun trans_type _ \<^typ>\<open>HOL.bool\<close> = pair Argo_Expr.Bool
   12.28 +  | trans_type ctxt (Type (\<^type_name>\<open>fun\<close>, [T1, T2])) =
   12.29        trans_type ctxt T1 ##>> trans_type ctxt T2 #>> Argo_Expr.Func
   12.30    | trans_type ctxt T = (fn tcx =>
   12.31        (case ext_trans_type ctxt (trans_type ctxt) T tcx of
   12.32 @@ -164,22 +164,22 @@
   12.33      SOME c => (Argo_Expr.mk_con c, tcx)
   12.34    | NONE => add_new_term ctxt t (Term.fastype_of t) tcx)
   12.35  
   12.36 -fun mk_eq @{typ HOL.bool} = Argo_Expr.mk_iff
   12.37 +fun mk_eq \<^typ>\<open>HOL.bool\<close> = Argo_Expr.mk_iff
   12.38    | mk_eq _ = Argo_Expr.mk_eq
   12.39  
   12.40 -fun trans_term _ @{const HOL.True} = pair Argo_Expr.true_expr
   12.41 -  | trans_term _ @{const HOL.False} = pair Argo_Expr.false_expr
   12.42 -  | trans_term ctxt (@{const HOL.Not} $ t) = trans_term ctxt t #>> Argo_Expr.mk_not
   12.43 -  | trans_term ctxt (@{const HOL.conj} $ t1 $ t2) =
   12.44 +fun trans_term _ \<^const>\<open>HOL.True\<close> = pair Argo_Expr.true_expr
   12.45 +  | trans_term _ \<^const>\<open>HOL.False\<close> = pair Argo_Expr.false_expr
   12.46 +  | trans_term ctxt (\<^const>\<open>HOL.Not\<close> $ t) = trans_term ctxt t #>> Argo_Expr.mk_not
   12.47 +  | trans_term ctxt (\<^const>\<open>HOL.conj\<close> $ t1 $ t2) =
   12.48        trans_term ctxt t1 ##>> trans_term ctxt t2 #>> uncurry Argo_Expr.mk_and2
   12.49 -  | trans_term ctxt (@{const HOL.disj} $ t1 $ t2) =
   12.50 +  | trans_term ctxt (\<^const>\<open>HOL.disj\<close> $ t1 $ t2) =
   12.51        trans_term ctxt t1 ##>> trans_term ctxt t2 #>> uncurry Argo_Expr.mk_or2
   12.52 -  | trans_term ctxt (@{const HOL.implies} $ t1 $ t2) =
   12.53 +  | trans_term ctxt (\<^const>\<open>HOL.implies\<close> $ t1 $ t2) =
   12.54        trans_term ctxt t1 ##>> trans_term ctxt t2 #>> uncurry Argo_Expr.mk_imp
   12.55 -  | trans_term ctxt (Const (@{const_name HOL.If}, _) $ t1 $ t2 $ t3) =
   12.56 +  | trans_term ctxt (Const (\<^const_name>\<open>HOL.If\<close>, _) $ t1 $ t2 $ t3) =
   12.57        trans_term ctxt t1 ##>> trans_term ctxt t2 ##>> trans_term ctxt t3 #>>
   12.58        (fn ((u1, u2), u3) => Argo_Expr.mk_ite u1 u2 u3)
   12.59 -  | trans_term ctxt (Const (@{const_name HOL.eq}, T) $ t1 $ t2) =
   12.60 +  | trans_term ctxt (Const (\<^const_name>\<open>HOL.eq\<close>, T) $ t1 $ t2) =
   12.61        trans_term ctxt t1 ##>> trans_term ctxt t2 #>> uncurry (mk_eq (Term.domain_type T))
   12.62    | trans_term ctxt (t as (t1 $ t2)) = (fn tcx =>
   12.63        (case ext_trans_term ctxt (trans_term ctxt) t tcx of
   12.64 @@ -260,16 +260,16 @@
   12.65  fun mk_ite t1 t2 t3 =
   12.66    let
   12.67      val T = Term.fastype_of t2
   12.68 -    val ite = Const (@{const_name HOL.If}, [@{typ HOL.bool}, T, T] ---> T)
   12.69 +    val ite = Const (\<^const_name>\<open>HOL.If\<close>, [\<^typ>\<open>HOL.bool\<close>, T, T] ---> T)
   12.70    in ite $ t1 $ t2 $ t3 end
   12.71  
   12.72 -fun term_of _ (Argo_Expr.E (Argo_Expr.True, _)) = @{const HOL.True}
   12.73 -  | term_of _ (Argo_Expr.E (Argo_Expr.False, _)) = @{const HOL.False}
   12.74 +fun term_of _ (Argo_Expr.E (Argo_Expr.True, _)) = \<^const>\<open>HOL.True\<close>
   12.75 +  | term_of _ (Argo_Expr.E (Argo_Expr.False, _)) = \<^const>\<open>HOL.False\<close>
   12.76    | term_of cx (Argo_Expr.E (Argo_Expr.Not, [e])) = HOLogic.mk_not (term_of cx e)
   12.77    | term_of cx (Argo_Expr.E (Argo_Expr.And, es)) =
   12.78 -      mk_nary' @{const HOL.True} HOLogic.mk_conj (map (term_of cx) es)
   12.79 +      mk_nary' \<^const>\<open>HOL.True\<close> HOLogic.mk_conj (map (term_of cx) es)
   12.80    | term_of cx (Argo_Expr.E (Argo_Expr.Or, es)) =
   12.81 -      mk_nary' @{const HOL.False} HOLogic.mk_disj (map (term_of cx) es)
   12.82 +      mk_nary' \<^const>\<open>HOL.False\<close> HOLogic.mk_disj (map (term_of cx) es)
   12.83    | term_of cx (Argo_Expr.E (Argo_Expr.Imp, [e1, e2])) =
   12.84        HOLogic.mk_imp (term_of cx e1, term_of cx e2)
   12.85    | term_of cx (Argo_Expr.E (Argo_Expr.Iff, [e1, e2])) =
   12.86 @@ -289,7 +289,7 @@
   12.87          SOME t => t
   12.88        | NONE => raise Fail "bad expression")
   12.89  
   12.90 -fun as_prop ct = Thm.apply @{cterm HOL.Trueprop} ct
   12.91 +fun as_prop ct = Thm.apply \<^cterm>\<open>HOL.Trueprop\<close> ct
   12.92  
   12.93  fun cterm_of ctxt cons e = Thm.cterm_of ctxt (term_of (ctxt, cons) e)
   12.94  fun cprop_of ctxt cons e = as_prop (cterm_of ctxt cons e)
   12.95 @@ -316,7 +316,7 @@
   12.96  fun with_frees ctxt n mk =
   12.97    let
   12.98      val ns = map (fn i => "P" ^ string_of_int i) (0 upto (n - 1))
   12.99 -    val ts = map (Free o rpair @{typ bool}) ns
  12.100 +    val ts = map (Free o rpair \<^typ>\<open>bool\<close>) ns
  12.101      val t = mk_nary HOLogic.mk_disj (mk ts)
  12.102    in prove_taut ctxt ns t end
  12.103  
  12.104 @@ -373,12 +373,12 @@
  12.105  
  12.106  fun flat_conj_conv ct =
  12.107    (case Thm.term_of ct of
  12.108 -    @{const HOL.conj} $ _ $ _ => flatten_conv flat_conj_conv flatten_and_thm ct
  12.109 +    \<^const>\<open>HOL.conj\<close> $ _ $ _ => flatten_conv flat_conj_conv flatten_and_thm ct
  12.110    | _ => Conv.all_conv ct)
  12.111  
  12.112  fun flat_disj_conv ct =
  12.113    (case Thm.term_of ct of
  12.114 -    @{const HOL.disj} $ _ $ _ => flatten_conv flat_disj_conv flatten_or_thm ct
  12.115 +    \<^const>\<open>HOL.disj\<close> $ _ $ _ => flatten_conv flat_disj_conv flatten_or_thm ct
  12.116    | _ => Conv.all_conv ct)
  12.117  
  12.118  fun explode rule1 rule2 thm =
  12.119 @@ -414,7 +414,7 @@
  12.120    in mk_rewr (discharge2 lhs rhs rule) end
  12.121  
  12.122  fun with_conj f g ct = iff_intro iff_conj_thm (f o explode_conj) g ct
  12.123 -fun with_ndis f g ct = iff_intro iff_ndis_thm (f o explode_ndis) g (Thm.apply @{cterm HOL.Not} ct)
  12.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)
  12.125  
  12.126  fun swap_indices n iss = map (fn i => find_index (fn is => member (op =) is i) iss) (0 upto (n - 1))
  12.127  fun sort_nary w f g (n, iss) = w (f (map hd iss)) (under_assumption (f (swap_indices n iss) o g))
  12.128 @@ -484,7 +484,7 @@
  12.129    | replay_args_conv ctxt [c1, c2] ct = binop_conv (replay_conv ctxt c1) (replay_conv ctxt c2) ct
  12.130    | replay_args_conv ctxt (c :: cs) ct =
  12.131        (case Term.head_of (Thm.term_of ct) of
  12.132 -        Const (@{const_name HOL.If}, _) =>
  12.133 +        Const (\<^const_name>\<open>HOL.If\<close>, _) =>
  12.134            let val (cs', c') = split_last cs
  12.135            in Conv.combination_conv (replay_args_conv ctxt (c :: cs')) (replay_conv ctxt c') ct end
  12.136        | _ => binop_conv (replay_conv ctxt c) (replay_args_conv ctxt cs) ct)
  12.137 @@ -520,7 +520,7 @@
  12.138  
  12.139  val unit_rule = @{lemma "(P \<Longrightarrow> False) \<Longrightarrow> (\<not>P \<Longrightarrow> False) \<Longrightarrow> False" by fast}
  12.140  val unit_rule_var = Thm.dest_arg (Thm.dest_arg1 (Thm.cprem_of unit_rule 1))
  12.141 -val bogus_ct = @{cterm HOL.True}
  12.142 +val bogus_ct = \<^cterm>\<open>HOL.True\<close>
  12.143  
  12.144  fun replay_unit_res lit (pthm, plits) (nthm, nlits) =
  12.145    let
  12.146 @@ -543,7 +543,7 @@
  12.147  fun replay_hyp i ct =
  12.148    if i < 0 then (Thm.assume ct, [(~i, ct)])
  12.149    else
  12.150 -    let val cu = as_prop (Thm.apply @{cterm HOL.Not} (Thm.apply @{cterm HOL.Not} (Thm.dest_arg ct)))
  12.151 +    let val cu = as_prop (Thm.apply \<^cterm>\<open>HOL.Not\<close> (Thm.apply \<^cterm>\<open>HOL.Not\<close> (Thm.dest_arg ct)))
  12.152      in (discharge (Thm.assume cu) dneg_rule, [(~i, cu)]) end
  12.153  
  12.154  
  12.155 @@ -601,7 +601,7 @@
  12.156  
  12.157  fun unclausify (thm, lits) ls =
  12.158    (case (Thm.prop_of thm, lits) of
  12.159 -    (@{const HOL.Trueprop} $ @{const HOL.False}, [(_, ct)]) =>
  12.160 +    (\<^const>\<open>HOL.Trueprop\<close> $ \<^const>\<open>HOL.False\<close>, [(_, ct)]) =>
  12.161        let val thm = Thm.implies_intr ct thm
  12.162        in (discharge thm unclausify_rule1 handle THM _ => discharge thm unclausify_rule2, ls) end
  12.163    | _ => (thm, Ord_List.union lit_ord lits ls))
  12.164 @@ -668,22 +668,22 @@
  12.165    let val ct = Drule.strip_imp_concl (Thm.cprop_of thm)
  12.166    in
  12.167      (case Thm.term_of ct of
  12.168 -      @{const HOL.Trueprop} $ Var (_, @{typ HOL.bool}) =>
  12.169 -        instantiate (Thm.dest_arg ct) @{cterm HOL.False} thm
  12.170 -    | Var _ => instantiate ct @{cprop HOL.False} thm
  12.171 +      \<^const>\<open>HOL.Trueprop\<close> $ Var (_, \<^typ>\<open>HOL.bool\<close>) =>
  12.172 +        instantiate (Thm.dest_arg ct) \<^cterm>\<open>HOL.False\<close> thm
  12.173 +    | Var _ => instantiate ct \<^cprop>\<open>HOL.False\<close> thm
  12.174      | _ => thm)
  12.175    end
  12.176  
  12.177  fun atomize_conv ctxt ct =
  12.178    (case Thm.term_of ct of
  12.179 -    @{const HOL.Trueprop} $ _ => Conv.all_conv
  12.180 -  | @{const Pure.imp} $ _ $ _ =>
  12.181 +    \<^const>\<open>HOL.Trueprop\<close> $ _ => Conv.all_conv
  12.182 +  | \<^const>\<open>Pure.imp\<close> $ _ $ _ =>
  12.183        Conv.binop_conv (atomize_conv ctxt) then_conv
  12.184        Conv.rewr_conv @{thm atomize_imp}
  12.185 -  | Const (@{const_name Pure.eq}, _) $ _ $ _ =>
  12.186 +  | Const (\<^const_name>\<open>Pure.eq\<close>, _) $ _ $ _ =>
  12.187        Conv.binop_conv (atomize_conv ctxt) then_conv
  12.188        Conv.rewr_conv @{thm atomize_eq}
  12.189 -  | Const (@{const_name Pure.all}, _) $ Abs _ =>
  12.190 +  | Const (\<^const_name>\<open>Pure.all\<close>, _) $ Abs _ =>
  12.191        Conv.binder_conv (atomize_conv o snd) ctxt then_conv
  12.192        Conv.rewr_conv @{thm atomize_all}
  12.193    | _ => Conv.all_conv) ct
  12.194 @@ -723,7 +723,7 @@
  12.195      | (NONE, _) => Tactical.no_tac)) ctxt
  12.196  
  12.197  val _ =
  12.198 -  Theory.setup (Method.setup @{binding argo}
  12.199 +  Theory.setup (Method.setup \<^binding>\<open>argo\<close>
  12.200      (Scan.optional Attrib.thms [] >>
  12.201        (fn thms => fn ctxt => METHOD (fn facts =>
  12.202          HEADGOAL (argo_tac ctxt (thms @ facts)))))
    13.1 --- a/src/HOL/Tools/Function/fun.ML	Wed Dec 06 16:01:15 2017 +0100
    13.2 +++ b/src/HOL/Tools/Function/fun.ML	Wed Dec 06 21:01:01 2017 +0100
    13.3 @@ -70,7 +70,7 @@
    13.4          val qs = map Free (Name.invent Name.context "a" n ~~ argTs)
    13.5        in
    13.6          HOLogic.mk_eq(list_comb (Free (fname, fT), qs),
    13.7 -          Const (@{const_name undefined}, rT))
    13.8 +          Const (\<^const_name>\<open>undefined\<close>, rT))
    13.9          |> HOLogic.mk_Trueprop
   13.10          |> fold_rev Logic.all qs
   13.11        end
   13.12 @@ -171,7 +171,7 @@
   13.13  
   13.14  
   13.15  val _ =
   13.16 -  Outer_Syntax.local_theory' @{command_keyword fun}
   13.17 +  Outer_Syntax.local_theory' \<^command_keyword>\<open>fun\<close>
   13.18      "define general recursive functions (short version)"
   13.19      (function_parser fun_config
   13.20        >> (fn (config, (fixes, specs)) => add_fun_cmd fixes specs config))
    14.1 --- a/src/HOL/Tools/Function/fun_cases.ML	Wed Dec 06 16:01:15 2017 +0100
    14.2 +++ b/src/HOL/Tools/Function/fun_cases.ML	Wed Dec 06 21:01:01 2017 +0100
    14.3 @@ -54,7 +54,7 @@
    14.4  val fun_cases_cmd = gen_fun_cases Attrib.check_src Syntax.read_prop;
    14.5  
    14.6  val _ =
    14.7 -  Outer_Syntax.local_theory @{command_keyword fun_cases}
    14.8 +  Outer_Syntax.local_theory \<^command_keyword>\<open>fun_cases\<close>
    14.9      "create simplified instances of elimination rules for function equations"
   14.10      (Parse.and_list1 Parse_Spec.simple_specs >> (snd oo fun_cases_cmd));
   14.11  
    15.1 --- a/src/HOL/Tools/Function/function.ML	Wed Dec 06 16:01:15 2017 +0100
    15.2 +++ b/src/HOL/Tools/Function/function.ML	Wed Dec 06 21:01:01 2017 +0100
    15.3 @@ -273,13 +273,13 @@
    15.4  (* outer syntax *)
    15.5  
    15.6  val _ =
    15.7 -  Outer_Syntax.local_theory_to_proof' @{command_keyword function}
    15.8 +  Outer_Syntax.local_theory_to_proof' \<^command_keyword>\<open>function\<close>
    15.9      "define general recursive functions"
   15.10      (function_parser default_config
   15.11        >> (fn (config, (fixes, specs)) => function_cmd fixes specs config))
   15.12  
   15.13  val _ =
   15.14 -  Outer_Syntax.local_theory_to_proof @{command_keyword termination}
   15.15 +  Outer_Syntax.local_theory_to_proof \<^command_keyword>\<open>termination\<close>
   15.16      "prove termination of a recursive function"
   15.17      (Scan.option Parse.term >> termination_cmd)
   15.18  
    16.1 --- a/src/HOL/Tools/Function/function_common.ML	Wed Dec 06 16:01:15 2017 +0100
    16.2 +++ b/src/HOL/Tools/Function/function_common.ML	Wed Dec 06 21:01:01 2017 +0100
    16.3 @@ -118,7 +118,7 @@
    16.4  
    16.5  fun PROFILE msg = if !profile then timeap_msg msg else I
    16.6  
    16.7 -val acc_const_name = @{const_name Wellfounded.accp}
    16.8 +val acc_const_name = \<^const_name>\<open>Wellfounded.accp\<close>
    16.9  fun mk_acc domT R =
   16.10    Const (acc_const_name, (domT --> domT --> HOLogic.boolT) --> domT --> HOLogic.boolT) $ R
   16.11  
   16.12 @@ -128,8 +128,8 @@
   16.13  fun split_def ctxt check_head geq =
   16.14    let
   16.15      fun input_error msg = cat_lines [msg, Syntax.string_of_term ctxt geq]
   16.16 -    val qs = Term.strip_qnt_vars @{const_name Pure.all} geq
   16.17 -    val imp = Term.strip_qnt_body @{const_name Pure.all} geq
   16.18 +    val qs = Term.strip_qnt_vars \<^const_name>\<open>Pure.all\<close> geq
   16.19 +    val imp = Term.strip_qnt_body \<^const_name>\<open>Pure.all\<close> geq
   16.20      val (gs, eq) = Logic.strip_horn imp
   16.21  
   16.22      val (f_args, rhs) = HOLogic.dest_eq (HOLogic.dest_Trueprop eq)
   16.23 @@ -372,7 +372,7 @@
   16.24       || (Parse.reserved "no_partials" >> K No_Partials))
   16.25  
   16.26    fun config_parser default =
   16.27 -    (Scan.optional (@{keyword "("} |-- Parse.!!! (Parse.list1 option_parser) --| @{keyword ")"}) [])
   16.28 +    (Scan.optional (\<^keyword>\<open>(\<close> |-- Parse.!!! (Parse.list1 option_parser) --| \<^keyword>\<open>)\<close>) [])
   16.29       >> (fn opts => fold apply_opt opts default)
   16.30  in
   16.31    fun function_parser default_cfg =
    17.1 --- a/src/HOL/Tools/Function/function_core.ML	Wed Dec 06 16:01:15 2017 +0100
    17.2 +++ b/src/HOL/Tools/Function/function_core.ML	Wed Dec 06 21:01:01 2017 +0100
    17.3 @@ -394,7 +394,7 @@
    17.4      (* Inductive Hypothesis: !!z. (z,x):R ==> EX!y. (z,y):G *)
    17.5      val ihyp = Logic.all_const domT $ Abs ("z", domT,
    17.6        Logic.mk_implies (HOLogic.mk_Trueprop (R $ Bound 0 $ x),
    17.7 -        HOLogic.mk_Trueprop (Const (@{const_name Ex1}, (ranT --> boolT) --> boolT) $
    17.8 +        HOLogic.mk_Trueprop (Const (\<^const_name>\<open>Ex1\<close>, (ranT --> boolT) --> boolT) $
    17.9            Abs ("y", ranT, G $ Bound 1 $ Bound 0))))
   17.10        |> Thm.cterm_of ctxt
   17.11  
   17.12 @@ -494,7 +494,7 @@
   17.13        Thm.make_def_binding (Config.get lthy function_internals)
   17.14          (derived_name_suffix defname "_sumC")
   17.15      val f_def =
   17.16 -      Abs ("x", domT, Const (@{const_name Fun_Def.THE_default}, ranT --> (ranT --> boolT) --> ranT)
   17.17 +      Abs ("x", domT, Const (\<^const_name>\<open>Fun_Def.THE_default\<close>, ranT --> (ranT --> boolT) --> ranT)
   17.18          $ (default $ Bound 0) $ Abs ("y", ranT, G $ Bound 1 $ Bound 0))
   17.19        |> Syntax.check_term lthy
   17.20    in
   17.21 @@ -777,10 +777,10 @@
   17.22      val R' = Free (Rn, fastype_of R)
   17.23  
   17.24      val Rrel = Free (Rn, HOLogic.mk_setT (HOLogic.mk_prodT (domT, domT)))
   17.25 -    val inrel_R = Const (@{const_name Fun_Def.in_rel},
   17.26 +    val inrel_R = Const (\<^const_name>\<open>Fun_Def.in_rel\<close>,
   17.27        HOLogic.mk_setT (HOLogic.mk_prodT (domT, domT)) --> fastype_of R) $ Rrel
   17.28  
   17.29 -    val wfR' = HOLogic.mk_Trueprop (Const (@{const_name Wellfounded.wfP},
   17.30 +    val wfR' = HOLogic.mk_Trueprop (Const (\<^const_name>\<open>Wellfounded.wfP\<close>,
   17.31        (domT --> domT --> boolT) --> boolT) $ R')
   17.32        |> Thm.cterm_of ctxt' (* "wf R'" *)
   17.33  
    18.1 --- a/src/HOL/Tools/Function/function_elims.ML	Wed Dec 06 16:01:15 2017 +0100
    18.2 +++ b/src/HOL/Tools/Function/function_elims.ML	Wed Dec 06 21:01:01 2017 +0100
    18.3 @@ -24,9 +24,9 @@
    18.4  (* Extract a function and its arguments from a proposition that is
    18.5     either of the form "f x y z = ..." or, in case of function that
    18.6     returns a boolean, "f x y z" *)
    18.7 -fun dest_funprop (Const (@{const_name HOL.eq}, _) $ lhs $ rhs) = (strip_comb lhs, rhs)
    18.8 -  | dest_funprop (Const (@{const_name Not}, _) $ t) = (strip_comb t, @{term False})
    18.9 -  | dest_funprop t = (strip_comb t, @{term True});
   18.10 +fun dest_funprop (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ lhs $ rhs) = (strip_comb lhs, rhs)
   18.11 +  | dest_funprop (Const (\<^const_name>\<open>Not\<close>, _) $ t) = (strip_comb t, \<^term>\<open>False\<close>)
   18.12 +  | dest_funprop t = (strip_comb t, \<^term>\<open>True\<close>);
   18.13  
   18.14  local
   18.15  
   18.16 @@ -34,9 +34,9 @@
   18.17    let
   18.18      fun inspect eq =
   18.19        (case eq of
   18.20 -        Const (@{const_name Trueprop}, _) $ (Const (@{const_name HOL.eq}, _) $ Free x $ t) =>
   18.21 +        Const (\<^const_name>\<open>Trueprop\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ Free x $ t) =>
   18.22            if Logic.occs (Free x, t) then raise Match else true
   18.23 -      | Const (@{const_name Trueprop}, _) $ (Const (@{const_name HOL.eq}, _) $ t $ Free x) =>
   18.24 +      | Const (\<^const_name>\<open>Trueprop\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ t $ Free x) =>
   18.25            if Logic.occs (Free x, t) then raise Match else false
   18.26        | _ => raise Match);
   18.27      fun mk_eq thm =
   18.28 @@ -68,7 +68,7 @@
   18.29        |> Tactic.rule_by_tactic ctxt (distinct_subgoals_tac THEN TRY (resolve_tac ctxt eq_boolI 1))
   18.30        |> Tactic.rule_by_tactic ctxt (distinct_subgoals_tac THEN ALLGOALS (bool_subst_tac ctxt));
   18.31    in
   18.32 -    map mk_bool_elim [@{cterm True}, @{cterm False}]
   18.33 +    map mk_bool_elim [\<^cterm>\<open>True\<close>, \<^cterm>\<open>False\<close>]
   18.34    end;
   18.35  
   18.36  in
   18.37 @@ -86,7 +86,7 @@
   18.38          fun mk_funeq 0 T (acc_args, acc_lhs) =
   18.39                let val y = variant_free acc_lhs ("y", T)
   18.40                in (y, rev acc_args, HOLogic.mk_Trueprop (HOLogic.mk_eq (acc_lhs, y))) end
   18.41 -          | mk_funeq n (Type (@{type_name fun}, [S, T])) (acc_args, acc_lhs) =
   18.42 +          | mk_funeq n (Type (\<^type_name>\<open>fun\<close>, [S, T])) (acc_args, acc_lhs) =
   18.43                let val x = variant_free acc_lhs ("x", S)
   18.44                in mk_funeq (n - 1) T (x :: acc_args, acc_lhs $ x) end
   18.45            | mk_funeq _ _ _ = raise TERM ("Not a function", [f]);
   18.46 @@ -111,7 +111,7 @@
   18.47          val args = HOLogic.mk_tuple arg_vars;
   18.48          val domT = R |> dest_Free |> snd |> hd o snd o dest_Type;
   18.49  
   18.50 -        val P = Thm.cterm_of ctxt (variant_free prop ("P", @{typ bool}));
   18.51 +        val P = Thm.cterm_of ctxt (variant_free prop ("P", \<^typ>\<open>bool\<close>));
   18.52          val sumtree_inj = Sum_Tree.mk_inj domT n_fs (idx + 1) args;
   18.53  
   18.54          val cprop = Thm.cterm_of ctxt prop;
   18.55 @@ -137,7 +137,7 @@
   18.56            |> Thm.forall_intr (Thm.cterm_of ctxt rhs_var);
   18.57  
   18.58          val bool_elims =
   18.59 -          if fastype_of rhs_var = @{typ bool}
   18.60 +          if fastype_of rhs_var = \<^typ>\<open>bool\<close>
   18.61            then mk_bool_elims ctxt elim_stripped
   18.62            else [];
   18.63  
    19.1 --- a/src/HOL/Tools/Function/function_lib.ML	Wed Dec 06 16:01:15 2017 +0100
    19.2 +++ b/src/HOL/Tools/Function/function_lib.ML	Wed Dec 06 21:01:01 2017 +0100
    19.3 @@ -50,7 +50,7 @@
    19.4  
    19.5  
    19.6  (* Removes all quantifiers from a term, replacing bound variables by frees. *)
    19.7 -fun dest_all_all (t as (Const (@{const_name Pure.all},_) $ _)) =
    19.8 +fun dest_all_all (t as (Const (\<^const_name>\<open>Pure.all\<close>,_) $ _)) =
    19.9    let
   19.10      val (v,b) = Logic.dest_all t |> apfst Free
   19.11      val (vs, b') = dest_all_all b
   19.12 @@ -129,7 +129,7 @@
   19.13  
   19.14  (* instance for unions *)
   19.15  fun regroup_union_conv ctxt =
   19.16 -  regroup_conv ctxt @{const_abbrev Set.empty} @{const_name Lattices.sup}
   19.17 +  regroup_conv ctxt \<^const_abbrev>\<open>Set.empty\<close> \<^const_name>\<open>Lattices.sup\<close>
   19.18      (map (fn t => t RS eq_reflection)
   19.19        (@{thms Un_ac} @ @{thms Un_empty_right} @ @{thms Un_empty_left}))
   19.20  
    20.1 --- a/src/HOL/Tools/Function/induction_schema.ML	Wed Dec 06 16:01:15 2017 +0100
    20.2 +++ b/src/HOL/Tools/Function/induction_schema.ML	Wed Dec 06 21:01:01 2017 +0100
    20.3 @@ -140,7 +140,7 @@
    20.4    end
    20.5  
    20.6  fun mk_wf R (IndScheme {T, ...}) =
    20.7 -  HOLogic.Trueprop $ (Const (@{const_name wf}, mk_relT T --> HOLogic.boolT) $ R)
    20.8 +  HOLogic.Trueprop $ (Const (\<^const_name>\<open>wf\<close>, mk_relT T --> HOLogic.boolT) $ R)
    20.9  
   20.10  fun mk_ineqs R thesisn (IndScheme {T, cases, branches}) =
   20.11    let
   20.12 @@ -215,7 +215,7 @@
   20.13      val ihyp = Logic.all_const T $ Abs ("z", T,
   20.14        Logic.mk_implies
   20.15          (HOLogic.mk_Trueprop (
   20.16 -          Const (@{const_name Set.member}, HOLogic.mk_prodT (T, T) --> mk_relT T --> HOLogic.boolT) 
   20.17 +          Const (\<^const_name>\<open>Set.member\<close>, HOLogic.mk_prodT (T, T) --> mk_relT T --> HOLogic.boolT) 
   20.18            $ (HOLogic.pair_const T T $ Bound 0 $ x)
   20.19            $ R),
   20.20           HOLogic.mk_Trueprop (P_comp $ Bound 0)))
    21.1 --- a/src/HOL/Tools/Function/lexicographic_order.ML	Wed Dec 06 16:01:15 2017 +0100
    21.2 +++ b/src/HOL/Tools/Function/lexicographic_order.ML	Wed Dec 06 21:01:01 2017 +0100
    21.3 @@ -22,9 +22,9 @@
    21.4    let
    21.5      val relT = HOLogic.mk_setT (HOLogic.mk_prodT (domT, domT))
    21.6      val mlexT = (domT --> HOLogic.natT) --> relT --> relT
    21.7 -    fun mk_ms [] = Const (@{const_abbrev Set.empty}, relT)
    21.8 +    fun mk_ms [] = Const (\<^const_abbrev>\<open>Set.empty\<close>, relT)
    21.9        | mk_ms (f::fs) =
   21.10 -        Const (@{const_name mlex_prod}, mlexT) $ f $ mk_ms fs
   21.11 +        Const (\<^const_name>\<open>mlex_prod\<close>, mlexT) $ f $ mk_ms fs
   21.12    in
   21.13      mk_ms mfuns
   21.14    end
   21.15 @@ -70,13 +70,13 @@
   21.16    let
   21.17      val goals = Thm.cterm_of ctxt o mk_goal (vars, prems, mfun $ lhs, mfun $ rhs)
   21.18    in
   21.19 -    (case try_proof ctxt (goals @{const_name Orderings.less}) solve_tac of
   21.20 +    (case try_proof ctxt (goals \<^const_name>\<open>Orderings.less\<close>) solve_tac of
   21.21        Solved thm => Less thm
   21.22      | Stuck thm =>
   21.23 -        (case try_proof ctxt (goals @{const_name Orderings.less_eq}) solve_tac of
   21.24 +        (case try_proof ctxt (goals \<^const_name>\<open>Orderings.less_eq\<close>) solve_tac of
   21.25            Solved thm2 => LessEq (thm2, thm)
   21.26          | Stuck thm2 =>
   21.27 -            if Thm.prems_of thm2 = [HOLogic.Trueprop $ @{term False}] then False thm2
   21.28 +            if Thm.prems_of thm2 = [HOLogic.Trueprop $ \<^term>\<open>False\<close>] then False thm2
   21.29              else None (thm2, thm)
   21.30          | _ => raise Match) (* FIXME *)
   21.31      | _ => raise Match)
    22.1 --- a/src/HOL/Tools/Function/measure_functions.ML	Wed Dec 06 16:01:15 2017 +0100
    22.2 +++ b/src/HOL/Tools/Function/measure_functions.ML	Wed Dec 06 21:01:01 2017 +0100
    22.3 @@ -15,10 +15,10 @@
    22.4  (** User-declared size functions **)
    22.5  
    22.6  fun mk_is_measure t =
    22.7 -  Const (@{const_name is_measure}, fastype_of t --> HOLogic.boolT) $ t
    22.8 +  Const (\<^const_name>\<open>is_measure\<close>, fastype_of t --> HOLogic.boolT) $ t
    22.9  
   22.10  fun find_measures ctxt T =
   22.11 -  DEPTH_SOLVE (resolve_tac ctxt (rev (Named_Theorems.get ctxt @{named_theorems measure_function})) 1)
   22.12 +  DEPTH_SOLVE (resolve_tac ctxt (rev (Named_Theorems.get ctxt \<^named_theorems>\<open>measure_function\<close>)) 1)
   22.13      (HOLogic.mk_Trueprop (mk_is_measure (Var (("f",0), T --> HOLogic.natT)))
   22.14       |> Thm.cterm_of ctxt |> Goal.init)
   22.15    |> Seq.map (Thm.prop_of #> (fn _ $ (_ $ (_ $ f)) => f))
   22.16 @@ -30,17 +30,17 @@
   22.17  fun constant_0 T = Abs ("x", T, HOLogic.zero)
   22.18  fun constant_1 T = Abs ("x", T, HOLogic.Suc_zero)
   22.19  
   22.20 -fun mk_funorder_funs (Type (@{type_name Sum_Type.sum}, [fT, sT])) =
   22.21 +fun mk_funorder_funs (Type (\<^type_name>\<open>Sum_Type.sum\<close>, [fT, sT])) =
   22.22    map (fn m => Sum_Tree.mk_sumcase fT sT HOLogic.natT m (constant_0 sT)) (mk_funorder_funs fT)
   22.23    @ map (fn m => Sum_Tree.mk_sumcase fT sT HOLogic.natT (constant_0 fT) m) (mk_funorder_funs sT)
   22.24    | mk_funorder_funs T = [ constant_1 T ]
   22.25  
   22.26 -fun mk_ext_base_funs ctxt (Type (@{type_name Sum_Type.sum}, [fT, sT])) =
   22.27 +fun mk_ext_base_funs ctxt (Type (\<^type_name>\<open>Sum_Type.sum\<close>, [fT, sT])) =
   22.28      map_product (Sum_Tree.mk_sumcase fT sT HOLogic.natT)
   22.29        (mk_ext_base_funs ctxt fT) (mk_ext_base_funs ctxt sT)
   22.30    | mk_ext_base_funs ctxt T = find_measures ctxt T
   22.31  
   22.32 -fun mk_all_measure_funs ctxt (T as Type (@{type_name Sum_Type.sum}, _)) =
   22.33 +fun mk_all_measure_funs ctxt (T as Type (\<^type_name>\<open>Sum_Type.sum\<close>, _)) =
   22.34      mk_ext_base_funs ctxt T @ mk_funorder_funs T
   22.35    | mk_all_measure_funs ctxt T = find_measures ctxt T
   22.36  
    23.1 --- a/src/HOL/Tools/Function/mutual.ML	Wed Dec 06 16:01:15 2017 +0100
    23.2 +++ b/src/HOL/Tools/Function/mutual.ML	Wed Dec 06 21:01:01 2017 +0100
    23.3 @@ -247,7 +247,7 @@
    23.4  fun mutual_cases_rule ctxt cases_rule n ST (MutualPart {i, cargTs = Ts, ...}) =
    23.5    let
    23.6      val [P, x] =
    23.7 -      Variable.variant_frees ctxt [] [("P", @{typ bool}), ("x", HOLogic.mk_tupleT Ts)]
    23.8 +      Variable.variant_frees ctxt [] [("P", \<^typ>\<open>bool\<close>), ("x", HOLogic.mk_tupleT Ts)]
    23.9        |> map (Thm.cterm_of ctxt o Free);
   23.10      val sumtree_inj = Thm.cterm_of ctxt (Sum_Tree.mk_inj ST n i (Thm.term_of x));
   23.11  
    24.1 --- a/src/HOL/Tools/Function/partial_function.ML	Wed Dec 06 16:01:15 2017 +0100
    24.2 +++ b/src/HOL/Tools/Function/partial_function.ML	Wed Dec 06 21:01:01 2017 +0100
    24.3 @@ -109,7 +109,7 @@
    24.4  fun mono_tac ctxt =
    24.5    K (Local_Defs.unfold0_tac ctxt [@{thm curry_def}])
    24.6    THEN' (TRY o REPEAT_ALL_NEW
    24.7 -   (resolve_tac ctxt (rev (Named_Theorems.get ctxt @{named_theorems partial_function_mono}))
    24.8 +   (resolve_tac ctxt (rev (Named_Theorems.get ctxt \<^named_theorems>\<open>partial_function_mono\<close>))
    24.9       ORELSE' split_cases_tac ctxt));
   24.10  
   24.11  
   24.12 @@ -135,7 +135,7 @@
   24.13  (*** currying transformation ***)
   24.14  
   24.15  fun curry_const (A, B, C) =
   24.16 -  Const (@{const_name Product_Type.curry},
   24.17 +  Const (\<^const_name>\<open>Product_Type.curry\<close>,
   24.18      [HOLogic.mk_prodT (A, B) --> C, A, B] ---> C);
   24.19  
   24.20  fun mk_curry f =
   24.21 @@ -310,10 +310,10 @@
   24.22  val add_partial_function = gen_add_partial_function Specification.check_multi_specs;
   24.23  val add_partial_function_cmd = gen_add_partial_function Specification.read_multi_specs;
   24.24  
   24.25 -val mode = @{keyword "("} |-- Parse.name --| @{keyword ")"};
   24.26 +val mode = \<^keyword>\<open>(\<close> |-- Parse.name --| \<^keyword>\<open>)\<close>;
   24.27  
   24.28  val _ =
   24.29 -  Outer_Syntax.local_theory @{command_keyword partial_function} "define partial function"
   24.30 +  Outer_Syntax.local_theory \<^command_keyword>\<open>partial_function\<close> "define partial function"
   24.31      ((mode -- (Parse.vars -- (Parse.where_ |-- Parse_Spec.simple_spec)))
   24.32        >> (fn (mode, (vars, spec)) => add_partial_function_cmd mode vars spec #> #2));
   24.33  
    25.1 --- a/src/HOL/Tools/Function/sum_tree.ML	Wed Dec 06 16:01:15 2017 +0100
    25.2 +++ b/src/HOL/Tools/Function/sum_tree.ML	Wed Dec 06 21:01:01 2017 +0100
    25.3 @@ -30,28 +30,28 @@
    25.4      {left = (fn f => f o left), right = (fn f => f o right), init = I} len i init
    25.5  
    25.6  (* Sum types *)
    25.7 -fun mk_sumT LT RT = Type (@{type_name Sum_Type.sum}, [LT, RT])
    25.8 +fun mk_sumT LT RT = Type (\<^type_name>\<open>Sum_Type.sum\<close>, [LT, RT])
    25.9  fun mk_sumcase TL TR T l r =
   25.10 -  Const (@{const_name sum.case_sum}, (TL --> T) --> (TR --> T) --> mk_sumT TL TR --> T) $ l $ r
   25.11 +  Const (\<^const_name>\<open>sum.case_sum\<close>, (TL --> T) --> (TR --> T) --> mk_sumT TL TR --> T) $ l $ r
   25.12  
   25.13  val App = curry op $
   25.14  
   25.15  fun mk_inj ST n i =
   25.16    access_top_down
   25.17    { init = (ST, I : term -> term),
   25.18 -    left = (fn (T as Type (@{type_name Sum_Type.sum}, [LT, RT]), inj) =>
   25.19 -      (LT, inj o App (Const (@{const_name Inl}, LT --> T)))),
   25.20 -    right =(fn (T as Type (@{type_name Sum_Type.sum}, [LT, RT]), inj) =>
   25.21 -      (RT, inj o App (Const (@{const_name Inr}, RT --> T))))} n i
   25.22 +    left = (fn (T as Type (\<^type_name>\<open>Sum_Type.sum\<close>, [LT, RT]), inj) =>
   25.23 +      (LT, inj o App (Const (\<^const_name>\<open>Inl\<close>, LT --> T)))),
   25.24 +    right =(fn (T as Type (\<^type_name>\<open>Sum_Type.sum\<close>, [LT, RT]), inj) =>
   25.25 +      (RT, inj o App (Const (\<^const_name>\<open>Inr\<close>, RT --> T))))} n i
   25.26    |> snd
   25.27  
   25.28  fun mk_proj ST n i =
   25.29    access_top_down
   25.30    { init = (ST, I : term -> term),
   25.31 -    left = (fn (T as Type (@{type_name Sum_Type.sum}, [LT, RT]), proj) =>
   25.32 -      (LT, App (Const (@{const_name Sum_Type.projl}, T --> LT)) o proj)),
   25.33 -    right =(fn (T as Type (@{type_name Sum_Type.sum}, [LT, RT]), proj) =>
   25.34 -      (RT, App (Const (@{const_name Sum_Type.projr}, T --> RT)) o proj))} n i
   25.35 +    left = (fn (T as Type (\<^type_name>\<open>Sum_Type.sum\<close>, [LT, RT]), proj) =>
   25.36 +      (LT, App (Const (\<^const_name>\<open>Sum_Type.projl\<close>, T --> LT)) o proj)),
   25.37 +    right =(fn (T as Type (\<^type_name>\<open>Sum_Type.sum\<close>, [LT, RT]), proj) =>
   25.38 +      (RT, App (Const (\<^const_name>\<open>Sum_Type.projr\<close>, T --> RT)) o proj))} n i
   25.39    |> snd
   25.40  
   25.41  fun mk_sumcases T fs =
    26.1 --- a/src/HOL/Tools/Function/termination.ML	Wed Dec 06 16:01:15 2017 +0100
    26.2 +++ b/src/HOL/Tools/Function/termination.ML	Wed Dec 06 21:01:01 2017 +0100
    26.3 @@ -67,14 +67,14 @@
    26.4  
    26.5  
    26.6  (* concrete versions for sum types *)
    26.7 -fun is_inj (Const (@{const_name Sum_Type.Inl}, _) $ _) = true
    26.8 -  | is_inj (Const (@{const_name Sum_Type.Inr}, _) $ _) = true
    26.9 +fun is_inj (Const (\<^const_name>\<open>Sum_Type.Inl\<close>, _) $ _) = true
   26.10 +  | is_inj (Const (\<^const_name>\<open>Sum_Type.Inr\<close>, _) $ _) = true
   26.11    | is_inj _ = false
   26.12  
   26.13 -fun dest_inl (Const (@{const_name Sum_Type.Inl}, _) $ t) = SOME t
   26.14 +fun dest_inl (Const (\<^const_name>\<open>Sum_Type.Inl\<close>, _) $ t) = SOME t
   26.15    | dest_inl _ = NONE
   26.16  
   26.17 -fun dest_inr (Const (@{const_name Sum_Type.Inr}, _) $ t) = SOME t
   26.18 +fun dest_inr (Const (\<^const_name>\<open>Sum_Type.Inr\<close>, _) $ t) = SOME t
   26.19    | dest_inr _ = NONE
   26.20  
   26.21  
   26.22 @@ -92,7 +92,7 @@
   26.23    end
   26.24  
   26.25  (* compute list of types for nodes *)
   26.26 -fun node_types sk T = dest_tree (fn Type (@{type_name Sum_Type.sum}, [LT, RT]) => (LT, RT)) sk T |> map snd
   26.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
   26.28  
   26.29  (* find index and raw term *)
   26.30  fun dest_inj (SLeaf i) trm = (i, trm)
   26.31 @@ -125,11 +125,11 @@
   26.32  
   26.33  fun mk_sum_skel rel =
   26.34    let
   26.35 -    val cs = Function_Lib.dest_binop_list @{const_name Lattices.sup} rel
   26.36 -    fun collect_pats (Const (@{const_name Collect}, _) $ Abs (_, _, c)) =
   26.37 +    val cs = Function_Lib.dest_binop_list \<^const_name>\<open>Lattices.sup\<close> rel
   26.38 +    fun collect_pats (Const (\<^const_name>\<open>Collect\<close>, _) $ Abs (_, _, c)) =
   26.39        let
   26.40 -        val (Const (@{const_name HOL.conj}, _) $ (Const (@{const_name HOL.eq}, _) $ _ $ (Const (@{const_name Pair}, _) $ r $ l)) $ _)
   26.41 -          = Term.strip_qnt_body @{const_name Ex} c
   26.42 +        val (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ _ $ (Const (\<^const_name>\<open>Pair\<close>, _) $ r $ l)) $ _)
   26.43 +          = Term.strip_qnt_body \<^const_name>\<open>Ex\<close> c
   26.44        in cons r o cons l end
   26.45    in
   26.46      mk_skel (fold collect_pats cs [])
   26.47 @@ -138,8 +138,8 @@
   26.48  fun prove_chain ctxt chain_tac (c1, c2) =
   26.49    let
   26.50      val goal =
   26.51 -      HOLogic.mk_eq (HOLogic.mk_binop @{const_name Relation.relcomp} (c1, c2),
   26.52 -        Const (@{const_abbrev Set.empty}, fastype_of c1))
   26.53 +      HOLogic.mk_eq (HOLogic.mk_binop \<^const_name>\<open>Relation.relcomp\<close> (c1, c2),
   26.54 +        Const (\<^const_abbrev>\<open>Set.empty\<close>, fastype_of c1))
   26.55        |> HOLogic.mk_Trueprop (* "C1 O C2 = {}" *)
   26.56    in
   26.57      (case Function_Lib.try_proof ctxt (Thm.cterm_of ctxt goal) chain_tac of
   26.58 @@ -148,13 +148,13 @@
   26.59    end
   26.60  
   26.61  
   26.62 -fun dest_call' sk (Const (@{const_name Collect}, _) $ Abs (_, _, c)) =
   26.63 +fun dest_call' sk (Const (\<^const_name>\<open>Collect\<close>, _) $ Abs (_, _, c)) =
   26.64    let
   26.65 -    val vs = Term.strip_qnt_vars @{const_name Ex} c
   26.66 +    val vs = Term.strip_qnt_vars \<^const_name>\<open>Ex\<close> c
   26.67  
   26.68      (* FIXME: throw error "dest_call" for malformed terms *)
   26.69 -    val (Const (@{const_name HOL.conj}, _) $ (Const (@{const_name HOL.eq}, _) $ _ $ (Const (@{const_name Pair}, _) $ r $ l)) $ Gam)
   26.70 -      = Term.strip_qnt_body @{const_name Ex} c
   26.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)
   26.72 +      = Term.strip_qnt_body \<^const_name>\<open>Ex\<close> c
   26.73      val (p, l') = dest_inj sk l
   26.74      val (q, r') = dest_inj sk r
   26.75    in
   26.76 @@ -170,16 +170,16 @@
   26.77        try_proof ctxt (Thm.cterm_of ctxt
   26.78          (Logic.list_all (vs,
   26.79             Logic.mk_implies (HOLogic.mk_Trueprop Gam,
   26.80 -             HOLogic.mk_Trueprop (Const (rel, @{typ "nat \<Rightarrow> nat \<Rightarrow> bool"})
   26.81 +             HOLogic.mk_Trueprop (Const (rel, \<^typ>\<open>nat \<Rightarrow> nat \<Rightarrow> bool\<close>)
   26.82                 $ (m2 $ r) $ (m1 $ l)))))) tac
   26.83    in
   26.84 -    (case try @{const_name Orderings.less} of
   26.85 +    (case try \<^const_name>\<open>Orderings.less\<close> of
   26.86        Solved thm => Less thm
   26.87      | Stuck thm =>
   26.88 -        (case try @{const_name Orderings.less_eq} of
   26.89 +        (case try \<^const_name>\<open>Orderings.less_eq\<close> of
   26.90            Solved thm2 => LessEq (thm2, thm)
   26.91          | Stuck thm2 =>
   26.92 -            if Thm.prems_of thm2 = [HOLogic.Trueprop $ @{term False}]
   26.93 +            if Thm.prems_of thm2 = [HOLogic.Trueprop $ \<^term>\<open>False\<close>]
   26.94              then False thm2 else None (thm2, thm)
   26.95          | _ => raise Match) (* FIXME *)
   26.96      | _ => raise Match)
   26.97 @@ -225,13 +225,13 @@
   26.98  fun CALLS tac i st =
   26.99    if Thm.no_prems st then all_tac st
  26.100    else case Thm.term_of (Thm.cprem_of st i) of
  26.101 -    (_ $ (_ $ rel)) => tac (Function_Lib.dest_binop_list @{const_name Lattices.sup} rel, i) st
  26.102 +    (_ $ (_ $ rel)) => tac (Function_Lib.dest_binop_list \<^const_name>\<open>Lattices.sup\<close> rel, i) st
  26.103    |_ => no_tac st
  26.104  
  26.105  type ttac = data -> int -> tactic
  26.106  
  26.107  fun TERMINATION ctxt atac tac =
  26.108 -  SUBGOAL (fn (_ $ (Const (@{const_name wf}, wfT) $ rel), i) =>
  26.109 +  SUBGOAL (fn (_ $ (Const (\<^const_name>\<open>wf\<close>, wfT) $ rel), i) =>
  26.110    let
  26.111      val (T, _) = HOLogic.dest_prodT (HOLogic.dest_setT (domain_type wfT))
  26.112    in
  26.113 @@ -258,7 +258,7 @@
  26.114      val pT = HOLogic.mk_prodT (T, T)
  26.115      val n = length qs
  26.116      val peq = HOLogic.eq_const pT $ Bound n $ (HOLogic.pair_const T T $ l $ r)
  26.117 -    val conds' = if null conds then [@{term True}] else conds
  26.118 +    val conds' = if null conds then [\<^term>\<open>True\<close>] else conds
  26.119    in
  26.120      HOLogic.Collect_const pT $
  26.121      Abs ("uu_", pT,
  26.122 @@ -284,9 +284,9 @@
  26.123  
  26.124      val relation =
  26.125        if null ineqs
  26.126 -      then Const (@{const_abbrev Set.empty}, fastype_of rel)
  26.127 +      then Const (\<^const_abbrev>\<open>Set.empty\<close>, fastype_of rel)
  26.128        else map mk_compr ineqs
  26.129 -        |> foldr1 (HOLogic.mk_binop @{const_name Lattices.sup})
  26.130 +        |> foldr1 (HOLogic.mk_binop \<^const_name>\<open>Lattices.sup\<close>)
  26.131  
  26.132      fun solve_membership_tac i =
  26.133        (EVERY' (replicate (i - 2) (resolve_tac ctxt @{thms UnI2}))  (* pick the right component of the union *)
    27.1 --- a/src/HOL/Tools/Meson/meson.ML	Wed Dec 06 16:01:15 2017 +0100
    27.2 +++ b/src/HOL/Tools/Meson/meson.ML	Wed Dec 06 21:01:01 2017 +0100
    27.3 @@ -48,11 +48,11 @@
    27.4  structure Meson : MESON =
    27.5  struct
    27.6  
    27.7 -val trace = Attrib.setup_config_bool @{binding meson_trace} (K false)
    27.8 +val trace = Attrib.setup_config_bool \<^binding>\<open>meson_trace\<close> (K false)
    27.9  
   27.10  fun trace_msg ctxt msg = if Config.get ctxt trace then tracing (msg ()) else ()
   27.11  
   27.12 -val max_clauses = Attrib.setup_config_int @{binding meson_max_clauses} (K 60)
   27.13 +val max_clauses = Attrib.setup_config_int \<^binding>\<open>meson_max_clauses\<close> (K 60)
   27.14  
   27.15  (*No known example (on 1-5-2007) needs even thirty*)
   27.16  val iter_deepen_limit = 50;
   27.17 @@ -100,7 +100,7 @@
   27.18      try (fn () =>
   27.19        let val thy = Proof_Context.theory_of ctxt
   27.20            val tmA = Thm.concl_of thA
   27.21 -          val Const(@{const_name Pure.imp},_) $ tmB $ _ = Thm.prop_of thB
   27.22 +          val Const(\<^const_name>\<open>Pure.imp\<close>,_) $ tmB $ _ = Thm.prop_of thB
   27.23            val tenv =
   27.24              Pattern.first_order_match thy (tmB, tmA)
   27.25                                            (Vartab.empty, Vartab.empty) |> snd
   27.26 @@ -121,18 +121,18 @@
   27.27  
   27.28  fun fix_bound_var_names old_t new_t =
   27.29    let
   27.30 -    fun quant_of @{const_name All} = SOME true
   27.31 -      | quant_of @{const_name Ball} = SOME true
   27.32 -      | quant_of @{const_name Ex} = SOME false
   27.33 -      | quant_of @{const_name Bex} = SOME false
   27.34 +    fun quant_of \<^const_name>\<open>All\<close> = SOME true
   27.35 +      | quant_of \<^const_name>\<open>Ball\<close> = SOME true
   27.36 +      | quant_of \<^const_name>\<open>Ex\<close> = SOME false
   27.37 +      | quant_of \<^const_name>\<open>Bex\<close> = SOME false
   27.38        | quant_of _ = NONE
   27.39      val flip_quant = Option.map not
   27.40      fun some_eq (SOME x) (SOME y) = x = y
   27.41        | some_eq _ _ = false
   27.42      fun add_names quant (Const (quant_s, _) $ Abs (s, _, t')) =
   27.43          add_names quant t' #> some_eq quant (quant_of quant_s) ? cons s
   27.44 -      | add_names quant (@{const Not} $ t) = add_names (flip_quant quant) t
   27.45 -      | add_names quant (@{const implies} $ t1 $ t2) =
   27.46 +      | add_names quant (\<^const>\<open>Not\<close> $ t) = add_names (flip_quant quant) t
   27.47 +      | add_names quant (\<^const>\<open>implies\<close> $ t1 $ t2) =
   27.48          add_names (flip_quant quant) t1 #> add_names quant t2
   27.49        | add_names quant (t1 $ t2) = fold (add_names quant) [t1, t2]
   27.50        | add_names _ _ = I
   27.51 @@ -169,7 +169,7 @@
   27.52     workaround is to instantiate "?P := (%c. ... c ... c ... c ...)" manually. *)
   27.53  fun quant_resolve_tac ctxt th i st =
   27.54    case (Thm.concl_of st, Thm.prop_of th) of
   27.55 -    (@{const Trueprop} $ (Var _ $ (c as Free _)), @{const Trueprop} $ _) =>
   27.56 +    (\<^const>\<open>Trueprop\<close> $ (Var _ $ (c as Free _)), \<^const>\<open>Trueprop\<close> $ _) =>
   27.57      let
   27.58        val cc = Thm.cterm_of ctxt c
   27.59        val ct = Thm.dest_arg (Thm.cprop_of th)
   27.60 @@ -197,21 +197,21 @@
   27.61  (*Are any of the logical connectives in "bs" present in the term?*)
   27.62  fun has_conns bs =
   27.63    let fun has (Const _) = false
   27.64 -        | has (Const(@{const_name Trueprop},_) $ p) = has p
   27.65 -        | has (Const(@{const_name Not},_) $ p) = has p
   27.66 -        | has (Const(@{const_name HOL.disj},_) $ p $ q) = member (op =) bs @{const_name HOL.disj} orelse has p orelse has q
   27.67 -        | has (Const(@{const_name HOL.conj},_) $ p $ q) = member (op =) bs @{const_name HOL.conj} orelse has p orelse has q
   27.68 -        | has (Const(@{const_name All},_) $ Abs(_,_,p)) = member (op =) bs @{const_name All} orelse has p
   27.69 -        | has (Const(@{const_name Ex},_) $ Abs(_,_,p)) = member (op =) bs @{const_name Ex} orelse has p
   27.70 +        | has (Const(\<^const_name>\<open>Trueprop\<close>,_) $ p) = has p
   27.71 +        | has (Const(\<^const_name>\<open>Not\<close>,_) $ p) = has p
   27.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
   27.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
   27.74 +        | has (Const(\<^const_name>\<open>All\<close>,_) $ Abs(_,_,p)) = member (op =) bs \<^const_name>\<open>All\<close> orelse has p
   27.75 +        | has (Const(\<^const_name>\<open>Ex\<close>,_) $ Abs(_,_,p)) = member (op =) bs \<^const_name>\<open>Ex\<close> orelse has p
   27.76          | has _ = false
   27.77    in  has  end;
   27.78  
   27.79  
   27.80  (**** Clause handling ****)
   27.81  
   27.82 -fun literals (Const(@{const_name Trueprop},_) $ P) = literals P
   27.83 -  | literals (Const(@{const_name HOL.disj},_) $ P $ Q) = literals P @ literals Q
   27.84 -  | literals (Const(@{const_name Not},_) $ P) = [(false,P)]
   27.85 +fun literals (Const(\<^const_name>\<open>Trueprop\<close>,_) $ P) = literals P
   27.86 +  | literals (Const(\<^const_name>\<open>HOL.disj\<close>,_) $ P $ Q) = literals P @ literals Q
   27.87 +  | literals (Const(\<^const_name>\<open>Not\<close>,_) $ P) = [(false,P)]
   27.88    | literals P = [(true,P)];
   27.89  
   27.90  (*number of literals in a term*)
   27.91 @@ -220,23 +220,23 @@
   27.92  
   27.93  (*** Tautology Checking ***)
   27.94  
   27.95 -fun signed_lits_aux (Const (@{const_name HOL.disj}, _) $ P $ Q) (poslits, neglits) =
   27.96 +fun signed_lits_aux (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ P $ Q) (poslits, neglits) =
   27.97        signed_lits_aux Q (signed_lits_aux P (poslits, neglits))
   27.98 -  | signed_lits_aux (Const(@{const_name Not},_) $ P) (poslits, neglits) = (poslits, P::neglits)
   27.99 +  | signed_lits_aux (Const(\<^const_name>\<open>Not\<close>,_) $ P) (poslits, neglits) = (poslits, P::neglits)
  27.100    | signed_lits_aux P (poslits, neglits) = (P::poslits, neglits);
  27.101  
  27.102  fun signed_lits th = signed_lits_aux (HOLogic.dest_Trueprop (Thm.concl_of th)) ([],[]);
  27.103  
  27.104  (*Literals like X=X are tautologous*)
  27.105 -fun taut_poslit (Const(@{const_name HOL.eq},_) $ t $ u) = t aconv u
  27.106 -  | taut_poslit (Const(@{const_name True},_)) = true
  27.107 +fun taut_poslit (Const(\<^const_name>\<open>HOL.eq\<close>,_) $ t $ u) = t aconv u
  27.108 +  | taut_poslit (Const(\<^const_name>\<open>True\<close>,_)) = true
  27.109    | taut_poslit _ = false;
  27.110  
  27.111  fun is_taut th =
  27.112    let val (poslits,neglits) = signed_lits th
  27.113    in  exists taut_poslit poslits
  27.114        orelse
  27.115 -      exists (member (op aconv) neglits) (@{term False} :: poslits)
  27.116 +      exists (member (op aconv) neglits) (\<^term>\<open>False\<close> :: poslits)
  27.117    end
  27.118    handle TERM _ => false;       (*probably dest_Trueprop on a weird theorem*)
  27.119  
  27.120 @@ -256,18 +256,18 @@
  27.121  fun refl_clause_aux 0 th = th
  27.122    | refl_clause_aux n th =
  27.123         case HOLogic.dest_Trueprop (Thm.concl_of th) of
  27.124 -          (Const (@{const_name HOL.disj}, _) $ (Const (@{const_name HOL.disj}, _) $ _ $ _) $ _) =>
  27.125 +          (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ _ $ _) $ _) =>
  27.126              refl_clause_aux n (th RS disj_assoc)    (*isolate an atom as first disjunct*)
  27.127 -        | (Const (@{const_name HOL.disj}, _) $ (Const(@{const_name Not},_) $ (Const(@{const_name HOL.eq},_) $ t $ u)) $ _) =>
  27.128 +        | (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ (Const(\<^const_name>\<open>Not\<close>,_) $ (Const(\<^const_name>\<open>HOL.eq\<close>,_) $ t $ u)) $ _) =>
  27.129              if eliminable(t,u)
  27.130              then refl_clause_aux (n-1) (th RS not_refl_disj_D)  (*Var inequation: delete*)
  27.131              else refl_clause_aux (n-1) (th RS disj_comm)  (*not between Vars: ignore*)
  27.132 -        | (Const (@{const_name HOL.disj}, _) $ _ $ _) => refl_clause_aux n (th RS disj_comm)
  27.133 +        | (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ _ $ _) => refl_clause_aux n (th RS disj_comm)
  27.134          | _ => (*not a disjunction*) th;
  27.135  
  27.136 -fun notequal_lits_count (Const (@{const_name HOL.disj}, _) $ P $ Q) =
  27.137 +fun notequal_lits_count (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ P $ Q) =
  27.138        notequal_lits_count P + notequal_lits_count Q
  27.139 -  | notequal_lits_count (Const(@{const_name Not},_) $ (Const(@{const_name HOL.eq},_) $ _ $ _)) = 1
  27.140 +  | notequal_lits_count (Const(\<^const_name>\<open>Not\<close>,_) $ (Const(\<^const_name>\<open>HOL.eq\<close>,_) $ _ $ _)) = 1
  27.141    | notequal_lits_count _ = 0;
  27.142  
  27.143  (*Simplify a clause by applying reflexivity to its negated equality literals*)
  27.144 @@ -312,26 +312,26 @@
  27.145    fun prod x y = if x < bound andalso y < bound then x*y else bound
  27.146    
  27.147    (*Estimate the number of clauses in order to detect infeasible theorems*)
  27.148 -  fun signed_nclauses b (Const(@{const_name Trueprop},_) $ t) = signed_nclauses b t
  27.149 -    | signed_nclauses b (Const(@{const_name Not},_) $ t) = signed_nclauses (not b) t
  27.150 -    | signed_nclauses b (Const(@{const_name HOL.conj},_) $ t $ u) =
  27.151 +  fun signed_nclauses b (Const(\<^const_name>\<open>Trueprop\<close>,_) $ t) = signed_nclauses b t
  27.152 +    | signed_nclauses b (Const(\<^const_name>\<open>Not\<close>,_) $ t) = signed_nclauses (not b) t
  27.153 +    | signed_nclauses b (Const(\<^const_name>\<open>HOL.conj\<close>,_) $ t $ u) =
  27.154          if b then sum (signed_nclauses b t) (signed_nclauses b u)
  27.155               else prod (signed_nclauses b t) (signed_nclauses b u)
  27.156 -    | signed_nclauses b (Const(@{const_name HOL.disj},_) $ t $ u) =
  27.157 +    | signed_nclauses b (Const(\<^const_name>\<open>HOL.disj\<close>,_) $ t $ u) =
  27.158          if b then prod (signed_nclauses b t) (signed_nclauses b u)
  27.159               else sum (signed_nclauses b t) (signed_nclauses b u)
  27.160 -    | signed_nclauses b (Const(@{const_name HOL.implies},_) $ t $ u) =
  27.161 +    | signed_nclauses b (Const(\<^const_name>\<open>HOL.implies\<close>,_) $ t $ u) =
  27.162          if b then prod (signed_nclauses (not b) t) (signed_nclauses b u)
  27.163               else sum (signed_nclauses (not b) t) (signed_nclauses b u)
  27.164 -    | signed_nclauses b (Const(@{const_name HOL.eq}, Type ("fun", [T, _])) $ t $ u) =
  27.165 +    | signed_nclauses b (Const(\<^const_name>\<open>HOL.eq\<close>, Type ("fun", [T, _])) $ t $ u) =
  27.166          if T = HOLogic.boolT then (*Boolean equality is if-and-only-if*)
  27.167              if b then sum (prod (signed_nclauses (not b) t) (signed_nclauses b u))
  27.168                            (prod (signed_nclauses (not b) u) (signed_nclauses b t))
  27.169                   else sum (prod (signed_nclauses b t) (signed_nclauses b u))
  27.170                            (prod (signed_nclauses (not b) t) (signed_nclauses (not b) u))
  27.171          else 1
  27.172 -    | signed_nclauses b (Const(@{const_name Ex}, _) $ Abs (_,_,t)) = signed_nclauses b t
  27.173 -    | signed_nclauses b (Const(@{const_name All},_) $ Abs (_,_,t)) = signed_nclauses b t
  27.174 +    | signed_nclauses b (Const(\<^const_name>\<open>Ex\<close>, _) $ Abs (_,_,t)) = signed_nclauses b t
  27.175 +    | signed_nclauses b (Const(\<^const_name>\<open>All\<close>,_) $ Abs (_,_,t)) = signed_nclauses b t
  27.176      | signed_nclauses _ _ = 1; (* literal *)
  27.177   in signed_nclauses true t end
  27.178  
  27.179 @@ -346,7 +346,7 @@
  27.180    val spec_var =
  27.181      Thm.dest_arg (Thm.dest_arg (#2 (Thm.dest_implies (Thm.cprop_of spec))))
  27.182      |> Thm.term_of |> dest_Var;
  27.183 -  fun name_of (Const (@{const_name All}, _) $ Abs(x, _, _)) = x | name_of _ = Name.uu;
  27.184 +  fun name_of (Const (\<^const_name>\<open>All\<close>, _) $ Abs(x, _, _)) = x | name_of _ = Name.uu;
  27.185  in  
  27.186    fun freeze_spec th ctxt =
  27.187      let
  27.188 @@ -370,18 +370,18 @@
  27.189    let val ctxt_ref = Unsynchronized.ref ctxt   (* FIXME ??? *)
  27.190        fun cnf_aux (th,ths) =
  27.191          if not (can HOLogic.dest_Trueprop (Thm.prop_of th)) then ths (*meta-level: ignore*)
  27.192 -        else if not (has_conns [@{const_name All}, @{const_name Ex}, @{const_name HOL.conj}] (Thm.prop_of th))
  27.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))
  27.194          then nodups ctxt th :: ths (*no work to do, terminate*)
  27.195          else case head_of (HOLogic.dest_Trueprop (Thm.concl_of th)) of
  27.196 -            Const (@{const_name HOL.conj}, _) => (*conjunction*)
  27.197 +            Const (\<^const_name>\<open>HOL.conj\<close>, _) => (*conjunction*)
  27.198                  cnf_aux (th RS conjunct1, cnf_aux (th RS conjunct2, ths))
  27.199 -          | Const (@{const_name All}, _) => (*universal quantifier*)
  27.200 +          | Const (\<^const_name>\<open>All\<close>, _) => (*universal quantifier*)
  27.201                  let val (th', ctxt') = freeze_spec th (! ctxt_ref)
  27.202                  in  ctxt_ref := ctxt'; cnf_aux (th', ths) end
  27.203 -          | Const (@{const_name Ex}, _) =>
  27.204 +          | Const (\<^const_name>\<open>Ex\<close>, _) =>
  27.205                (*existential quantifier: Insert Skolem functions*)
  27.206                cnf_aux (apply_skolem_theorem (! ctxt_ref) (th, old_skolem_ths), ths)
  27.207 -          | Const (@{const_name HOL.disj}, _) =>
  27.208 +          | Const (\<^const_name>\<open>HOL.disj\<close>, _) =>
  27.209                (*Disjunction of P, Q: Create new goal of proving ?P | ?Q and solve it using
  27.210                  all combinations of converting P, Q to CNF.*)
  27.211                (*There is one assumption, which gets bound to prem and then normalized via
  27.212 @@ -409,8 +409,8 @@
  27.213  
  27.214  (**** Generation of contrapositives ****)
  27.215  
  27.216 -fun is_left (Const (@{const_name Trueprop}, _) $
  27.217 -               (Const (@{const_name HOL.disj}, _) $ (Const (@{const_name HOL.disj}, _) $ _ $ _) $ _)) = true
  27.218 +fun is_left (Const (\<^const_name>\<open>Trueprop\<close>, _) $
  27.219 +               (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ _ $ _) $ _)) = true
  27.220    | is_left _ = false;
  27.221  
  27.222  (*Associate disjuctions to right -- make leftmost disjunct a LITERAL*)
  27.223 @@ -431,8 +431,8 @@
  27.224  
  27.225  fun rigid t = not (is_Var (head_of t));
  27.226  
  27.227 -fun ok4horn (Const (@{const_name Trueprop},_) $ (Const (@{const_name HOL.disj}, _) $ t $ _)) = rigid t
  27.228 -  | ok4horn (Const (@{const_name Trueprop},_) $ t) = rigid t
  27.229 +fun ok4horn (Const (\<^const_name>\<open>Trueprop\<close>,_) $ (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ t $ _)) = rigid t
  27.230 +  | ok4horn (Const (\<^const_name>\<open>Trueprop\<close>,_) $ t) = rigid t
  27.231    | ok4horn _ = false;
  27.232  
  27.233  (*Create a meta-level Horn clause*)
  27.234 @@ -466,7 +466,7 @@
  27.235  
  27.236  (***** MESON PROOF PROCEDURE *****)
  27.237  
  27.238 -fun rhyps (Const(@{const_name Pure.imp},_) $ (Const(@{const_name Trueprop},_) $ A) $ phi,
  27.239 +fun rhyps (Const(\<^const_name>\<open>Pure.imp\<close>,_) $ (Const(\<^const_name>\<open>Trueprop\<close>,_) $ A) $ phi,
  27.240             As) = rhyps(phi, A::As)
  27.241    | rhyps (_, As) = As;
  27.242  
  27.243 @@ -511,8 +511,8 @@
  27.244  val nnf_rls = [imp_to_disjD, iff_to_disjD, not_conjD, not_disjD,
  27.245                 not_impD, not_iffD, not_allD, not_exD, not_notD];
  27.246  
  27.247 -fun ok4nnf (Const (@{const_name Trueprop},_) $ (Const (@{const_name Not}, _) $ t)) = rigid t
  27.248 -  | ok4nnf (Const (@{const_name Trueprop},_) $ t) = rigid t
  27.249 +fun ok4nnf (Const (\<^const_name>\<open>Trueprop\<close>,_) $ (Const (\<^const_name>\<open>Not\<close>, _) $ t)) = rigid t
  27.250 +  | ok4nnf (Const (\<^const_name>\<open>Trueprop\<close>,_) $ t) = rigid t
  27.251    | ok4nnf _ = false;
  27.252  
  27.253  fun make_nnf1 ctxt th =
  27.254 @@ -537,13 +537,12 @@
  27.255  val nnf_ss =
  27.256    simpset_of (put_simpset HOL_basic_ss @{context}
  27.257      addsimps nnf_extra_simps
  27.258 -    addsimprocs [@{simproc defined_All}, @{simproc defined_Ex}, @{simproc neq},
  27.259 -                 @{simproc let_simp}])
  27.260 +    addsimprocs [\<^simproc>\<open>defined_All\<close>, \<^simproc>\<open>defined_Ex\<close>, \<^simproc>\<open>neq\<close>, \<^simproc>\<open>let_simp\<close>])
  27.261  
  27.262  val presimplified_consts =
  27.263 -  [@{const_name simp_implies}, @{const_name False}, @{const_name True},
  27.264 -   @{const_name Ex1}, @{const_name Ball}, @{const_name Bex}, @{const_name If},
  27.265 -   @{const_name Let}]
  27.266 +  [\<^const_name>\<open>simp_implies\<close>, \<^const_name>\<open>False\<close>, \<^const_name>\<open>True\<close>,
  27.267 +   \<^const_name>\<open>Ex1\<close>, \<^const_name>\<open>Ball\<close>, \<^const_name>\<open>Bex\<close>, \<^const_name>\<open>If\<close>,
  27.268 +   \<^const_name>\<open>Let\<close>]
  27.269  
  27.270  fun presimplify ctxt =
  27.271    rewrite_rule ctxt (map safe_mk_meta_eq nnf_simps)
  27.272 @@ -563,7 +562,7 @@
  27.273  fun skolemize_with_choice_theorems ctxt choice_ths =
  27.274    let
  27.275      fun aux th =
  27.276 -      if not (has_conns [@{const_name Ex}] (Thm.prop_of th)) then
  27.277 +      if not (has_conns [\<^const_name>\<open>Ex\<close>] (Thm.prop_of th)) then
  27.278          th
  27.279        else
  27.280          tryres (th, choice_ths @
  27.281 @@ -604,7 +603,7 @@
  27.282            end
  27.283        end
  27.284    in
  27.285 -    if T = @{typ bool} then
  27.286 +    if T = \<^typ>\<open>bool\<close> then
  27.287        NONE
  27.288      else case pat t u of
  27.289        (SOME T, p as _ $ _) => SOME (Abs (Name.uu, T, p))
  27.290 @@ -617,8 +616,8 @@
  27.291  (* Strengthens "f g ~= f h" to "f g ~= f h & (EX x. g x ~= h x)". *)
  27.292  fun cong_extensionalize_thm ctxt th =
  27.293    (case Thm.concl_of th of
  27.294 -    @{const Trueprop} $ (@{const Not}
  27.295 -        $ (Const (@{const_name HOL.eq}, Type (_, [T, _]))
  27.296 +    \<^const>\<open>Trueprop\<close> $ (\<^const>\<open>Not\<close>
  27.297 +        $ (Const (\<^const_name>\<open>HOL.eq\<close>, Type (_, [T, _]))
  27.298             $ (t as _ $ _) $ (u as _ $ _))) =>
  27.299      (case get_F_pattern T t u of
  27.300        SOME p => th RS infer_instantiate ctxt [(("F", 0), Thm.cterm_of ctxt p)] ext_cong_neq
  27.301 @@ -630,7 +629,7 @@
  27.302     proof in "Tarski" that relies on the current behavior. *)
  27.303  fun abs_extensionalize_conv ctxt ct =
  27.304    (case Thm.term_of ct of
  27.305 -    Const (@{const_name HOL.eq}, _) $ _ $ Abs _ =>
  27.306 +    Const (\<^const_name>\<open>HOL.eq\<close>, _) $ _ $ Abs _ =>
  27.307      ct |> (Conv.rewr_conv @{thm fun_eq_iff [THEN eq_reflection]}
  27.308             then_conv abs_extensionalize_conv ctxt)
  27.309    | _ $ _ => Conv.comb_conv (abs_extensionalize_conv ctxt) ct
    28.1 --- a/src/HOL/Tools/Meson/meson_clausify.ML	Wed Dec 06 16:01:15 2017 +0100
    28.2 +++ b/src/HOL/Tools/Meson/meson_clausify.ML	Wed Dec 06 21:01:01 2017 +0100
    28.3 @@ -35,8 +35,8 @@
    28.4  
    28.5  (**** Transformation of Elimination Rules into First-Order Formulas****)
    28.6  
    28.7 -val cfalse = Thm.cterm_of @{theory_context HOL} @{term False};
    28.8 -val ctp_false = Thm.cterm_of @{theory_context HOL} (HOLogic.mk_Trueprop @{term False});
    28.9 +val cfalse = Thm.cterm_of \<^theory_context>\<open>HOL\<close> \<^term>\<open>False\<close>;
   28.10 +val ctp_false = Thm.cterm_of \<^theory_context>\<open>HOL\<close> (HOLogic.mk_Trueprop \<^term>\<open>False\<close>);
   28.11  
   28.12  (* Converts an elim-rule into an equivalent theorem that does not have the
   28.13     predicate variable. Leaves other theorems unchanged. We simply instantiate
   28.14 @@ -44,9 +44,9 @@
   28.15     "Sledgehammer_Util".) *)
   28.16  fun transform_elim_theorem th =
   28.17    (case Thm.concl_of th of    (*conclusion variable*)
   28.18 -    @{const Trueprop} $ (Var (v as (_, @{typ bool}))) =>
   28.19 +    \<^const>\<open>Trueprop\<close> $ (Var (v as (_, \<^typ>\<open>bool\<close>))) =>
   28.20        Thm.instantiate ([], [(v, cfalse)]) th
   28.21 -  | Var (v as (_, @{typ prop})) =>
   28.22 +  | Var (v as (_, \<^typ>\<open>prop\<close>)) =>
   28.23        Thm.instantiate ([], [(v, ctp_false)]) th
   28.24    | _ => th)
   28.25  
   28.26 @@ -55,7 +55,7 @@
   28.27  
   28.28  fun mk_old_skolem_term_wrapper t =
   28.29    let val T = fastype_of t in
   28.30 -    Const (@{const_name Meson.skolem}, T --> T) $ t
   28.31 +    Const (\<^const_name>\<open>Meson.skolem\<close>, T --> T) $ t
   28.32    end
   28.33  
   28.34  fun beta_eta_in_abs_body (Abs (s, T, t')) = Abs (s, T, beta_eta_in_abs_body t')
   28.35 @@ -64,7 +64,7 @@
   28.36  (*Traverse a theorem, accumulating Skolem function definitions.*)
   28.37  fun old_skolem_defs th =
   28.38    let
   28.39 -    fun dec_sko (Const (@{const_name Ex}, _) $ (body as Abs (_, T, p))) rhss =
   28.40 +    fun dec_sko (Const (\<^const_name>\<open>Ex\<close>, _) $ (body as Abs (_, T, p))) rhss =
   28.41          (*Existential: declare a Skolem function, then insert into body and continue*)
   28.42          let
   28.43            val args = Misc_Legacy.term_frees body
   28.44 @@ -75,20 +75,20 @@
   28.45              |> mk_old_skolem_term_wrapper
   28.46            val comb = list_comb (rhs, args)
   28.47          in dec_sko (subst_bound (comb, p)) (rhs :: rhss) end
   28.48 -      | dec_sko (Const (@{const_name All},_) $ Abs (a, T, p)) rhss =
   28.49 +      | dec_sko (Const (\<^const_name>\<open>All\<close>,_) $ Abs (a, T, p)) rhss =
   28.50          (*Universal quant: insert a free variable into body and continue*)
   28.51          let val fname = singleton (Name.variant_list (Misc_Legacy.add_term_names (p, []))) a
   28.52          in dec_sko (subst_bound (Free(fname,T), p)) rhss end
   28.53 -      | dec_sko (@{const conj} $ p $ q) rhss = rhss |> dec_sko p |> dec_sko q
   28.54 -      | dec_sko (@{const disj} $ p $ q) rhss = rhss |> dec_sko p |> dec_sko q
   28.55 -      | dec_sko (@{const Trueprop} $ p) rhss = dec_sko p rhss
   28.56 +      | dec_sko (\<^const>\<open>conj\<close> $ p $ q) rhss = rhss |> dec_sko p |> dec_sko q
   28.57 +      | dec_sko (\<^const>\<open>disj\<close> $ p $ q) rhss = rhss |> dec_sko p |> dec_sko q
   28.58 +      | dec_sko (\<^const>\<open>Trueprop\<close> $ p) rhss = dec_sko p rhss
   28.59        | dec_sko _ rhss = rhss
   28.60    in  dec_sko (Thm.prop_of th) []  end;
   28.61  
   28.62  
   28.63  (**** REPLACING ABSTRACTIONS BY COMBINATORS ****)
   28.64  
   28.65 -fun is_quasi_lambda_free (Const (@{const_name Meson.skolem}, _) $ _) = true
   28.66 +fun is_quasi_lambda_free (Const (\<^const_name>\<open>Meson.skolem\<close>, _) $ _) = true
   28.67    | is_quasi_lambda_free (t1 $ t2) =
   28.68      is_quasi_lambda_free t1 andalso is_quasi_lambda_free t2
   28.69    | is_quasi_lambda_free (Abs _) = false
   28.70 @@ -98,7 +98,7 @@
   28.71  fun abstract ctxt ct =
   28.72    let
   28.73        val Abs(x,_,body) = Thm.term_of ct
   28.74 -      val Type (@{type_name fun}, [xT,bodyT]) = Thm.typ_of_cterm ct
   28.75 +      val Type (\<^type_name>\<open>fun\<close>, [xT,bodyT]) = Thm.typ_of_cterm ct
   28.76        val cxT = Thm.ctyp_of ctxt xT
   28.77        val cbodyT = Thm.ctyp_of ctxt bodyT
   28.78        fun makeK () =
   28.79 @@ -196,7 +196,7 @@
   28.80      val (hilbert, cabs) = ch |> Thm.dest_comb |>> Thm.term_of
   28.81      val T =
   28.82        case hilbert of
   28.83 -        Const (_, Type (@{type_name fun}, [_, T])) => T
   28.84 +        Const (_, Type (\<^type_name>\<open>fun\<close>, [_, T])) => T
   28.85        | _ => raise TERM ("old_skolem_theorem_of_def: expected \"Eps\"", [hilbert])
   28.86      val cex = Thm.cterm_of ctxt (HOLogic.exists_const T)
   28.87      val ex_tm = Thm.apply cTrueprop (Thm.apply cex cabs)
   28.88 @@ -238,10 +238,10 @@
   28.89      fun aux (cluster as (cluster_no, cluster_skolem)) index_no pos t =
   28.90        case t of
   28.91          (t1 as Const (s, _)) $ Abs (s', T, t') =>
   28.92 -        if s = @{const_name Pure.all} orelse s = @{const_name All} orelse
   28.93 -           s = @{const_name Ex} then
   28.94 +        if s = \<^const_name>\<open>Pure.all\<close> orelse s = \<^const_name>\<open>All\<close> orelse
   28.95 +           s = \<^const_name>\<open>Ex\<close> then
   28.96            let
   28.97 -            val skolem = (pos = (s = @{const_name Ex}))
   28.98 +            val skolem = (pos = (s = \<^const_name>\<open>Ex\<close>))
   28.99              val (cluster, index_no) =
  28.100                if skolem = cluster_skolem then (cluster, index_no)
  28.101                else ((cluster_no ||> cluster_skolem ? Integer.add 1, skolem), 0)
  28.102 @@ -250,17 +250,17 @@
  28.103          else
  28.104            t
  28.105        | (t1 as Const (s, _)) $ t2 $ t3 =>
  28.106 -        if s = @{const_name Pure.imp} orelse s = @{const_name HOL.implies} then
  28.107 +        if s = \<^const_name>\<open>Pure.imp\<close> orelse s = \<^const_name>\<open>HOL.implies\<close> then
  28.108            t1 $ aux cluster index_no (not pos) t2 $ aux cluster index_no pos t3
  28.109 -        else if s = @{const_name HOL.conj} orelse
  28.110 -                s = @{const_name HOL.disj} then
  28.111 +        else if s = \<^const_name>\<open>HOL.conj\<close> orelse
  28.112 +                s = \<^const_name>\<open>HOL.disj\<close> then
  28.113            t1 $ aux cluster index_no pos t2 $ aux cluster index_no pos t3
  28.114          else
  28.115            t
  28.116        | (t1 as Const (s, _)) $ t2 =>
  28.117 -        if s = @{const_name Trueprop} then
  28.118 +        if s = \<^const_name>\<open>Trueprop\<close> then
  28.119            t1 $ aux cluster index_no pos t2
  28.120 -        else if s = @{const_name Not} then
  28.121 +        else if s = \<^const_name>\<open>Not\<close> then
  28.122            t1 $ aux cluster index_no (not pos) t2
  28.123          else
  28.124            t
  28.125 @@ -271,28 +271,28 @@
  28.126    ct
  28.127    |> (case Thm.term_of ct of
  28.128          Const (s, _) $ Abs (s', _, _) =>
  28.129 -        if s = @{const_name Pure.all} orelse s = @{const_name All} orelse
  28.130 -           s = @{const_name Ex} then
  28.131 +        if s = \<^const_name>\<open>Pure.all\<close> orelse s = \<^const_name>\<open>All\<close> orelse
  28.132 +           s = \<^const_name>\<open>Ex\<close> then
  28.133            Thm.dest_comb #> snd #> Thm.dest_abs (SOME s') #> snd #> zap pos
  28.134          else
  28.135            Conv.all_conv
  28.136        | Const (s, _) $ _ $ _ =>
  28.137 -        if s = @{const_name Pure.imp} orelse s = @{const_name implies} then
  28.138 +        if s = \<^const_name>\<open>Pure.imp\<close> orelse s = \<^const_name>\<open>implies\<close> then
  28.139            Conv.combination_conv (Conv.arg_conv (zap (not pos))) (zap pos)
  28.140 -        else if s = @{const_name conj} orelse s = @{const_name disj} then
  28.141 +        else if s = \<^const_name>\<open>conj\<close> orelse s = \<^const_name>\<open>disj\<close> then
  28.142            Conv.combination_conv (Conv.arg_conv (zap pos)) (zap pos)
  28.143          else
  28.144            Conv.all_conv
  28.145        | Const (s, _) $ _ =>
  28.146 -        if s = @{const_name Trueprop} then Conv.arg_conv (zap pos)
  28.147 -        else if s = @{const_name Not} then Conv.arg_conv (zap (not pos))
  28.148 +        if s = \<^const_name>\<open>Trueprop\<close> then Conv.arg_conv (zap pos)
  28.149 +        else if s = \<^const_name>\<open>Not\<close> then Conv.arg_conv (zap (not pos))
  28.150          else Conv.all_conv
  28.151        | _ => Conv.all_conv)
  28.152  
  28.153  fun ss_only ths ctxt = clear_simpset (put_simpset HOL_basic_ss ctxt) addsimps ths
  28.154  
  28.155  val cheat_choice =
  28.156 -  @{prop "\<forall>x. \<exists>y. Q x y \<Longrightarrow> \<exists>f. \<forall>x. Q x (f x)"}
  28.157 +  \<^prop>\<open>\<forall>x. \<exists>y. Q x y \<Longrightarrow> \<exists>f. \<forall>x. Q x (f x)\<close>
  28.158    |> Logic.varify_global
  28.159    |> Skip_Proof.make_thm @{theory}
  28.160  
  28.161 @@ -374,7 +374,7 @@
  28.162         th ctxt
  28.163      val (cnf_ths, ctxt) = clausify nnf_th
  28.164      fun intr_imp ct th =
  28.165 -      Thm.instantiate ([], [((("i", 0), @{typ nat}), Thm.cterm_of ctxt (HOLogic.mk_nat ax_no))])
  28.166 +      Thm.instantiate ([], [((("i", 0), \<^typ>\<open>nat\<close>), Thm.cterm_of ctxt (HOLogic.mk_nat ax_no))])
  28.167                        (zero_var_indexes @{thm skolem_COMBK_D})
  28.168        RS Thm.implies_intr ct th
  28.169    in
    29.1 --- a/src/HOL/Tools/Meson/meson_tactic.ML	Wed Dec 06 16:01:15 2017 +0100
    29.2 +++ b/src/HOL/Tools/Meson/meson_tactic.ML	Wed Dec 06 21:01:01 2017 +0100
    29.3 @@ -19,7 +19,7 @@
    29.4  
    29.5  val _ =
    29.6    Theory.setup
    29.7 -    (Method.setup @{binding meson} (Attrib.thms >> (fn ths => fn ctxt =>
    29.8 +    (Method.setup \<^binding>\<open>meson\<close> (Attrib.thms >> (fn ths => fn ctxt =>
    29.9        SIMPLE_METHOD' (CHANGED_PROP o meson_general_tac ctxt ths)))
   29.10        "MESON resolution proof procedure")
   29.11  
    30.1 --- a/src/HOL/Tools/Quickcheck/abstract_generators.ML	Wed Dec 06 16:01:15 2017 +0100
    30.2 +++ b/src/HOL/Tools/Quickcheck/abstract_generators.ML	Wed Dec 06 21:01:01 2017 +0100
    30.3 @@ -45,14 +45,14 @@
    30.4        in (descr, vs, [tyco], name, ([name], []), ([Type (tyco, map TFree vs)], [])) end
    30.5      fun ensure_sort (sort, instantiate) =
    30.6        Quickcheck_Common.ensure_sort
    30.7 -        (((@{sort typerep}, @{sort term_of}), sort), (the_descr, instantiate))
    30.8 +        (((\<^sort>\<open>typerep\<close>, \<^sort>\<open>term_of\<close>), sort), (the_descr, instantiate))
    30.9          Old_Datatype_Aux.default_config [tyco]
   30.10    in
   30.11      thy
   30.12      |> ensure_sort
   30.13 -        (@{sort full_exhaustive}, Exhaustive_Generators.instantiate_full_exhaustive_datatype)
   30.14 -    |> ensure_sort (@{sort exhaustive}, Exhaustive_Generators.instantiate_exhaustive_datatype)
   30.15 -    |> ensure_sort (@{sort random}, Random_Generators.instantiate_random_datatype)
   30.16 +        (\<^sort>\<open>full_exhaustive\<close>, Exhaustive_Generators.instantiate_full_exhaustive_datatype)
   30.17 +    |> ensure_sort (\<^sort>\<open>exhaustive\<close>, Exhaustive_Generators.instantiate_exhaustive_datatype)
   30.18 +    |> ensure_sort (\<^sort>\<open>random\<close>, Random_Generators.instantiate_random_datatype)
   30.19      |> (case opt_pred of NONE => I
   30.20         | SOME t => Context.theory_map (Quickcheck_Common.register_predicate (t, tyco)))
   30.21    end
   30.22 @@ -65,11 +65,11 @@
   30.23      Syntax.read_term
   30.24  
   30.25  val _ =
   30.26 -  Outer_Syntax.command @{command_keyword quickcheck_generator}
   30.27 +  Outer_Syntax.command \<^command_keyword>\<open>quickcheck_generator\<close>
   30.28      "define quickcheck generators for abstract types"
   30.29      ((Parse.type_const --
   30.30 -      Scan.option (Args.$$$ "predicate" |-- @{keyword ":"} |-- Parse.term)) --
   30.31 -      (Args.$$$ "constructors" |-- @{keyword ":"} |-- Parse.list1 Parse.term)
   30.32 +      Scan.option (Args.$$$ "predicate" |-- \<^keyword>\<open>:\<close> |-- Parse.term)) --
   30.33 +      (Args.$$$ "constructors" |-- \<^keyword>\<open>:\<close> |-- Parse.list1 Parse.term)
   30.34        >> (fn ((tyco, opt_pred), constrs) =>
   30.35          Toplevel.theory (quickcheck_generator_cmd tyco opt_pred constrs)))
   30.36  
    31.1 --- a/src/HOL/Tools/Quickcheck/exhaustive_generators.ML	Wed Dec 06 16:01:15 2017 +0100
    31.2 +++ b/src/HOL/Tools/Quickcheck/exhaustive_generators.ML	Wed Dec 06 21:01:01 2017 +0100
    31.3 @@ -38,30 +38,30 @@
    31.4  
    31.5  (** dynamic options **)
    31.6  
    31.7 -val smart_quantifier = Attrib.setup_config_bool @{binding quickcheck_smart_quantifier} (K true)
    31.8 -val optimise_equality = Attrib.setup_config_bool @{binding quickcheck_optimise_equality} (K true)
    31.9 +val smart_quantifier = Attrib.setup_config_bool \<^binding>\<open>quickcheck_smart_quantifier\<close> (K true)
   31.10 +val optimise_equality = Attrib.setup_config_bool \<^binding>\<open>quickcheck_optimise_equality\<close> (K true)
   31.11  
   31.12 -val fast = Attrib.setup_config_bool @{binding quickcheck_fast} (K false)
   31.13 -val bounded_forall = Attrib.setup_config_bool @{binding quickcheck_bounded_forall} (K false)
   31.14 -val full_support = Attrib.setup_config_bool @{binding quickcheck_full_support} (K true)
   31.15 -val quickcheck_pretty = Attrib.setup_config_bool @{binding quickcheck_pretty} (K true)
   31.16 +val fast = Attrib.setup_config_bool \<^binding>\<open>quickcheck_fast\<close> (K false)
   31.17 +val bounded_forall = Attrib.setup_config_bool \<^binding>\<open>quickcheck_bounded_forall\<close> (K false)
   31.18 +val full_support = Attrib.setup_config_bool \<^binding>\<open>quickcheck_full_support\<close> (K true)
   31.19 +val quickcheck_pretty = Attrib.setup_config_bool \<^binding>\<open>quickcheck_pretty\<close> (K true)
   31.20  
   31.21  
   31.22  (** abstract syntax **)
   31.23  
   31.24 -fun termifyT T = HOLogic.mk_prodT (T, @{typ "unit \<Rightarrow> Code_Evaluation.term"})
   31.25 +fun termifyT T = HOLogic.mk_prodT (T, \<^typ>\<open>unit \<Rightarrow> Code_Evaluation.term\<close>)
   31.26  
   31.27 -val size = @{term "i :: natural"}
   31.28 -val size_pred = @{term "(i :: natural) - 1"}
   31.29 -val size_ge_zero = @{term "(i :: natural) > 0"}
   31.30 +val size = \<^term>\<open>i :: natural\<close>
   31.31 +val size_pred = \<^term>\<open>(i :: natural) - 1\<close>
   31.32 +val size_ge_zero = \<^term>\<open>(i :: natural) > 0\<close>
   31.33  
   31.34  fun mk_none_continuation (x, y) =
   31.35 -  let val (T as Type (@{type_name option}, _)) = fastype_of x
   31.36 -  in Const (@{const_name orelse}, T --> T --> T) $ x $ y end
   31.37 +  let val (T as Type (\<^type_name>\<open>option\<close>, _)) = fastype_of x
   31.38 +  in Const (\<^const_name>\<open>orelse\<close>, T --> T --> T) $ x $ y end
   31.39  
   31.40  fun mk_if (b, t, e) =
   31.41    let val T = fastype_of t
   31.42 -  in Const (@{const_name If}, @{typ bool} --> T --> T --> T) $ b $ t $ e end
   31.43 +  in Const (\<^const_name>\<open>If\<close>, \<^typ>\<open>bool\<close> --> T --> T --> T) $ b $ t $ e end
   31.44  
   31.45  
   31.46  (* handling inductive datatypes *)
   31.47 @@ -72,19 +72,19 @@
   31.48  
   31.49  exception Counterexample of term list
   31.50  
   31.51 -val resultT =  @{typ "(bool * term list) option"}
   31.52 +val resultT = \<^typ>\<open>(bool \<times> term list) option\<close>
   31.53  
   31.54  val exhaustiveN = "exhaustive"
   31.55  val full_exhaustiveN = "full_exhaustive"
   31.56  val bounded_forallN = "bounded_forall"
   31.57  
   31.58 -fun fast_exhaustiveT T = (T --> @{typ unit}) --> @{typ natural} --> @{typ unit}
   31.59 +fun fast_exhaustiveT T = (T --> \<^typ>\<open>unit\<close>) --> \<^typ>\<open>natural\<close> --> \<^typ>\<open>unit\<close>
   31.60  
   31.61 -fun exhaustiveT T = (T --> resultT) --> @{typ natural} --> resultT
   31.62 +fun exhaustiveT T = (T --> resultT) --> \<^typ>\<open>natural\<close> --> resultT
   31.63  
   31.64 -fun bounded_forallT T = (T --> @{typ bool}) --> @{typ natural} --> @{typ bool}
   31.65 +fun bounded_forallT T = (T --> \<^typ>\<open>bool\<close>) --> \<^typ>\<open>natural\<close> --> \<^typ>\<open>bool\<close>
   31.66  
   31.67 -fun full_exhaustiveT T = (termifyT T --> resultT) --> @{typ natural} --> resultT
   31.68 +fun full_exhaustiveT T = (termifyT T --> resultT) --> \<^typ>\<open>natural\<close> --> resultT
   31.69  
   31.70  fun check_allT T = (termifyT T --> resultT) --> resultT
   31.71  
   31.72 @@ -119,35 +119,35 @@
   31.73  fun mk_equations functerms =
   31.74    let
   31.75      fun test_function T = Free ("f", T --> resultT)
   31.76 -    val mk_call = gen_mk_call (fn T => Const (@{const_name exhaustive}, exhaustiveT T))
   31.77 +    val mk_call = gen_mk_call (fn T => Const (\<^const_name>\<open>exhaustive\<close>, exhaustiveT T))
   31.78      val mk_aux_call = gen_mk_aux_call functerms
   31.79      val mk_consexpr = gen_mk_consexpr test_function
   31.80      fun mk_rhs exprs =
   31.81 -      mk_if (size_ge_zero, foldr1 mk_none_continuation exprs, Const (@{const_name None}, resultT))
   31.82 +      mk_if (size_ge_zero, foldr1 mk_none_continuation exprs, Const (\<^const_name>\<open>None\<close>, resultT))
   31.83    in mk_equation_terms (mk_call, mk_aux_call, mk_consexpr, mk_rhs, test_function, functerms) end
   31.84  
   31.85  fun mk_bounded_forall_equations functerms =
   31.86    let
   31.87 -    fun test_function T = Free ("P", T --> @{typ bool})
   31.88 -    val mk_call = gen_mk_call (fn T => Const (@{const_name bounded_forall}, bounded_forallT T))
   31.89 +    fun test_function T = Free ("P", T --> \<^typ>\<open>bool\<close>)
   31.90 +    val mk_call = gen_mk_call (fn T => Const (\<^const_name>\<open>bounded_forall\<close>, bounded_forallT T))
   31.91      val mk_aux_call = gen_mk_aux_call functerms
   31.92      val mk_consexpr = gen_mk_consexpr test_function
   31.93 -    fun mk_rhs exprs = mk_if (size_ge_zero, foldr1 HOLogic.mk_conj exprs, @{term True})
   31.94 +    fun mk_rhs exprs = mk_if (size_ge_zero, foldr1 HOLogic.mk_conj exprs, \<^term>\<open>True\<close>)
   31.95    in mk_equation_terms (mk_call, mk_aux_call, mk_consexpr, mk_rhs, test_function, functerms) end
   31.96  
   31.97  fun mk_full_equations functerms =
   31.98    let
   31.99      fun test_function T = Free ("f", termifyT T --> resultT)
  31.100      fun case_prod_const T =
  31.101 -      HOLogic.case_prod_const (T, @{typ "unit \<Rightarrow> Code_Evaluation.term"}, resultT)
  31.102 +      HOLogic.case_prod_const (T, \<^typ>\<open>unit \<Rightarrow> Code_Evaluation.term\<close>, resultT)
  31.103      fun mk_call T =
  31.104        let
  31.105 -        val full_exhaustive = Const (@{const_name full_exhaustive}, full_exhaustiveT T)
  31.106 +        val full_exhaustive = Const (\<^const_name>\<open>full_exhaustive\<close>, full_exhaustiveT T)
  31.107        in
  31.108          (T,
  31.109            fn t =>
  31.110              full_exhaustive $
  31.111 -              (case_prod_const T $ absdummy T (absdummy @{typ "unit \<Rightarrow> Code_Evaluation.term"} t)) $
  31.112 +              (case_prod_const T $ absdummy T (absdummy \<^typ>\<open>unit \<Rightarrow> Code_Evaluation.term\<close> t)) $
  31.113                size_pred)
  31.114        end
  31.115      fun mk_aux_call fTs (k, _) (tyco, Ts) =
  31.116 @@ -158,7 +158,7 @@
  31.117          (T,
  31.118            fn t =>
  31.119              nth functerms k $
  31.120 -              (case_prod_const T $ absdummy T (absdummy @{typ "unit \<Rightarrow> Code_Evaluation.term"} t)) $
  31.121 +              (case_prod_const T $ absdummy T (absdummy \<^typ>\<open>unit \<Rightarrow> Code_Evaluation.term\<close> t)) $
  31.122                size_pred)
  31.123        end
  31.124      fun mk_consexpr simpleT (c, xs) =
  31.125 @@ -167,21 +167,21 @@
  31.126          val constr = Const (c, Ts ---> simpleT)
  31.127          val bounds = map (fn x => Bound (2 * x + 1)) (((length xs) - 1) downto 0)
  31.128          val Eval_App =
  31.129 -          Const (@{const_name Code_Evaluation.App},
  31.130 +          Const (\<^const_name>\<open>Code_Evaluation.App\<close>,
  31.131              HOLogic.termT --> HOLogic.termT --> HOLogic.termT)
  31.132          val Eval_Const =
  31.133 -          Const (@{const_name Code_Evaluation.Const},
  31.134 -            HOLogic.literalT --> @{typ typerep} --> HOLogic.termT)
  31.135 +          Const (\<^const_name>\<open>Code_Evaluation.Const\<close>,
  31.136 +            HOLogic.literalT --> \<^typ>\<open>typerep\<close> --> HOLogic.termT)
  31.137          val term =
  31.138 -          fold (fn u => fn t => Eval_App $ t $ (u $ @{term "()"}))
  31.139 +          fold (fn u => fn t => Eval_App $ t $ (u $ \<^term>\<open>()\<close>))
  31.140              bounds (Eval_Const $ HOLogic.mk_literal c $ HOLogic.mk_typerep (Ts ---> simpleT))
  31.141          val start_term =
  31.142            test_function simpleT $
  31.143 -            (HOLogic.pair_const simpleT @{typ "unit \<Rightarrow> Code_Evaluation.term"} $
  31.144 -              (list_comb (constr, bounds)) $ absdummy @{typ unit} term)
  31.145 +            (HOLogic.pair_const simpleT \<^typ>\<open>unit \<Rightarrow> Code_Evaluation.term\<close> $
  31.146 +              (list_comb (constr, bounds)) $ absdummy \<^typ>\<open>unit\<close> term)
  31.147        in fold_rev (fn f => fn t => f t) fns start_term end
  31.148      fun mk_rhs exprs =
  31.149 -      mk_if (size_ge_zero, foldr1 mk_none_continuation exprs, Const (@{const_name None}, resultT))
  31.150 +      mk_if (size_ge_zero, foldr1 mk_none_continuation exprs, Const (\<^const_name>\<open>None\<close>, resultT))
  31.151    in mk_equation_terms (mk_call, mk_aux_call, mk_consexpr, mk_rhs, test_function, functerms) end
  31.152  
  31.153  
  31.154 @@ -212,17 +212,17 @@
  31.155  
  31.156  val instantiate_bounded_forall_datatype =
  31.157    instantiate_datatype
  31.158 -    ("bounded universal quantifiers", bounded_forallN, @{sort bounded_forall},
  31.159 +    ("bounded universal quantifiers", bounded_forallN, \<^sort>\<open>bounded_forall\<close>,
  31.160        mk_bounded_forall_equations, bounded_forallT, ["P", "i"])
  31.161  
  31.162  val instantiate_exhaustive_datatype =
  31.163    instantiate_datatype
  31.164 -    ("exhaustive generators", exhaustiveN, @{sort exhaustive},
  31.165 +    ("exhaustive generators", exhaustiveN, \<^sort>\<open>exhaustive\<close>,
  31.166        mk_equations, exhaustiveT, ["f", "i"])
  31.167  
  31.168  val instantiate_full_exhaustive_datatype =
  31.169    instantiate_datatype
  31.170 -    ("full exhaustive generators", full_exhaustiveN, @{sort full_exhaustive},
  31.171 +    ("full exhaustive generators", full_exhaustiveN, \<^sort>\<open>full_exhaustive\<close>,
  31.172        mk_full_equations, full_exhaustiveT, ["f", "i"])
  31.173  
  31.174  
  31.175 @@ -230,15 +230,15 @@
  31.176  
  31.177  fun mk_let_expr (x, t, e) genuine =
  31.178    let val (T1, T2) = (fastype_of x, fastype_of (e genuine))
  31.179 -  in Const (@{const_name Let}, T1 --> (T1 --> T2) --> T2) $ t $ lambda x (e genuine) end
  31.180 +  in Const (\<^const_name>\<open>Let\<close>, T1 --> (T1 --> T2) --> T2) $ t $ lambda x (e genuine) end
  31.181  
  31.182  fun mk_safe_let_expr genuine_only none safe (x, t, e) genuine =
  31.183    let
  31.184      val (T1, T2) = (fastype_of x, fastype_of (e genuine))
  31.185 -    val if_t = Const (@{const_name If}, @{typ bool} --> T2 --> T2 --> T2)
  31.186 +    val if_t = Const (\<^const_name>\<open>If\<close>, \<^typ>\<open>bool\<close> --> T2 --> T2 --> T2)
  31.187    in
  31.188 -    Const (@{const_name Quickcheck_Random.catch_match}, T2 --> T2 --> T2) $
  31.189 -      (Const (@{const_name Let}, T1 --> (T1 --> T2) --> T2) $ t $ lambda x (e genuine)) $
  31.190 +    Const (\<^const_name>\<open>Quickcheck_Random.catch_match\<close>, T2 --> T2 --> T2) $
  31.191 +      (Const (\<^const_name>\<open>Let\<close>, T1 --> (T1 --> T2) --> T2) $ t $ lambda x (e genuine)) $
  31.192        (if_t $ genuine_only $ none $ safe false)
  31.193    end
  31.194  
  31.195 @@ -323,30 +323,30 @@
  31.196      val frees = map Free (Term.add_frees t [])
  31.197      fun lookup v = the (AList.lookup (op =) (names ~~ frees) v)
  31.198      val ([depth_name], _) = Variable.variant_fixes ["depth"] ctxt'
  31.199 -    val depth = Free (depth_name, @{typ natural})
  31.200 +    val depth = Free (depth_name, \<^typ>\<open>natural\<close>)
  31.201      fun return _ =
  31.202 -      @{term "throw_Counterexample :: term list \<Rightarrow> unit"} $
  31.203 -        (HOLogic.mk_list @{typ term}
  31.204 +      \<^term>\<open>throw_Counterexample :: term list \<Rightarrow> unit\<close> $
  31.205 +        (HOLogic.mk_list \<^typ>\<open>term\<close>
  31.206            (map (fn t => HOLogic.mk_term_of (fastype_of t) t) (frees @ eval_terms)))
  31.207      fun mk_exhaustive_closure (free as Free (_, T)) t =
  31.208 -      Const (@{const_name fast_exhaustive}, fast_exhaustiveT T) $ lambda free t $ depth
  31.209 -    val none_t = @{term "()"}
  31.210 +      Const (\<^const_name>\<open>fast_exhaustive\<close>, fast_exhaustiveT T) $ lambda free t $ depth
  31.211 +    val none_t = \<^term>\<open>()\<close>
  31.212      fun mk_safe_if (cond, then_t, else_t) genuine = mk_if (cond, then_t, else_t genuine)
  31.213      fun mk_let _ def v_opt t e = mk_let_expr (the_default def v_opt, t, e)
  31.214      val mk_test_term =
  31.215        mk_test_term lookup mk_exhaustive_closure mk_safe_if mk_let none_t return ctxt
  31.216 -  in lambda depth (@{term "catch_Counterexample :: unit => term list option"} $ mk_test_term t) end
  31.217 +  in lambda depth (\<^term>\<open>catch_Counterexample :: unit => term list option\<close> $ mk_test_term t) end
  31.218  
  31.219  fun mk_unknown_term T =
  31.220 -  HOLogic.reflect_term (Const (@{const_name unknown}, T))
  31.221 +  HOLogic.reflect_term (Const (\<^const_name>\<open>unknown\<close>, T))
  31.222  
  31.223  fun mk_safe_term t =
  31.224 -  @{term "Quickcheck_Random.catch_match :: term \<Rightarrow> term \<Rightarrow> term"} $
  31.225 +  \<^term>\<open>Quickcheck_Random.catch_match :: term \<Rightarrow> term \<Rightarrow> term\<close> $
  31.226      (HOLogic.mk_term_of (fastype_of t) t) $ mk_unknown_term (fastype_of t)
  31.227  
  31.228  fun mk_return t genuine =
  31.229 -  @{term "Some :: bool \<times> term list \<Rightarrow> (bool \<times> term list) option"} $
  31.230 -    (HOLogic.pair_const @{typ bool} @{typ "term list"} $
  31.231 +  \<^term>\<open>Some :: bool \<times> term list \<Rightarrow> (bool \<times> term list) option\<close> $
  31.232 +    (HOLogic.pair_const \<^typ>\<open>bool\<close> \<^typ>\<open>term list\<close> $
  31.233        Quickcheck_Common.reflect_bool genuine $ t)
  31.234  
  31.235  fun mk_generator_expr ctxt (t, eval_terms) =
  31.236 @@ -357,14 +357,14 @@
  31.237      fun lookup v = the (AList.lookup (op =) (names ~~ frees) v)
  31.238      val ([depth_name, genuine_only_name], _) =
  31.239        Variable.variant_fixes ["depth", "genuine_only"] ctxt'
  31.240 -    val depth = Free (depth_name, @{typ natural})
  31.241 -    val genuine_only = Free (genuine_only_name, @{typ bool})
  31.242 +    val depth = Free (depth_name, \<^typ>\<open>natural\<close>)
  31.243 +    val genuine_only = Free (genuine_only_name, \<^typ>\<open>bool\<close>)
  31.244      val return =
  31.245 -      mk_return (HOLogic.mk_list @{typ term}
  31.246 +      mk_return (HOLogic.mk_list \<^typ>\<open>term\<close>
  31.247          (map (fn t => HOLogic.mk_term_of (fastype_of t) t) frees @ map mk_safe_term eval_terms))
  31.248      fun mk_exhaustive_closure (free as Free (_, T)) t =
  31.249 -      Const (@{const_name exhaustive}, exhaustiveT T) $ lambda free t $ depth
  31.250 -    val none_t = Const (@{const_name None}, resultT)
  31.251 +      Const (\<^const_name>\<open>exhaustive\<close>, exhaustiveT T) $ lambda free t $ depth
  31.252 +    val none_t = Const (\<^const_name>\<open>None\<close>, resultT)
  31.253      val mk_if = Quickcheck_Common.mk_safe_if genuine_only none_t
  31.254      fun mk_let safe def v_opt t e =
  31.255        mk_safe_let_expr genuine_only none_t safe (the_default def v_opt, t, e)
  31.256 @@ -380,28 +380,28 @@
  31.257      val ([depth_name, genuine_only_name], ctxt'') =
  31.258        Variable.variant_fixes ["depth", "genuine_only"] ctxt'
  31.259      val (term_names, _) = Variable.variant_fixes (map (prefix "t_") names) ctxt''
  31.260 -    val depth = Free (depth_name, @{typ natural})
  31.261 -    val genuine_only = Free (genuine_only_name, @{typ bool})
  31.262 -    val term_vars = map (fn n => Free (n, @{typ "unit \<Rightarrow> term"})) term_names
  31.263 +    val depth = Free (depth_name, \<^typ>\<open>natural\<close>)
  31.264 +    val genuine_only = Free (genuine_only_name, \<^typ>\<open>bool\<close>)
  31.265 +    val term_vars = map (fn n => Free (n, \<^typ>\<open>unit \<Rightarrow> term\<close>)) term_names
  31.266      fun lookup v = the (AList.lookup (op =) (names ~~ (frees ~~ term_vars)) v)
  31.267      val return =
  31.268        mk_return
  31.269 -        (HOLogic.mk_list @{typ term}
  31.270 -          (map (fn v => v $ @{term "()"}) term_vars @ map mk_safe_term eval_terms))
  31.271 +        (HOLogic.mk_list \<^typ>\<open>term\<close>
  31.272 +          (map (fn v => v $ \<^term>\<open>()\<close>) term_vars @ map mk_safe_term eval_terms))
  31.273      fun mk_exhaustive_closure (free as Free (_, T), term_var) t =
  31.274 -      if Sign.of_sort thy (T, @{sort check_all}) then
  31.275 -        Const (@{const_name check_all}, check_allT T) $
  31.276 -          (HOLogic.case_prod_const (T, @{typ "unit \<Rightarrow> term"}, resultT) $
  31.277 +      if Sign.of_sort thy (T, \<^sort>\<open>check_all\<close>) then
  31.278 +        Const (\<^const_name>\<open>check_all\<close>, check_allT T) $
  31.279 +          (HOLogic.case_prod_const (T, \<^typ>\<open>unit \<Rightarrow> term\<close>, resultT) $
  31.280              lambda free (lambda term_var t))
  31.281        else
  31.282 -        Const (@{const_name full_exhaustive}, full_exhaustiveT T) $
  31.283 -          (HOLogic.case_prod_const (T, @{typ "unit \<Rightarrow> term"}, resultT) $
  31.284 +        Const (\<^const_name>\<open>full_exhaustive\<close>, full_exhaustiveT T) $
  31.285 +          (HOLogic.case_prod_const (T, \<^typ>\<open>unit \<Rightarrow> term\<close>, resultT) $
  31.286              lambda free (lambda term_var t)) $ depth
  31.287 -    val none_t = Const (@{const_name None}, resultT)
  31.288 +    val none_t = Const (\<^const_name>\<open>None\<close>, resultT)
  31.289      val mk_if = Quickcheck_Common.mk_safe_if genuine_only none_t
  31.290      fun mk_let safe _ (SOME (v, term_var)) t e =
  31.291            mk_safe_let_expr genuine_only none_t safe (v, t,
  31.292 -            e #> subst_free [(term_var, absdummy @{typ unit} (mk_safe_term t))])
  31.293 +            e #> subst_free [(term_var, absdummy \<^typ>\<open>unit\<close> (mk_safe_term t))])
  31.294        | mk_let safe v NONE t e = mk_safe_let_expr genuine_only none_t safe (v, t, e)
  31.295      val mk_test_term = mk_test_term lookup mk_exhaustive_closure mk_if mk_let none_t return ctxt
  31.296    in lambda genuine_only (lambda depth (mk_test_term t)) end
  31.297 @@ -409,37 +409,37 @@
  31.298  fun mk_parametric_generator_expr mk_generator_expr =
  31.299    Quickcheck_Common.gen_mk_parametric_generator_expr
  31.300      ((mk_generator_expr,
  31.301 -      absdummy @{typ bool} (absdummy @{typ natural} (Const (@{const_name None}, resultT)))),
  31.302 -      @{typ bool} --> @{typ natural} --> resultT)
  31.303 +      absdummy \<^typ>\<open>bool\<close> (absdummy \<^typ>\<open>natural\<close> (Const (\<^const_name>\<open>None\<close>, resultT)))),
  31.304 +      \<^typ>\<open>bool\<close> --> \<^typ>\<open>natural\<close> --> resultT)
  31.305  
  31.306  fun mk_validator_expr ctxt t =
  31.307    let
  31.308 -    fun bounded_forallT T = (T --> @{typ bool}) --> @{typ natural} --> @{typ bool}
  31.309 +    fun bounded_forallT T = (T --> \<^typ>\<open>bool\<close>) --> \<^typ>\<open>natural\<close> --> \<^typ>\<open>bool\<close>
  31.310      val ctxt' = Variable.auto_fixes t ctxt
  31.311      val names = Term.add_free_names t []
  31.312      val frees = map Free (Term.add_frees t [])
  31.313      fun lookup v = the (AList.lookup (op =) (names ~~ frees) v)
  31.314      val ([depth_name], _) = Variable.variant_fixes ["depth"] ctxt'
  31.315 -    val depth = Free (depth_name, @{typ natural})
  31.316 +    val depth = Free (depth_name, \<^typ>\<open>natural\<close>)
  31.317      fun mk_bounded_forall (Free (s, T)) t =
  31.318 -      Const (@{const_name bounded_forall}, bounded_forallT T) $ lambda (Free (s, T)) t $ depth
  31.319 +      Const (\<^const_name>\<open>bounded_forall\<close>, bounded_forallT T) $ lambda (Free (s, T)) t $ depth
  31.320      fun mk_safe_if (cond, then_t, else_t) genuine = mk_if (cond, then_t, else_t genuine)
  31.321      fun mk_let _ def v_opt t e = mk_let_expr (the_default def v_opt, t, e)
  31.322      val mk_test_term =
  31.323 -      mk_test_term lookup mk_bounded_forall mk_safe_if mk_let @{term True} (K @{term False}) ctxt
  31.324 +      mk_test_term lookup mk_bounded_forall mk_safe_if mk_let \<^term>\<open>True\<close> (K \<^term>\<open>False\<close>) ctxt
  31.325    in lambda depth (mk_test_term t) end
  31.326  
  31.327  fun mk_bounded_forall_generator_expr ctxt (t, eval_terms) =
  31.328    let
  31.329      val frees = Term.add_free_names t []
  31.330      val dummy_term =
  31.331 -      @{term "Code_Evaluation.Const (STR ''Pure.dummy_pattern'') (Typerep.Typerep (STR ''dummy'') [])"}
  31.332 +      \<^term>\<open>Code_Evaluation.Const (STR ''Pure.dummy_pattern'') (Typerep.Typerep (STR ''dummy'') [])\<close>
  31.333      val return =
  31.334 -      @{term "Some :: term list => term list option"} $
  31.335 -        (HOLogic.mk_list @{typ term} (replicate (length frees + length eval_terms) dummy_term))
  31.336 -    val wrap = absdummy @{typ bool}
  31.337 -      (@{term "If :: bool \<Rightarrow> term list option \<Rightarrow> term list option \<Rightarrow> term list option"} $
  31.338 -        Bound 0 $ @{term "None :: term list option"} $ return)
  31.339 +      \<^term>\<open>Some :: term list => term list option\<close> $
  31.340 +        (HOLogic.mk_list \<^typ>\<open>term\<close> (replicate (length frees + length eval_terms) dummy_term))
  31.341 +    val wrap = absdummy \<^typ>\<open>bool\<close>
  31.342 +      (\<^term>\<open>If :: bool \<Rightarrow> term list option \<Rightarrow> term list option \<Rightarrow> term list option\<close> $
  31.343 +        Bound 0 $ \<^term>\<open>None :: term list option\<close> $ return)
  31.344    in HOLogic.mk_comp (wrap, mk_validator_expr ctxt t) end
  31.345  
  31.346  
  31.347 @@ -504,7 +504,7 @@
  31.348          (get_counterexample_batch, put_counterexample_batch,
  31.349            "Exhaustive_Generators.put_counterexample_batch")
  31.350          ctxt (SOME target) (fn proc => map (fn g => g #> (Option.map o map) proc))
  31.351 -        (HOLogic.mk_list @{typ "natural => term list option"} ts') []
  31.352 +        (HOLogic.mk_list \<^typ>\<open>natural \<Rightarrow> term list option\<close> ts') []
  31.353    in
  31.354      map (fn compile => fn size =>
  31.355        compile size |> (Option.map o map) Quickcheck_Common.post_process_term) compiles
  31.356 @@ -518,14 +518,14 @@
  31.357    let val ts' = map (mk_validator_expr ctxt) ts in
  31.358      Code_Runtime.dynamic_value_strict
  31.359        (get_validator_batch, put_validator_batch, "Exhaustive_Generators.put_validator_batch")
  31.360 -      ctxt (SOME target) (K I) (HOLogic.mk_list @{typ "natural \<Rightarrow> bool"} ts') []
  31.361 +      ctxt (SOME target) (K I) (HOLogic.mk_list \<^typ>\<open>natural \<Rightarrow> bool\<close> ts') []
  31.362    end
  31.363  
  31.364  fun compile_validator_exprs ctxt ts =
  31.365    compile_validator_exprs_raw ctxt ts
  31.366    |> map (fn f => fn size => f (Code_Numeral.natural_of_integer size))
  31.367  
  31.368 -fun size_matters_for thy Ts = not (forall (fn T => Sign.of_sort thy (T,  @{sort check_all})) Ts)
  31.369 +fun size_matters_for thy Ts = not (forall (fn T => Sign.of_sort thy (T, \<^sort>\<open>check_all\<close>)) Ts)
  31.370  
  31.371  val test_goals =
  31.372    Quickcheck_Common.generator_test_goal_terms
  31.373 @@ -535,22 +535,22 @@
  31.374  (* setup *)
  31.375  
  31.376  val setup_exhaustive_datatype_interpretation =
  31.377 -  Quickcheck_Common.datatype_interpretation @{plugin quickcheck_exhaustive}
  31.378 -    (@{sort exhaustive}, instantiate_exhaustive_datatype)
  31.379 +  Quickcheck_Common.datatype_interpretation \<^plugin>\<open>quickcheck_exhaustive\<close>
  31.380 +    (\<^sort>\<open>exhaustive\<close>, instantiate_exhaustive_datatype)
  31.381  
  31.382  val setup_bounded_forall_datatype_interpretation =
  31.383 -  BNF_LFP_Compat.interpretation @{plugin quickcheck_bounded_forall} Quickcheck_Common.compat_prefs
  31.384 +  BNF_LFP_Compat.interpretation \<^plugin>\<open>quickcheck_bounded_forall\<close> Quickcheck_Common.compat_prefs
  31.385      (Quickcheck_Common.ensure_sort
  31.386 -       (((@{sort type}, @{sort type}), @{sort bounded_forall}),
  31.387 +       (((\<^sort>\<open>type\<close>, \<^sort>\<open>type\<close>), \<^sort>\<open>bounded_forall\<close>),
  31.388         (fn thy => BNF_LFP_Compat.the_descr thy Quickcheck_Common.compat_prefs,
  31.389          instantiate_bounded_forall_datatype)))
  31.390  
  31.391 -val active = Attrib.setup_config_bool @{binding quickcheck_exhaustive_active} (K true)
  31.392 +val active = Attrib.setup_config_bool \<^binding>\<open>quickcheck_exhaustive_active\<close> (K true)
  31.393  
  31.394  val _ =
  31.395    Theory.setup
  31.396 -   (Quickcheck_Common.datatype_interpretation @{plugin quickcheck_full_exhaustive}
  31.397 -      (@{sort full_exhaustive}, instantiate_full_exhaustive_datatype)
  31.398 +   (Quickcheck_Common.datatype_interpretation \<^plugin>\<open>quickcheck_full_exhaustive\<close>
  31.399 +      (\<^sort>\<open>full_exhaustive\<close>, instantiate_full_exhaustive_datatype)
  31.400      #> Context.theory_map (Quickcheck.add_tester ("exhaustive", (active, test_goals)))
  31.401      #> Context.theory_map (Quickcheck.add_batch_generator ("exhaustive", compile_generator_exprs))
  31.402      #> Context.theory_map (Quickcheck.add_batch_validator ("exhaustive", compile_validator_exprs)))
    32.1 --- a/src/HOL/Tools/Quickcheck/find_unused_assms.ML	Wed Dec 06 16:01:15 2017 +0100
    32.2 +++ b/src/HOL/Tools/Quickcheck/find_unused_assms.ML	Wed Dec 06 21:01:01 2017 +0100
    32.3 @@ -113,7 +113,7 @@
    32.4  end
    32.5  
    32.6  val _ =
    32.7 -  Outer_Syntax.command @{command_keyword find_unused_assms}
    32.8 +  Outer_Syntax.command \<^command_keyword>\<open>find_unused_assms\<close>
    32.9      "find theorems with (potentially) superfluous assumptions"
   32.10      (Scan.option Parse.name >> (fn name =>
   32.11        Toplevel.keep (fn state => print_unused_assms (Toplevel.context_of state) name)))
    33.1 --- a/src/HOL/Tools/Quickcheck/narrowing_generators.ML	Wed Dec 06 16:01:15 2017 +0100
    33.2 +++ b/src/HOL/Tools/Quickcheck/narrowing_generators.ML	Wed Dec 06 21:01:01 2017 +0100
    33.3 @@ -24,37 +24,37 @@
    33.4  
    33.5  (* configurations *)
    33.6  
    33.7 -val allow_existentials = Attrib.setup_config_bool @{binding quickcheck_allow_existentials} (K true)
    33.8 -val finite_functions = Attrib.setup_config_bool @{binding quickcheck_finite_functions} (K true)
    33.9 -val overlord = Attrib.setup_config_bool @{binding quickcheck_narrowing_overlord} (K false)
   33.10 -val ghc_options = Attrib.setup_config_string @{binding quickcheck_narrowing_ghc_options} (K "")
   33.11 +val allow_existentials = Attrib.setup_config_bool \<^binding>\<open>quickcheck_allow_existentials\<close> (K true)
   33.12 +val finite_functions = Attrib.setup_config_bool \<^binding>\<open>quickcheck_finite_functions\<close> (K true)
   33.13 +val overlord = Attrib.setup_config_bool \<^binding>\<open>quickcheck_narrowing_overlord\<close> (K false)
   33.14 +val ghc_options = Attrib.setup_config_string \<^binding>\<open>quickcheck_narrowing_ghc_options\<close> (K "")
   33.15  
   33.16  
   33.17  (* partial_term_of instances *)
   33.18  
   33.19  fun mk_partial_term_of (x, T) =
   33.20 -  Const (@{const_name Quickcheck_Narrowing.partial_term_of_class.partial_term_of},
   33.21 -    Term.itselfT T --> @{typ narrowing_term} --> @{typ Code_Evaluation.term}) $ Logic.mk_type T $ x
   33.22 +  Const (\<^const_name>\<open>Quickcheck_Narrowing.partial_term_of_class.partial_term_of\<close>,
   33.23 +    Term.itselfT T --> \<^typ>\<open>narrowing_term\<close> --> \<^typ>\<open>Code_Evaluation.term\<close>) $ Logic.mk_type T $ x
   33.24  
   33.25  
   33.26  (** formal definition **)
   33.27  
   33.28  fun add_partial_term_of tyco raw_vs thy =
   33.29    let
   33.30 -    val vs = map (fn (v, _) => (v, @{sort typerep})) raw_vs
   33.31 +    val vs = map (fn (v, _) => (v, \<^sort>\<open>typerep\<close>)) raw_vs
   33.32      val ty = Type (tyco, map TFree vs)
   33.33      val lhs =
   33.34 -      Const (@{const_name partial_term_of},
   33.35 -        Term.itselfT ty --> @{typ narrowing_term} --> @{typ Code_Evaluation.term}) $
   33.36 -      Free ("x", Term.itselfT ty) $ Free ("t", @{typ narrowing_term})
   33.37 -    val rhs = @{term "undefined :: Code_Evaluation.term"}
   33.38 +      Const (\<^const_name>\<open>partial_term_of\<close>,
   33.39 +        Term.itselfT ty --> \<^typ>\<open>narrowing_term\<close> --> \<^typ>\<open>Code_Evaluation.term\<close>) $
   33.40 +      Free ("x", Term.itselfT ty) $ Free ("t", \<^typ>\<open>narrowing_term\<close>)
   33.41 +    val rhs = \<^term>\<open>undefined :: Code_Evaluation.term\<close>
   33.42      val eq = HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs, rhs))
   33.43      fun triv_name_of t =
   33.44        (fst o dest_Free o fst o strip_comb o fst o HOLogic.dest_eq o HOLogic.dest_Trueprop) t ^
   33.45          "_triv"
   33.46    in
   33.47      thy
   33.48 -    |> Class.instantiation ([tyco], vs, @{sort partial_term_of})
   33.49 +    |> Class.instantiation ([tyco], vs, \<^sort>\<open>partial_term_of\<close>)
   33.50      |> `(fn lthy => Syntax.check_term lthy eq)
   33.51      |-> (fn eq => Specification.definition NONE [] [] ((Binding.name (triv_name_of eq), []), eq))
   33.52      |> snd
   33.53 @@ -63,8 +63,8 @@
   33.54  
   33.55  fun ensure_partial_term_of (tyco, (raw_vs, _)) thy =
   33.56    let
   33.57 -    val need_inst = not (Sorts.has_instance (Sign.classes_of thy) tyco @{sort partial_term_of})
   33.58 -      andalso Sorts.has_instance (Sign.classes_of thy) tyco @{sort typerep}
   33.59 +    val need_inst = not (Sorts.has_instance (Sign.classes_of thy) tyco \<^sort>\<open>partial_term_of\<close>)
   33.60 +      andalso Sorts.has_instance (Sign.classes_of thy) tyco \<^sort>\<open>typerep\<close>
   33.61    in if need_inst then add_partial_term_of tyco raw_vs thy else thy end
   33.62  
   33.63  
   33.64 @@ -72,14 +72,14 @@
   33.65  
   33.66  fun mk_partial_term_of_eq thy ty (i, (c, (_, tys))) =
   33.67    let
   33.68 -    val frees = map Free (Name.invent_names Name.context "a" (map (K @{typ narrowing_term}) tys))
   33.69 +    val frees = map Free (Name.invent_names Name.context "a" (map (K \<^typ>\<open>narrowing_term\<close>) tys))
   33.70      val narrowing_term =
   33.71 -      @{term Quickcheck_Narrowing.Narrowing_constructor} $ HOLogic.mk_number @{typ integer} i $
   33.72 -        HOLogic.mk_list @{typ narrowing_term} (rev frees)
   33.73 +      \<^term>\<open>Quickcheck_Narrowing.Narrowing_constructor\<close> $ HOLogic.mk_number \<^typ>\<open>integer\<close> i $
   33.74 +        HOLogic.mk_list \<^typ>\<open>narrowing_term\<close> (rev frees)
   33.75      val rhs =
   33.76 -      fold (fn u => fn t => @{term "Code_Evaluation.App"} $ t $ u)
   33.77 +      fold (fn u => fn t => \<^term>\<open>Code_Evaluation.App\<close> $ t $ u)
   33.78          (map mk_partial_term_of (frees ~~ tys))
   33.79 -        (@{term "Code_Evaluation.Const"} $ HOLogic.mk_literal c $ HOLogic.mk_typerep (tys ---> ty))
   33.80 +        (\<^term>\<open>Code_Evaluation.Const\<close> $ HOLogic.mk_literal c $ HOLogic.mk_typerep (tys ---> ty))
   33.81      val insts =
   33.82        map (SOME o Thm.global_cterm_of thy o Logic.unvarify_types_global o Logic.varify_global)
   33.83          [Free ("ty", Term.itselfT ty), narrowing_term, rhs]
   33.84 @@ -93,16 +93,16 @@
   33.85  fun add_partial_term_of_code tyco raw_vs raw_cs thy =
   33.86    let
   33.87      val algebra = Sign.classes_of thy
   33.88 -    val vs = map (fn (v, sort) => (v, curry (Sorts.inter_sort algebra) @{sort typerep} sort)) raw_vs
   33.89 +    val vs = map (fn (v, sort) => (v, curry (Sorts.inter_sort algebra) \<^sort>\<open>typerep\<close> sort)) raw_vs
   33.90      val ty = Type (tyco, map TFree vs)
   33.91      val cs =
   33.92        (map o apsnd o apsnd o map o map_atyps)
   33.93          (fn TFree (v, _) => TFree (v, (the o AList.lookup (op =) vs) v)) raw_cs
   33.94 -    val const = Axclass.param_of_inst thy (@{const_name partial_term_of}, tyco)
   33.95 +    val const = Axclass.param_of_inst thy (\<^const_name>\<open>partial_term_of\<close>, tyco)
   33.96      val var_insts =
   33.97        map (SOME o Thm.global_cterm_of thy o Logic.unvarify_types_global o Logic.varify_global)
   33.98 -        [Free ("ty", Term.itselfT ty), @{term "Quickcheck_Narrowing.Narrowing_variable p tt"},
   33.99 -          @{term "Code_Evaluation.Free (STR ''_'')"} $ HOLogic.mk_typerep ty]
  33.100 +        [Free ("ty", Term.itselfT ty), \<^term>\<open>Quickcheck_Narrowing.Narrowing_variable p tt\<close>,
  33.101 +          \<^term>\<open>Code_Evaluation.Free (STR ''_'')\<close> $ HOLogic.mk_typerep ty]
  33.102      val var_eq =
  33.103        @{thm partial_term_of_anything}
  33.104        |> Thm.instantiate' [SOME (Thm.global_ctyp_of thy ty)] var_insts
  33.105 @@ -114,7 +114,7 @@
  33.106    end
  33.107  
  33.108  fun ensure_partial_term_of_code (tyco, (raw_vs, cs)) thy =
  33.109 -  let val has_inst = Sorts.has_instance (Sign.classes_of thy) tyco @{sort partial_term_of}
  33.110 +  let val has_inst = Sorts.has_instance (Sign.classes_of thy) tyco \<^sort>\<open>partial_term_of\<close>
  33.111    in if has_inst then add_partial_term_of_code tyco raw_vs cs thy else thy end
  33.112  
  33.113  
  33.114 @@ -126,21 +126,21 @@
  33.115  
  33.116  val narrowingN = "narrowing"
  33.117  
  33.118 -fun narrowingT T = @{typ integer} --> Type (@{type_name Quickcheck_Narrowing.narrowing_cons}, [T])
  33.119 +fun narrowingT T = \<^typ>\<open>integer\<close> --> Type (\<^type_name>\<open>Quickcheck_Narrowing.narrowing_cons\<close>, [T])
  33.120  
  33.121 -fun mk_cons c T = Const (@{const_name Quickcheck_Narrowing.cons}, T --> narrowingT T) $ Const (c, T)
  33.122 +fun mk_cons c T = Const (\<^const_name>\<open>Quickcheck_Narrowing.cons\<close>, T --> narrowingT T) $ Const (c, T)
  33.123  
  33.124  fun mk_apply (T, t) (U, u) =
  33.125    let
  33.126      val (_, U') = dest_funT U
  33.127    in
  33.128 -    (U', Const (@{const_name Quickcheck_Narrowing.apply},
  33.129 +    (U', Const (\<^const_name>\<open>Quickcheck_Narrowing.apply\<close>,
  33.130        narrowingT U --> narrowingT T --> narrowingT U') $ u $ t)
  33.131    end
  33.132  
  33.133  fun mk_sum (t, u) =
  33.134    let val T = fastype_of t
  33.135 -  in Const (@{const_name Quickcheck_Narrowing.sum}, T --> T --> T) $ t $ u end
  33.136 +  in Const (\<^const_name>\<open>Quickcheck_Narrowing.sum\<close>, T --> T --> T) $ t $ u end
  33.137  
  33.138  
  33.139  (** deriving narrowing instances **)
  33.140 @@ -148,7 +148,7 @@
  33.141  fun mk_equations descr vs narrowings =
  33.142    let
  33.143      fun mk_call T =
  33.144 -      (T, Const (@{const_name "Quickcheck_Narrowing.narrowing_class.narrowing"}, narrowingT T))
  33.145 +      (T, Const (\<^const_name>\<open>Quickcheck_Narrowing.narrowing_class.narrowing\<close>, narrowingT T))
  33.146      fun mk_aux_call fTs (k, _) (tyco, Ts) =
  33.147        let
  33.148          val T = Type (tyco, Ts)
  33.149 @@ -181,7 +181,7 @@
  33.150    in
  33.151      if not (contains_recursive_type_under_function_types descr) then
  33.152        thy
  33.153 -      |> Class.instantiation (tycos, vs, @{sort narrowing})
  33.154 +      |> Class.instantiation (tycos, vs, \<^sort>\<open>narrowing\<close>)
  33.155        |> Quickcheck_Common.define_functions
  33.156          (fn narrowings => mk_equations descr vs narrowings, NONE)
  33.157          prfx [] narrowingsN (map narrowingT (Ts @ Us))
  33.158 @@ -348,29 +348,29 @@
  33.159    let
  33.160      val (names, boundTs) = split_list xTs
  33.161      fun mk_eval_ffun dT rT =
  33.162 -      Const (@{const_name "Quickcheck_Narrowing.eval_ffun"},
  33.163 -        Type (@{type_name "Quickcheck_Narrowing.ffun"}, [dT, rT]) --> dT --> rT)
  33.164 +      Const (\<^const_name>\<open>Quickcheck_Narrowing.eval_ffun\<close>,
  33.165 +        Type (\<^type_name>\<open>Quickcheck_Narrowing.ffun\<close>, [dT, rT]) --> dT --> rT)
  33.166      fun mk_eval_cfun dT rT =
  33.167 -      Const (@{const_name "Quickcheck_Narrowing.eval_cfun"},
  33.168 -        Type (@{type_name "Quickcheck_Narrowing.cfun"}, [rT]) --> dT --> rT)
  33.169 -    fun eval_function (Type (@{type_name fun}, [dT, rT])) =
  33.170 +      Const (\<^const_name>\<open>Quickcheck_Narrowing.eval_cfun\<close>,
  33.171 +        Type (\<^type_name>\<open>Quickcheck_Narrowing.cfun\<close>, [rT]) --> dT --> rT)
  33.172 +    fun eval_function (Type (\<^type_name>\<open>fun\<close>, [dT, rT])) =
  33.173            let
  33.174              val (rt', rT') = eval_function rT
  33.175            in
  33.176              (case dT of
  33.177 -              Type (@{type_name fun}, _) =>
  33.178 +              Type (\<^type_name>\<open>fun\<close>, _) =>
  33.179                  (fn t => absdummy dT (rt' (mk_eval_cfun dT rT' $ incr_boundvars 1 t $ Bound 0)),
  33.180 -                  Type (@{type_name "Quickcheck_Narrowing.cfun"}, [rT']))
  33.181 +                  Type (\<^type_name>\<open>Quickcheck_Narrowing.cfun\<close>, [rT']))
  33.182              | _ =>
  33.183                  (fn t => absdummy dT (rt' (mk_eval_ffun dT rT' $ incr_boundvars 1 t $ Bound 0)),
  33.184 -                  Type (@{type_name "Quickcheck_Narrowing.ffun"}, [dT, rT'])))
  33.185 +                  Type (\<^type_name>\<open>Quickcheck_Narrowing.ffun\<close>, [dT, rT'])))
  33.186            end
  33.187 -      | eval_function (T as Type (@{type_name prod}, [fT, sT])) =
  33.188 +      | eval_function (T as Type (\<^type_name>\<open>prod\<close>, [fT, sT])) =
  33.189            let
  33.190              val (ft', fT') = eval_function fT
  33.191              val (st', sT') = eval_function sT
  33.192 -            val T' = Type (@{type_name prod}, [fT', sT'])
  33.193 -            val map_const = Const (@{const_name map_prod}, (fT' --> fT) --> (sT' --> sT) --> T' --> T)
  33.194 +            val T' = Type (\<^type_name>\<open>prod\<close>, [fT', sT'])
  33.195 +            val map_const = Const (\<^const_name>\<open>map_prod\<close>, (fT' --> fT) --> (sT' --> sT) --> T' --> T)
  33.196              fun apply_dummy T t = absdummy T (t (Bound 0))
  33.197            in
  33.198              (fn t => list_comb (map_const, [apply_dummy fT' ft', apply_dummy sT' st', t]), T')
  33.199 @@ -382,11 +382,11 @@
  33.200      (names ~~ boundTs', t')
  33.201    end
  33.202  
  33.203 -fun dest_ffun (Type (@{type_name "Quickcheck_Narrowing.ffun"}, [dT, rT])) = (dT, rT)
  33.204 +fun dest_ffun (Type (\<^type_name>\<open>Quickcheck_Narrowing.ffun\<close>, [dT, rT])) = (dT, rT)
  33.205  
  33.206 -fun eval_finite_functions (Const (@{const_name "Quickcheck_Narrowing.ffun.Constant"}, T) $ value) =
  33.207 +fun eval_finite_functions (Const (\<^const_name>\<open>Quickcheck_Narrowing.ffun.Constant\<close>, T) $ value) =
  33.208        absdummy (fst (dest_ffun (body_type T))) (eval_finite_functions value)
  33.209 -  | eval_finite_functions (Const (@{const_name "Quickcheck_Narrowing.ffun.Update"}, T) $ a $ b $ f) =
  33.210 +  | eval_finite_functions (Const (\<^const_name>\<open>Quickcheck_Narrowing.ffun.Update\<close>, T) $ a $ b $ f) =
  33.211        let
  33.212          val (T1, T2) = dest_ffun (body_type T)
  33.213        in
  33.214 @@ -407,29 +407,29 @@
  33.215  
  33.216  fun make_pnf_term thy t = Pattern.rewrite_term thy rewrs [] t
  33.217  
  33.218 -fun strip_quantifiers (Const (@{const_name Ex}, _) $ Abs (x, T, t)) =
  33.219 -      apfst (cons (@{const_name Ex}, (x, T))) (strip_quantifiers t)
  33.220 -  | strip_quantifiers (Const (@{const_name All}, _) $ Abs (x, T, t)) =
  33.221 -      apfst (cons (@{const_name All}, (x, T))) (strip_quantifiers t)
  33.222 +fun strip_quantifiers (Const (\<^const_name>\<open>Ex\<close>, _) $ Abs (x, T, t)) =
  33.223 +      apfst (cons (\<^const_name>\<open>Ex\<close>, (x, T))) (strip_quantifiers t)
  33.224 +  | strip_quantifiers (Const (\<^const_name>\<open>All\<close>, _) $ Abs (x, T, t)) =
  33.225 +      apfst (cons (\<^const_name>\<open>All\<close>, (x, T))) (strip_quantifiers t)
  33.226    | strip_quantifiers t = ([], t)
  33.227  
  33.228  fun contains_existentials t =
  33.229 -  exists (fn (Q, _) => Q = @{const_name Ex}) (fst (strip_quantifiers t))
  33.230 +  exists (fn (Q, _) => Q = \<^const_name>\<open>Ex\<close>) (fst (strip_quantifiers t))
  33.231  
  33.232  fun mk_property qs t =
  33.233    let
  33.234 -    fun enclose (@{const_name Ex}, (x, T)) t =
  33.235 -          Const (@{const_name Quickcheck_Narrowing.exists},
  33.236 -            (T --> @{typ property}) --> @{typ property}) $ Abs (x, T, t)
  33.237 -      | enclose (@{const_name All}, (x, T)) t =
  33.238 -          Const (@{const_name Quickcheck_Narrowing.all},
  33.239 -            (T --> @{typ property}) --> @{typ property}) $ Abs (x, T, t)
  33.240 -  in fold_rev enclose qs (@{term Quickcheck_Narrowing.Property} $ t) end
  33.241 +    fun enclose (\<^const_name>\<open>Ex\<close>, (x, T)) t =
  33.242 +          Const (\<^const_name>\<open>Quickcheck_Narrowing.exists\<close>,
  33.243 +            (T --> \<^typ>\<open>property\<close>) --> \<^typ>\<open>property\<close>) $ Abs (x, T, t)
  33.244 +      | enclose (\<^const_name>\<open>All\<close>, (x, T)) t =
  33.245 +          Const (\<^const_name>\<open>Quickcheck_Narrowing.all\<close>,
  33.246 +            (T --> \<^typ>\<open>property\<close>) --> \<^typ>\<open>property\<close>) $ Abs (x, T, t)
  33.247 +  in fold_rev enclose qs (\<^term>\<open>Quickcheck_Narrowing.Property\<close> $ t) end
  33.248  
  33.249 -fun mk_case_term ctxt p ((@{const_name Ex}, (x, T)) :: qs') (Existential_Counterexample cs) =
  33.250 +fun mk_case_term ctxt p ((\<^const_name>\<open>Ex\<close>, (x, T)) :: qs') (Existential_Counterexample cs) =
  33.251        Case_Translation.make_case ctxt Case_Translation.Quiet Name.context (Free (x, T)) (map (fn (t, c) =>
  33.252          (t, mk_case_term ctxt (p - 1) qs' c)) cs)
  33.253 -  | mk_case_term ctxt p ((@{const_name All}, _) :: qs') (Universal_Counterexample (t, c)) =
  33.254 +  | mk_case_term ctxt p ((\<^const_name>\<open>All\<close>, _) :: qs') (Universal_Counterexample (t, c)) =
  33.255        if p = 0 then t else mk_case_term ctxt (p - 1) qs' c
  33.256  
  33.257  val post_process =
  33.258 @@ -437,7 +437,7 @@
  33.259  
  33.260  fun mk_terms ctxt qs result =
  33.261    let
  33.262 -    val ps = filter (fn (_, (@{const_name All}, _)) => true | _ => false) (map_index I qs)
  33.263 +    val ps = filter (fn (_, (\<^const_name>\<open>All\<close>, _)) => true | _ => false) (map_index I qs)
  33.264    in
  33.265      map (fn (p, (_, (x, _))) => (x, mk_case_term ctxt p qs result)) ps
  33.266      |> map (apsnd post_process)
  33.267 @@ -485,7 +485,7 @@
  33.268          fun wrap f t = uncurry (fold_rev Term.abs) (f (strip_abs t))
  33.269          val finitize = if Config.get ctxt finite_functions then wrap finitize_functions else I
  33.270          fun ensure_testable t =
  33.271 -          Const (@{const_name Quickcheck_Narrowing.ensure_testable},
  33.272 +          Const (\<^const_name>\<open>Quickcheck_Narrowing.ensure_testable\<close>,
  33.273              fastype_of t --> fastype_of t) $ t
  33.274          fun is_genuine (SOME (true, _)) = true
  33.275            | is_genuine _ = false
  33.276 @@ -531,14 +531,14 @@
  33.277  
  33.278  (* setup *)
  33.279  
  33.280 -val active = Attrib.setup_config_bool @{binding quickcheck_narrowing_active} (K false)
  33.281 +val active = Attrib.setup_config_bool \<^binding>\<open>quickcheck_narrowing_active\<close> (K false)
  33.282  
  33.283  val _ =
  33.284    Theory.setup
  33.285     (Code.datatype_interpretation ensure_partial_term_of
  33.286      #> Code.datatype_interpretation ensure_partial_term_of_code
  33.287 -    #> Quickcheck_Common.datatype_interpretation @{plugin quickcheck_narrowing}
  33.288 -      (@{sort narrowing}, instantiate_narrowing_datatype)
  33.289 +    #> Quickcheck_Common.datatype_interpretation \<^plugin>\<open>quickcheck_narrowing\<close>
  33.290 +      (\<^sort>\<open>narrowing\<close>, instantiate_narrowing_datatype)
  33.291      #> Context.theory_map (Quickcheck.add_tester ("narrowing", (active, test_goals))))
  33.292  
  33.293  end
    34.1 --- a/src/HOL/Tools/Quickcheck/quickcheck_common.ML	Wed Dec 06 16:01:15 2017 +0100
    34.2 +++ b/src/HOL/Tools/Quickcheck/quickcheck_common.ML	Wed Dec 06 21:01:01 2017 +0100
    34.3 @@ -56,12 +56,12 @@
    34.4  
    34.5  (* HOLogic's term functions *)
    34.6  
    34.7 -fun strip_imp (Const(@{const_name HOL.implies}, _) $ A $ B) = apfst (cons A) (strip_imp B)
    34.8 +fun strip_imp (Const(\<^const_name>\<open>HOL.implies\<close>, _) $ A $ B) = apfst (cons A) (strip_imp B)
    34.9    | strip_imp A = ([], A)
   34.10  
   34.11 -fun reflect_bool b = if b then @{term True} else @{term False}
   34.12 +fun reflect_bool b = if b then \<^term>\<open>True\<close> else \<^term>\<open>False\<close>
   34.13  
   34.14 -fun mk_undefined T = Const (@{const_name undefined}, T)
   34.15 +fun mk_undefined T = Const (\<^const_name>\<open>undefined\<close>, T)
   34.16  
   34.17  
   34.18  (* testing functions: testing with increasing sizes (and cardinalities) *)
   34.19 @@ -210,8 +210,8 @@
   34.20  
   34.21  fun get_finite_types ctxt =
   34.22    fst (chop (Config.get ctxt Quickcheck.finite_type_size)
   34.23 -    [@{typ Enum.finite_1}, @{typ Enum.finite_2}, @{typ Enum.finite_3},
   34.24 -     @{typ Enum.finite_4}, @{typ Enum.finite_5}])
   34.25 +    [\<^typ>\<open>Enum.finite_1\<close>, \<^typ>\<open>Enum.finite_2\<close>, \<^typ>\<open>Enum.finite_3\<close>,
   34.26 +     \<^typ>\<open>Enum.finite_4\<close>, \<^typ>\<open>Enum.finite_5\<close>])
   34.27  
   34.28  exception WELLSORTED of string
   34.29  
   34.30 @@ -233,7 +233,7 @@
   34.31  
   34.32  (* minimalistic preprocessing *)
   34.33  
   34.34 -fun strip_all (Const (@{const_name HOL.All}, _) $ Abs (a, T, t)) =
   34.35 +fun strip_all (Const (\<^const_name>\<open>HOL.All\<close>, _) $ Abs (a, T, t)) =
   34.36        let val (a', t') = strip_all t
   34.37        in ((a, T) :: a', t') end
   34.38    | strip_all t = ([], t)
   34.39 @@ -315,9 +315,9 @@
   34.40  fun mk_safe_if genuine_only none (cond, then_t, else_t) genuine =
   34.41    let
   34.42      val T = fastype_of then_t
   34.43 -    val if_t = Const (@{const_name If}, @{typ bool} --> T --> T --> T)
   34.44 +    val if_t = Const (\<^const_name>\<open>If\<close>, \<^typ>\<open>bool\<close> --> T --> T --> T)
   34.45    in
   34.46 -    Const (@{const_name "Quickcheck_Random.catch_match"}, T --> T --> T) $
   34.47 +    Const (\<^const_name>\<open>Quickcheck_Random.catch_match\<close>, T --> T --> T) $
   34.48        (if_t $ cond $ then_t $ else_t genuine) $
   34.49        (if_t $ genuine_only $ none $ else_t false)
   34.50    end
   34.51 @@ -429,7 +429,7 @@
   34.52      end)
   34.53  
   34.54  fun ensure_common_sort_datatype (sort, instantiate) =
   34.55 -  ensure_sort (((@{sort typerep}, @{sort term_of}), sort),
   34.56 +  ensure_sort (((\<^sort>\<open>typerep\<close>, \<^sort>\<open>term_of\<close>), sort),
   34.57      (fn thy => BNF_LFP_Compat.the_descr thy compat_prefs, instantiate))
   34.58  
   34.59  fun datatype_interpretation name =
   34.60 @@ -440,20 +440,20 @@
   34.61  
   34.62  fun gen_mk_parametric_generator_expr ((mk_generator_expr, out_of_bounds), T) ctxt ts =
   34.63    let
   34.64 -    val if_t = Const (@{const_name If}, @{typ bool} --> T --> T --> T)
   34.65 +    val if_t = Const (\<^const_name>\<open>If\<close>, \<^typ>\<open>bool\<close> --> T --> T --> T)
   34.66      fun mk_if (index, (t, eval_terms)) else_t =
   34.67 -      if_t $ (HOLogic.eq_const @{typ natural} $ Bound 0 $ HOLogic.mk_number @{typ natural} index) $
   34.68 +      if_t $ (HOLogic.eq_const \<^typ>\<open>natural\<close> $ Bound 0 $ HOLogic.mk_number \<^typ>\<open>natural\<close> index) $
   34.69          (mk_generator_expr ctxt (t, eval_terms)) $ else_t
   34.70 -  in absdummy @{typ natural} (fold_rev mk_if (1 upto (length ts) ~~ ts) out_of_bounds) end
   34.71 +  in absdummy \<^typ>\<open>natural\<close> (fold_rev mk_if (1 upto (length ts) ~~ ts) out_of_bounds) end
   34.72  
   34.73  
   34.74  (** post-processing of function terms **)
   34.75  
   34.76 -fun dest_fun_upd (Const (@{const_name fun_upd}, _) $ t0 $ t1 $ t2) = (t0, (t1, t2))
   34.77 +fun dest_fun_upd (Const (\<^const_name>\<open>fun_upd\<close>, _) $ t0 $ t1 $ t2) = (t0, (t1, t2))
   34.78    | dest_fun_upd t = raise TERM ("dest_fun_upd", [t])
   34.79  
   34.80  fun mk_fun_upd T1 T2 (t1, t2) t =
   34.81 -  Const (@{const_name fun_upd}, (T1 --> T2) --> T1 --> T2 --> T1 --> T2) $ t $ t1 $ t2
   34.82 +  Const (\<^const_name>\<open>fun_upd\<close>, (T1 --> T2) --> T1 --> T2 --> T1 --> T2) $ t $ t1 $ t2
   34.83  
   34.84  fun dest_fun_upds t =
   34.85    (case try dest_fun_upd t of
   34.86 @@ -465,26 +465,26 @@
   34.87  
   34.88  fun make_fun_upds T1 T2 (tps, t) = fold_rev (mk_fun_upd T1 T2) tps t
   34.89  
   34.90 -fun make_set T1 [] = Const (@{const_abbrev Set.empty}, T1 --> @{typ bool})
   34.91 -  | make_set T1 ((_, @{const False}) :: tps) = make_set T1 tps
   34.92 -  | make_set T1 ((t1, @{const True}) :: tps) =
   34.93 -      Const (@{const_name insert}, T1 --> (T1 --> @{typ bool}) --> T1 --> @{typ bool}) $
   34.94 +fun make_set T1 [] = Const (\<^const_abbrev>\<open>Set.empty\<close>, T1 --> \<^typ>\<open>bool\<close>)
   34.95 +  | make_set T1 ((_, \<^const>\<open>False\<close>) :: tps) = make_set T1 tps
   34.96 +  | make_set T1 ((t1, \<^const>\<open>True\<close>) :: tps) =
   34.97 +      Const (\<^const_name>\<open>insert\<close>, T1 --> (T1 --> \<^typ>\<open>bool\<close>) --> T1 --> \<^typ>\<open>bool\<close>) $
   34.98          t1 $ (make_set T1 tps)
   34.99    | make_set T1 ((_, t) :: _) = raise TERM ("make_set", [t])
  34.100  
  34.101 -fun make_coset T [] = Const (@{const_abbrev UNIV}, T --> @{typ bool})
  34.102 +fun make_coset T [] = Const (\<^const_abbrev>\<open>UNIV\<close>, T --> \<^typ>\<open>bool\<close>)
  34.103    | make_coset T tps =
  34.104      let
  34.105 -      val U = T --> @{typ bool}
  34.106 -      fun invert @{const False} = @{const True}
  34.107 -        | invert @{const True} = @{const False}
  34.108 +      val U = T --> \<^typ>\<open>bool\<close>
  34.109 +      fun invert \<^const>\<open>False\<close> = \<^const>\<open>True\<close>
  34.110 +        | invert \<^const>\<open>True\<close> = \<^const>\<open>False\<close>
  34.111      in
  34.112 -      Const (@{const_name "Groups.minus_class.minus"}, U --> U --> U) $
  34.113 -        Const (@{const_abbrev UNIV}, U) $ make_set T (map (apsnd invert) tps)
  34.114 +      Const (\<^const_name>\<open>Groups.minus_class.minus\<close>, U --> U --> U) $
  34.115 +        Const (\<^const_abbrev>\<open>UNIV\<close>, U) $ make_set T (map (apsnd invert) tps)
  34.116      end
  34.117  
  34.118 -fun make_map T1 T2 [] = Const (@{const_abbrev Map.empty}, T1 --> T2)
  34.119 -  | make_map T1 T2 ((_, Const (@{const_name None}, _)) :: tps) = make_map T1 T2 tps
  34.120 +fun make_map T1 T2 [] = Const (\<^const_abbrev>\<open>Map.empty\<close>, T1 --> T2)
  34.121 +  | make_map T1 T2 ((_, Const (\<^const_name>\<open>None\<close>, _)) :: tps) = make_map T1 T2 tps
  34.122    | make_map T1 T2 ((t1, t2) :: tps) = mk_fun_upd T1 T2 (t1, t2) (make_map T1 T2 tps)
  34.123  
  34.124  fun post_process_term t =
  34.125 @@ -498,21 +498,21 @@
  34.126          (c as Const (_, _), ts) => list_comb (c, map post_process_term ts))
  34.127    in
  34.128      (case fastype_of t of
  34.129 -      Type (@{type_name fun}, [T1, T2]) =>
  34.130 +      Type (\<^type_name>\<open>fun\<close>, [T1, T2]) =>
  34.131          (case try dest_fun_upds t of
  34.132            SOME (tps, t) =>
  34.133              (map (apply2 post_process_term) tps, map_Abs post_process_term t) |>
  34.134                (case T2 of
  34.135 -                @{typ bool} =>
  34.136 +                \<^typ>\<open>bool\<close> =>
  34.137                    (case t of
  34.138 -                     Abs(_, _, @{const False}) => fst #> rev #> make_set T1
  34.139 -                   | Abs(_, _, @{const True}) => fst #> rev #> make_coset T1
  34.140 -                   | Abs(_, _, Const (@{const_name undefined}, _)) => fst #> rev #> make_set T1
  34.141 +                     Abs(_, _, \<^const>\<open>False\<close>) => fst #> rev #> make_set T1
  34.142 +                   | Abs(_, _, \<^const>\<open>True\<close>) => fst #> rev #> make_coset T1
  34.143 +                   | Abs(_, _, Const (\<^const_name>\<open>undefined\<close>, _)) => fst #> rev #> make_set T1
  34.144                     | _ => raise TERM ("post_process_term", [t]))
  34.145 -              | Type (@{type_name option}, _) =>
  34.146 +              | Type (\<^type_name>\<open>option\<close>, _) =>
  34.147                    (case t of
  34.148 -                    Abs(_, _, Const (@{const_name None}, _)) => fst #> make_map T1 T2
  34.149 -                  | Abs(_, _, Const (@{const_name undefined}, _)) => fst #> make_map T1 T2
  34.150 +                    Abs(_, _, Const (\<^const_name>\<open>None\<close>, _)) => fst #> make_map T1 T2
  34.151 +                  | Abs(_, _, Const (\<^const_name>\<open>undefined\<close>, _)) => fst #> make_map T1 T2
  34.152                    | _ => make_fun_upds T1 T2)
  34.153                | _ => make_fun_upds T1 T2)
  34.154          | NONE => process_args t)
    35.1 --- a/src/HOL/Tools/Quickcheck/random_generators.ML	Wed Dec 06 16:01:15 2017 +0100
    35.2 +++ b/src/HOL/Tools/Quickcheck/random_generators.ML	Wed Dec 06 21:01:01 2017 +0100
    35.3 @@ -27,13 +27,13 @@
    35.4  
    35.5  (** abstract syntax **)
    35.6  
    35.7 -fun termifyT T = HOLogic.mk_prodT (T, @{typ "unit \<Rightarrow> term"})
    35.8 -val size = @{term "i::natural"};
    35.9 -val size_pred = @{term "(i::natural) - 1"};
   35.10 -val size' = @{term "j::natural"};
   35.11 -val seed = @{term "s::Random.seed"};
   35.12 +fun termifyT T = HOLogic.mk_prodT (T, \<^typ>\<open>unit \<Rightarrow> term\<close>)
   35.13 +val size = \<^term>\<open>i::natural\<close>;
   35.14 +val size_pred = \<^term>\<open>(i::natural) - 1\<close>;
   35.15 +val size' = \<^term>\<open>j::natural\<close>;
   35.16 +val seed = \<^term>\<open>s::Random.seed\<close>;
   35.17  
   35.18 -val resultT =  @{typ "(bool \<times> term list) option"};
   35.19 +val resultT =  \<^typ>\<open>(bool \<times> term list) option\<close>;
   35.20  
   35.21  
   35.22  (** typ "'a \<Rightarrow> 'b" **)
   35.23 @@ -42,7 +42,7 @@
   35.24  
   35.25  fun random_fun T1 T2 eq term_of random random_split seed =
   35.26    let
   35.27 -    val fun_upd = Const (@{const_name fun_upd}, (T1 --> T2) --> T1 --> T2 --> T1 --> T2);
   35.28 +    val fun_upd = Const (\<^const_name>\<open>fun_upd\<close>, (T1 --> T2) --> T1 --> T2 --> T1 --> T2);
   35.29      val ((_, t2), seed') = random seed;
   35.30      val (seed'', seed''') = random_split seed';
   35.31  
   35.32 @@ -96,8 +96,8 @@
   35.33      val inst = Thm.instantiate_cterm ([(a_v, icT)], []);
   35.34      fun subst_v t' = map_aterms (fn t as Free (w, _) => if v = w then t' else t | t => t);
   35.35      val t_rhs = lambda t_k proto_t_rhs;
   35.36 -    val eqs0 = [subst_v @{term "0::natural"} eq,
   35.37 -      subst_v (@{const Code_Numeral.Suc} $ t_k) eq];
   35.38 +    val eqs0 = [subst_v \<^term>\<open>0::natural\<close> eq,
   35.39 +      subst_v (\<^const>\<open>Code_Numeral.Suc\<close> $ t_k) eq];
   35.40      val eqs1 = map (Pattern.rewrite_term thy rew_ts []) eqs0;
   35.41      val ((_, (_, eqs2)), lthy') = lthy
   35.42        |> BNF_LFP_Compat.primrec_simple
   35.43 @@ -134,8 +134,8 @@
   35.44            (aux_lhs, foldr1 HOLogic.mk_prod rhss);
   35.45          fun mk_proj t [T] = [t]
   35.46            | mk_proj t (Ts as T :: (Ts' as _ :: _)) =
   35.47 -              Const (@{const_name fst}, foldr1 HOLogic.mk_prodT Ts --> T) $ t
   35.48 -                :: mk_proj (Const (@{const_name snd},
   35.49 +              Const (\<^const_name>\<open>fst\<close>, foldr1 HOLogic.mk_prodT Ts --> T) $ t
   35.50 +                :: mk_proj (Const (\<^const_name>\<open>snd\<close>,
   35.51                    foldr1 HOLogic.mk_prodT Ts --> foldr1 HOLogic.mk_prodT Ts') $ t) Ts';
   35.52          val projs = mk_proj (aux_lhs) Ts;
   35.53          val proj_eqs = map2 (fn v => fn proj => (v, lambda arg proj)) vs projs;
   35.54 @@ -193,9 +193,9 @@
   35.55      val mk_const = curry (Sign.mk_const thy);
   35.56      val random_auxsN = map (prefix (random_auxN ^ "_")) (names @ auxnames);
   35.57      val rTs = Ts @ Us;
   35.58 -    fun random_resultT T = @{typ Random.seed}
   35.59 -      --> HOLogic.mk_prodT (termifyT T,@{typ Random.seed});
   35.60 -    fun sizeT T = @{typ natural} --> @{typ natural} --> T;
   35.61 +    fun random_resultT T = \<^typ>\<open>Random.seed\<close>
   35.62 +      --> HOLogic.mk_prodT (termifyT T,\<^typ>\<open>Random.seed\<close>);
   35.63 +    fun sizeT T = \<^typ>\<open>natural\<close> --> \<^typ>\<open>natural\<close> --> T;
   35.64      val random_auxT = sizeT o random_resultT;
   35.65      val random_auxs = map2 (fn s => fn rT => Free (s, random_auxT rT))
   35.66        random_auxsN rTs;
   35.67 @@ -205,7 +205,7 @@
   35.68          val T = Type (tyco, Ts);
   35.69          fun mk_random_fun_lift [] t = t
   35.70            | mk_random_fun_lift (fT :: fTs) t =
   35.71 -              mk_const @{const_name random_fun_lift} [fTs ---> T, fT] $
   35.72 +              mk_const \<^const_name>\<open>random_fun_lift\<close> [fTs ---> T, fT] $
   35.73                  mk_random_fun_lift fTs t;
   35.74          val t = mk_random_fun_lift fTs (nth random_auxs k $ size_pred $ size');
   35.75          val size = Option.map snd (Old_Datatype_Aux.find_shortest_path descr k)
   35.76 @@ -221,16 +221,16 @@
   35.77          val is_rec = exists is_some ks;
   35.78          val k = fold (fn NONE => I | SOME k => Integer.max k) ks 0;
   35.79          val vs = Name.invent_names Name.context "x" (map snd simple_tTs);
   35.80 -        val tc = HOLogic.mk_return T @{typ Random.seed}
   35.81 +        val tc = HOLogic.mk_return T \<^typ>\<open>Random.seed\<close>
   35.82            (HOLogic.mk_valtermify_app c vs simpleT);
   35.83          val t = HOLogic.mk_ST
   35.84 -          (map2 (fn (t, _) => fn (v, T') => ((t, @{typ Random.seed}), SOME ((v, termifyT T')))) tTs vs)
   35.85 -            tc @{typ Random.seed} (SOME T, @{typ Random.seed});
   35.86 +          (map2 (fn (t, _) => fn (v, T') => ((t, \<^typ>\<open>Random.seed\<close>), SOME ((v, termifyT T')))) tTs vs)
   35.87 +            tc \<^typ>\<open>Random.seed\<close> (SOME T, \<^typ>\<open>Random.seed\<close>);
   35.88          val tk = if is_rec
   35.89            then if k = 0 then size
   35.90 -            else @{term "Quickcheck_Random.beyond :: natural \<Rightarrow> natural \<Rightarrow> natural"}
   35.91 -             $ HOLogic.mk_number @{typ natural} k $ size
   35.92 -          else @{term "1::natural"}
   35.93 +            else \<^term>\<open>Quickcheck_Random.beyond :: natural \<Rightarrow> natural \<Rightarrow> natural\<close>
   35.94 +             $ HOLogic.mk_number \<^typ>\<open>natural\<close> k $ size
   35.95 +          else \<^term>\<open>1::natural\<close>
   35.96        in (is_rec, HOLogic.mk_prod (tk, t)) end;
   35.97      fun sort_rec xs =
   35.98        map_filter (fn (true, t) => SOME t | _ =>  NONE) xs
   35.99 @@ -239,9 +239,9 @@
  35.100        |> (map o apfst) Type
  35.101        |> map (fn (T, cs) => (T, (sort_rec o map (mk_consexpr T)) cs));
  35.102      fun mk_select (rT, xs) =
  35.103 -      mk_const @{const_name Quickcheck_Random.collapse} [@{typ Random.seed}, termifyT rT]
  35.104 -      $ (mk_const @{const_name Random.select_weight} [random_resultT rT]
  35.105 -        $ HOLogic.mk_list (HOLogic.mk_prodT (@{typ natural}, random_resultT rT)) xs)
  35.106 +      mk_const \<^const_name>\<open>Quickcheck_Random.collapse\<close> [\<^typ>\<open>Random.seed\<close>, termifyT rT]
  35.107 +      $ (mk_const \<^const_name>\<open>Random.select_weight\<close> [random_resultT rT]
  35.108 +        $ HOLogic.mk_list (HOLogic.mk_prodT (\<^typ>\<open>natural\<close>, random_resultT rT)) xs)
  35.109            $ seed;
  35.110      val auxs_lhss = map (fn t => t $ size $ size' $ seed) random_auxs;
  35.111      val auxs_rhss = map mk_select gen_exprss;
  35.112 @@ -253,8 +253,8 @@
  35.113      val mk_prop_eq = HOLogic.mk_Trueprop o HOLogic.mk_eq;
  35.114      fun mk_size_arg k = case Old_Datatype_Aux.find_shortest_path descr k
  35.115       of SOME (_, l) => if l = 0 then size
  35.116 -          else @{term "max :: natural \<Rightarrow> natural \<Rightarrow> natural"}
  35.117 -            $ HOLogic.mk_number @{typ natural} l $ size
  35.118 +          else \<^term>\<open>max :: natural \<Rightarrow> natural \<Rightarrow> natural\<close>
  35.119 +            $ HOLogic.mk_number \<^typ>\<open>natural\<close> l $ size
  35.120        | NONE => size;
  35.121      val (random_auxs, auxs_eqs) = (apsnd o map) mk_prop_eq
  35.122        (mk_random_aux_eqs thy descr vs (names, auxnames) (Ts, Us));
  35.123 @@ -262,7 +262,7 @@
  35.124        (HOLogic.mk_random T size, nth random_auxs k $ mk_size_arg k $ size)) Ts;
  35.125    in
  35.126      thy
  35.127 -    |> Class.instantiation (tycos, vs, @{sort random})
  35.128 +    |> Class.instantiation (tycos, vs, \<^sort>\<open>random\<close>)
  35.129      |> random_aux_specification prfx random_auxN auxs_eqs
  35.130      |> `(fn lthy => map (Syntax.check_term lthy) random_defs)
  35.131      |-> (fn random_defs' => fold_map (fn random_def =>
  35.132 @@ -305,88 +305,88 @@
  35.133      val bounds = map_index (fn (i, ty) =>
  35.134        (2 * (bound_max - i) + 1, 2 * (bound_max - i), 2 * i, ty)) Ts;
  35.135      val result = list_comb (prop, map (fn (i, _, _, _) => Bound i) bounds);
  35.136 -    val terms = HOLogic.mk_list @{typ term} (map (fn (_, i, _, _) => Bound i $ @{term "()"}) bounds);
  35.137 +    val terms = HOLogic.mk_list \<^typ>\<open>term\<close> (map (fn (_, i, _, _) => Bound i $ \<^term>\<open>()\<close>) bounds);
  35.138      val ([genuine_only_name], _) = Variable.variant_fixes ["genuine_only"] ctxt
  35.139 -    val genuine_only = Free (genuine_only_name, @{typ bool})
  35.140 -    val none_t = Const (@{const_name "None"}, resultT)
  35.141 +    val genuine_only = Free (genuine_only_name, \<^typ>\<open>bool\<close>)
  35.142 +    val none_t = Const (\<^const_name>\<open>None\<close>, resultT)
  35.143      val check = Quickcheck_Common.mk_safe_if genuine_only none_t (result, none_t,
  35.144 -      fn genuine => @{term "Some :: bool * term list => (bool * term list) option"} $
  35.145 +      fn genuine => \<^term>\<open>Some :: bool \<times> term list => (bool \<times> term list) option\<close> $
  35.146          HOLogic.mk_prod (Quickcheck_Common.reflect_bool genuine, terms))
  35.147 -    val return = HOLogic.pair_const resultT @{typ Random.seed};
  35.148 +    val return = HOLogic.pair_const resultT \<^typ>\<open>Random.seed\<close>;
  35.149      fun liftT T sT = sT --> HOLogic.mk_prodT (T, sT);
  35.150 -    fun mk_termtyp T = HOLogic.mk_prodT (T, @{typ "unit => term"});
  35.151 -    fun mk_scomp T1 T2 sT f g = Const (@{const_name scomp},
  35.152 +    fun mk_termtyp T = HOLogic.mk_prodT (T, \<^typ>\<open>unit \<Rightarrow> term\<close>);
  35.153 +    fun mk_scomp T1 T2 sT f g = Const (\<^const_name>\<open>scomp\<close>,
  35.154        liftT T1 sT --> (T1 --> liftT T2 sT) --> liftT T2 sT) $ f $ g;
  35.155      fun mk_case_prod T = Sign.mk_const thy
  35.156 -      (@{const_name case_prod}, [T, @{typ "unit => term"}, liftT resultT @{typ Random.seed}]);
  35.157 +      (\<^const_name>\<open>case_prod\<close>, [T, \<^typ>\<open>unit \<Rightarrow> term\<close>, liftT resultT \<^typ>\<open>Random.seed\<close>]);
  35.158      fun mk_scomp_split T t t' =
  35.159 -      mk_scomp (mk_termtyp T) resultT @{typ Random.seed} t
  35.160 -        (mk_case_prod T $ Abs ("", T, Abs ("", @{typ "unit => term"}, t')));
  35.161 +      mk_scomp (mk_termtyp T) resultT \<^typ>\<open>Random.seed\<close> t
  35.162 +        (mk_case_prod T $ Abs ("", T, Abs ("", \<^typ>\<open>unit => term\<close>, t')));
  35.163      fun mk_bindclause (_, _, i, T) = mk_scomp_split T
  35.164 -      (Sign.mk_const thy (@{const_name Quickcheck_Random.random}, [T]) $ Bound i);
  35.165 +      (Sign.mk_const thy (\<^const_name>\<open>Quickcheck_Random.random\<close>, [T]) $ Bound i);
  35.166    in
  35.167      lambda genuine_only
  35.168 -      (Abs ("n", @{typ natural}, fold_rev mk_bindclause bounds (return $ check true)))
  35.169 +      (Abs ("n", \<^typ>\<open>natural\<close>, fold_rev mk_bindclause bounds (return $ check true)))
  35.170    end;
  35.171  
  35.172  fun mk_reporting_generator_expr ctxt (t, _) =
  35.173    let
  35.174      val thy = Proof_Context.theory_of ctxt
  35.175 -    val resultT = @{typ "(bool * term list) option * (bool list * bool)"}
  35.176 +    val resultT = \<^typ>\<open>(bool \<times> term list) option \<times> (bool list \<times> bool)\<close>
  35.177      val prop = fold_rev absfree (Term.add_frees t []) t
  35.178      val Ts = (map snd o fst o strip_abs) prop
  35.179      val bound_max = length Ts - 1
  35.180      val bounds = map_index (fn (i, ty) =>
  35.181        (2 * (bound_max - i) + 1, 2 * (bound_max - i), 2 * i, ty)) Ts;
  35.182      val prop' = betapplys (prop, map (fn (i, _, _, _) => Bound i) bounds);
  35.183 -    val terms = HOLogic.mk_list @{typ term} (map (fn (_, i, _, _) => Bound i $ @{term "()"}) bounds)
  35.184 +    val terms = HOLogic.mk_list \<^typ>\<open>term\<close> (map (fn (_, i, _, _) => Bound i $ \<^term>\<open>()\<close>) bounds)
  35.185      val (assms, concl) = Quickcheck_Common.strip_imp prop'
  35.186 -    val return = HOLogic.pair_const resultT @{typ Random.seed};
  35.187 +    val return = HOLogic.pair_const resultT \<^typ>\<open>Random.seed\<close>;
  35.188      fun mk_assms_report i =
  35.189 -      HOLogic.mk_prod (@{term "None :: (bool * term list) option"},
  35.190 +      HOLogic.mk_prod (\<^term>\<open>None :: (bool \<times> term list) option\<close>,
  35.191          HOLogic.mk_prod (HOLogic.mk_list HOLogic.boolT
  35.192 -          (replicate i @{term True} @ replicate (length assms - i) @{term False}),
  35.193 -        @{term False}))
  35.194 +          (replicate i \<^term>\<open>True\<close> @ replicate (length assms - i) \<^term>\<open>False\<close>),
  35.195 +        \<^term>\<open>False\<close>))
  35.196      fun mk_concl_report b =
  35.197 -      HOLogic.mk_prod (HOLogic.mk_list HOLogic.boolT (replicate (length assms) @{term True}),
  35.198 +      HOLogic.mk_prod (HOLogic.mk_list HOLogic.boolT (replicate (length assms) \<^term>\<open>True\<close>),
  35.199          Quickcheck_Common.reflect_bool b)
  35.200      val ([genuine_only_name], _) = Variable.variant_fixes ["genuine_only"] ctxt
  35.201 -    val genuine_only = Free (genuine_only_name, @{typ bool})
  35.202 -    val none_t = HOLogic.mk_prod (@{term "None :: (bool * term list) option"}, mk_concl_report true)
  35.203 +    val genuine_only = Free (genuine_only_name, \<^typ>\<open>bool\<close>)
  35.204 +    val none_t = HOLogic.mk_prod (\<^term>\<open>None :: (bool \<times> term list) option\<close>, mk_concl_report true)
  35.205      val concl_check = Quickcheck_Common.mk_safe_if genuine_only none_t (concl, none_t,
  35.206 -      fn genuine => HOLogic.mk_prod (@{term "Some :: bool * term list => (bool * term list) option"} $
  35.207 +      fn genuine => HOLogic.mk_prod (\<^term>\<open>Some :: bool \<times> term list => (bool \<times> term list) option\<close> $
  35.208          HOLogic.mk_prod (Quickcheck_Common.reflect_bool genuine, terms), mk_concl_report false))
  35.209      val check = fold_rev (fn (i, assm) => fn t => Quickcheck_Common.mk_safe_if genuine_only
  35.210        (mk_assms_report i) (HOLogic.mk_not assm, mk_assms_report i, t))
  35.211        (map_index I assms) concl_check
  35.212      fun liftT T sT = sT --> HOLogic.mk_prodT (T, sT);
  35.213 -    fun mk_termtyp T = HOLogic.mk_prodT (T, @{typ "unit => term"});
  35.214 -    fun mk_scomp T1 T2 sT f g = Const (@{const_name scomp},
  35.215 +    fun mk_termtyp T = HOLogic.mk_prodT (T, \<^typ>\<open>unit \<Rightarrow> term\<close>);
  35.216 +    fun mk_scomp T1 T2 sT f g = Const (\<^const_name>\<open>scomp\<close>,
  35.217        liftT T1 sT --> (T1 --> liftT T2 sT) --> liftT T2 sT) $ f $ g;
  35.218      fun mk_case_prod T = Sign.mk_const thy
  35.219 -      (@{const_name case_prod}, [T, @{typ "unit => term"}, liftT resultT @{typ Random.seed}]);
  35.220 +      (\<^const_name>\<open>case_prod\<close>, [T, \<^typ>\<open>unit \<Rightarrow> term\<close>, liftT resultT \<^typ>\<open>Random.seed\<close>]);
  35.221      fun mk_scomp_split T t t' =
  35.222 -      mk_scomp (mk_termtyp T) resultT @{typ Random.seed} t
  35.223 -        (mk_case_prod T $ Abs ("", T, Abs ("", @{typ "unit => term"}, t')));
  35.224 +      mk_scomp (mk_termtyp T) resultT \<^typ>\<open>Random.seed\<close> t
  35.225 +        (mk_case_prod T $ Abs ("", T, Abs ("", \<^typ>\<open>unit \<Rightarrow> term\<close>, t')));
  35.226      fun mk_bindclause (_, _, i, T) = mk_scomp_split T
  35.227 -      (Sign.mk_const thy (@{const_name Quickcheck_Random.random}, [T]) $ Bound i);
  35.228 +      (Sign.mk_const thy (\<^const_name>\<open>Quickcheck_Random.random\<close>, [T]) $ Bound i);
  35.229    in
  35.230      lambda genuine_only
  35.231 -      (Abs ("n", @{typ natural}, fold_rev mk_bindclause bounds (return $ check true)))
  35.232 +      (Abs ("n", \<^typ>\<open>natural\<close>, fold_rev mk_bindclause bounds (return $ check true)))
  35.233    end
  35.234  
  35.235  val mk_parametric_generator_expr = Quickcheck_Common.gen_mk_parametric_generator_expr 
  35.236    ((mk_generator_expr, 
  35.237 -    absdummy @{typ bool} (absdummy @{typ natural}
  35.238 -      @{term "Pair None :: Random.seed => (bool * term list) option * Random.seed"})),
  35.239 -    @{typ "bool => natural => Random.seed => (bool * term list) option * Random.seed"})
  35.240 +    absdummy \<^typ>\<open>bool\<close> (absdummy \<^typ>\<open>natural\<close>
  35.241 +      \<^term>\<open>Pair None :: Random.seed \<Rightarrow> (bool \<times> term list) option \<times> Random.seed\<close>)),
  35.242 +    \<^typ>\<open>bool \<Rightarrow> natural \<Rightarrow> Random.seed \<Rightarrow> (bool \<times> term list) option \<times> Random.seed\<close>)
  35.243  
  35.244  val mk_parametric_reporting_generator_expr = Quickcheck_Common.gen_mk_parametric_generator_expr 
  35.245    ((mk_reporting_generator_expr,
  35.246 -    absdummy @{typ bool} (absdummy @{typ natural}
  35.247 -      @{term "Pair (None, ([], False)) :: Random.seed =>
  35.248 -        ((bool * term list) option * (bool list * bool)) * Random.seed"})),
  35.249 -    @{typ "bool => natural => Random.seed => ((bool * term list) option * (bool list * bool)) * Random.seed"})
  35.250 +    absdummy \<^typ>\<open>bool\<close> (absdummy \<^typ>\<open>natural\<close>
  35.251 +      \<^term>\<open>Pair (None, ([], False)) :: Random.seed \<Rightarrow>
  35.252 +        ((bool \<times> term list) option \<times> (bool list \<times> bool)) \<times> Random.seed\<close>)),
  35.253 +    \<^typ>\<open>bool \<Rightarrow> natural \<Rightarrow> Random.seed \<Rightarrow> ((bool \<times> term list) option \<times> (bool list \<times> bool)) \<times> Random.seed\<close>)
  35.254      
  35.255      
  35.256  (* single quickcheck report *)
  35.257 @@ -468,8 +468,8 @@
  35.258      compiled genuine_only [Code_Numeral.natural_of_integer card, Code_Numeral.natural_of_integer size]
  35.259    end;
  35.260  
  35.261 -val size_types = [@{type_name Enum.finite_1}, @{type_name Enum.finite_2},
  35.262 -  @{type_name Enum.finite_3}, @{type_name Enum.finite_4}, @{type_name Enum.finite_5}];
  35.263 +val size_types = [\<^type_name>\<open>Enum.finite_1\<close>, \<^type_name>\<open>Enum.finite_2\<close>,
  35.264 +  \<^type_name>\<open>Enum.finite_3\<close>, \<^type_name>\<open>Enum.finite_4\<close>, \<^type_name>\<open>Enum.finite_5\<close>];
  35.265  
  35.266  fun size_matters_for _ Ts =
  35.267    not (forall (fn Type (tyco, []) => member (op =) size_types tyco | _ => false) Ts);
  35.268 @@ -480,12 +480,12 @@
  35.269    
  35.270  (** setup **)
  35.271  
  35.272 -val active = Attrib.setup_config_bool @{binding quickcheck_random_active} (K false);
  35.273 +val active = Attrib.setup_config_bool \<^binding>\<open>quickcheck_random_active\<close> (K false);
  35.274  
  35.275  val _ =
  35.276    Theory.setup
  35.277 -   (Quickcheck_Common.datatype_interpretation @{plugin quickcheck_random}
  35.278 -      (@{sort random}, instantiate_random_datatype) #>
  35.279 +   (Quickcheck_Common.datatype_interpretation \<^plugin>\<open>quickcheck_random\<close>
  35.280 +      (\<^sort>\<open>random\<close>, instantiate_random_datatype) #>
  35.281      Context.theory_map (Quickcheck.add_tester ("random", (active, test_goals))));
  35.282  
  35.283  end;
    36.1 --- a/src/HOL/Tools/SMT/conj_disj_perm.ML	Wed Dec 06 16:01:15 2017 +0100
    36.2 +++ b/src/HOL/Tools/SMT/conj_disj_perm.ML	Wed Dec 06 21:01:01 2017 +0100
    36.3 @@ -13,7 +13,7 @@
    36.4  struct
    36.5  
    36.6  fun with_assumption ct f =
    36.7 -  let val ct' = Thm.apply @{cterm HOL.Trueprop} ct
    36.8 +  let val ct' = Thm.apply \<^cterm>\<open>HOL.Trueprop\<close> ct
    36.9    in Thm.implies_intr ct' (f (Thm.assume ct')) end
   36.10  
   36.11  fun eq_from_impls thm1 thm2 = thm2 INCR_COMP (thm1 INCR_COMP @{thm iffI})
   36.12 @@ -25,9 +25,9 @@
   36.13  
   36.14  fun explode_thm thm =
   36.15    (case HOLogic.dest_Trueprop (Thm.prop_of thm) of
   36.16 -    @{const HOL.conj} $ _ $ _ => explode_conj_thm @{thm conjunct1} @{thm conjunct2} thm
   36.17 -  | @{const HOL.Not} $ (@{const HOL.disj} $ _ $ _) => explode_conj_thm ndisj1_rule ndisj2_rule thm
   36.18 -  | @{const HOL.Not} $ (@{const HOL.Not} $ _) => explode_thm (thm RS @{thm notnotD})
   36.19 +    \<^const>\<open>HOL.conj\<close> $ _ $ _ => explode_conj_thm @{thm conjunct1} @{thm conjunct2} thm
   36.20 +  | \<^const>\<open>HOL.Not\<close> $ (\<^const>\<open>HOL.disj\<close> $ _ $ _) => explode_conj_thm ndisj1_rule ndisj2_rule thm
   36.21 +  | \<^const>\<open>HOL.Not\<close> $ (\<^const>\<open>HOL.Not\<close> $ _) => explode_thm (thm RS @{thm notnotD})
   36.22    | _ => add_lit thm)
   36.23  
   36.24  and explode_conj_thm rule1 rule2 thm lits =
   36.25 @@ -36,7 +36,7 @@
   36.26  val not_false_rule = @{lemma "\<not>False" by auto}
   36.27  fun explode thm = explode_thm thm (add_lit not_false_rule (add_lit @{thm TrueI} Termtab.empty))
   36.28  
   36.29 -fun find_dual_lit lits (@{const HOL.Not} $ t, thm) = Termtab.lookup lits t |> Option.map (pair thm)
   36.30 +fun find_dual_lit lits (\<^const>\<open>HOL.Not\<close> $ t, thm) = Termtab.lookup lits t |> Option.map (pair thm)
   36.31    | find_dual_lit _ _ = NONE
   36.32  
   36.33  fun find_dual_lits lits = Termtab.get_first (find_dual_lit lits) lits
   36.34 @@ -49,10 +49,10 @@
   36.35      SOME thm => thm
   36.36    | NONE => join_term lits t)
   36.37  
   36.38 -and join_term lits (@{const HOL.conj} $ t $ u) = @{thm conjI} OF (map (join lits) [t, u])
   36.39 -  | join_term lits (@{const HOL.Not} $ (@{const HOL.disj} $ t $ u)) =
   36.40 +and join_term lits (\<^const>\<open>HOL.conj\<close> $ t $ u) = @{thm conjI} OF (map (join lits) [t, u])
   36.41 +  | join_term lits (\<^const>\<open>HOL.Not\<close> $ (\<^const>\<open>HOL.disj\<close> $ t $ u)) =
   36.42        ndisj_rule OF (map (join lits o HOLogic.mk_not) [t, u])
   36.43 -  | join_term lits (@{const HOL.Not} $ (@{const HOL.Not} $ t)) = join lits t RS not_not_rule
   36.44 +  | join_term lits (\<^const>\<open>HOL.Not\<close> $ (\<^const>\<open>HOL.Not\<close> $ t)) = join lits t RS not_not_rule
   36.45    | join_term _ t = raise TERM ("join_term", [t])
   36.46  
   36.47  fun prove_conj_disj_imp ct cu = with_assumption ct (fn thm => join (explode thm) (Thm.term_of cu))
   36.48 @@ -68,19 +68,19 @@
   36.49  
   36.50  fun prove_any_imp ct =
   36.51    (case Thm.term_of ct of
   36.52 -    @{const HOL.False} => @{thm FalseE}
   36.53 -  | @{const HOL.Not} $ (@{const HOL.Not} $ @{const HOL.False}) => not_not_false_rule
   36.54 -  | @{const HOL.Not} $ @{const HOL.True} => not_true_rule
   36.55 +    \<^const>\<open>HOL.False\<close> => @{thm FalseE}
   36.56 +  | \<^const>\<open>HOL.Not\<close> $ (\<^const>\<open>HOL.Not\<close> $ \<^const>\<open>HOL.False\<close>) => not_not_false_rule
   36.57 +  | \<^const>\<open>HOL.Not\<close> $ \<^const>\<open>HOL.True\<close> => not_true_rule
   36.58    | _ => raise CTERM ("prove_any_imp", [ct]))
   36.59  
   36.60  fun prove_contradiction_imp ct =
   36.61    with_assumption ct (fn thm =>
   36.62      let val lits = explode thm
   36.63      in
   36.64 -      (case Termtab.lookup lits @{const HOL.False} of
   36.65 +      (case Termtab.lookup lits \<^const>\<open>HOL.False\<close> of
   36.66          SOME thm' => thm' RS @{thm FalseE}
   36.67        | NONE =>
   36.68 -          (case Termtab.lookup lits (@{const HOL.Not} $ @{const HOL.True}) of
   36.69 +          (case Termtab.lookup lits (\<^const>\<open>HOL.Not\<close> $ \<^const>\<open>HOL.True\<close>) of
   36.70              SOME thm' => thm' RS not_true_rule
   36.71            | NONE =>
   36.72                (case find_dual_lits lits of
   36.73 @@ -99,13 +99,13 @@
   36.74  
   36.75  datatype kind = True | False | Conj | Disj | Other
   36.76  
   36.77 -fun choose t _ _ _ @{const HOL.True} = t
   36.78 -  | choose _ f _ _ @{const HOL.False} = f
   36.79 -  | choose _ _ c _ (@{const HOL.conj} $ _ $ _) = c
   36.80 -  | choose _ _ _ d (@{const HOL.disj} $ _ $ _) = d
   36.81 +fun choose t _ _ _ \<^const>\<open>HOL.True\<close> = t
   36.82 +  | choose _ f _ _ \<^const>\<open>HOL.False\<close> = f
   36.83 +  | choose _ _ c _ (\<^const>\<open>HOL.conj\<close> $ _ $ _) = c
   36.84 +  | choose _ _ _ d (\<^const>\<open>HOL.disj\<close> $ _ $ _) = d
   36.85    | choose _ _ _ _ _ = Other
   36.86  
   36.87 -fun kind_of (@{const HOL.Not} $ t) = choose False True Disj Conj t
   36.88 +fun kind_of (\<^const>\<open>HOL.Not\<close> $ t) = choose False True Disj Conj t
   36.89    | kind_of t = choose True False Conj Disj t
   36.90  
   36.91  fun prove_conj_disj_perm ct cp =
   36.92 @@ -120,7 +120,7 @@
   36.93  
   36.94  fun conj_disj_perm_tac ctxt = CSUBGOAL (fn (ct, i) => 
   36.95    (case Thm.term_of ct of
   36.96 -    @{const HOL.Trueprop} $ (@{const HOL.eq(bool)} $ _ $ _) =>
   36.97 +    \<^const>\<open>HOL.Trueprop\<close> $ (@{const HOL.eq(bool)} $ _ $ _) =>
   36.98        resolve_tac ctxt [prove_conj_disj_perm ct (Thm.dest_binop (Thm.dest_arg ct))] i
   36.99    | _ => no_tac))
  36.100  
    37.1 --- a/src/HOL/Tools/SMT/smt_builtin.ML	Wed Dec 06 16:01:15 2017 +0100
    37.2 +++ b/src/HOL/Tools/SMT/smt_builtin.ML	Wed Dec 06 21:01:01 2017 +0100
    37.3 @@ -180,8 +180,8 @@
    37.4  
    37.5  fun dest_builtin_eq ctxt t u =
    37.6    let
    37.7 -    val aT = TFree (Name.aT, @{sort type})
    37.8 -    val c = (@{const_name HOL.eq}, aT --> aT --> @{typ bool})
    37.9 +    val aT = TFree (Name.aT, \<^sort>\<open>type\<close>)
   37.10 +    val c = (\<^const_name>\<open>HOL.eq\<close>, aT --> aT --> \<^typ>\<open>bool\<close>)
   37.11      fun mk ts = Term.list_comb (HOLogic.eq_const (Term.fastype_of (hd ts)), ts)
   37.12    in
   37.13      dest_builtin_fun ctxt c []
   37.14 @@ -193,10 +193,10 @@
   37.15      dest_builtin_fun ctxt c ts
   37.16    else NONE
   37.17  
   37.18 -fun dest_builtin_pred ctxt = special_builtin_fun (equal @{typ bool} o fst) ctxt
   37.19 +fun dest_builtin_pred ctxt = special_builtin_fun (equal \<^typ>\<open>bool\<close> o fst) ctxt
   37.20  
   37.21  fun dest_builtin_conn ctxt =
   37.22 -  special_builtin_fun (forall (equal @{typ bool}) o (op ::)) ctxt
   37.23 +  special_builtin_fun (forall (equal \<^typ>\<open>bool\<close>) o (op ::)) ctxt
   37.24  
   37.25  fun dest_builtin ctxt c ts =
   37.26    let val t = Term.list_comb (Const c, ts)
    38.1 --- a/src/HOL/Tools/SMT/smt_config.ML	Wed Dec 06 16:01:15 2017 +0100
    38.2 +++ b/src/HOL/Tools/SMT/smt_config.ML	Wed Dec 06 21:01:01 2017 +0100
    38.3 @@ -106,7 +106,7 @@
    38.4      context
    38.5      |> Data.map (map_solvers (Symtab.update (name, (info, []))))
    38.6      |> Context.map_theory (Attrib.setup (Binding.name (name ^ "_options"))
    38.7 -        (Scan.lift (@{keyword "="} |-- Args.name) >>
    38.8 +        (Scan.lift (\<^keyword>\<open>=\<close> |-- Args.name) >>
    38.9            (Thm.declaration_attribute o K o set_solver_options o pair name))
   38.10          ("additional command line options for SMT solver " ^ quote name))
   38.11  
   38.12 @@ -164,30 +164,30 @@
   38.13    in solver_info_of (K []) all_options ctxt end
   38.14  
   38.15  val setup_solver =
   38.16 -  Attrib.setup @{binding smt_solver}
   38.17 -    (Scan.lift (@{keyword "="} |-- Args.name) >>
   38.18 +  Attrib.setup \<^binding>\<open>smt_solver\<close>
   38.19 +    (Scan.lift (\<^keyword>\<open>=\<close> |-- Args.name) >>
   38.20        (Thm.declaration_attribute o K o select_solver))
   38.21      "SMT solver configuration"
   38.22  
   38.23  
   38.24  (* options *)
   38.25  
   38.26 -val oracle = Attrib.setup_config_bool @{binding smt_oracle} (K true)
   38.27 -val timeout = Attrib.setup_config_real @{binding smt_timeout} (K 30.0)
   38.28 -val reconstruction_step_timeout = Attrib.setup_config_real @{binding smt_reconstruction_step_timeout} (K 10.0)
   38.29 -val random_seed = Attrib.setup_config_int @{binding smt_random_seed} (K 1)
   38.30 -val read_only_certificates = Attrib.setup_config_bool @{binding smt_read_only_certificates} (K false)
   38.31 -val verbose = Attrib.setup_config_bool @{binding smt_verbose} (K true)
   38.32 -val trace = Attrib.setup_config_bool @{binding smt_trace} (K false)
   38.33 -val statistics = Attrib.setup_config_bool @{binding smt_statistics} (K false)
   38.34 -val monomorph_limit = Attrib.setup_config_int @{binding smt_monomorph_limit} (K 10)
   38.35 -val monomorph_instances = Attrib.setup_config_int @{binding smt_monomorph_instances} (K 500)
   38.36 -val explicit_application = Attrib.setup_config_int @{binding smt_explicit_application} (K 1)
   38.37 -val higher_order = Attrib.setup_config_bool @{binding smt_higher_order} (K false)
   38.38 -val nat_as_int = Attrib.setup_config_bool @{binding smt_nat_as_int} (K false)
   38.39 -val infer_triggers = Attrib.setup_config_bool @{binding smt_infer_triggers} (K false)
   38.40 -val debug_files = Attrib.setup_config_string @{binding smt_debug_files} (K "")
   38.41 -val sat_solver = Attrib.setup_config_string @{binding smt_sat_solver} (K "cdclite")
   38.42 +val oracle = Attrib.setup_config_bool \<^binding>\<open>smt_oracle\<close> (K true)
   38.43 +val timeout = Attrib.setup_config_real \<^binding>\<open>smt_timeout\<close> (K 30.0)
   38.44 +val reconstruction_step_timeout = Attrib.setup_config_real \<^binding>\<open>smt_reconstruction_step_timeout\<close> (K 10.0)
   38.45 +val random_seed = Attrib.setup_config_int \<^binding>\<open>smt_random_seed\<close> (K 1)
   38.46 +val read_only_certificates = Attrib.setup_config_bool \<^binding>\<open>smt_read_only_certificates\<close> (K false)
   38.47 +val verbose = Attrib.setup_config_bool \<^binding>\<open>smt_verbose\<close> (K true)
   38.48 +val trace = Attrib.setup_config_bool \<^binding>\<open>smt_trace\<close> (K false)
   38.49 +val statistics = Attrib.setup_config_bool \<^binding>\<open>smt_statistics\<close> (K false)
   38.50 +val monomorph_limit = Attrib.setup_config_int \<^binding>\<open>smt_monomorph_limit\<close> (K 10)
   38.51 +val monomorph_instances = Attrib.setup_config_int \<^binding>\<open>smt_monomorph_instances\<close> (K 500)
   38.52 +val explicit_application = Attrib.setup_config_int \<^binding>\<open>smt_explicit_application\<close> (K 1)
   38.53 +val higher_order = Attrib.setup_config_bool \<^binding>\<open>smt_higher_order\<close> (K false)
   38.54 +val nat_as_int = Attrib.setup_config_bool \<^binding>\<open>smt_nat_as_int\<close> (K false)
   38.55 +val infer_triggers = Attrib.setup_config_bool \<^binding>\<open>smt_infer_triggers\<close> (K false)
   38.56 +val debug_files = Attrib.setup_config_string \<^binding>\<open>smt_debug_files\<close> (K "")
   38.57 +val sat_solver = Attrib.setup_config_string \<^binding>\<open>smt_sat_solver\<close> (K "cdclite")
   38.58  
   38.59  
   38.60  (* diagnostics *)
   38.61 @@ -222,8 +222,8 @@
   38.62      |> SOME o Cache_IO.unsynchronized_init))
   38.63  
   38.64  val setup_certificates =
   38.65 -  Attrib.setup @{binding smt_certificates}
   38.66 -    (Scan.lift (@{keyword "="} |-- Args.name) >>
   38.67 +  Attrib.setup \<^binding>\<open>smt_certificates\<close>
   38.68 +    (Scan.lift (\<^keyword>\<open>=\<close> |-- Args.name) >>
   38.69        (Thm.declaration_attribute o K o select_certificates))
   38.70      "SMT certificates configuration"
   38.71  
   38.72 @@ -263,7 +263,7 @@
   38.73    end
   38.74  
   38.75  val _ =
   38.76 -  Outer_Syntax.command @{command_keyword smt_status}
   38.77 +  Outer_Syntax.command \<^command_keyword>\<open>smt_status\<close>
   38.78      "show the available SMT solvers, the currently selected SMT solver, \
   38.79      \and the values of SMT configuration options"
   38.80      (Scan.succeed (Toplevel.keep (print_setup o Toplevel.context_of)))
    39.1 --- a/src/HOL/Tools/SMT/smt_datatypes.ML	Wed Dec 06 16:01:15 2017 +0100
    39.2 +++ b/src/HOL/Tools/SMT/smt_datatypes.ML	Wed Dec 06 21:01:01 2017 +0100
    39.3 @@ -100,7 +100,7 @@
    39.4               (http://church.cims.nyu.edu/bugzilla3/show_bug.cgi?id=597). It should be removed once
    39.5               the bug is fixed. *)
    39.6            if forall (forall (forall (is_homogenously_nested_co_recursive))) ctrXs_Tsss andalso
    39.7 -             forall (forall (forall (curry (op <>) @{typ bool})))
    39.8 +             forall (forall (forall (curry (op <>) \<^typ>\<open>bool\<close>)))
    39.9                 (map (map (map substAs)) ctrXs_Tsss) then
   39.10              get_ctr_sugar_decl ctr_sugar T Ts ctxt |>> map (pair fp)
   39.11            else
   39.12 @@ -127,9 +127,9 @@
   39.13  
   39.14      fun add (TFree _) = I
   39.15        | add (TVar _) = I
   39.16 -      | add (T as Type (@{type_name fun}, _)) =
   39.17 +      | add (T as Type (\<^type_name>\<open>fun\<close>, _)) =
   39.18            fold add (Term.body_type T :: Term.binder_types T)
   39.19 -      | add @{typ bool} = I
   39.20 +      | add \<^typ>\<open>bool\<close> = I
   39.21        | add (T as Type (n, Ts)) = (fn (dss, ctxt1) =>
   39.22            if declared T declss orelse declared' T dss then
   39.23              (dss, ctxt1)
    40.1 --- a/src/HOL/Tools/SMT/smt_normalize.ML	Wed Dec 06 16:01:15 2017 +0100
    40.2 +++ b/src/HOL/Tools/SMT/smt_normalize.ML	Wed Dec 06 21:01:01 2017 +0100
    40.3 @@ -31,7 +31,7 @@
    40.4  (** instantiate elimination rules **)
    40.5  
    40.6  local
    40.7 -  val (cpfalse, cfalse) = `SMT_Util.mk_cprop (Thm.cterm_of @{context} @{const False})
    40.8 +  val (cpfalse, cfalse) = `SMT_Util.mk_cprop (Thm.cterm_of @{context} \<^const>\<open>False\<close>)
    40.9  
   40.10    fun inst f ct thm =
   40.11      let val cv = f (Drule.strip_imp_concl (Thm.cprop_of thm))
   40.12 @@ -40,7 +40,7 @@
   40.13  
   40.14  fun instantiate_elim thm =
   40.15    (case Thm.concl_of thm of
   40.16 -    @{const Trueprop} $ Var (_, @{typ bool}) => inst Thm.dest_arg cfalse thm
   40.17 +    \<^const>\<open>Trueprop\<close> $ Var (_, \<^typ>\<open>bool\<close>) => inst Thm.dest_arg cfalse thm
   40.18    | Var _ => inst I cpfalse thm
   40.19    | _ => thm)
   40.20  
   40.21 @@ -51,9 +51,9 @@
   40.22  
   40.23  fun norm_def thm =
   40.24    (case Thm.prop_of thm of
   40.25 -    @{const Trueprop} $ (Const (@{const_name HOL.eq}, _) $ _ $ Abs _) =>
   40.26 +    \<^const>\<open>Trueprop\<close> $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ _ $ Abs _) =>
   40.27        norm_def (thm RS @{thm fun_cong})
   40.28 -  | Const (@{const_name Pure.eq}, _) $ _ $ Abs _ => norm_def (thm RS @{thm meta_eq_to_obj_eq})
   40.29 +  | Const (\<^const_name>\<open>Pure.eq\<close>, _) $ _ $ Abs _ => norm_def (thm RS @{thm meta_eq_to_obj_eq})
   40.30    | _ => thm)
   40.31  
   40.32  
   40.33 @@ -61,26 +61,26 @@
   40.34  
   40.35  fun atomize_conv ctxt ct =
   40.36    (case Thm.term_of ct of
   40.37 -    @{const Pure.imp} $ _ $ _ =>
   40.38 +    \<^const>\<open>Pure.imp\<close> $ _ $ _ =>
   40.39        Conv.binop_conv (atomize_conv ctxt) then_conv Conv.rewr_conv @{thm atomize_imp}
   40.40 -  | Const (@{const_name Pure.eq}, _) $ _ $ _ =>
   40.41 +  | Const (\<^const_name>\<open>Pure.eq\<close>, _) $ _ $ _ =>
   40.42        Conv.binop_conv (atomize_conv ctxt) then_conv Conv.rewr_conv @{thm atomize_eq}
   40.43 -  | Const (@{const_name Pure.all}, _) $ Abs _ =>
   40.44 +  | Const (\<^const_name>\<open>Pure.all\<close>, _) $ Abs _ =>
   40.45        Conv.binder_conv (atomize_conv o snd) ctxt then_conv Conv.rewr_conv @{thm atomize_all}
   40.46    | _ => Conv.all_conv) ct
   40.47    handle CTERM _ => Conv.all_conv ct
   40.48  
   40.49  val setup_atomize =
   40.50 -  fold SMT_Builtin.add_builtin_fun_ext'' [@{const_name Pure.imp}, @{const_name Pure.eq},
   40.51 -    @{const_name Pure.all}, @{const_name Trueprop}]
   40.52 +  fold SMT_Builtin.add_builtin_fun_ext'' [\<^const_name>\<open>Pure.imp\<close>, \<^const_name>\<open>Pure.eq\<close>,
   40.53 +    \<^const_name>\<open>Pure.all\<close>, \<^const_name>\<open>Trueprop\<close>]
   40.54  
   40.55  
   40.56  (** unfold special quantifiers **)
   40.57  
   40.58  val special_quant_table = [
   40.59 -  (@{const_name Ex1}, @{thm Ex1_def_raw}),
   40.60 -  (@{const_name Ball}, @{thm Ball_def_raw}),
   40.61 -  (@{const_name Bex}, @{thm Bex_def_raw})]
   40.62 +  (\<^const_name>\<open>Ex1\<close>, @{thm Ex1_def_raw}),
   40.63 +  (\<^const_name>\<open>Ball\<close>, @{thm Ball_def_raw}),
   40.64 +  (\<^const_name>\<open>Bex\<close>, @{thm Bex_def_raw})]
   40.65  
   40.66  local
   40.67    fun special_quant (Const (n, _)) = AList.lookup (op =) special_quant_table n
   40.68 @@ -105,8 +105,8 @@
   40.69  local
   40.70    (*** check trigger syntax ***)
   40.71  
   40.72 -  fun dest_trigger (Const (@{const_name pat}, _) $ _) = SOME true
   40.73 -    | dest_trigger (Const (@{const_name nopat}, _) $ _) = SOME false
   40.74 +  fun dest_trigger (Const (\<^const_name>\<open>pat\<close>, _) $ _) = SOME true
   40.75 +    | dest_trigger (Const (\<^const_name>\<open>nopat\<close>, _) $ _) = SOME false
   40.76      | dest_trigger _ = NONE
   40.77  
   40.78    fun eq_list [] = false
   40.79 @@ -120,9 +120,9 @@
   40.80  
   40.81    fun proper_quant inside f t =
   40.82      (case t of
   40.83 -      Const (@{const_name All}, _) $ Abs (_, _, u) => proper_quant true f u
   40.84 -    | Const (@{const_name Ex}, _) $ Abs (_, _, u) => proper_quant true f u
   40.85 -    | @{const trigger} $ p $ u =>
   40.86 +      Const (\<^const_name>\<open>All\<close>, _) $ Abs (_, _, u) => proper_quant true f u
   40.87 +    | Const (\<^const_name>\<open>Ex\<close>, _) $ Abs (_, _, u) => proper_quant true f u
   40.88 +    | \<^const>\<open>trigger\<close> $ p $ u =>
   40.89          (if inside then f p else false) andalso proper_quant false f u
   40.90      | Abs (_, _, u) => proper_quant false f u
   40.91      | u1 $ u2 => proper_quant false f u1 andalso proper_quant false f u2
   40.92 @@ -141,8 +141,8 @@
   40.93  
   40.94    fun dest_cond_eq ct =
   40.95      (case Thm.term_of ct of
   40.96 -      Const (@{const_name HOL.eq}, _) $ _ $ _ => Thm.dest_binop ct
   40.97 -    | @{const HOL.implies} $ _ $ _ => dest_cond_eq (Thm.dest_arg ct)
   40.98 +      Const (\<^const_name>\<open>HOL.eq\<close>, _) $ _ $ _ => Thm.dest_binop ct
   40.99 +    | \<^const>\<open>HOL.implies\<close> $ _ $ _ => dest_cond_eq (Thm.dest_arg ct)
  40.100      | _ => raise CTERM ("no equation", [ct]))
  40.101  
  40.102    fun get_constrs thy (Type (n, _)) = these (BNF_LFP_Compat.get_constrs thy n)
  40.103 @@ -186,14 +186,14 @@
  40.104              Pattern.matches thy (t', u) andalso not (t aconv u))
  40.105          in not (Term.exists_subterm some_match u) end
  40.106  
  40.107 -  val pat = SMT_Util.mk_const_pat @{theory} @{const_name pat} SMT_Util.destT1
  40.108 +  val pat = SMT_Util.mk_const_pat @{theory} \<^const_name>\<open>pat\<close> SMT_Util.destT1
  40.109    fun mk_pat ct = Thm.apply (SMT_Util.instT' ct pat) ct
  40.110  
  40.111    fun mk_clist T =
  40.112      apply2 (Thm.cterm_of @{context}) (SMT_Util.symb_cons_const T, SMT_Util.symb_nil_const T)
  40.113    fun mk_list (ccons, cnil) f cts = fold_rev (Thm.mk_binop ccons o f) cts cnil
  40.114 -  val mk_pat_list = mk_list (mk_clist @{typ pattern})
  40.115 -  val mk_mpat_list = mk_list (mk_clist @{typ "pattern symb_list"})
  40.116 +  val mk_pat_list = mk_list (mk_clist \<^typ>\<open>pattern\<close>)
  40.117 +  val mk_mpat_list = mk_list (mk_clist \<^typ>\<open>pattern symb_list\<close>)
  40.118    fun mk_trigger ctss = mk_mpat_list (mk_pat_list mk_pat) ctss
  40.119  
  40.120    val trigger_eq = mk_meta_eq @{lemma "p = trigger t p" by (simp add: trigger_def)}
  40.121 @@ -220,7 +220,7 @@
  40.122  
  40.123      in insert_trigger_conv (filter_mpats (get_mpats lhs)) ct end
  40.124  
  40.125 -  fun has_trigger (@{const trigger} $ _ $ _) = true
  40.126 +  fun has_trigger (\<^const>\<open>trigger\<close> $ _ $ _) = true
  40.127      | has_trigger _ = false
  40.128  
  40.129    fun try_trigger_conv cv ct =
  40.130 @@ -238,7 +238,7 @@
  40.131  
  40.132  val setup_trigger =
  40.133    fold SMT_Builtin.add_builtin_fun_ext''
  40.134 -    [@{const_name pat}, @{const_name nopat}, @{const_name trigger}]
  40.135 +    [\<^const_name>\<open>pat\<close>, \<^const_name>\<open>nopat\<close>, \<^const_name>\<open>trigger\<close>]
  40.136  
  40.137  end
  40.138  
  40.139 @@ -280,10 +280,10 @@
  40.140  
  40.141  (** rewrite bool case expressions as if expressions **)
  40.142  
  40.143 -val case_bool_entry = (@{const_name "bool.case_bool"}, @{thm case_bool_if})
  40.144 +val case_bool_entry = (\<^const_name>\<open>bool.case_bool\<close>, @{thm case_bool_if})
  40.145  
  40.146  local
  40.147 -  fun is_case_bool (Const (@{const_name "bool.case_bool"}, _)) = true
  40.148 +  fun is_case_bool (Const (\<^const_name>\<open>bool.case_bool\<close>, _)) = true
  40.149      | is_case_bool _ = false
  40.150  
  40.151    fun unfold_conv _ =
  40.152 @@ -294,7 +294,7 @@
  40.153  fun rewrite_case_bool_conv ctxt =
  40.154    SMT_Util.if_exists_conv is_case_bool (Conv.top_conv unfold_conv ctxt)
  40.155  
  40.156 -val setup_case_bool = SMT_Builtin.add_builtin_fun_ext'' @{const_name "bool.case_bool"}
  40.157 +val setup_case_bool = SMT_Builtin.add_builtin_fun_ext'' \<^const_name>\<open>bool.case_bool\<close>
  40.158  
  40.159  end
  40.160  
  40.161 @@ -302,12 +302,12 @@
  40.162  (** unfold abs, min and max **)
  40.163  
  40.164  val abs_min_max_table = [
  40.165 -  (@{const_name min}, @{thm min_def_raw}),
  40.166 -  (@{const_name max}, @{thm max_def_raw}),
  40.167 -  (@{const_name abs}, @{thm abs_if_raw})]
  40.168 +  (\<^const_name>\<open>min\<close>, @{thm min_def_raw}),
  40.169 +  (\<^const_name>\<open>max\<close>, @{thm max_def_raw}),
  40.170 +  (\<^const_name>\<open>abs\<close>, @{thm abs_if_raw})]
  40.171  
  40.172  local
  40.173 -  fun abs_min_max ctxt (Const (n, Type (@{type_name fun}, [T, _]))) =
  40.174 +  fun abs_min_max ctxt (Const (n, Type (\<^type_name>\<open>fun\<close>, [T, _]))) =
  40.175          (case AList.lookup (op =) abs_min_max_table n of
  40.176            NONE => NONE
  40.177          | SOME thm => if SMT_Builtin.is_builtin_typ_ext ctxt T then SOME thm else NONE)
  40.178 @@ -334,7 +334,7 @@
  40.179  
  40.180    val simple_nat_ops = [
  40.181      @{const less (nat)}, @{const less_eq (nat)},
  40.182 -    @{const Suc}, @{const plus (nat)}, @{const minus (nat)}]
  40.183 +    \<^const>\<open>Suc\<close>, @{const plus (nat)}, @{const minus (nat)}]
  40.184  
  40.185    val mult_nat_ops =
  40.186      [@{const times (nat)}, @{const divide (nat)}, @{const modulo (nat)}]
  40.187 @@ -344,7 +344,7 @@
  40.188    val nat_consts = nat_ops @ [@{const numeral (nat)},
  40.189      @{const zero_class.zero (nat)}, @{const one_class.one (nat)}]
  40.190  
  40.191 -  val nat_int_coercions = [@{const of_nat (int)}, @{const nat}]
  40.192 +  val nat_int_coercions = [@{const of_nat (int)}, \<^const>\<open>nat\<close>]
  40.193  
  40.194    val builtin_nat_ops = nat_int_coercions @ simple_nat_ops
  40.195  
  40.196 @@ -399,7 +399,7 @@
  40.197    if exists (uses_nat_int o Thm.prop_of) thms then (thms, nat_embedding) else (thms, [])
  40.198  
  40.199  val setup_nat_as_int =
  40.200 -  SMT_Builtin.add_builtin_typ_ext (@{typ nat},
  40.201 +  SMT_Builtin.add_builtin_typ_ext (\<^typ>\<open>nat\<close>,
  40.202      fn ctxt => K (Config.get ctxt SMT_Config.nat_as_int)) #>
  40.203    fold (SMT_Builtin.add_builtin_fun_ext' o Term.dest_Const) builtin_nat_ops
  40.204  
  40.205 @@ -414,9 +414,9 @@
  40.206      rewrite - 0 into 0
  40.207    *)
  40.208  
  40.209 -  fun is_irregular_number (Const (@{const_name numeral}, _) $ Const (@{const_name num.One}, _)) =
  40.210 +  fun is_irregular_number (Const (\<^const_name>\<open>numeral\<close>, _) $ Const (\<^const_name>\<open>num.One\<close>, _)) =
  40.211          true
  40.212 -    | is_irregular_number (Const (@{const_name uminus}, _) $ Const (@{const_name Groups.zero}, _)) =
  40.213 +    | is_irregular_number (Const (\<^const_name>\<open>uminus\<close>, _) $ Const (\<^const_name>\<open>Groups.zero\<close>, _)) =
  40.214          true
  40.215      | is_irregular_number _ = false
  40.216  
  40.217 @@ -478,12 +478,12 @@
  40.218    in burrow_ids (fold (fn e => e ctxt) es o rpair []) ithms end
  40.219  
  40.220  local
  40.221 -  val ignored = member (op =) [@{const_name All}, @{const_name Ex},
  40.222 -    @{const_name Let}, @{const_name If}, @{const_name HOL.eq}]
  40.223 +  val ignored = member (op =) [\<^const_name>\<open>All\<close>, \<^const_name>\<open>Ex\<close>,
  40.224 +    \<^const_name>\<open>Let\<close>, \<^const_name>\<open>If\<close>, \<^const_name>\<open>HOL.eq\<close>]
  40.225  
  40.226    val schematic_consts_of =
  40.227      let
  40.228 -      fun collect (@{const trigger} $ p $ t) = collect_trigger p #> collect t
  40.229 +      fun collect (\<^const>\<open>trigger\<close> $ p $ t) = collect_trigger p #> collect t
  40.230          | collect (t $ u) = collect t #> collect u
  40.231          | collect (Abs (_, _, t)) = collect t
  40.232          | collect (t as Const (n, _)) =
  40.233 @@ -492,8 +492,8 @@
  40.234        and collect_trigger t =
  40.235          let val dest = these o try SMT_Util.dest_symb_list
  40.236          in fold (fold collect_pat o dest) (dest t) end
  40.237 -      and collect_pat (Const (@{const_name pat}, _) $ t) = collect t
  40.238 -        | collect_pat (Const (@{const_name nopat}, _) $ t) = collect t
  40.239 +      and collect_pat (Const (\<^const_name>\<open>pat\<close>, _) $ t) = collect t
  40.240 +        | collect_pat (Const (\<^const_name>\<open>nopat\<close>, _) $ t) = collect t
  40.241          | collect_pat _ = I
  40.242      in (fn t => collect t Symtab.empty) end
  40.243  in
    41.1 --- a/src/HOL/Tools/SMT/smt_translate.ML	Wed Dec 06 16:01:15 2017 +0100
    41.2 +++ b/src/HOL/Tools/SMT/smt_translate.ML	Wed Dec 06 21:01:01 2017 +0100
    41.3 @@ -199,21 +199,21 @@
    41.4          SOME k => Term.list_comb (t, ts) |> k <> length ts ? expf k (length ts) T
    41.5        | NONE => Term.list_comb (t, ts))
    41.6  
    41.7 -    fun expand ((q as Const (@{const_name All}, _)) $ Abs a) = q $ abs_expand a
    41.8 -      | expand ((q as Const (@{const_name All}, T)) $ t) = q $ exp expand T t
    41.9 -      | expand (q as Const (@{const_name All}, T)) = exp2 T q
   41.10 -      | expand ((q as Const (@{const_name Ex}, _)) $ Abs a) = q $ abs_expand a
   41.11 -      | expand ((q as Const (@{const_name Ex}, T)) $ t) = q $ exp expand T t
   41.12 -      | expand (q as Const (@{const_name Ex}, T)) = exp2 T q
   41.13 -      | expand (Const (@{const_name Let}, T) $ t) =
   41.14 +    fun expand ((q as Const (\<^const_name>\<open>All\<close>, _)) $ Abs a) = q $ abs_expand a
   41.15 +      | expand ((q as Const (\<^const_name>\<open>All\<close>, T)) $ t) = q $ exp expand T t
   41.16 +      | expand (q as Const (\<^const_name>\<open>All\<close>, T)) = exp2 T q
   41.17 +      | expand ((q as Const (\<^const_name>\<open>Ex\<close>, _)) $ Abs a) = q $ abs_expand a
   41.18 +      | expand ((q as Const (\<^const_name>\<open>Ex\<close>, T)) $ t) = q $ exp expand T t
   41.19 +      | expand (q as Const (\<^const_name>\<open>Ex\<close>, T)) = exp2 T q
   41.20 +      | expand (Const (\<^const_name>\<open>Let\<close>, T) $ t) =
   41.21            let val U = Term.domain_type (Term.range_type T)
   41.22            in Abs (Name.uu, U, Bound 0 $ Term.incr_boundvars 1 t) end
   41.23 -      | expand (Const (@{const_name Let}, T)) =
   41.24 +      | expand (Const (\<^const_name>\<open>Let\<close>, T)) =
   41.25            let val U = Term.domain_type (Term.range_type T)
   41.26            in Abs (Name.uu, Term.domain_type T, Abs (Name.uu, U, Bound 0 $ Bound 1)) end
   41.27        | expand t =
   41.28            (case Term.strip_comb t of
   41.29 -            (Const (@{const_name Let}, _), t1 :: t2 :: ts) =>
   41.30 +            (Const (\<^const_name>\<open>Let\<close>, _), t1 :: t2 :: ts) =>
   41.31              Term.betapplys (Term.betapply (expand t2, expand t1), map expand ts)
   41.32            | (u as Const (c as (_, T)), ts) =>
   41.33                (case SMT_Builtin.dest_builtin ctxt c ts of
   41.34 @@ -252,12 +252,12 @@
   41.35  
   41.36    fun take_vars_into_account types t i =
   41.37      let
   41.38 -      fun find_min j (T as Type (@{type_name fun}, [_, T'])) =
   41.39 +      fun find_min j (T as Type (\<^type_name>\<open>fun\<close>, [_, T'])) =
   41.40            if j = i orelse Typtab.defined types T then j else find_min (j + 1) T'
   41.41          | find_min j _ = j
   41.42      in find_min 0 (Term.type_of t) end
   41.43  
   41.44 -  fun app u (t, T) = (Const (@{const_name fun_app}, T --> T) $ t $ u, Term.range_type T)
   41.45 +  fun app u (t, T) = (Const (\<^const_name>\<open>fun_app\<close>, T --> T) $ t $ u, Term.range_type T)
   41.46  
   41.47    fun apply i t T ts =
   41.48      let
   41.49 @@ -288,11 +288,11 @@
   41.50  
   41.51      fun traverse Ts t =
   41.52        (case Term.strip_comb t of
   41.53 -        (q as Const (@{const_name All}, _), [Abs (x, T, u)]) =>
   41.54 +        (q as Const (\<^const_name>\<open>All\<close>, _), [Abs (x, T, u)]) =>
   41.55            q $ Abs (x, T, in_trigger (T :: Ts) u)
   41.56 -      | (q as Const (@{const_name Ex}, _), [Abs (x, T, u)]) =>
   41.57 +      | (q as Const (\<^const_name>\<open>Ex\<close>, _), [Abs (x, T, u)]) =>
   41.58            q $ Abs (x, T, in_trigger (T :: Ts) u)
   41.59 -      | (q as Const (@{const_name Let}, _), [u1, u2 as Abs _]) =>
   41.60 +      | (q as Const (\<^const_name>\<open>Let\<close>, _), [u1, u2 as Abs _]) =>
   41.61            q $ traverse Ts u1 $ traverse Ts u2
   41.62        | (u as Const (c as (_, T)), ts) =>
   41.63            (case SMT_Builtin.dest_builtin ctxt c ts of
   41.64 @@ -306,12 +306,12 @@
   41.65        | (u as Bound i, ts) => apply 0 u (nth Ts i) (map (traverse Ts) ts)
   41.66        | (Abs (n, T, u), ts) => traverses Ts (Abs (n, T, traverse (T::Ts) u)) ts
   41.67        | (u, ts) => traverses Ts u ts)
   41.68 -    and in_trigger Ts ((c as @{const trigger}) $ p $ t) = c $ in_pats Ts p $ traverse Ts t
   41.69 +    and in_trigger Ts ((c as \<^const>\<open>trigger\<close>) $ p $ t) = c $ in_pats Ts p $ traverse Ts t
   41.70        | in_trigger Ts t = traverse Ts t
   41.71      and in_pats Ts ps =
   41.72 -      in_list @{typ "pattern symb_list"} (in_list @{typ pattern} (in_pat Ts)) ps
   41.73 -    and in_pat Ts ((p as Const (@{const_name pat}, _)) $ t) = p $ traverse Ts t
   41.74 -      | in_pat Ts ((p as Const (@{const_name nopat}, _)) $ t) = p $ traverse Ts t
   41.75 +      in_list \<^typ>\<open>pattern symb_list\<close> (in_list \<^typ>\<open>pattern\<close> (in_pat Ts)) ps
   41.76 +    and in_pat Ts ((p as Const (\<^const_name>\<open>pat\<close>, _)) $ t) = p $ traverse Ts t
   41.77 +      | in_pat Ts ((p as Const (\<^const_name>\<open>nopat\<close>, _)) $ t) = p $ traverse Ts t
   41.78        | in_pat _ t = raise TERM ("bad pattern", [t])
   41.79      and traverses Ts t ts = Term.list_comb (t, map (traverse Ts) ts)
   41.80    in map (traverse []) ts end
   41.81 @@ -324,7 +324,7 @@
   41.82  (** map HOL formulas to FOL formulas (i.e., separate formulas froms terms) **)
   41.83  
   41.84  local
   41.85 -  val is_quant = member (op =) [@{const_name All}, @{const_name Ex}]
   41.86 +  val is_quant = member (op =) [\<^const_name>\<open>All\<close>, \<^const_name>\<open>Ex\<close>]
   41.87  
   41.88    val fol_rules = [
   41.89      Let_def,
   41.90 @@ -343,9 +343,9 @@
   41.91  
   41.92      fun in_term pat t =
   41.93        (case Term.strip_comb t of
   41.94 -        (@{const True}, []) => t
   41.95 -      | (@{const False}, []) => t
   41.96 -      | (u as Const (@{const_name If}, _), [t1, t2, t3]) =>
   41.97 +        (\<^const>\<open>True\<close>, []) => t
   41.98 +      | (\<^const>\<open>False\<close>, []) => t
   41.99 +      | (u as Const (\<^const_name>\<open>If\<close>, _), [t1, t2, t3]) =>
  41.100            if pat then raise BAD_PATTERN () else u $ in_form t1 $ in_term pat t2 $ in_term pat t3
  41.101        | (Const (c as (n, _)), ts) =>
  41.102            if is_builtin_conn_or_pred ctxt c ts orelse is_quant n then
  41.103 @@ -355,16 +355,16 @@
  41.104        | (Free c, ts) => Term.list_comb (Free c, map (in_term pat) ts)
  41.105        | _ => t)
  41.106  
  41.107 -    and in_pat ((p as Const (@{const_name pat}, _)) $ t) =
  41.108 +    and in_pat ((p as Const (\<^const_name>\<open>pat\<close>, _)) $ t) =
  41.109            p $ in_term true t
  41.110 -      | in_pat ((p as Const (@{const_name nopat}, _)) $ t) =
  41.111 +      | in_pat ((p as Const (\<^const_name>\<open>nopat\<close>, _)) $ t) =
  41.112            p $ in_term true t
  41.113        | in_pat t = raise TERM ("bad pattern", [t])
  41.114  
  41.115      and in_pats ps =
  41.116 -      in_list @{typ "pattern symb_list"} (SOME o in_list @{typ pattern} (try in_pat)) ps
  41.117 +      in_list \<^typ>\<open>pattern symb_list\<close> (SOME o in_list \<^typ>\<open>pattern\<close> (try in_pat)) ps
  41.118  
  41.119 -    and in_trigger ((c as @{const trigger}) $ p $ t) = c $ in_pats p $ in_form t
  41.120 +    and in_trigger ((c as \<^const>\<open>trigger\<close>) $ p $ t) = c $ in_pats p $ in_form t
  41.121        | in_trigger t = in_form t
  41.122  
  41.123      and in_form t =
  41.124 @@ -393,16 +393,16 @@
  41.125  (** utility functions **)
  41.126  
  41.127  val quantifier = (fn
  41.128 -    @{const_name All} => SOME SForall
  41.129 -  | @{const_name Ex} => SOME SExists
  41.130 +    \<^const_name>\<open>All\<close> => SOME SForall
  41.131 +  | \<^const_name>\<open>Ex\<close> => SOME SExists
  41.132    | _ => NONE)
  41.133  
  41.134  fun group_quant qname Ts (t as Const (q, _) $ Abs (_, T, u)) =
  41.135        if q = qname then group_quant qname (T :: Ts) u else (Ts, t)
  41.136    | group_quant _ Ts t = (Ts, t)
  41.137  
  41.138 -fun dest_pat (Const (@{const_name pat}, _) $ t) = (t, true)
  41.139 -  | dest_pat (Const (@{const_name nopat}, _) $ t) = (t, false)
  41.140 +fun dest_pat (Const (\<^const_name>\<open>pat\<close>, _) $ t) = (t, true)
  41.141 +  | dest_pat (Const (\<^const_name>\<open>nopat\<close>, _) $ t) = (t, false)
  41.142    | dest_pat t = raise TERM ("bad pattern", [t])
  41.143  
  41.144  fun dest_pats [] = I
  41.145 @@ -412,7 +412,7 @@
  41.146        | (ps, [false]) => cons (SNoPat ps)
  41.147        | _ => raise TERM ("bad multi-pattern", ts))
  41.148  
  41.149 -fun dest_trigger (@{const trigger} $ tl $ t) =
  41.150 +fun dest_trigger (\<^const>\<open>trigger\<close> $ tl $ t) =
  41.151        (rev (fold (dest_pats o SMT_Util.dest_symb_list) (SMT_Util.dest_symb_list tl) []), t)
  41.152    | dest_trigger t = ([], t)
  41.153  
  41.154 @@ -501,17 +501,17 @@
  41.155        ((empty_tr_context, ctxt), ts1)
  41.156        |-> (if null fp_kinds then no_dtyps else collect_co_datatypes fp_kinds)
  41.157  
  41.158 -    fun is_binder (Const (@{const_name Let}, _) $ _) = true
  41.159 +    fun is_binder (Const (\<^const_name>\<open>Let\<close>, _) $ _) = true
  41.160        | is_binder t = Lambda_Lifting.is_quantifier t
  41.161  
  41.162 -    fun mk_trigger ((q as Const (@{const_name All}, _)) $ Abs (n, T, t)) =
  41.163 +    fun mk_trigger ((q as Const (\<^const_name>\<open>All\<close>, _)) $ Abs (n, T, t)) =
  41.164            q $ Abs (n, T, mk_trigger t)
  41.165 -      | mk_trigger (eq as (Const (@{const_name HOL.eq}, T) $ lhs $ _)) =
  41.166 -          Term.domain_type T --> @{typ pattern}
  41.167 -          |> (fn T => Const (@{const_name pat}, T) $ lhs)
  41.168 -          |> SMT_Util.mk_symb_list @{typ pattern} o single
  41.169 -          |> SMT_Util.mk_symb_list @{typ "pattern symb_list"} o single
  41.170 -          |> (fn t => @{const trigger} $ t $ eq)
  41.171 +      | mk_trigger (eq as (Const (\<^const_name>\<open>HOL.eq\<close>, T) $ lhs $ _)) =
  41.172 +          Term.domain_type T --> \<^typ>\<open>pattern\<close>
  41.173 +          |> (fn T => Const (\<^const_name>\<open>pat\<close>, T) $ lhs)
  41.174 +          |> SMT_Util.mk_symb_list \<^typ>\<open>pattern\<close> o single
  41.175 +          |> SMT_Util.mk_symb_list \<^typ>\<open>pattern symb_list\<close> o single
  41.176 +          |> (fn t => \<^const>\<open>trigger\<close> $ t $ eq)
  41.177        | mk_trigger t = t
  41.178  
  41.179      val (ctxt2, (ts3, ll_defs)) =
    42.1 --- a/src/HOL/Tools/arith_data.ML	Wed Dec 06 16:01:15 2017 +0100
    42.2 +++ b/src/HOL/Tools/arith_data.ML	Wed Dec 06 21:01:01 2017 +0100
    42.3 @@ -44,11 +44,11 @@
    42.4  
    42.5  val _ =
    42.6    Theory.setup
    42.7 -    (Method.setup @{binding arith}
    42.8 +    (Method.setup \<^binding>\<open>arith\<close>
    42.9        (Scan.succeed (fn ctxt =>
   42.10          METHOD (fn facts =>
   42.11            HEADGOAL
   42.12 -            (Method.insert_tac ctxt (rev (Named_Theorems.get ctxt @{named_theorems arith}) @ facts)
   42.13 +            (Method.insert_tac ctxt (rev (Named_Theorems.get ctxt \<^named_theorems>\<open>arith\<close>) @ facts)
   42.14                THEN' arith_tac ctxt))))
   42.15        "various arithmetic decision procedures");
   42.16  
   42.17 @@ -58,11 +58,11 @@
   42.18  fun mk_number T 1 = HOLogic.numeral_const T $ HOLogic.one_const
   42.19    | mk_number T n = HOLogic.mk_number T n;
   42.20  
   42.21 -val mk_plus = HOLogic.mk_binop @{const_name Groups.plus};
   42.22 +val mk_plus = HOLogic.mk_binop \<^const_name>\<open>Groups.plus\<close>;
   42.23  
   42.24  fun mk_minus t =
   42.25    let val T = Term.fastype_of t
   42.26 -  in Const (@{const_name Groups.uminus}, T --> T) $ t end;
   42.27 +  in Const (\<^const_name>\<open>Groups.uminus\<close>, T --> T) $ t end;
   42.28  
   42.29  (*Thus mk_sum[t] yields t+0; longer sums don't have a trailing zero*)
   42.30  fun mk_sum T [] = mk_number T 0
   42.31 @@ -74,9 +74,9 @@
   42.32    | long_mk_sum T (t :: ts) = mk_plus (t, long_mk_sum T ts);
   42.33  
   42.34  (*decompose additions AND subtractions as a sum*)
   42.35 -fun dest_summing (pos, Const (@{const_name Groups.plus}, _) $ t $ u, ts) =
   42.36 +fun dest_summing (pos, Const (\<^const_name>\<open>Groups.plus\<close>, _) $ t $ u, ts) =
   42.37        dest_summing (pos, t, dest_summing (pos, u, ts))
   42.38 -  | dest_summing (pos, Const (@{const_name Groups.minus}, _) $ t $ u, ts) =
   42.39 +  | dest_summing (pos, Const (\<^const_name>\<open>Groups.minus\<close>, _) $ t $ u, ts) =
   42.40        dest_summing (pos, t, dest_summing (not pos, u, ts))
   42.41    | dest_summing (pos, t, ts) = (if pos then t else mk_minus t) :: ts;
   42.42  
    43.1 --- a/src/HOL/Tools/boolean_algebra_cancel.ML	Wed Dec 06 16:01:15 2017 +0100
    43.2 +++ b/src/HOL/Tools/boolean_algebra_cancel.ML	Wed Dec 06 21:01:01 2017 +0100
    43.3 @@ -27,17 +27,17 @@
    43.4  
    43.5  fun move_to_front rule path = Conv.rewr_conv (Library.foldl (op RS) (rule, path))
    43.6  
    43.7 -fun add_atoms sup pos path (t as Const (@{const_name Lattices.sup}, _) $ x $ y) =
    43.8 +fun add_atoms sup pos path (t as Const (\<^const_name>\<open>Lattices.sup\<close>, _) $ x $ y) =
    43.9      if sup then
   43.10        add_atoms sup pos (sup1::path) x #> add_atoms sup pos (sup2::path) y
   43.11      else cons ((pos, t), path)
   43.12 -  | add_atoms sup pos path (t as Const (@{const_name Lattices.inf}, _) $ x $ y) =
   43.13 +  | add_atoms sup pos path (t as Const (\<^const_name>\<open>Lattices.inf\<close>, _) $ x $ y) =
   43.14      if not sup then
   43.15        add_atoms sup pos (inf1::path) x #> add_atoms sup pos (inf2::path) y
   43.16      else cons ((pos, t), path)
   43.17 -  | add_atoms _ _ _ (Const (@{const_name Orderings.bot}, _)) = I
   43.18 -  | add_atoms _ _ _ (Const (@{const_name Orderings.top}, _)) = I
   43.19 -  | add_atoms _ pos path (Const (@{const_name Groups.uminus}, _) $ x) = cons ((not pos, x), path)
   43.20 +  | add_atoms _ _ _ (Const (\<^const_name>\<open>Orderings.bot\<close>, _)) = I
   43.21 +  | add_atoms _ _ _ (Const (\<^const_name>\<open>Orderings.top\<close>, _)) = I
   43.22 +  | add_atoms _ pos path (Const (\<^const_name>\<open>Groups.uminus\<close>, _) $ x) = cons ((not pos, x), path)
   43.23    | add_atoms _ pos path x = cons ((pos, x), path);
   43.24  
   43.25  fun atoms sup pos t = add_atoms sup pos [] t []
    44.1 --- a/src/HOL/Tools/choice_specification.ML	Wed Dec 06 16:01:15 2017 +0100
    44.2 +++ b/src/HOL/Tools/choice_specification.ML	Wed Dec 06 21:01:01 2017 +0100
    44.3 @@ -18,7 +18,7 @@
    44.4  fun mk_definitional [] arg = arg
    44.5    | mk_definitional ((thname, cname, covld) :: cos) (thy, thm) =
    44.6        (case HOLogic.dest_Trueprop (Thm.concl_of thm) of
    44.7 -        Const (@{const_name Ex}, _) $ P =>
    44.8 +        Const (\<^const_name>\<open>Ex\<close>, _) $ P =>
    44.9            let
   44.10              val ctype = domain_type (type_of P)
   44.11              val cname_full = Sign.intern_const thy cname
   44.12 @@ -90,7 +90,7 @@
   44.13      fun proc_single prop =
   44.14        let
   44.15          val frees = Misc_Legacy.term_frees prop
   44.16 -        val _ = forall (fn v => Sign.of_sort thy (type_of v, @{sort type})) frees
   44.17 +        val _ = forall (fn v => Sign.of_sort thy (type_of v, \<^sort>\<open>type\<close>)) frees
   44.18            orelse error "Specificaton: Only free variables of sort 'type' allowed"
   44.19          val prop_closed = close_form prop
   44.20        in (prop_closed, frees) end
   44.21 @@ -194,12 +194,12 @@
   44.22  
   44.23  (* outer syntax *)
   44.24  
   44.25 -val opt_name = Scan.optional (Parse.name --| @{keyword ":"}) ""
   44.26 +val opt_name = Scan.optional (Parse.name --| \<^keyword>\<open>:\<close>) ""
   44.27  val opt_overloaded = Parse.opt_keyword "overloaded"
   44.28  
   44.29  val _ =
   44.30 -  Outer_Syntax.command @{command_keyword specification} "define constants by specification"
   44.31 -    (@{keyword "("} |-- Scan.repeat1 (opt_name -- Parse.term -- opt_overloaded) --| @{keyword ")"} --
   44.32 +  Outer_Syntax.command \<^command_keyword>\<open>specification\<close> "define constants by specification"
   44.33 +    (\<^keyword>\<open>(\<close> |-- Scan.repeat1 (opt_name -- Parse.term -- opt_overloaded) --| \<^keyword>\<open>)\<close> --
   44.34        Scan.repeat1 ((Parse_Spec.opt_thm_name ":" >> apfst Binding.name_of) -- Parse.prop)
   44.35        >> (fn (cos, alt_props) => Toplevel.theory_to_proof (process_spec cos alt_props)))
   44.36  
    45.1 --- a/src/HOL/Tools/cnf.ML	Wed Dec 06 16:01:15 2017 +0100
    45.2 +++ b/src/HOL/Tools/cnf.ML	Wed Dec 06 21:01:01 2017 +0100
    45.3 @@ -94,19 +94,19 @@
    45.4  
    45.5  val cnftac_eq_imp        = @{lemma "[| P = Q; P |] ==> Q" by auto};
    45.6  
    45.7 -fun is_atom (Const (@{const_name False}, _)) = false
    45.8 -  | is_atom (Const (@{const_name True}, _)) = false
    45.9 -  | is_atom (Const (@{const_name HOL.conj}, _) $ _ $ _) = false
   45.10 -  | is_atom (Const (@{const_name HOL.disj}, _) $ _ $ _) = false
   45.11 -  | is_atom (Const (@{const_name HOL.implies}, _) $ _ $ _) = false
   45.12 -  | is_atom (Const (@{const_name HOL.eq}, Type ("fun", @{typ bool} :: _)) $ _ $ _) = false
   45.13 -  | is_atom (Const (@{const_name Not}, _) $ _) = false
   45.14 +fun is_atom (Const (\<^const_name>\<open>False\<close>, _)) = false
   45.15 +  | is_atom (Const (\<^const_name>\<open>True\<close>, _)) = false
   45.16 +  | is_atom (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ _ $ _) = false
   45.17 +  | is_atom (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ _ $ _) = false
   45.18 +  | is_atom (Const (\<^const_name>\<open>HOL.implies\<close>, _) $ _ $ _) = false
   45.19 +  | is_atom (Const (\<^const_name>\<open>HOL.eq\<close>, Type ("fun", \<^typ>\<open>bool\<close> :: _)) $ _ $ _) = false
   45.20 +  | is_atom (Const (\<^const_name>\<open>Not\<close>, _) $ _) = false
   45.21    | is_atom _ = true;
   45.22  
   45.23 -fun is_literal (Const (@{const_name Not}, _) $ x) = is_atom x
   45.24 +fun is_literal (Const (\<^const_name>\<open>Not\<close>, _) $ x) = is_atom x
   45.25    | is_literal x = is_atom x;
   45.26  
   45.27 -fun is_clause (Const (@{const_name HOL.disj}, _) $ x $ y) = is_clause x andalso is_clause y
   45.28 +fun is_clause (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ x $ y) = is_clause x andalso is_clause y
   45.29    | is_clause x = is_literal x;
   45.30  
   45.31  (* ------------------------------------------------------------------------- *)
   45.32 @@ -116,7 +116,7 @@
   45.33  
   45.34  fun clause_is_trivial c =
   45.35    let
   45.36 -    fun dual (Const (@{const_name Not}, _) $ x) = x
   45.37 +    fun dual (Const (\<^const_name>\<open>Not\<close>, _) $ x) = x
   45.38        | dual x = HOLogic.Not $ x
   45.39      fun has_duals [] = false
   45.40        | has_duals (x::xs) = member (op =) xs (dual x) orelse has_duals xs
   45.41 @@ -178,28 +178,28 @@
   45.42  (*      eliminated (possibly causing an exponential blowup)                  *)
   45.43  (* ------------------------------------------------------------------------- *)
   45.44  
   45.45 -fun make_nnf_thm thy (Const (@{const_name HOL.conj}, _) $ x $ y) =
   45.46 +fun make_nnf_thm thy (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x $ y) =
   45.47        let
   45.48          val thm1 = make_nnf_thm thy x
   45.49          val thm2 = make_nnf_thm thy y
   45.50        in
   45.51          conj_cong OF [thm1, thm2]
   45.52        end
   45.53 -  | make_nnf_thm thy (Const (@{const_name HOL.disj}, _) $ x $ y) =
   45.54 +  | make_nnf_thm thy (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ x $ y) =
   45.55        let
   45.56          val thm1 = make_nnf_thm thy x
   45.57          val thm2 = make_nnf_thm thy y
   45.58        in
   45.59          disj_cong OF [thm1, thm2]
   45.60        end
   45.61 -  | make_nnf_thm thy (Const (@{const_name HOL.implies}, _) $ x $ y) =
   45.62 +  | make_nnf_thm thy (Const (\<^const_name>\<open>HOL.implies\<close>, _) $ x $ y) =
   45.63        let
   45.64          val thm1 = make_nnf_thm thy (HOLogic.Not $ x)
   45.65          val thm2 = make_nnf_thm thy y
   45.66        in
   45.67          make_nnf_imp OF [thm1, thm2]
   45.68        end
   45.69 -  | make_nnf_thm thy (Const (@{const_name HOL.eq}, Type ("fun", @{typ bool} :: _)) $ x $ y) =
   45.70 +  | make_nnf_thm thy (Const (\<^const_name>\<open>HOL.eq\<close>, Type ("fun", \<^typ>\<open>bool\<close> :: _)) $ x $ y) =
   45.71        let
   45.72          val thm1 = make_nnf_thm thy x
   45.73          val thm2 = make_nnf_thm thy (HOLogic.Not $ x)
   45.74 @@ -208,18 +208,18 @@
   45.75        in
   45.76          make_nnf_iff OF [thm1, thm2, thm3, thm4]
   45.77        end
   45.78 -  | make_nnf_thm _ (Const (@{const_name Not}, _) $ Const (@{const_name False}, _)) =
   45.79 +  | make_nnf_thm _ (Const (\<^const_name>\<open>Not\<close>, _) $ Const (\<^const_name>\<open>False\<close>, _)) =
   45.80        make_nnf_not_false
   45.81 -  | make_nnf_thm _ (Const (@{const_name Not}, _) $ Const (@{const_name True}, _)) =
   45.82 +  | make_nnf_thm _ (Const (\<^const_name>\<open>Not\<close>, _) $ Const (\<^const_name>\<open>True\<close>, _)) =
   45.83        make_nnf_not_true
   45.84 -  | make_nnf_thm thy (Const (@{const_name Not}, _) $ (Const (@{const_name HOL.conj}, _) $ x $ y)) =
   45.85 +  | make_nnf_thm thy (Const (\<^const_name>\<open>Not\<close>, _) $ (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x $ y)) =
   45.86        let
   45.87          val thm1 = make_nnf_thm thy (HOLogic.Not $ x)
   45.88          val thm2 = make_nnf_thm thy (HOLogic.Not $ y)
   45.89        in
   45.90          make_nnf_not_conj OF [thm1, thm2]
   45.91        end
   45.92 -  | make_nnf_thm thy (Const (@{const_name Not}, _) $ (Const (@{const_name HOL.disj}, _) $ x $ y)) =
   45.93 +  | make_nnf_thm thy (Const (\<^const_name>\<open>Not\<close>, _) $ (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ x $ y)) =
   45.94        let
   45.95          val thm1 = make_nnf_thm thy (HOLogic.Not $ x)
   45.96          val thm2 = make_nnf_thm thy (HOLogic.Not $ y)
   45.97 @@ -227,8 +227,7 @@
   45.98          make_nnf_not_disj OF [thm1, thm2]
   45.99        end
  45.100    | make_nnf_thm thy
  45.101 -      (Const (@{const_name Not}, _) $
  45.102 -        (Const (@{const_name HOL.implies}, _) $ x $ y)) =
  45.103 +      (Const (\<^const_name>\<open>Not\<close>, _) $ (Const (\<^const_name>\<open>HOL.implies\<close>, _) $ x $ y)) =
  45.104        let
  45.105          val thm1 = make_nnf_thm thy x
  45.106          val thm2 = make_nnf_thm thy (HOLogic.Not $ y)
  45.107 @@ -236,8 +235,8 @@
  45.108          make_nnf_not_imp OF [thm1, thm2]
  45.109        end
  45.110    | make_nnf_thm thy
  45.111 -      (Const (@{const_name Not}, _) $
  45.112 -        (Const (@{const_name HOL.eq}, Type ("fun", @{typ bool} :: _)) $ x $ y)) =
  45.113 +      (Const (\<^const_name>\<open>Not\<close>, _) $
  45.114 +        (Const (\<^const_name>\<open>HOL.eq\<close>, Type ("fun", \<^typ>\<open>bool\<close> :: _)) $ x $ y)) =
  45.115        let
  45.116          val thm1 = make_nnf_thm thy x
  45.117          val thm2 = make_nnf_thm thy (HOLogic.Not $ x)
  45.118 @@ -246,7 +245,7 @@
  45.119        in
  45.120          make_nnf_not_iff OF [thm1, thm2, thm3, thm4]
  45.121        end
  45.122 -  | make_nnf_thm thy (Const (@{const_name Not}, _) $ (Const (@{const_name Not}, _) $ x)) =
  45.123 +  | make_nnf_thm thy (Const (\<^const_name>\<open>Not\<close>, _) $ (Const (\<^const_name>\<open>Not\<close>, _) $ x)) =
  45.124        let
  45.125          val thm1 = make_nnf_thm thy x
  45.126        in
  45.127 @@ -289,45 +288,45 @@
  45.128  
  45.129  (* Theory.theory -> Term.term -> Thm.thm *)
  45.130  
  45.131 -fun simp_True_False_thm thy (Const (@{const_name HOL.conj}, _) $ x $ y) =
  45.132 +fun simp_True_False_thm thy (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x $ y) =
  45.133        let
  45.134          val thm1 = simp_True_False_thm thy x
  45.135          val x'= (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop o Thm.prop_of) thm1
  45.136        in
  45.137 -        if x' = @{term False} then
  45.138 +        if x' = \<^term>\<open>False\<close> then
  45.139            simp_TF_conj_False_l OF [thm1]  (* (x & y) = False *)
  45.140          else
  45.141            let
  45.142              val thm2 = simp_True_False_thm thy y
  45.143              val y' = (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop o Thm.prop_of) thm2
  45.144            in
  45.145 -            if x' = @{term True} then
  45.146 +            if x' = \<^term>\<open>True\<close> then
  45.147                simp_TF_conj_True_l OF [thm1, thm2]  (* (x & y) = y' *)
  45.148 -            else if y' = @{term False} then
  45.149 +            else if y' = \<^term>\<open>False\<close> then
  45.150                simp_TF_conj_False_r OF [thm2]  (* (x & y) = False *)
  45.151 -            else if y' = @{term True} then
  45.152 +            else if y' = \<^term>\<open>True\<close> then
  45.153                simp_TF_conj_True_r OF [thm1, thm2]  (* (x & y) = x' *)
  45.154              else
  45.155                conj_cong OF [thm1, thm2]  (* (x & y) = (x' & y') *)
  45.156            end
  45.157        end
  45.158 -  | simp_True_False_thm thy (Const (@{const_name HOL.disj}, _) $ x $ y) =
  45.159 +  | simp_True_False_thm thy (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ x $ y) =
  45.160        let
  45.161          val thm1 = simp_True_False_thm thy x
  45.162          val x' = (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop o Thm.prop_of) thm1
  45.163        in
  45.164 -        if x' = @{term True} then
  45.165 +        if x' = \<^term>\<open>True\<close> then
  45.166            simp_TF_disj_True_l OF [thm1]  (* (x | y) = True *)
  45.167          else
  45.168            let
  45.169              val thm2 = simp_True_False_thm thy y
  45.170              val y' = (snd o HOLogic.dest_eq o HOLogic.dest_Trueprop o Thm.prop_of) thm2
  45.171            in
  45.172 -            if x' = @{term False} then
  45.173 +            if x' = \<^term>\<open>False\<close> then
  45.174                simp_TF_disj_False_l OF [thm1, thm2]  (* (x | y) = y' *)
  45.175 -            else if y' = @{term True} then
  45.176 +            else if y' = \<^term>\<open>True\<close> then
  45.177                simp_TF_disj_True_r OF [thm2]  (* (x | y) = True *)
  45.178 -            else if y' = @{term False} then
  45.179 +            else if y' = \<^term>\<open>False\<close> then
  45.180                simp_TF_disj_False_r OF [thm1, thm2]  (* (x | y) = x' *)
  45.181              else
  45.182                disj_cong OF [thm1, thm2]  (* (x | y) = (x' | y') *)
  45.183 @@ -344,24 +343,24 @@
  45.184  fun make_cnf_thm ctxt t =
  45.185    let
  45.186      val thy = Proof_Context.theory_of ctxt
  45.187 -    fun make_cnf_thm_from_nnf (Const (@{const_name HOL.conj}, _) $ x $ y) =
  45.188 +    fun make_cnf_thm_from_nnf (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x $ y) =
  45.189            let
  45.190              val thm1 = make_cnf_thm_from_nnf x
  45.191              val thm2 = make_cnf_thm_from_nnf y
  45.192            in
  45.193              conj_cong OF [thm1, thm2]
  45.194            end
  45.195 -      | make_cnf_thm_from_nnf (Const (@{const_name HOL.disj}, _) $ x $ y) =
  45.196 +      | make_cnf_thm_from_nnf (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ x $ y) =
  45.197            let
  45.198              (* produces a theorem "(x' | y') = t'", where x', y', and t' are in CNF *)
  45.199 -            fun make_cnf_disj_thm (Const (@{const_name HOL.conj}, _) $ x1 $ x2) y' =
  45.200 +            fun make_cnf_disj_thm (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x1 $ x2) y' =
  45.201                    let
  45.202                      val thm1 = make_cnf_disj_thm x1 y'
  45.203                      val thm2 = make_cnf_disj_thm x2 y'
  45.204                    in
  45.205                      make_cnf_disj_conj_l OF [thm1, thm2]  (* ((x1 & x2) | y') = ((x1 | y')' & (x2 | y')') *)
  45.206                    end
  45.207 -              | make_cnf_disj_thm x' (Const (@{const_name HOL.conj}, _) $ y1 $ y2) =
  45.208 +              | make_cnf_disj_thm x' (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ y1 $ y2) =
  45.209                    let
  45.210                      val thm1 = make_cnf_disj_thm x' y1
  45.211                      val thm2 = make_cnf_disj_thm x' y2
  45.212 @@ -417,35 +416,35 @@
  45.213      val var_id = Unsynchronized.ref 0  (* properly initialized below *)
  45.214      fun new_free () =
  45.215        Free ("cnfx_" ^ string_of_int (Unsynchronized.inc var_id), HOLogic.boolT)
  45.216 -    fun make_cnfx_thm_from_nnf (Const (@{const_name HOL.conj}, _) $ x $ y) : thm =
  45.217 +    fun make_cnfx_thm_from_nnf (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x $ y) : thm =
  45.218            let
  45.219              val thm1 = make_cnfx_thm_from_nnf x
  45.220              val thm2 = make_cnfx_thm_from_nnf y
  45.221            in
  45.222              conj_cong OF [thm1, thm2]
  45.223            end
  45.224 -      | make_cnfx_thm_from_nnf (Const (@{const_name HOL.disj}, _) $ x $ y) =
  45.225 +      | make_cnfx_thm_from_nnf (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ x $ y) =
  45.226            if is_clause x andalso is_clause y then
  45.227              inst_thm thy [HOLogic.mk_disj (x, y)] iff_refl
  45.228            else if is_literal y orelse is_literal x then
  45.229              let
  45.230                (* produces a theorem "(x' | y') = t'", where x', y', and t' are *)
  45.231                (* almost in CNF, and x' or y' is a literal                      *)
  45.232 -              fun make_cnfx_disj_thm (Const (@{const_name HOL.conj}, _) $ x1 $ x2) y' =
  45.233 +              fun make_cnfx_disj_thm (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x1 $ x2) y' =
  45.234                      let
  45.235                        val thm1 = make_cnfx_disj_thm x1 y'
  45.236                        val thm2 = make_cnfx_disj_thm x2 y'
  45.237                      in
  45.238                        make_cnf_disj_conj_l OF [thm1, thm2]  (* ((x1 & x2) | y') = ((x1 | y')' & (x2 | y')') *)
  45.239                      end
  45.240 -                | make_cnfx_disj_thm x' (Const (@{const_name HOL.conj}, _) $ y1 $ y2) =
  45.241 +                | make_cnfx_disj_thm x' (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ y1 $ y2) =
  45.242                      let
  45.243                        val thm1 = make_cnfx_disj_thm x' y1
  45.244                        val thm2 = make_cnfx_disj_thm x' y2
  45.245                      in
  45.246                        make_cnf_disj_conj_r OF [thm1, thm2]  (* (x' | (y1 & y2)) = ((x' | y1)' & (x' | y2)') *)
  45.247                      end
  45.248 -                | make_cnfx_disj_thm (@{term "Ex::(bool => bool) => bool"} $ x') y' =
  45.249 +                | make_cnfx_disj_thm (\<^term>\<open>Ex :: (bool \<Rightarrow> bool) \<Rightarrow> bool\<close> $ x') y' =
  45.250                      let
  45.251                        val thm1 = inst_thm thy [x', y'] make_cnfx_disj_ex_l   (* ((Ex x') | y') = (Ex (x' | y')) *)
  45.252                        val var = new_free ()
  45.253 @@ -456,7 +455,7 @@
  45.254                      in
  45.255                        iff_trans OF [thm1, thm5]  (* ((Ex x') | y') = (Ex v. body') *)
  45.256                      end
  45.257 -                | make_cnfx_disj_thm x' (@{term "Ex::(bool => bool) => bool"} $ y') =
  45.258 +                | make_cnfx_disj_thm x' (\<^term>\<open>Ex :: (bool \<Rightarrow> bool) \<Rightarrow> bool\<close> $ y') =
  45.259                      let
  45.260                        val thm1 = inst_thm thy [x', y'] make_cnfx_disj_ex_r   (* (x' | (Ex y')) = (Ex (x' | y')) *)
  45.261                        val var = new_free ()
    46.1 --- a/src/HOL/Tools/code_evaluation.ML	Wed Dec 06 16:01:15 2017 +0100
    46.2 +++ b/src/HOL/Tools/code_evaluation.ML	Wed Dec 06 21:01:01 2017 +0100
    46.3 @@ -23,17 +23,16 @@
    46.4  fun add_term_of_inst tyco thy =
    46.5    let
    46.6      val ((raw_vs, _), _) = Code.get_type thy tyco;
    46.7 -    val vs = map (fn (v, _) => (v, @{sort typerep})) raw_vs;
    46.8 +    val vs = map (fn (v, _) => (v, \<^sort>\<open>typerep\<close>)) raw_vs;
    46.9      val ty = Type (tyco, map TFree vs);
   46.10 -    val lhs = Const (@{const_name term_of}, ty --> @{typ term})
   46.11 -      $ Free ("x", ty);
   46.12 -    val rhs = @{term "undefined :: term"};
   46.13 +    val lhs = Const (\<^const_name>\<open>term_of\<close>, ty --> \<^typ>\<open>term\<close>) $ Free ("x", ty);
   46.14 +    val rhs = \<^term>\<open>undefined :: term\<close>;
   46.15      val eq = HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs, rhs));
   46.16      fun triv_name_of t = (fst o dest_Free o fst o strip_comb o fst
   46.17        o HOLogic.dest_eq o HOLogic.dest_Trueprop) t ^ "_triv";
   46.18    in
   46.19      thy
   46.20 -    |> Class.instantiation ([tyco], vs, @{sort term_of})
   46.21 +    |> Class.instantiation ([tyco], vs, \<^sort>\<open>term_of\<close>)
   46.22      |> `(fn lthy => Syntax.check_term lthy eq)
   46.23      |-> (fn eq => Specification.definition NONE [] [] ((Binding.name (triv_name_of eq), []), eq))
   46.24      |> snd
   46.25 @@ -42,15 +41,15 @@
   46.26  
   46.27  fun ensure_term_of_inst tyco thy =
   46.28    let
   46.29 -    val need_inst = not (Sorts.has_instance (Sign.classes_of thy) tyco @{sort term_of})
   46.30 -      andalso Sorts.has_instance (Sign.classes_of thy) tyco @{sort typerep};
   46.31 +    val need_inst = not (Sorts.has_instance (Sign.classes_of thy) tyco \<^sort>\<open>term_of\<close>)
   46.32 +      andalso Sorts.has_instance (Sign.classes_of thy) tyco \<^sort>\<open>typerep\<close>;
   46.33    in if need_inst then add_term_of_inst tyco thy else thy end;
   46.34  
   46.35  fun for_term_of_instance tyco vs f thy =
   46.36    let
   46.37      val algebra = Sign.classes_of thy;
   46.38    in
   46.39 -    case try (Sorts.mg_domain algebra tyco) @{sort term_of} of
   46.40 +    case try (Sorts.mg_domain algebra tyco) \<^sort>\<open>term_of\<close> of
   46.41        NONE => thy
   46.42      | SOME sorts => f tyco (map2 (fn (v, sort) => fn sort' =>
   46.43          (v, Sorts.inter_sort algebra (sort, sort'))) vs sorts) thy
   46.44 @@ -95,7 +94,7 @@
   46.45  fun mk_abs_term_of_eq thy ty abs ty_rep proj =
   46.46    let
   46.47      val arg = Var (("x", 0), ty);
   46.48 -    val rhs = Abs ("y", @{typ term}, HOLogic.reflect_term (Const (abs, ty_rep --> ty) $ Bound 0)) $
   46.49 +    val rhs = Abs ("y", \<^typ>\<open>term\<close>, HOLogic.reflect_term (Const (abs, ty_rep --> ty) $ Bound 0)) $
   46.50        (HOLogic.mk_term_of ty_rep (Const (proj, ty --> ty_rep) $ arg))
   46.51        |> Thm.global_cterm_of thy;
   46.52      val cty = Thm.global_ctyp_of thy ty;
   46.53 @@ -139,7 +138,7 @@
   46.54      else NONE
   46.55    end;
   46.56  
   46.57 -fun subst_termify_app (Const (@{const_name termify}, _), [t]) =
   46.58 +fun subst_termify_app (Const (\<^const_name>\<open>termify\<close>, _), [t]) =
   46.59        if not (Term.exists_subterm (fn Abs _ => true | _ => false) t)
   46.60        then if fold_aterms (fn Const _ => I | _ => K false) t true
   46.61          then SOME (HOLogic.reflect_term t)
    47.1 --- a/src/HOL/Tools/coinduction.ML	Wed Dec 06 16:01:15 2017 +0100
    47.2 +++ b/src/HOL/Tools/coinduction.ML	Wed Dec 06 21:01:01 2017 +0100
    47.3 @@ -82,7 +82,7 @@
    47.4                names Ts raw_eqs;
    47.5              val phi = eqs @ map (HOLogic.dest_Trueprop o Thm.prop_of) prems
    47.6                |> try (Library.foldr1 HOLogic.mk_conj)
    47.7 -              |> the_default @{term True}
    47.8 +              |> the_default \<^term>\<open>True\<close>
    47.9                |> Ctr_Sugar_Util.list_exists_free vars
   47.10                |> Term.map_abs_vars (Variable.revert_fixed ctxt)
   47.11                |> fold_rev Term.absfree (names ~~ Ts)
   47.12 @@ -159,7 +159,7 @@
   47.13  
   47.14  val _ =
   47.15    Theory.setup
   47.16 -    (Method.setup @{binding coinduction}
   47.17 +    (Method.setup \<^binding>\<open>coinduction\<close>
   47.18        (arbitrary -- Scan.option coinduct_rules >>
   47.19          (fn (arbitrary, opt_rules) => fn _ => fn facts =>
   47.20            Seq.DETERM (coinduction_context_tactic arbitrary opt_rules facts 1)))
    48.1 --- a/src/HOL/Tools/functor.ML	Wed Dec 06 16:01:15 2017 +0100
    48.2 +++ b/src/HOL/Tools/functor.ML	Wed Dec 06 21:01:01 2017 +0100
    48.3 @@ -275,8 +275,8 @@
    48.4  val functor_cmd = gen_functor Syntax.read_term;
    48.5  
    48.6  val _ =
    48.7 -  Outer_Syntax.local_theory_to_proof @{command_keyword functor}
    48.8 +  Outer_Syntax.local_theory_to_proof \<^command_keyword>\<open>functor\<close>
    48.9      "register operations managing the functorial structure of a type"
   48.10 -    (Scan.option (Parse.name --| @{keyword ":"}) -- Parse.term >> uncurry functor_cmd);
   48.11 +    (Scan.option (Parse.name --| \<^keyword>\<open>:\<close>) -- Parse.term >> uncurry functor_cmd);
   48.12  
   48.13  end;
    49.1 --- a/src/HOL/Tools/groebner.ML	Wed Dec 06 16:01:15 2017 +0100
    49.2 +++ b/src/HOL/Tools/groebner.ML	Wed Dec 06 21:01:01 2017 +0100
    49.3 @@ -327,7 +327,7 @@
    49.4  (* Produce Strong Nullstellensatz certificate for a power of pol.            *)
    49.5  
    49.6  fun grobner_strong vars pols pol =
    49.7 -    let val vars' = @{cterm "True"}::vars
    49.8 +    let val vars' = \<^cterm>\<open>True\<close>::vars
    49.9          val grob_z = [(@1, 1::(map (K 0) vars))]
   49.10          val grob_1 = [(@1, (map (K 0) vars'))]
   49.11          fun augment p= map (fn (c,m) => (c,0::m)) p
   49.12 @@ -349,7 +349,7 @@
   49.13  
   49.14  fun refute_disj rfn tm =
   49.15   case Thm.term_of tm of
   49.16 -  Const(@{const_name HOL.disj},_)$_$_ =>
   49.17 +  Const(\<^const_name>\<open>HOL.disj\<close>,_)$_$_ =>
   49.18     Drule.compose
   49.19      (refute_disj rfn (Thm.dest_arg tm), 2,
   49.20        Drule.compose (refute_disj rfn (Thm.dest_arg1 tm), 2, disjE))
   49.21 @@ -360,11 +360,11 @@
   49.22  
   49.23  fun is_neg t =
   49.24      case Thm.term_of t of
   49.25 -      (Const(@{const_name Not},_)$_) => true
   49.26 +      (Const(\<^const_name>\<open>Not\<close>,_)$_) => true
   49.27      | _  => false;
   49.28  fun is_eq t =
   49.29   case Thm.term_of t of
   49.30 - (Const(@{const_name HOL.eq},_)$_$_) => true
   49.31 + (Const(\<^const_name>\<open>HOL.eq\<close>,_)$_$_) => true
   49.32  | _  => false;
   49.33  
   49.34  fun end_itlist f l =
   49.35 @@ -385,7 +385,7 @@
   49.36  val strip_exists =
   49.37   let fun h (acc, t) =
   49.38        case Thm.term_of t of
   49.39 -       Const (@{const_name Ex}, _) $ Abs _ =>
   49.40 +       Const (\<^const_name>\<open>Ex\<close>, _) $ Abs _ =>
   49.41          h (Thm.dest_abs NONE (Thm.dest_arg t) |>> (fn v => v::acc))
   49.42       | _ => (acc,t)
   49.43   in fn t => h ([],t)
   49.44 @@ -393,7 +393,7 @@
   49.45  
   49.46  fun is_forall t =
   49.47   case Thm.term_of t of
   49.48 -  (Const(@{const_name All},_)$Abs(_,_,_)) => true
   49.49 +  (Const(\<^const_name>\<open>All\<close>,_)$Abs(_,_,_)) => true
   49.50  | _ => false;
   49.51  
   49.52  val mk_object_eq = fn th => th COMP meta_eq_to_obj_eq;
   49.53 @@ -412,9 +412,9 @@
   49.54  
   49.55  val specl = fold_rev (fn x => fn th => Thm.instantiate' [] [SOME x] (th RS spec));
   49.56  
   49.57 -val cTrp = @{cterm "Trueprop"};
   49.58 -val cConj = @{cterm HOL.conj};
   49.59 -val (cNot,false_tm) = (@{cterm "Not"}, @{cterm "False"});
   49.60 +val cTrp = \<^cterm>\<open>Trueprop\<close>;
   49.61 +val cConj = \<^cterm>\<open>HOL.conj\<close>;
   49.62 +val (cNot,false_tm) = (\<^cterm>\<open>Not\<close>, \<^cterm>\<open>False\<close>);
   49.63  val assume_Trueprop = Thm.apply cTrp #> Thm.assume;
   49.64  val list_mk_conj = list_mk_binop cConj;
   49.65  val conjs = list_dest_binop cConj;
   49.66 @@ -438,7 +438,7 @@
   49.67    (* FIXME : copied from cqe.ML -- complex QE*)
   49.68  fun conjuncts ct =
   49.69   case Thm.term_of ct of
   49.70 -  @{term HOL.conj}$_$_ => (Thm.dest_arg1 ct)::(conjuncts (Thm.dest_arg ct))
   49.71 +  \<^term>\<open>HOL.conj\<close>$_$_ => (Thm.dest_arg1 ct)::(conjuncts (Thm.dest_arg ct))
   49.72  | _ => [ct];
   49.73  
   49.74  fun fold1 f = foldr1 (uncurry f);
   49.75 @@ -446,12 +446,12 @@
   49.76  fun mk_conj_tab th =
   49.77   let fun h acc th =
   49.78     case Thm.prop_of th of
   49.79 -   @{term "Trueprop"}$(@{term HOL.conj}$_$_) =>
   49.80 +   \<^term>\<open>Trueprop\<close>$(\<^term>\<open>HOL.conj\<close>$_$_) =>
   49.81       h (h acc (th RS conjunct2)) (th RS conjunct1)
   49.82 -  | @{term "Trueprop"}$p => (p,th)::acc
   49.83 +  | \<^term>\<open>Trueprop\<close>$p => (p,th)::acc
   49.84  in fold (Termtab.insert Thm.eq_thm) (h [] th) Termtab.empty end;
   49.85  
   49.86 -fun is_conj (@{term HOL.conj}$_$_) = true
   49.87 +fun is_conj (\<^term>\<open>HOL.conj\<close>$_$_) = true
   49.88    | is_conj _ = false;
   49.89  
   49.90  fun prove_conj tab cjs =
   49.91 @@ -462,8 +462,8 @@
   49.92  fun conj_ac_rule eq =
   49.93   let
   49.94    val (l,r) = Thm.dest_equals eq
   49.95 -  val ctabl = mk_conj_tab (Thm.assume (Thm.apply @{cterm Trueprop} l))
   49.96 -  val ctabr = mk_conj_tab (Thm.assume (Thm.apply @{cterm Trueprop} r))
   49.97 +  val ctabl = mk_conj_tab (Thm.assume (Thm.apply \<^cterm>\<open>Trueprop\<close> l))
   49.98 +  val ctabr = mk_conj_tab (Thm.assume (Thm.apply \<^cterm>\<open>Trueprop\<close> r))
   49.99    fun tabl c = the (Termtab.lookup ctabl (Thm.term_of c))
  49.100    fun tabr c = the (Termtab.lookup ctabr (Thm.term_of c))
  49.101    val thl  = prove_conj tabl (conjuncts r) |> implies_intr_hyps
  49.102 @@ -475,24 +475,24 @@
  49.103  
  49.104     (* Conversion for the equivalence of existential statements where
  49.105        EX quantifiers are rearranged differently *)
  49.106 -fun ext ctxt T = Thm.cterm_of ctxt (Const (@{const_name Ex}, (T --> @{typ bool}) --> @{typ bool}))
  49.107 +fun ext ctxt T = Thm.cterm_of ctxt (Const (\<^const_name>\<open>Ex\<close>, (T --> \<^typ>\<open>bool\<close>) --> \<^typ>\<open>bool\<close>))
  49.108  fun mk_ex ctxt v t = Thm.apply (ext ctxt (Thm.typ_of_cterm v)) (Thm.lambda v t)
  49.109  
  49.110  fun choose v th th' = case Thm.concl_of th of
  49.111 -  @{term Trueprop} $ (Const(@{const_name Ex},_)$_) =>
  49.112 +  \<^term>\<open>Trueprop\<close> $ (Const(\<^const_name>\<open>Ex\<close>,_)$_) =>
  49.113     let
  49.114      val p = (funpow 2 Thm.dest_arg o Thm.cprop_of) th
  49.115      val T = (hd o Thm.dest_ctyp o Thm.ctyp_of_cterm) p
  49.116      val th0 = Conv.fconv_rule (Thm.beta_conversion true)
  49.117          (Thm.instantiate' [SOME T] [SOME p, (SOME o Thm.dest_arg o Thm.cprop_of) th'] exE)
  49.118      val pv = (Thm.rhs_of o Thm.beta_conversion true)
  49.119 -          (Thm.apply @{cterm Trueprop} (Thm.apply p v))
  49.120 +          (Thm.apply \<^cterm>\<open>Trueprop\<close> (Thm.apply p v))
  49.121      val th1 = Thm.forall_intr v (Thm.implies_intr pv th')
  49.122     in Thm.implies_elim (Thm.implies_elim th0 th) th1  end
  49.123  | _ => error ""  (* FIXME ? *)
  49.124  
  49.125  fun simple_choose ctxt v th =
  49.126 -   choose v (Thm.assume ((Thm.apply @{cterm Trueprop} o mk_ex ctxt v)
  49.127 +   choose v (Thm.assume ((Thm.apply \<^cterm>\<open>Trueprop\<close> o mk_ex ctxt v)
  49.128      (Thm.dest_arg (hd (Thm.chyps_of th))))) th
  49.129  
  49.130  
  49.131 @@ -509,7 +509,7 @@
  49.132    val (p0,q0) = Thm.dest_binop t
  49.133    val (vs',P) = strip_exists p0
  49.134    val (vs,_) = strip_exists q0
  49.135 -   val th = Thm.assume (Thm.apply @{cterm Trueprop} P)
  49.136 +   val th = Thm.assume (Thm.apply \<^cterm>\<open>Trueprop\<close> P)
  49.137     val th1 = implies_intr_hyps (fold (simple_choose ctxt) vs' (fold mkexi vs th))
  49.138     val th2 = implies_intr_hyps (fold (simple_choose ctxt) vs (fold mkexi vs' th))
  49.139     val p = (Thm.dest_arg o Thm.dest_arg1 o Thm.cprop_of) th1
  49.140 @@ -523,7 +523,7 @@
  49.141    Free(s,_) => s
  49.142   | Var ((s,_),_) => s
  49.143   | _ => "x"
  49.144 - fun mk_eq s t = Thm.apply (Thm.apply @{cterm "op == :: bool => _"} s) t
  49.145 + fun mk_eq s t = Thm.apply (Thm.apply \<^cterm>\<open>op \<equiv> :: bool \<Rightarrow> _\<close> s) t
  49.146   fun mk_exists ctxt v th = Drule.arg_cong_rule (ext ctxt (Thm.typ_of_cterm v))
  49.147     (Thm.abstract_rule (getname v) v th)
  49.148   fun simp_ex_conv ctxt =
  49.149 @@ -552,12 +552,12 @@
  49.150    val (ring_sub_tm, ring_neg_tm) =
  49.151      (case r_ops of
  49.152       [sub_pat, neg_pat] => (Thm.dest_fun2 sub_pat, Thm.dest_fun neg_pat)
  49.153 -    |_  => (@{cterm "True"}, @{cterm "True"}));
  49.154 +    |_  => (\<^cterm>\<open>True\<close>, \<^cterm>\<open>True\<close>));
  49.155  
  49.156    val (field_div_tm, field_inv_tm) =
  49.157      (case f_ops of
  49.158         [div_pat, inv_pat] => (Thm.dest_fun2 div_pat, Thm.dest_fun inv_pat)
  49.159 -     | _ => (@{cterm "True"}, @{cterm "True"}));
  49.160 +     | _ => (\<^cterm>\<open>True\<close>, \<^cterm>\<open>True\<close>));
  49.161  
  49.162    val [idom_thm, neq_thm] = idom;
  49.163    val [idl_sub, idl_add0] =
  49.164 @@ -653,7 +653,7 @@
  49.165  
  49.166  val holify_polynomial =
  49.167   let fun holify_varpow (v,n) =
  49.168 -  if n = 1 then v else ring_mk_pow v (Numeral.mk_cnumber @{ctyp nat} n)  (* FIXME *)
  49.169 +  if n = 1 then v else ring_mk_pow v (Numeral.mk_cnumber \<^ctyp>\<open>nat\<close> n)  (* FIXME *)
  49.170   fun holify_monomial vars (c,m) =
  49.171    let val xps = map holify_varpow (filter (fn (_,n) => n <> 0) (vars ~~ m))
  49.172     in end_itlist ring_mk_mul (mk_const c :: xps)
  49.173 @@ -737,7 +737,7 @@
  49.174    fun mk_forall x p =
  49.175      let
  49.176        val T = Thm.typ_of_cterm x;
  49.177 -      val all = Thm.cterm_of ctxt (Const (@{const_name All}, (T --> @{typ bool}) --> @{typ bool}))
  49.178 +      val all = Thm.cterm_of ctxt (Const (\<^const_name>\<open>All\<close>, (T --> \<^typ>\<open>bool\<close>) --> \<^typ>\<open>bool\<close>))
  49.179      in Thm.apply all (Thm.lambda x p) end
  49.180    val avs = Drule.cterm_add_frees tm []
  49.181    val P' = fold mk_forall avs tm
  49.182 @@ -819,15 +819,15 @@
  49.183   fun unwind_polys_conv ctxt tm =
  49.184   let
  49.185    val (vars,bod) = strip_exists tm
  49.186 -  val cjs = striplist (dest_binary @{cterm HOL.conj}) bod
  49.187 +  val cjs = striplist (dest_binary \<^cterm>\<open>HOL.conj\<close>) bod
  49.188    val th1 = (the (get_first (try (isolate_variable vars)) cjs)
  49.189               handle Option.Option => raise CTERM ("unwind_polys_conv",[tm]))
  49.190    val eq = Thm.lhs_of th1
  49.191 -  val bod' = list_mk_binop @{cterm HOL.conj} (eq::(remove op aconvc eq cjs))
  49.192 +  val bod' = list_mk_binop \<^cterm>\<open>HOL.conj\<close> (eq::(remove op aconvc eq cjs))
  49.193    val th2 = conj_ac_rule (mk_eq bod bod')
  49.194    val th3 =
  49.195      Thm.transitive th2
  49.196 -      (Drule.binop_cong_rule @{cterm HOL.conj} th1
  49.197 +      (Drule.binop_cong_rule \<^cterm>\<open>HOL.conj\<close> th1
  49.198          (Thm.reflexive (Thm.dest_arg (Thm.rhs_of th2))))
  49.199    val v = Thm.dest_arg1(Thm.dest_arg1(Thm.rhs_of th3))
  49.200    val th4 = Conv.fconv_rule (Conv.arg_conv (simp_ex_conv ctxt)) (mk_exists ctxt v th3)
  49.201 @@ -890,18 +890,18 @@
  49.202  
  49.203  fun find_term bounds tm =
  49.204    (case Thm.term_of tm of
  49.205 -    Const (@{const_name HOL.eq}, T) $ _ $ _ =>
  49.206 +    Const (\<^const_name>\<open>HOL.eq\<close>, T) $ _ $ _ =>
  49.207        if domain_type T = HOLogic.boolT then find_args bounds tm
  49.208        else Thm.dest_arg tm
  49.209 -  | Const (@{const_name Not}, _) $ _ => find_term bounds (Thm.dest_arg tm)
  49.210 -  | Const (@{const_name All}, _) $ _ => find_body bounds (Thm.dest_arg tm)
  49.211 -  | Const (@{const_name Ex}, _) $ _ => find_body bounds (Thm.dest_arg tm)
  49.212 -  | Const (@{const_name HOL.conj}, _) $ _ $ _ => find_args bounds tm
  49.213 -  | Const (@{const_name HOL.disj}, _) $ _ $ _ => find_args bounds tm
  49.214 -  | Const (@{const_name HOL.implies}, _) $ _ $ _ => find_args bounds tm
  49.215 -  | @{term "op ==>"} $_$_ => find_args bounds tm
  49.216 -  | Const("op ==",_)$_$_ => find_args bounds tm
  49.217 -  | @{term Trueprop}$_ => find_term bounds (Thm.dest_arg tm)
  49.218 +  | Const (\<^const_name>\<open>Not\<close>, _) $ _ => find_term bounds (Thm.dest_arg tm)
  49.219 +  | Const (\<^const_name>\<open>All\<close>, _) $ _ => find_body bounds (Thm.dest_arg tm)
  49.220 +  | Const (\<^const_name>\<open>Ex\<close>, _) $ _ => find_body bounds (Thm.dest_arg tm)
  49.221 +  | Const (\<^const_name>\<open>HOL.conj\<close>, _) $ _ $ _ => find_args bounds tm
  49.222 +  | Const (\<^const_name>\<open>HOL.disj\<close>, _) $ _ $ _ => find_args bounds tm
  49.223 +  | Const (\<^const_name>\<open>HOL.implies\<close>, _) $ _ $ _ => find_args bounds tm
  49.224 +  | \<^term>\<open>op \<Longrightarrow>\<close> $_$_ => find_args bounds tm
  49.225 +  | Const("op ==",_)$_$_ => find_args bounds tm  (* FIXME proper const name *)
  49.226 +  | \<^term>\<open>Trueprop\<close>$_ => find_term bounds (Thm.dest_arg tm)
  49.227    | _ => raise TERM ("find_term", []))
  49.228  and find_args bounds tm =
  49.229    let val (t, u) = Thm.dest_binop tm
  49.230 @@ -925,7 +925,7 @@
  49.231  
  49.232  fun presimplify ctxt add_thms del_thms =
  49.233    asm_full_simp_tac (put_simpset HOL_basic_ss ctxt
  49.234 -    addsimps (Named_Theorems.get ctxt @{named_theorems algebra})
  49.235 +    addsimps (Named_Theorems.get ctxt \<^named_theorems>\<open>algebra\<close>)
  49.236      delsimps del_thms addsimps add_thms);
  49.237  
  49.238  fun ring_tac add_ths del_ths ctxt =
  49.239 @@ -943,7 +943,7 @@
  49.240  
  49.241  local
  49.242   fun lhs t = case Thm.term_of t of
  49.243 -  Const(@{const_name HOL.eq},_)$_$_ => Thm.dest_arg1 t
  49.244 +  Const(\<^const_name>\<open>HOL.eq\<close>,_)$_$_ => Thm.dest_arg1 t
  49.245   | _=> raise CTERM ("ideal_tac - lhs",[t])
  49.246   fun exitac _ NONE = no_tac
  49.247     | exitac ctxt (SOME y) =
    50.1 --- a/src/HOL/Tools/group_cancel.ML	Wed Dec 06 16:01:15 2017 +0100
    50.2 +++ b/src/HOL/Tools/group_cancel.ML	Wed Dec 06 21:01:01 2017 +0100
    50.3 @@ -36,13 +36,13 @@
    50.4      [Conv.rewr_conv (Library.foldl (op RS) (rule0, path)),
    50.5       Conv.arg1_conv (Conv.repeat_conv (Conv.rewr_conv minus_minus))]
    50.6  
    50.7 -fun add_atoms pos path (Const (@{const_name Groups.plus}, _) $ x $ y) =
    50.8 +fun add_atoms pos path (Const (\<^const_name>\<open>Groups.plus\<close>, _) $ x $ y) =
    50.9        add_atoms pos (add1::path) x #> add_atoms pos (add2::path) y
   50.10 -  | add_atoms pos path (Const (@{const_name Groups.minus}, _) $ x $ y) =
   50.11 +  | add_atoms pos path (Const (\<^const_name>\<open>Groups.minus\<close>, _) $ x $ y) =
   50.12        add_atoms pos (sub1::path) x #> add_atoms (not pos) (sub2::path) y
   50.13 -  | add_atoms pos path (Const (@{const_name Groups.uminus}, _) $ x) =
   50.14 +  | add_atoms pos path (Const (\<^const_name>\<open>Groups.uminus\<close>, _) $ x) =
   50.15        add_atoms (not pos) (neg1::path) x
   50.16 -  | add_atoms _ _ (Const (@{const_name Groups.zero}, _)) = I
   50.17 +  | add_atoms _ _ (Const (\<^const_name>\<open>Groups.zero\<close>, _)) = I
   50.18    | add_atoms pos path x = cons ((pos, x), path)
   50.19  
   50.20  fun atoms t = add_atoms true [] t []
    51.1 --- a/src/HOL/Tools/hologic.ML	Wed Dec 06 16:01:15 2017 +0100
    51.2 +++ b/src/HOL/Tools/hologic.ML	Wed Dec 06 21:01:01 2017 +0100
    51.3 @@ -187,16 +187,16 @@
    51.4  
    51.5  (* logic *)
    51.6  
    51.7 -val Trueprop = Const (@{const_name Trueprop}, boolT --> propT);
    51.8 +val Trueprop = Const (\<^const_name>\<open>Trueprop\<close>, boolT --> propT);
    51.9  
   51.10  fun mk_Trueprop P = Trueprop $ P;
   51.11  
   51.12 -fun dest_Trueprop (Const (@{const_name Trueprop}, _) $ P) = P
   51.13 +fun dest_Trueprop (Const (\<^const_name>\<open>Trueprop\<close>, _) $ P) = P
   51.14    | dest_Trueprop t = raise TERM ("dest_Trueprop", [t]);
   51.15  
   51.16  fun Trueprop_conv cv ct =
   51.17    (case Thm.term_of ct of
   51.18 -    Const (@{const_name Trueprop}, _) $ _ => Conv.arg_conv cv ct
   51.19 +    Const (\<^const_name>\<open>Trueprop\<close>, _) $ _ => Conv.arg_conv cv ct
   51.20    | _ => raise CTERM ("Trueprop_conv", [ct]))
   51.21  
   51.22  
   51.23 @@ -220,10 +220,10 @@
   51.24    let val (th1, th2) = conj_elim ctxt th
   51.25    in conj_elims ctxt th1 @ conj_elims ctxt th2 end handle THM _ => [th];
   51.26  
   51.27 -val conj = @{term HOL.conj}
   51.28 -and disj = @{term HOL.disj}
   51.29 -and imp = @{term implies}
   51.30 -and Not = @{term Not};
   51.31 +val conj = \<^term>\<open>HOL.conj\<close>
   51.32 +and disj = \<^term>\<open>HOL.disj\<close>
   51.33 +and imp = \<^term>\<open>implies\<close>
   51.34 +and Not = \<^term>\<open>Not\<close>;
   51.35  
   51.36  fun mk_conj (t1, t2) = conj $ t1 $ t2
   51.37  and mk_disj (t1, t2) = disj $ t1 $ t2
   51.38 @@ -257,21 +257,21 @@
   51.39  
   51.40  fun conj_conv cv1 cv2 ct =
   51.41    (case Thm.term_of ct of
   51.42 -    Const (@{const_name HOL.conj}, _) $ _ $ _ =>
   51.43 +    Const (\<^const_name>\<open>HOL.conj\<close>, _) $ _ $ _ =>
   51.44        Conv.combination_conv (Conv.arg_conv cv1) cv2 ct
   51.45    | _ => raise CTERM ("conj_conv", [ct]));
   51.46  
   51.47  
   51.48 -fun eq_const T = Const (@{const_name HOL.eq}, T --> T --> boolT);
   51.49 +fun eq_const T = Const (\<^const_name>\<open>HOL.eq\<close>, T --> T --> boolT);
   51.50  
   51.51  fun mk_eq (t, u) = eq_const (fastype_of t) $ t $ u;
   51.52  
   51.53 -fun dest_eq (Const (@{const_name HOL.eq}, _) $ lhs $ rhs) = (lhs, rhs)
   51.54 +fun dest_eq (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ lhs $ rhs) = (lhs, rhs)
   51.55    | dest_eq t = raise TERM ("dest_eq", [t])
   51.56  
   51.57  fun eq_conv cv1 cv2 ct =
   51.58    (case Thm.term_of ct of
   51.59 -    Const (@{const_name HOL.eq}, _) $ _ $ _ => Conv.combination_conv (Conv.arg_conv cv1) cv2 ct
   51.60 +    Const (\<^const_name>\<open>HOL.eq\<close>, _) $ _ $ _ => Conv.combination_conv (Conv.arg_conv cv1) cv2 ct
   51.61    | _ => raise CTERM ("eq_conv", [ct]));
   51.62  
   51.63  
    52.1 --- a/src/HOL/Tools/inductive.ML	Wed Dec 06 16:01:15 2017 +0100
    52.2 +++ b/src/HOL/Tools/inductive.ML	Wed Dec 06 21:01:01 2017 +0100
    52.3 @@ -125,7 +125,7 @@
    52.4  
    52.5  (** misc utilities **)
    52.6  
    52.7 -val inductive_internals = Attrib.setup_config_bool @{binding inductive_internals} (K false);
    52.8 +val inductive_internals = Attrib.setup_config_bool \<^binding>\<open>inductive_internals\<close> (K false);
    52.9  
   52.10  fun message quiet_mode s = if quiet_mode then () else writeln s;
   52.11  
   52.12 @@ -142,7 +142,7 @@
   52.13        (if i mod 2 = 0 then f x else g x) :: make_bool_args f g xs (i div 2);
   52.14  
   52.15  fun make_bool_args' xs =
   52.16 -  make_bool_args (K @{term False}) (K @{term True}) xs;
   52.17 +  make_bool_args (K \<^term>\<open>False\<close>) (K \<^term>\<open>True\<close>) xs;
   52.18  
   52.19  fun arg_types_of k c = drop k (binder_types (fastype_of c));
   52.20  
   52.21 @@ -154,7 +154,7 @@
   52.22        else apsnd (cons p) (find_arg T x ps);
   52.23  
   52.24  fun make_args Ts xs =
   52.25 -  map (fn (T, (NONE, ())) => Const (@{const_name undefined}, T) | (_, (SOME t, ())) => t)
   52.26 +  map (fn (T, (NONE, ())) => Const (\<^const_name>\<open>undefined\<close>, T) | (_, (SOME t, ())) => t)
   52.27      (fold (fn (t, T) => snd o find_arg T t) xs (map (rpair (NONE, ())) Ts));
   52.28  
   52.29  fun make_args' Ts xs Us =
   52.30 @@ -280,9 +280,9 @@
   52.31        handle THM _ => thm RS @{thm le_boolD}
   52.32    in
   52.33      (case Thm.concl_of thm of
   52.34 -      Const (@{const_name Pure.eq}, _) $ _ $ _ => eq_to_mono (thm RS meta_eq_to_obj_eq)
   52.35 -    | _ $ (Const (@{const_name HOL.eq}, _) $ _ $ _) => eq_to_mono thm
   52.36 -    | _ $ (Const (@{const_name Orderings.less_eq}, _) $ _ $ _) =>
   52.37 +      Const (\<^const_name>\<open>Pure.eq\<close>, _) $ _ $ _ => eq_to_mono (thm RS meta_eq_to_obj_eq)
   52.38 +    | _ $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ _ $ _) => eq_to_mono thm
   52.39 +    | _ $ (Const (\<^const_name>\<open>Orderings.less_eq\<close>, _) $ _ $ _) =>
   52.40        dest_less_concl (Seq.hd (REPEAT (FIRSTGOAL
   52.41          (resolve_tac ctxt [@{thm le_funI}, @{thm le_boolI'}])) thm))
   52.42      | _ => thm)
   52.43 @@ -300,7 +300,7 @@
   52.44  
   52.45  val _ =
   52.46    Theory.setup
   52.47 -    (Attrib.setup @{binding mono} (Attrib.add_del mono_add mono_del)
   52.48 +    (Attrib.setup \<^binding>\<open>mono\<close> (Attrib.add_del mono_add mono_del)
   52.49        "declaration of monotonicity rule");
   52.50  
   52.51  
   52.52 @@ -370,7 +370,7 @@
   52.53  
   52.54      val _ =
   52.55        (case concl of
   52.56 -        Const (@{const_name Trueprop}, _) $ t =>
   52.57 +        Const (\<^const_name>\<open>Trueprop\<close>, _) $ t =>
   52.58            if member (op =) cs (head_of t) then
   52.59             (check_ind (err_in_rule ctxt binding rule') t;
   52.60              List.app check_prem (prems ~~ aprems))
   52.61 @@ -400,7 +400,7 @@
   52.62    (if skip_mono then Goal.prove_sorry else Goal.prove_future) ctxt
   52.63      [] []
   52.64      (HOLogic.mk_Trueprop
   52.65 -      (Const (@{const_name Orderings.mono}, (predT --> predT) --> HOLogic.boolT) $ fp_fun))
   52.66 +      (Const (\<^const_name>\<open>Orderings.mono\<close>, (predT --> predT) --> HOLogic.boolT) $ fp_fun))
   52.67      (fn _ => EVERY [resolve_tac ctxt @{thms monoI} 1,
   52.68        REPEAT (resolve_tac ctxt [@{thm le_funI}, @{thm le_boolI'}] 1),
   52.69        REPEAT (FIRST
   52.70 @@ -510,11 +510,11 @@
   52.71                    HOLogic.exists_const T $ Abs (a, T, list_ex (vars, t));
   52.72              val conjs = map2 (curry HOLogic.mk_eq) frees us @ map HOLogic.dest_Trueprop ts;
   52.73            in
   52.74 -            list_ex (params', if null conjs then @{term True} else foldr1 HOLogic.mk_conj conjs)
   52.75 +            list_ex (params', if null conjs then \<^term>\<open>True\<close> else foldr1 HOLogic.mk_conj conjs)
   52.76            end;
   52.77          val lhs = list_comb (c, params @ frees);
   52.78          val rhs =
   52.79 -          if null c_intrs then @{term False}
   52.80 +          if null c_intrs then \<^term>\<open>False\<close>
   52.81            else foldr1 HOLogic.mk_disj (map mk_intr_conj c_intrs);
   52.82          val eq = HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs, rhs));
   52.83          fun prove_intr1 (i, _) = Subgoal.FOCUS_PREMS (fn {context = ctxt'', params, prems, ...} =>
   52.84 @@ -567,7 +567,7 @@
   52.85  local
   52.86  
   52.87  (*delete needless equality assumptions*)
   52.88 -val refl_thin = Goal.prove_global @{theory HOL} [] [] @{prop "!!P. a = a ==> P ==> P"}
   52.89 +val refl_thin = Goal.prove_global @{theory HOL} [] [] \<^prop>\<open>\<And>P. a = a \<Longrightarrow> P \<Longrightarrow> P\<close>
   52.90    (fn {context = ctxt, ...} => assume_tac ctxt 1);
   52.91  val elim_rls = [asm_rl, FalseE, refl_thin, conjE, exE];
   52.92  fun elim_tac ctxt = REPEAT o eresolve_tac ctxt elim_rls;
   52.93 @@ -630,7 +630,7 @@
   52.94  
   52.95  val _ =
   52.96    Theory.setup
   52.97 -    (Method.setup @{binding ind_cases}
   52.98 +    (Method.setup \<^binding>\<open>ind_cases\<close>
   52.99        (Scan.lift (Scan.repeat1 Parse.prop -- Parse.for_fixes) >>
  52.100          (fn (props, fixes) => fn ctxt =>
  52.101            Method.erule ctxt 0 (ind_cases_rules ctxt props fixes)))
  52.102 @@ -705,7 +705,7 @@
  52.103                  val P = list_comb (nth preds i, map (incr_boundvars k) ys @ bs);
  52.104                  val Q =
  52.105                    fold_rev Term.abs (mk_names "x" k ~~ Ts)
  52.106 -                    (HOLogic.mk_binop @{const_name HOL.induct_conj}
  52.107 +                    (HOLogic.mk_binop \<^const_name>\<open>HOL.induct_conj\<close>
  52.108                        (list_comb (incr_boundvars k s, bs), P));
  52.109                in (Q, case Ts of [] => SOME (s, P) | _ => NONE) end
  52.110            | NONE =>
  52.111 @@ -753,7 +753,7 @@
  52.112  
  52.113      val ind_concl =
  52.114        HOLogic.mk_Trueprop
  52.115 -        (HOLogic.mk_binrel @{const_name Orderings.less_eq} (rec_const, ind_pred));
  52.116 +        (HOLogic.mk_binrel \<^const_name>\<open>Orderings.less_eq\<close> (rec_const, ind_pred));
  52.117  
  52.118      val raw_fp_induct = mono RS (fp_def RS @{thm def_lfp_induct});
  52.119  
  52.120 @@ -791,7 +791,7 @@
  52.121  
  52.122  (* prove coinduction rule *)
  52.123  
  52.124 -fun If_const T = Const (@{const_name If}, HOLogic.boolT --> T --> T --> T);
  52.125 +fun If_const T = Const (\<^const_name>\<open>If\<close>, HOLogic.boolT --> T --> T --> T);
  52.126  fun mk_If p t f = let val T = fastype_of t in If_const T $ p $ t $ f end;
  52.127  
  52.128  fun prove_coindrule quiet_mode preds cs argTs bs xs params intr_ts mono
  52.129 @@ -803,20 +803,20 @@
  52.130        make_args' argTs xs (arg_types_of (length params) pred) |> `length) preds;
  52.131      val xTss = map (map fastype_of) xss;
  52.132      val (Rs_names, names_ctxt) = Variable.variant_fixes (mk_names "X" n) ctxt;
  52.133 -    val Rs = map2 (fn name => fn Ts => Free (name, Ts ---> @{typ bool})) Rs_names xTss;
  52.134 +    val Rs = map2 (fn name => fn Ts => Free (name, Ts ---> \<^typ>\<open>bool\<close>)) Rs_names xTss;
  52.135      val Rs_applied = map2 (curry list_comb) Rs xss;
  52.136      val preds_applied = map2 (curry list_comb) (map (fn p => list_comb (p, params)) preds) xss;
  52.137      val abstract_list = fold_rev (absfree o dest_Free);
  52.138      val bss = map (make_bool_args
  52.139 -      (fn b => HOLogic.mk_eq (b, @{term False}))
  52.140 -      (fn b => HOLogic.mk_eq (b, @{term True})) bs) (0 upto n - 1);
  52.141 +      (fn b => HOLogic.mk_eq (b, \<^term>\<open>False\<close>))
  52.142 +      (fn b => HOLogic.mk_eq (b, \<^term>\<open>True\<close>)) bs) (0 upto n - 1);
  52.143      val eq_undefinedss = map (fn ys => map (fn x =>
  52.144 -        HOLogic.mk_eq (x, Const (@{const_name undefined}, fastype_of x)))
  52.145 +        HOLogic.mk_eq (x, Const (\<^const_name>\<open>undefined\<close>, fastype_of x)))
  52.146        (subtract (op =) ys xs)) xss;
  52.147      val R =
  52.148        @{fold 3} (fn bs => fn eqs => fn R => fn t => if null bs andalso null eqs then R else
  52.149          mk_If (Library.foldr1 HOLogic.mk_conj (bs @ eqs)) R t)
  52.150 -      bss eq_undefinedss Rs_applied @{term False}
  52.151 +      bss eq_undefinedss Rs_applied \<^term>\<open>False\<close>
  52.152        |> abstract_list (bs @ xs);
  52.153  
  52.154      fun subst t =
  52.155 @@ -847,7 +847,7 @@
  52.156        in
  52.157          (i, fold_rev (fn (x, T) => fn P => HOLogic.exists_const T $ Abs (x, T, P))
  52.158            (Logic.strip_params r)
  52.159 -          (if null ps then @{term True} else foldr1 HOLogic.mk_conj ps))
  52.160 +          (if null ps then \<^term>\<open>True\<close> else foldr1 HOLogic.mk_conj ps))
  52.161        end;
  52.162  
  52.163      fun mk_prem i Ps = Logic.mk_implies
  52.164 @@ -908,7 +908,7 @@
  52.165  
  52.166  fun mk_ind_def quiet_mode skip_mono alt_name coind cs intr_ts monos params cnames_syn lthy =
  52.167    let
  52.168 -    val fp_name = if coind then @{const_name Inductive.gfp} else @{const_name Inductive.lfp};
  52.169 +    val fp_name = if coind then \<^const_name>\<open>Inductive.gfp\<close> else \<^const_name>\<open>Inductive.lfp\<close>;
  52.170  
  52.171      val argTs = fold (combine (op =) o arg_types_of (length params)) cs [];
  52.172      val k = log 2 1 (length cs);
  52.173 @@ -954,14 +954,14 @@
  52.174        in
  52.175          fold_rev (fn (x, T) => fn P => HOLogic.exists_const T $ Abs (x, T, P))
  52.176            (Logic.strip_params r)
  52.177 -          (if null ps then @{term True} else foldr1 HOLogic.mk_conj ps)
  52.178 +          (if null ps then \<^term>\<open>True\<close> else foldr1 HOLogic.mk_conj ps)
  52.179        end;
  52.180  
  52.181      (* make a disjunction of all introduction rules *)
  52.182  
  52.183      val fp_fun =
  52.184        fold_rev lambda (p :: bs @ xs)
  52.185 -        (if null intr_ts then @{term False}
  52.186 +        (if null intr_ts then \<^term>\<open>False\<close>
  52.187           else foldr1 HOLogic.mk_disj (map transform_rule intr_ts));
  52.188  
  52.189      (* add definition of recursive predicates to theory *)
  52.190 @@ -1296,32 +1296,32 @@
  52.191  fun gen_ind_decl mk_def coind =
  52.192    Parse.vars -- Parse.for_fixes --
  52.193    Scan.optional Parse_Spec.where_multi_specs [] --
  52.194 -  Scan.optional (@{keyword "monos"} |-- Parse.!!! Parse.thms1) []
  52.195 +  Scan.optional (\<^keyword>\<open>monos\<close> |-- Parse.!!! Parse.thms1) []
  52.196    >> (fn (((preds, params), specs), monos) =>
  52.197        (snd o gen_add_inductive mk_def true coind preds params specs monos));
  52.198  
  52.199  val ind_decl = gen_ind_decl add_ind_def;
  52.200  
  52.201  val _ =
  52.202 -  Outer_Syntax.local_theory @{command_keyword inductive} "define inductive predicates"
  52.203 +  Outer_Syntax.local_theory \<^command_keyword>\<open>inductive\<close> "define inductive predicates"
  52.204      (ind_decl false);
  52.205  
  52.206  val _ =
  52.207 -  Outer_Syntax.local_theory @{command_keyword coinductive} "define coinductive predicates"
  52.208 +  Outer_Syntax.local_theory \<^command_keyword>\<open>coinductive\<close> "define coinductive predicates"
  52.209      (ind_decl true);
  52.210  
  52.211  val _ =
  52.212 -  Outer_Syntax.local_theory @{command_keyword inductive_cases}
  52.213 +  Outer_Syntax.local_theory \<^command_keyword>\<open>inductive_cases\<close>
  52.214      "create simplified instances of elimination rules"
  52.215      (Parse.and_list1 Parse_Spec.simple_specs >> (snd oo inductive_cases));
  52.216  
  52.217  val _ =
  52.218 -  Outer_Syntax.local_theory @{command_keyword inductive_simps}
  52.219 +  Outer_Syntax.local_theory \<^command_keyword>\<open>inductive_simps\<close>
  52.220      "create simplification rules for inductive predicates"
  52.221      (Parse.and_list1 Parse_Spec.simple_specs >> (snd oo inductive_simps));
  52.222  
  52.223  val _ =
  52.224 -  Outer_Syntax.command @{command_keyword print_inductives}
  52.225 +  Outer_Syntax.command \<^command_keyword>\<open>print_inductives\<close>
  52.226      "print (co)inductive definitions and monotonicity rules"
  52.227      (Parse.opt_bang >> (fn b => Toplevel.keep (print_inductives b o Toplevel.context_of)));
  52.228  
    53.1 --- a/src/HOL/Tools/inductive_realizer.ML	Wed Dec 06 16:01:15 2017 +0100
    53.2 +++ b/src/HOL/Tools/inductive_realizer.ML	Wed Dec 06 21:01:01 2017 +0100
    53.3 @@ -515,7 +515,7 @@
    53.4        | SOME (SOME sets') => subtract (op =) sets' sets)
    53.5    end I);
    53.6  
    53.7 -val _ = Theory.setup (Attrib.setup @{binding ind_realizer}
    53.8 +val _ = Theory.setup (Attrib.setup \<^binding>\<open>ind_realizer\<close>
    53.9    ((Scan.option (Scan.lift (Args.$$$ "irrelevant") |--
   53.10      Scan.option (Scan.lift (Args.colon) |--
   53.11        Scan.repeat1 (Args.const {proper = true, strict = true})))) >> rlz_attrib)
    54.1 --- a/src/HOL/Tools/inductive_set.ML	Wed Dec 06 16:01:15 2017 +0100
    54.2 +++ b/src/HOL/Tools/inductive_set.ML	Wed Dec 06 21:01:01 2017 +0100
    54.3 @@ -39,7 +39,7 @@
    54.4  
    54.5  fun strong_ind_simproc tab =
    54.6    Simplifier.make_simproc @{context} "strong_ind"
    54.7 -   {lhss = [@{term "x::'a::{}"}],
    54.8 +   {lhss = [\<^term>\<open>x::'a::{}\<close>],
    54.9      proc = fn _ => fn ctxt => fn ct =>
   54.10        let
   54.11          fun close p t f =
   54.12 @@ -47,20 +47,20 @@
   54.13            in Thm.instantiate' [] (rev (map (SOME o Thm.cterm_of ctxt o Var) vs))
   54.14              (p (fold (Logic.all o Var) vs t) f)
   54.15            end;
   54.16 -        fun mkop @{const_name HOL.conj} T x =
   54.17 -              SOME (Const (@{const_name Lattices.inf}, T --> T --> T), x)
   54.18 -          | mkop @{const_name HOL.disj} T x =
   54.19 -              SOME (Const (@{const_name Lattices.sup}, T --> T --> T), x)
   54.20 +        fun mkop \<^const_name>\<open>HOL.conj\<close> T x =
   54.21 +              SOME (Const (\<^const_name>\<open>Lattices.inf\<close>, T --> T --> T), x)
   54.22 +          | mkop \<^const_name>\<open>HOL.disj\<close> T x =
   54.23 +              SOME (Const (\<^const_name>\<open>Lattices.sup\<close>, T --> T --> T), x)
   54.24            | mkop _ _ _ = NONE;
   54.25          fun mk_collect p T t =
   54.26            let val U = HOLogic.dest_setT T
   54.27            in HOLogic.Collect_const U $
   54.28              HOLogic.mk_ptupleabs (HOLogic.flat_tuple_paths p) U HOLogic.boolT t
   54.29            end;
   54.30 -        fun decomp (Const (s, _) $ ((m as Const (@{const_name Set.member},
   54.31 +        fun decomp (Const (s, _) $ ((m as Const (\<^const_name>\<open>Set.member\<close>,
   54.32                Type (_, [_, Type (_, [T, _])]))) $ p $ S) $ u) =
   54.33                  mkop s T (m, p, S, mk_collect p T (head_of u))
   54.34 -          | decomp (Const (s, _) $ u $ ((m as Const (@{const_name Set.member},
   54.35 +          | decomp (Const (s, _) $ u $ ((m as Const (\<^const_name>\<open>Set.member\<close>,
   54.36                Type (_, [_, Type (_, [T, _])]))) $ p $ S)) =
   54.37                  mkop s T (m, p, mk_collect p T (head_of u), S)
   54.38            | decomp _ = NONE;
   54.39 @@ -241,7 +241,7 @@
   54.40    in
   54.41      Simplifier.simplify
   54.42        (put_simpset HOL_basic_ss ctxt addsimps @{thms mem_Collect_eq case_prod_conv}
   54.43 -        addsimprocs [@{simproc Collect_mem}]) thm''
   54.44 +        addsimprocs [\<^simproc>\<open>Collect_mem\<close>]) thm''
   54.45        |> zero_var_indexes |> eta_contract_thm ctxt (equal p)
   54.46    end;
   54.47  
   54.48 @@ -252,14 +252,14 @@
   54.49  
   54.50  fun add context thm (tab as {to_set_simps, to_pred_simps, set_arities, pred_arities}) =
   54.51    (case Thm.prop_of thm of
   54.52 -    Const (@{const_name Trueprop}, _) $ (Const (@{const_name HOL.eq}, Type (_, [T, _])) $ lhs $ rhs) =>
   54.53 +    Const (\<^const_name>\<open>Trueprop\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, Type (_, [T, _])) $ lhs $ rhs) =>
   54.54        (case body_type T of
   54.55 -         @{typ bool} =>
   54.56 +         \<^typ>\<open>bool\<close> =>
   54.57             let
   54.58               val thy = Context.theory_of context;
   54.59               val ctxt = Context.proof_of context;
   54.60               fun factors_of t fs = case strip_abs_body t of
   54.61 -                 Const (@{const_name Set.member}, _) $ u $ S =>
   54.62 +                 Const (\<^const_name>\<open>Set.member\<close>, _) $ u $ S =>
   54.63                     if is_Free S orelse is_Var S then
   54.64                       let val ps = HOLogic.flat_tuple_paths u
   54.65                       in (SOME ps, (S, ps) :: fs) end
   54.66 @@ -269,7 +269,7 @@
   54.67               val (pfs, fs) = fold_map factors_of ts [];
   54.68               val ((h', ts'), fs') = (case rhs of
   54.69                   Abs _ => (case strip_abs_body rhs of
   54.70 -                     Const (@{const_name Set.member}, _) $ u $ S =>
   54.71 +                     Const (\<^const_name>\<open>Set.member\<close>, _) $ u $ S =>
   54.72                         (strip_comb S, SOME (HOLogic.flat_tuple_paths u))
   54.73                     | _ => raise Malformed "member symbol on right-hand side expected")
   54.74                 | _ => (strip_comb rhs, NONE))
   54.75 @@ -384,7 +384,7 @@
   54.76      thm |>
   54.77      Thm.instantiate ([], insts) |>
   54.78      Simplifier.full_simplify (put_simpset HOL_basic_ss ctxt addsimps to_set_simps
   54.79 -        addsimprocs [strong_ind_simproc pred_arities, @{simproc Collect_mem}]) |>
   54.80 +        addsimprocs [strong_ind_simproc pred_arities, \<^simproc>\<open>Collect_mem\<close>]) |>
   54.81      Rule_Cases.save thm
   54.82    end;
   54.83  
   54.84 @@ -401,7 +401,7 @@
   54.85      val {set_arities, pred_arities, to_pred_simps, ...} =
   54.86        Data.get (Context.Proof lthy);
   54.87      fun infer (Abs (_, _, t)) = infer t
   54.88 -      | infer (Const (@{const_name Set.member}, _) $ t $ u) =
   54.89 +      | infer (Const (\<^const_name>\<open>Set.member\<close>, _) $ t $ u) =
   54.90            infer_arities thy set_arities (SOME (HOLogic.flat_tuple_paths t), u)
   54.91        | infer (t $ u) = infer t #> infer u
   54.92        | infer _ = I;
   54.93 @@ -534,13 +534,13 @@
   54.94  
   54.95  val _ =
   54.96    Theory.setup
   54.97 -   (Attrib.setup @{binding pred_set_conv} (Scan.succeed pred_set_conv_att)
   54.98 +   (Attrib.setup \<^binding>\<open>pred_set_conv\<close> (Scan.succeed pred_set_conv_att)
   54.99        "declare rules for converting between predicate and set notation" #>
  54.100 -    Attrib.setup @{binding to_set} (Attrib.thms >> to_set_att)
  54.101 +    Attrib.setup \<^binding>\<open>to_set\<close> (Attrib.thms >> to_set_att)
  54.102        "convert rule to set notation" #>
  54.103 -    Attrib.setup @{binding to_pred} (Attrib.thms >> to_pred_att)
  54.104 +    Attrib.setup \<^binding>\<open>to_pred\<close> (Attrib.thms >> to_pred_att)
  54.105        "convert rule to predicate notation" #>
  54.106 -    Attrib.setup @{binding mono_set} (Attrib.add_del mono_add mono_del)
  54.107 +    Attrib.setup \<^binding>\<open>mono_set\<close> (Attrib.add_del mono_add mono_del)
  54.108        "declare of monotonicity rule for set operators");
  54.109  
  54.110  
  54.111 @@ -549,11 +549,11 @@
  54.112  val ind_set_decl = Inductive.gen_ind_decl add_ind_set_def;
  54.113  
  54.114  val _ =
  54.115 -  Outer_Syntax.local_theory @{command_keyword inductive_set} "define inductive sets"
  54.116 +  Outer_Syntax.local_theory \<^command_keyword>\<open>inductive_set\<close> "define inductive sets"
  54.117      (ind_set_decl false);
  54.118  
  54.119  val _ =
  54.120 -  Outer_Syntax.local_theory @{command_keyword coinductive_set} "define coinductive sets"
  54.121 +  Outer_Syntax.local_theory \<^command_keyword>\<open>coinductive_set\<close> "define coinductive sets"
  54.122      (ind_set_decl true);
  54.123  
  54.124  end;
    55.1 --- a/src/HOL/Tools/int_arith.ML	Wed Dec 06 16:01:15 2017 +0100
    55.2 +++ b/src/HOL/Tools/int_arith.ML	Wed Dec 06 21:01:01 2017 +0100
    55.3 @@ -24,10 +24,10 @@
    55.4  
    55.5  val zero_to_of_int_zero_simproc =
    55.6    Simplifier.make_simproc @{context} "zero_to_of_int_zero_simproc"
    55.7 -   {lhss = [@{term "0::'a::ring"}],
    55.8 +   {lhss = [\<^term>\<open>0::'a::ring\<close>],
    55.9      proc = fn _ => fn ctxt => fn ct =>
   55.10        let val T = Thm.ctyp_of_cterm ct in
   55.11 -        if Thm.typ_of T = @{typ int} then NONE
   55.12 +        if Thm.typ_of T = \<^typ>\<open>int\<close> then NONE
   55.13          else SOME (Thm.instantiate' [SOME T] [] zeroth)
   55.14        end};
   55.15  
   55.16 @@ -35,20 +35,20 @@
   55.17  
   55.18  val one_to_of_int_one_simproc =
   55.19    Simplifier.make_simproc @{context} "one_to_of_int_one_simproc"
   55.20 -   {lhss = [@{term "1::'a::ring_1"}],
   55.21 +   {lhss = [\<^term>\<open>1::'a::ring_1\<close>],
   55.22      proc = fn _ => fn ctxt => fn ct =>
   55.23        let val T = Thm.ctyp_of_cterm ct in
   55.24 -        if Thm.typ_of T = @{typ int} then NONE
   55.25 +        if Thm.typ_of T = \<^typ>\<open>int\<close> then NONE
   55.26          else SOME (Thm.instantiate' [SOME T] [] oneth)
   55.27        end};
   55.28  
   55.29 -fun check (Const (@{const_name Groups.one}, @{typ int})) = false
   55.30 -  | check (Const (@{const_name Groups.one}, _)) = true
   55.31 -  | check (Const (s, _)) = member (op =) [@{const_name HOL.eq},
   55.32 -      @{const_name Groups.times}, @{const_name Groups.uminus},
   55.33 -      @{const_name Groups.minus}, @{const_name Groups.plus},
   55.34 -      @{const_name Groups.zero},
   55.35 -      @{const_name Orderings.less}, @{const_name Orderings.less_eq}] s
   55.36 +fun check (Const (\<^const_name>\<open>Groups.one\<close>, \<^typ>\<open>int\<close>)) = false
   55.37 +  | check (Const (\<^const_name>\<open>Groups.one\<close>, _)) = true
   55.38 +  | check (Const (s, _)) = member (op =) [\<^const_name>\<open>HOL.eq\<close>,
   55.39 +      \<^const_name>\<open>Groups.times\<close>, \<^const_name>\<open>Groups.uminus\<close>,
   55.40 +      \<^const_name>\<open>Groups.minus\<close>, \<^const_name>\<open>Groups.plus\<close>,
   55.41 +      \<^const_name>\<open>Groups.zero\<close>,
   55.42 +      \<^const_name>\<open>Orderings.less\<close>, \<^const_name>\<open>Orderings.less_eq\<close>] s
   55.43    | check (a $ b) = check a andalso check b
   55.44    | check _ = false;
   55.45  
   55.46 @@ -63,9 +63,9 @@
   55.47  val zero_one_idom_simproc =
   55.48    Simplifier.make_simproc @{context} "zero_one_idom_simproc"
   55.49     {lhss =
   55.50 -      [@{term "(x::'a::ring_char_0) = y"},
   55.51 -       @{term "(x::'a::linordered_idom) < y"},
   55.52 -       @{term "(x::'a::linordered_idom) \<le> y"}],
   55.53 +      [\<^term>\<open>(x::'a::ring_char_0) = y\<close>,
   55.54 +       \<^term>\<open>(x::'a::linordered_idom) < y\<close>,
   55.55 +       \<^term>\<open>(x::'a::linordered_idom) \<le> y\<close>],
   55.56      proc = fn _ => fn ctxt => fn ct =>
   55.57        if check (Thm.term_of ct)
   55.58        then SOME (Simplifier.rewrite (put_simpset conv_ss ctxt) ct)
   55.59 @@ -73,7 +73,7 @@
   55.60  
   55.61  
   55.62  fun number_of ctxt T n =
   55.63 -  if not (Sign.of_sort (Proof_Context.theory_of ctxt) (T, @{sort numeral}))
   55.64 +  if not (Sign.of_sort (Proof_Context.theory_of ctxt) (T, \<^sort>\<open>numeral\<close>))
   55.65    then raise CTERM ("number_of", [])
   55.66    else Numeral.mk_cnumber (Thm.ctyp_of ctxt T) n;
   55.67  
   55.68 @@ -85,7 +85,7 @@
   55.69        [@{thm of_int_numeral}, @{thm nat_0}, @{thm nat_1}, @{thm diff_nat_numeral}, @{thm nat_numeral}]
   55.70    #> Lin_Arith.add_simprocs [zero_one_idom_simproc]
   55.71    #> Lin_Arith.set_number_of number_of
   55.72 -  #> Lin_Arith.add_inj_const (@{const_name of_nat}, HOLogic.natT --> HOLogic.intT)
   55.73 -  #> Lin_Arith.add_discrete_type @{type_name Int.int}
   55.74 +  #> Lin_Arith.add_inj_const (\<^const_name>\<open>of_nat\<close>, HOLogic.natT --> HOLogic.intT)
   55.75 +  #> Lin_Arith.add_discrete_type \<^type_name>\<open>Int.int\<close>
   55.76  
   55.77  end;
    56.1 --- a/src/HOL/Tools/lin_arith.ML	Wed Dec 06 16:01:15 2017 +0100
    56.2 +++ b/src/HOL/Tools/lin_arith.ML	Wed Dec 06 21:01:01 2017 +0100
    56.3 @@ -45,17 +45,17 @@
    56.4  val mk_Trueprop = HOLogic.mk_Trueprop;
    56.5  
    56.6  fun atomize thm = case Thm.prop_of thm of
    56.7 -    Const (@{const_name Trueprop}, _) $ (Const (@{const_name HOL.conj}, _) $ _ $ _) =>
    56.8 +    Const (\<^const_name>\<open>Trueprop\<close>, _) $ (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ _ $ _) =>
    56.9      atomize (thm RS conjunct1) @ atomize (thm RS conjunct2)
   56.10    | _ => [thm];
   56.11  
   56.12 -fun neg_prop ((TP as Const(@{const_name Trueprop}, _)) $ (Const (@{const_name Not}, _) $ t)) = TP $ t
   56.13 -  | neg_prop ((TP as Const(@{const_name Trueprop}, _)) $ t) = TP $ (HOLogic.Not $t)
   56.14 +fun neg_prop ((TP as Const(\<^const_name>\<open>Trueprop\<close>, _)) $ (Const (\<^const_name>\<open>Not\<close>, _) $ t)) = TP $ t
   56.15 +  | neg_prop ((TP as Const(\<^const_name>\<open>Trueprop\<close>, _)) $ t) = TP $ (HOLogic.Not $t)
   56.16    | neg_prop t = raise TERM ("neg_prop", [t]);
   56.17  
   56.18  fun is_False thm =
   56.19    let val _ $ t = Thm.prop_of thm
   56.20 -  in t = @{term False} end;
   56.21 +  in t = \<^term>\<open>False\<close> end;
   56.22  
   56.23  fun is_nat t = (fastype_of1 t = HOLogic.natT);
   56.24  
   56.25 @@ -97,9 +97,9 @@
   56.26    {splits = splits, inj_consts = update (op =) c inj_consts,
   56.27     discrete = discrete});
   56.28  
   56.29 -val split_limit = Attrib.setup_config_int @{binding linarith_split_limit} (K 9);
   56.30 -val neq_limit = Attrib.setup_config_int @{binding linarith_neq_limit} (K 9);
   56.31 -val trace = Attrib.setup_config_bool @{binding linarith_trace} (K false);
   56.32 +val split_limit = Attrib.setup_config_int \<^binding>\<open>linarith_split_limit\<close> (K 9);
   56.33 +val neq_limit = Attrib.setup_config_int \<^binding>\<open>linarith_neq_limit\<close> (K 9);
   56.34 +val trace = Attrib.setup_config_bool \<^binding>\<open>linarith_trace\<close> (K false);
   56.35  
   56.36  
   56.37  structure LA_Data: LIN_ARITH_DATA =
   56.38 @@ -134,12 +134,12 @@
   56.39  
   56.40     returns either (SOME term, associated multiplicity) or (NONE, constant)
   56.41  *)
   56.42 -fun of_field_sort thy U = Sign.of_sort thy (U, @{sort inverse});
   56.43 +fun of_field_sort thy U = Sign.of_sort thy (U, \<^sort>\<open>inverse\<close>);
   56.44  
   56.45  fun demult thy (inj_consts : (string * typ) list) : term * Rat.rat -> term option * Rat.rat =
   56.46  let
   56.47 -  fun demult ((mC as Const (@{const_name Groups.times}, _)) $ s $ t, m) =
   56.48 -      (case s of Const (@{const_name Groups.times}, _) $ s1 $ s2 =>
   56.49 +  fun demult ((mC as Const (\<^const_name>\<open>Groups.times\<close>, _)) $ s $ t, m) =
   56.50 +      (case s of Const (\<^const_name>\<open>Groups.times\<close>, _) $ s1 $ s2 =>
   56.51          (* bracketing to the right: '(s1 * s2) * t' becomes 's1 * (s2 * t)' *)
   56.52          demult (mC $ s1 $ (mC $ s2 $ t), m)
   56.53        | _ =>
   56.54 @@ -150,7 +150,7 @@
   56.55                (SOME t', m'') => (SOME (mC $ s' $ t'), m'')
   56.56              | (NONE,    m'') => (SOME s', m''))
   56.57          | (NONE,    m') => demult (t, m')))
   56.58 -    | demult (atom as (mC as Const (@{const_name Rings.divide}, T)) $ s $ t, m) =
   56.59 +    | demult (atom as (mC as Const (\<^const_name>\<open>Rings.divide\<close>, T)) $ s $ t, m) =
   56.60        (* FIXME: Shouldn't we simplify nested quotients, e.g. '(s/t)/u' could
   56.61           become 's/(t*u)', and '(s*t)/u' could become 's*(t/u)' ?   Note that
   56.62           if we choose to do so here, the simpset used by arith must be able to
   56.63 @@ -165,15 +165,15 @@
   56.64              (SOME s', SOME t') => SOME (mC $ s' $ t')
   56.65            | (SOME s', NONE) => SOME s'
   56.66            | (NONE, SOME t') =>
   56.67 -               SOME (mC $ Const (@{const_name Groups.one}, domain_type (snd (dest_Const mC))) $ t')
   56.68 +               SOME (mC $ Const (\<^const_name>\<open>Groups.one\<close>, domain_type (snd (dest_Const mC))) $ t')
   56.69            | (NONE, NONE) => NONE,
   56.70            Rat.mult m' (Rat.inv p))
   56.71          end
   56.72        else (SOME atom, m)
   56.73      (* terms that evaluate to numeric constants *)
   56.74 -    | demult (Const (@{const_name Groups.uminus}, _) $ t, m) = demult (t, ~ m)
   56.75 -    | demult (Const (@{const_name Groups.zero}, _), _) = (NONE, @0)
   56.76 -    | demult (Const (@{const_name Groups.one}, _), m) = (NONE, m)
   56.77 +    | demult (Const (\<^const_name>\<open>Groups.uminus\<close>, _) $ t, m) = demult (t, ~ m)
   56.78 +    | demult (Const (\<^const_name>\<open>Groups.zero\<close>, _), _) = (NONE, @0)
   56.79 +    | demult (Const (\<^const_name>\<open>Groups.one\<close>, _), m) = (NONE, m)
   56.80      (*Warning: in rare cases (neg_)numeral encloses a non-numeral,
   56.81        in which case dest_numeral raises TERM; hence all the handles below.
   56.82        Same for Suc-terms that turn out not to be numerals -
   56.83 @@ -181,7 +181,7 @@
   56.84      | demult (t as Const ("Num.numeral_class.numeral", _) (*DYNAMIC BINDING!*) $ n, m) =
   56.85        ((NONE, Rat.mult m (Rat.of_int (HOLogic.dest_numeral n)))
   56.86          handle TERM _ => (SOME t, m))
   56.87 -    | demult (t as Const (@{const_name Suc}, _) $ _, m) =
   56.88 +    | demult (t as Const (\<^const_name>\<open>Suc\<close>, _) $ _, m) =
   56.89        ((NONE, Rat.mult m (Rat.of_int (HOLogic.dest_nat t)))
   56.90          handle TERM _ => (SOME t, m))
   56.91      (* injection constants are ignored *)
   56.92 @@ -197,27 +197,27 @@
   56.93    (* Turns a term 'all' and associated multiplicity 'm' into a list 'p' of
   56.94       summands and associated multiplicities, plus a constant 'i' (with implicit
   56.95       multiplicity 1) *)
   56.96 -  fun poly (Const (@{const_name Groups.plus}, _) $ s $ t,
   56.97 +  fun poly (Const (\<^const_name>\<open>Groups.plus\<close>, _) $ s $ t,
   56.98          m : Rat.rat, pi : (term * Rat.rat) list * Rat.rat) = poly (s, m, poly (t, m, pi))
   56.99 -    | poly (all as Const (@{const_name Groups.minus}, T) $ s $ t, m, pi) =
  56.100 +    | poly (all as Const (\<^const_name>\<open>Groups.minus\<close>, T) $ s $ t, m, pi) =
  56.101          if nT T then add_atom all m pi else poly (s, m, poly (t, ~ m, pi))
  56.102 -    | poly (all as Const (@{const_name Groups.uminus}, T) $ t, m, pi) =
  56.103 +    | poly (all as Const (\<^const_name>\<open>Groups.uminus\<close>, T) $ t, m, pi) =
  56.104          if nT T then add_atom all m pi else poly (t, ~ m, pi)
  56.105 -    | poly (Const (@{const_name Groups.zero}, _), _, pi) =
  56.106 +    | poly (Const (\<^const_name>\<open>Groups.zero\<close>, _), _, pi) =
  56.107          pi
  56.108 -    | poly (Const (@{const_name Groups.one}, _), m, (p, i)) =
  56.109 +    | poly (Const (\<^const_name>\<open>Groups.one\<close>, _), m, (p, i)) =
  56.110          (p, Rat.add i m)
  56.111      | poly (all as Const ("Num.numeral_class.numeral", _) (*DYNAMIC BINDING!*) $ t, m, pi as (p, i)) =
  56.112          (let val k = HOLogic.dest_numeral t
  56.113          in (p, Rat.add i (Rat.mult m (Rat.of_int k))) end
  56.114          handle TERM _ => add_atom all m pi)
  56.115 -    | poly (Const (@{const_name Suc}, _) $ t, m, (p, i)) =
  56.116 +    | poly (Const (\<^const_name>\<open>Suc\<close>, _) $ t, m, (p, i)) =
  56.117          poly (t, m, (p, Rat.add i m))
  56.118 -    | poly (all as Const (@{const_name Groups.times}, _) $ _ $ _, m, pi as (p, i)) =
  56.119 +    | poly (all as Const (\<^const_name>\<open>Groups.times\<close>, _) $ _ $ _, m, pi as (p, i)) =
  56.120          (case demult thy inj_consts (all, m) of
  56.121             (NONE,   m') => (p, Rat.add i m')
  56.122           | (SOME u, m') => add_atom u m' pi)
  56.123 -    | poly (all as Const (@{const_name Rings.divide}, T) $ _ $ _, m, pi as (p, i)) =
  56.124 +    | poly (all as Const (\<^const_name>\<open>Rings.divide\<close>, T) $ _ $ _, m, pi as (p, i)) =
  56.125          if of_field_sort thy (domain_type T) then 
  56.126            (case demult thy inj_consts (all, m) of
  56.127               (NONE,   m') => (p, Rat.add i m')
  56.128 @@ -231,14 +231,14 @@
  56.129    val (q, j) = poly (rhs, @1, ([], @0))
  56.130  in
  56.131    case rel of
  56.132 -    @{const_name Orderings.less}    => SOME (p, i, "<", q, j)
  56.133 -  | @{const_name Orderings.less_eq} => SOME (p, i, "<=", q, j)
  56.134 -  | @{const_name HOL.eq}            => SOME (p, i, "=", q, j)
  56.135 +    \<^const_name>\<open>Orderings.less\<close>    => SOME (p, i, "<", q, j)
  56.136 +  | \<^const_name>\<open>Orderings.less_eq\<close> => SOME (p, i, "<=", q, j)
  56.137 +  | \<^const_name>\<open>HOL.eq\<close>            => SOME (p, i, "=", q, j)
  56.138    | _                   => NONE
  56.139  end handle General.Div => NONE;
  56.140  
  56.141  fun of_lin_arith_sort thy U =
  56.142 -  Sign.of_sort thy (U, @{sort Rings.linordered_idom});
  56.143 +  Sign.of_sort thy (U, \<^sort>\<open>Rings.linordered_idom\<close>);
  56.144  
  56.145  fun allows_lin_arith thy (discrete : string list) (U as Type (D, [])) : bool * bool =
  56.146        if of_lin_arith_sort thy U then (true, member (op =) discrete D)
  56.147 @@ -261,10 +261,10 @@
  56.148    | negate NONE                        = NONE;
  56.149  
  56.150  fun decomp_negation thy data
  56.151 -      ((Const (@{const_name Trueprop}, _)) $ (Const (rel, T) $ lhs $ rhs)) : decomp option =
  56.152 +      ((Const (\<^const_name>\<open>Trueprop\<close>, _)) $ (Const (rel, T) $ lhs $ rhs)) : decomp option =
  56.153        decomp_typecheck thy data (T, (rel, lhs, rhs))
  56.154    | decomp_negation thy data
  56.155 -      ((Const (@{const_name Trueprop}, _)) $ (Const (@{const_name Not}, _) $ (Const (rel, T) $ lhs $ rhs))) =
  56.156 +      ((Const (\<^const_name>\<open>Trueprop\<close>, _)) $ (Const (\<^const_name>\<open>Not\<close>, _) $ (Const (rel, T) $ lhs $ rhs))) =
  56.157        negate (decomp_typecheck thy data (T, (rel, lhs, rhs)))
  56.158    | decomp_negation _ _ _ =
  56.159        NONE;
  56.160 @@ -276,7 +276,7 @@
  56.161    in decomp_negation thy (discrete, inj_consts) end;
  56.162  
  56.163  fun domain_is_nat (_ $ (Const (_, T) $ _ $ _)) = nT T
  56.164 -  | domain_is_nat (_ $ (Const (@{const_name Not}, _) $ (Const (_, T) $ _ $ _))) = nT T
  56.165 +  | domain_is_nat (_ $ (Const (\<^const_name>\<open>Not\<close>, _) $ (Const (_, T) $ _ $ _))) = nT T
  56.166    | domain_is_nat _ = false;
  56.167  
  56.168  
  56.169 @@ -313,24 +313,24 @@
  56.170    let val {inj_consts, ...} = get_arith_data ctxt
  56.171    in member (op =) inj_consts f end
  56.172  
  56.173 -fun abstract_arith ((c as Const (@{const_name Groups.plus}, _)) $ u1 $ u2) cx =
  56.174 +fun abstract_arith ((c as Const (\<^const_name>\<open>Groups.plus\<close>, _)) $ u1 $ u2) cx =
  56.175        with2 abstract_arith c u1 u2 cx
  56.176 -  | abstract_arith (t as (c as Const (@{const_name Groups.minus}, T)) $ u1 $ u2) cx =
  56.177 +  | abstract_arith (t as (c as Const (\<^const_name>\<open>Groups.minus\<close>, T)) $ u1 $ u2) cx =
  56.178        if nT T then abstract_atom t cx else with2 abstract_arith c u1 u2 cx
  56.179 -  | abstract_arith (t as (c as Const (@{const_name Groups.uminus}, T)) $ u) cx =
  56.180 +  | abstract_arith (t as (c as Const (\<^const_name>\<open>Groups.uminus\<close>, T)) $ u) cx =
  56.181        if nT T then abstract_atom t cx else abstract_arith u cx |>> apply c
  56.182 -  | abstract_arith ((c as Const (@{const_name Suc}, _)) $ u) cx = abstract_arith u cx |>> apply c
  56.183 -  | abstract_arith ((c as Const (@{const_name Groups.times}, _)) $ u1 $ u2) cx =
  56.184 +  | abstract_arith ((c as Const (\<^const_name>\<open>Suc\<close>, _)) $ u) cx = abstract_arith u cx |>> apply c
  56.185 +  | abstract_arith ((c as Const (\<^const_name>\<open>Groups.times\<close>, _)) $ u1 $ u2) cx =
  56.186        with2 abstract_arith c u1 u2 cx
  56.187 -  | abstract_arith (t as (c as Const (@{const_name Rings.divide}, T)) $ u1 $ u2) cx =
  56.188 +  | abstract_arith (t as (c as Const (\<^const_name>\<open>Rings.divide\<close>, T)) $ u1 $ u2) cx =
  56.189        if is_field_sort cx T then with2 abstract_arith c u1 u2 cx else abstract_atom t cx
  56.190    | abstract_arith (t as (c as Const f) $ u) cx =
  56.191        if is_inj_const cx f then abstract_arith u cx |>> apply c else abstract_num t cx
  56.192    | abstract_arith t cx = abstract_num t cx
  56.193  
  56.194 -fun is_lin_arith_rel @{const_name Orderings.less} = true
  56.195 -  | is_lin_arith_rel @{const_name Orderings.less_eq} = true
  56.196 -  | is_lin_arith_rel @{const_name HOL.eq} = true
  56.197 +fun is_lin_arith_rel \<^const_name>\<open>Orderings.less\<close> = true
  56.198 +  | is_lin_arith_rel \<^const_name>\<open>Orderings.less_eq\<close> = true
  56.199 +  | is_lin_arith_rel \<^const_name>\<open>HOL.eq\<close> = true
  56.200    | is_lin_arith_rel _ = false
  56.201  
  56.202  fun is_lin_arith_type (_, ctxt) T =
  56.203 @@ -342,10 +342,10 @@
  56.204        else abstract_atom t cx
  56.205    | abstract_rel t cx = abstract_atom t cx
  56.206  
  56.207 -fun abstract_neg ((c as Const (@{const_name Not}, _)) $ t) cx = abstract_rel t cx |>> apply c
  56.208 +fun abstract_neg ((c as Const (\<^const_name>\<open>Not\<close>, _)) $ t) cx = abstract_rel t cx |>> apply c
  56.209    | abstract_neg t cx = abstract_rel t cx
  56.210  
  56.211 -fun abstract ((c as Const (@{const_name Trueprop}, _)) $ t) cx = abstract_neg t cx |>> apply c
  56.212 +fun abstract ((c as Const (\<^const_name>\<open>Trueprop\<close>, _)) $ t) cx = abstract_neg t cx |>> apply c
  56.213    | abstract t cx = abstract_atom t cx
  56.214  
  56.215  
  56.216 @@ -363,13 +363,13 @@
  56.217      (case head_of lhs of
  56.218        Const (a, _) =>
  56.219          member (op =)
  56.220 -         [@{const_name Orderings.max},
  56.221 -          @{const_name Orderings.min},
  56.222 -          @{const_name Groups.abs},
  56.223 -          @{const_name Groups.minus},
  56.224 +         [\<^const_name>\<open>Orderings.max\<close>,
  56.225 +          \<^const_name>\<open>Orderings.min\<close>,
  56.226 +          \<^const_name>\<open>Groups.abs\<close>,
  56.227 +          \<^const_name>\<open>Groups.minus\<close>,
  56.228            "Int.nat" (*DYNAMIC BINDING!*),
  56.229 -          @{const_name Rings.modulo},
  56.230 -          @{const_name Rings.divide}] a
  56.231 +          \<^const_name>\<open>Rings.modulo\<close>,
  56.232 +          \<^const_name>\<open>Rings.divide\<close>] a
  56.233      | _ =>
  56.234        (if Context_Position.is_visible ctxt then
  56.235          warning ("Lin. Arith.: wrong format for split rule " ^ Thm.string_of_thm ctxt thm)
  56.236 @@ -417,8 +417,7 @@
  56.237    (*   tn' --> ... --> t1' --> False  ,                                      *)
  56.238    (* where ti' = HOLogic.dest_Trueprop ti                                    *)
  56.239    fun REPEAT_DETERM_etac_rev_mp tms =
  56.240 -    fold (curry HOLogic.mk_imp) (map HOLogic.dest_Trueprop tms)
  56.241 -      @{term False}
  56.242 +    fold (curry HOLogic.mk_imp) (map HOLogic.dest_Trueprop tms) \<^term>\<open>False\<close>
  56.243    val split_thms  = filter (is_split_thm ctxt) (#splits (get_arith_data ctxt))
  56.244    val cmap        = Splitter.cmap_of_split_thms split_thms
  56.245    val goal_tm     = REPEAT_DETERM_etac_rev_mp terms
  56.246 @@ -441,72 +440,72 @@
  56.247      (* ignore all but the first possible split                               *)
  56.248      (case strip_comb split_term of
  56.249      (* ?P (max ?i ?j) = ((?i <= ?j --> ?P ?j) & (~ ?i <= ?j --> ?P ?i)) *)
  56.250 -      (Const (@{const_name Orderings.max}, _), [t1, t2]) =>
  56.251 +      (Const (\<^const_name>\<open>Orderings.max\<close>, _), [t1, t2]) =>
  56.252        let
  56.253          val rev_terms     = rev terms
  56.254          val terms1        = map (subst_term [(split_term, t1)]) rev_terms
  56.255          val terms2        = map (subst_term [(split_term, t2)]) rev_terms
  56.256 -        val t1_leq_t2     = Const (@{const_name Orderings.less_eq},
  56.257 +        val t1_leq_t2     = Const (\<^const_name>\<open>Orderings.less_eq\<close>,
  56.258                                      split_type --> split_type --> HOLogic.boolT) $ t1 $ t2
  56.259          val not_t1_leq_t2 = HOLogic.Not $ t1_leq_t2
  56.260 -        val not_false     = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  56.261 +        val not_false     = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  56.262          val subgoal1      = (HOLogic.mk_Trueprop t1_leq_t2) :: terms2 @ [not_false]
  56.263          val subgoal2      = (HOLogic.mk_Trueprop not_t1_leq_t2) :: terms1 @ [not_false]
  56.264        in
  56.265          SOME [(Ts, subgoal1), (Ts, subgoal2)]
  56.266        end
  56.267      (* ?P (min ?i ?j) = ((?i <= ?j --> ?P ?i) & (~ ?i <= ?j --> ?P ?j)) *)
  56.268 -    | (Const (@{const_name Orderings.min}, _), [t1, t2]) =>
  56.269 +    | (Const (\<^const_name>\<open>Orderings.min\<close>, _), [t1, t2]) =>
  56.270        let
  56.271          val rev_terms     = rev terms
  56.272          val terms1        = map (subst_term [(split_term, t1)]) rev_terms
  56.273          val terms2        = map (subst_term [(split_term, t2)]) rev_terms
  56.274 -        val t1_leq_t2     = Const (@{const_name Orderings.less_eq},
  56.275 +        val t1_leq_t2     = Const (\<^const_name>\<open>Orderings.less_eq\<close>,
  56.276                                      split_type --> split_type --> HOLogic.boolT) $ t1 $ t2
  56.277          val not_t1_leq_t2 = HOLogic.Not $ t1_leq_t2
  56.278 -        val not_false     = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  56.279 +        val not_false     = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  56.280          val subgoal1      = (HOLogic.mk_Trueprop t1_leq_t2) :: terms1 @ [not_false]
  56.281          val subgoal2      = (HOLogic.mk_Trueprop not_t1_leq_t2) :: terms2 @ [not_false]
  56.282        in
  56.283          SOME [(Ts, subgoal1), (Ts, subgoal2)]
  56.284        end
  56.285      (* ?P (abs ?a) = ((0 <= ?a --> ?P ?a) & (?a < 0 --> ?P (- ?a))) *)
  56.286 -    | (Const (@{const_name Groups.abs}, _), [t1]) =>
  56.287 +    | (Const (\<^const_name>\<open>Groups.abs\<close>, _), [t1]) =>
  56.288        let
  56.289          val rev_terms   = rev terms
  56.290          val terms1      = map (subst_term [(split_term, t1)]) rev_terms
  56.291 -        val terms2      = map (subst_term [(split_term, Const (@{const_name Groups.uminus},
  56.292 +        val terms2      = map (subst_term [(split_term, Const (\<^const_name>\<open>Groups.uminus\<close>,
  56.293                              split_type --> split_type) $ t1)]) rev_terms
  56.294 -        val zero        = Const (@{const_name Groups.zero}, split_type)
  56.295 -        val zero_leq_t1 = Const (@{const_name Orderings.less_eq},
  56.296 +        val zero        = Const (\<^const_name>\<open>Groups.zero\<close>, split_type)
  56.297 +        val zero_leq_t1 = Const (\<^const_name>\<open>Orderings.less_eq\<close>,
  56.298                              split_type --> split_type --> HOLogic.boolT) $ zero $ t1
  56.299 -        val t1_lt_zero  = Const (@{const_name Orderings.less},
  56.300 +        val t1_lt_zero  = Const (\<^const_name>\<open>Orderings.less\<close>,
  56.301                              split_type --> split_type --> HOLogic.boolT) $ t1 $ zero
  56.302 -        val not_false   = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  56.303 +        val not_false   = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  56.304          val subgoal1    = (HOLogic.mk_Trueprop zero_leq_t1) :: terms1 @ [not_false]
  56.305          val subgoal2    = (HOLogic.mk_Trueprop t1_lt_zero) :: terms2 @ [not_false]
  56.306        in
  56.307          SOME [(Ts, subgoal1), (Ts, subgoal2)]
  56.308        end
  56.309      (* ?P (?a - ?b) = ((?a < ?b --> ?P 0) & (ALL d. ?a = ?b + d --> ?P d)) *)
  56.310 -    | (Const (@{const_name Groups.minus}, _), [t1, t2]) =>
  56.311 +    | (Const (\<^const_name>\<open>Groups.minus\<close>, _), [t1, t2]) =>
  56.312        let
  56.313          (* "d" in the above theorem becomes a new bound variable after NNF   *)
  56.314          (* transformation, therefore some adjustment of indices is necessary *)
  56.315          val rev_terms       = rev terms
  56.316 -        val zero            = Const (@{const_name Groups.zero}, split_type)
  56.317 +        val zero            = Const (\<^const_name>\<open>Groups.zero\<close>, split_type)
  56.318          val d               = Bound 0
  56.319          val terms1          = map (subst_term [(split_term, zero)]) rev_terms
  56.320          val terms2          = map (subst_term [(incr_boundvars 1 split_term, d)])
  56.321                                  (map (incr_boundvars 1) rev_terms)
  56.322          val t1'             = incr_boundvars 1 t1
  56.323          val t2'             = incr_boundvars 1 t2
  56.324 -        val t1_lt_t2        = Const (@{const_name Orderings.less},
  56.325 +        val t1_lt_t2        = Const (\<^const_name>\<open>Orderings.less\<close>,
  56.326                                  split_type --> split_type --> HOLogic.boolT) $ t1 $ t2
  56.327 -        val t1_eq_t2_plus_d = Const (@{const_name HOL.eq}, split_type --> split_type --> HOLogic.boolT) $ t1' $
  56.328 -                                (Const (@{const_name Groups.plus},
  56.329 +        val t1_eq_t2_plus_d = Const (\<^const_name>\<open>HOL.eq\<close>, split_type --> split_type --> HOLogic.boolT) $ t1' $
  56.330 +                                (Const (\<^const_name>\<open>Groups.plus\<close>,
  56.331                                    split_type --> split_type --> split_type) $ t2' $ d)
  56.332 -        val not_false       = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  56.333 +        val not_false       = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  56.334          val subgoal1        = (HOLogic.mk_Trueprop t1_lt_t2) :: terms1 @ [not_false]
  56.335          val subgoal2        = (HOLogic.mk_Trueprop t1_eq_t2_plus_d) :: terms2 @ [not_false]
  56.336        in
  56.337 @@ -516,18 +515,18 @@
  56.338      | (Const ("Int.nat", _), (*DYNAMIC BINDING!*) [t1]) =>
  56.339        let
  56.340          val rev_terms   = rev terms
  56.341 -        val zero_int    = Const (@{const_name Groups.zero}, HOLogic.intT)
  56.342 -        val zero_nat    = Const (@{const_name Groups.zero}, HOLogic.natT)
  56.343 +        val zero_int    = Const (\<^const_name>\<open>Groups.zero\<close>, HOLogic.intT)
  56.344 +        val zero_nat    = Const (\<^const_name>\<open>Groups.zero\<close>, HOLogic.natT)
  56.345          val n           = Bound 0
  56.346          val terms1      = map (subst_term [(incr_boundvars 1 split_term, n)])
  56.347                              (map (incr_boundvars 1) rev_terms)
  56.348          val terms2      = map (subst_term [(split_term, zero_nat)]) rev_terms
  56.349          val t1'         = incr_boundvars 1 t1
  56.350 -        val t1_eq_nat_n = Const (@{const_name HOL.eq}, HOLogic.intT --> HOLogic.intT --> HOLogic.boolT) $ t1' $
  56.351 -                            (Const (@{const_name of_nat}, HOLogic.natT --> HOLogic.intT) $ n)
  56.352 -        val t1_lt_zero  = Const (@{const_name Orderings.less},
  56.353 +        val t1_eq_nat_n = Const (\<^const_name>\<open>HOL.eq\<close>, HOLogic.intT --> HOLogic.intT --> HOLogic.boolT) $ t1' $
  56.354 +                            (Const (\<^const_name>\<open>of_nat\<close>, HOLogic.natT --> HOLogic.intT) $ n)
  56.355 +        val t1_lt_zero  = Const (\<^const_name>\<open>Orderings.less\<close>,
  56.356                              HOLogic.intT --> HOLogic.intT --> HOLogic.boolT) $ t1 $ zero_int
  56.357 -        val not_false   = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  56.358 +        val not_false   = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  56.359          val subgoal1    = (HOLogic.mk_Trueprop t1_eq_nat_n) :: terms1 @ [not_false]
  56.360          val subgoal2    = (HOLogic.mk_Trueprop t1_lt_zero) :: terms2 @ [not_false]
  56.361        in
  56.362 @@ -536,10 +535,10 @@
  56.363      (* ?P ((?n::nat) mod (numeral ?k)) =
  56.364           ((numeral ?k = 0 --> ?P ?n) & (~ (numeral ?k = 0) -->
  56.365             (ALL i j. j < numeral ?k --> ?n = numeral ?k * i + j --> ?P j))) *)
  56.366 -    | (Const (@{const_name Rings.modulo}, Type ("fun", [@{typ nat}, _])), [t1, t2]) =>
  56.367 +    | (Const (\<^const_name>\<open>Rings.modulo\<close>, Type ("fun", [\<^typ>\<open>nat\<close>, _])), [t1, t2]) =>
  56.368        let
  56.369          val rev_terms               = rev terms
  56.370 -        val zero                    = Const (@{const_name Groups.zero}, split_type)
  56.371 +        val zero                    = Const (\<^const_name>\<open>Groups.zero\<close>, split_type)
  56.372          val i                       = Bound 1
  56.373          val j                       = Bound 0
  56.374          val terms1                  = map (subst_term [(split_term, t1)]) rev_terms
  56.375 @@ -547,17 +546,17 @@
  56.376                                          (map (incr_boundvars 2) rev_terms)
  56.377          val t1'                     = incr_boundvars 2 t1
  56.378          val t2'                     = incr_boundvars 2 t2
  56.379 -        val t2_eq_zero              = Const (@{const_name HOL.eq},
  56.380 +        val t2_eq_zero              = Const (\<^const_name>\<open>HOL.eq\<close>,
  56.381                                          split_type --> split_type --> HOLogic.boolT) $ t2 $ zero
  56.382 -        val t2_neq_zero             = HOLogic.mk_not (Const (@{const_name HOL.eq},
  56.383 +        val t2_neq_zero             = HOLogic.mk_not (Const (\<^const_name>\<open>HOL.eq\<close>,
  56.384                                          split_type --> split_type --> HOLogic.boolT) $ t2' $ zero)
  56.385 -        val j_lt_t2                 = Const (@{const_name Orderings.less},
  56.386 +        val j_lt_t2                 = Const (\<^const_name>\<open>Orderings.less\<close>,
  56.387                                          split_type --> split_type--> HOLogic.boolT) $ j $ t2'
  56.388 -        val t1_eq_t2_times_i_plus_j = Const (@{const_name HOL.eq}, split_type --> split_type --> HOLogic.boolT) $ t1' $
  56.389 -                                       (Const (@{const_name Groups.plus}, split_type --> split_type --> split_type) $
  56.390 -                                         (Const (@{const_name Groups.times},
  56.391 +        val t1_eq_t2_times_i_plus_j = Const (\<^const_name>\<open>HOL.eq\<close>, split_type --> split_type --> HOLogic.boolT) $ t1' $
  56.392 +                                       (Const (\<^const_name>\<open>Groups.plus\<close>, split_type --> split_type --> split_type) $
  56.393 +                                         (Const (\<^const_name>\<open>Groups.times\<close>,
  56.394                                             split_type --> split_type --> split_type) $ t2' $ i) $ j)
  56.395 -        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  56.396 +        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  56.397          val subgoal1                = (HOLogic.mk_Trueprop t2_eq_zero) :: terms1 @ [not_false]
  56.398          val subgoal2                = (map HOLogic.mk_Trueprop
  56.399                                          [t2_neq_zero, j_lt_t2, t1_eq_t2_times_i_plus_j])
  56.400 @@ -568,10 +567,10 @@
  56.401      (* ?P ((?n::nat) div (numeral ?k)) =
  56.402           ((numeral ?k = 0 --> ?P 0) & (~ (numeral ?k = 0) -->
  56.403             (ALL i j. j < numeral ?k --> ?n = numeral ?k * i + j --> ?P i))) *)
  56.404 -    | (Const (@{const_name Rings.divide}, Type ("fun", [@{typ nat}, _])), [t1, t2]) =>
  56.405 +    | (Const (\<^const_name>\<open>Rings.divide\<close>, Type ("fun", [\<^typ>\<open>nat\<close>, _])), [t1, t2]) =>
  56.406        let
  56.407          val rev_terms               = rev terms
  56.408 -        val zero                    = Const (@{const_name Groups.zero}, split_type)
  56.409 +        val zero                    = Const (\<^const_name>\<open>Groups.zero\<close>, split_type)
  56.410          val i                       = Bound 1
  56.411          val j                       = Bound 0
  56.412          val terms1                  = map (subst_term [(split_term, zero)]) rev_terms
  56.413 @@ -579,17 +578,17 @@
  56.414                                          (map (incr_boundvars 2) rev_terms)
  56.415          val t1'                     = incr_boundvars 2 t1
  56.416          val t2'                     = incr_boundvars 2 t2
  56.417 -        val t2_eq_zero              = Const (@{const_name HOL.eq},
  56.418 +        val t2_eq_zero              = Const (\<^const_name>\<open>HOL.eq\<close>,
  56.419                                          split_type --> split_type --> HOLogic.boolT) $ t2 $ zero
  56.420 -        val t2_neq_zero             = HOLogic.mk_not (Const (@{const_name HOL.eq},
  56.421 +        val t2_neq_zero             = HOLogic.mk_not (Const (\<^const_name>\<open>HOL.eq\<close>,
  56.422                                          split_type --> split_type --> HOLogic.boolT) $ t2' $ zero)
  56.423 -        val j_lt_t2                 = Const (@{const_name Orderings.less},
  56.424 +        val j_lt_t2                 = Const (\<^const_name>\<open>Orderings.less\<close>,
  56.425                                          split_type --> split_type--> HOLogic.boolT) $ j $ t2'
  56.426 -        val t1_eq_t2_times_i_plus_j = Const (@{const_name HOL.eq}, split_type --> split_type --> HOLogic.boolT) $ t1' $
  56.427 -                                       (Const (@{const_name Groups.plus}, split_type --> split_type --> split_type) $
  56.428 -                                         (Const (@{const_name Groups.times},
  56.429 +        val t1_eq_t2_times_i_plus_j = Const (\<^const_name>\<open>HOL.eq\<close>, split_type --> split_type --> HOLogic.boolT) $ t1' $
  56.430 +                                       (Const (\<^const_name>\<open>Groups.plus\<close>, split_type --> split_type --> split_type) $
  56.431 +                                         (Const (\<^const_name>\<open>Groups.times\<close>,
  56.432                                             split_type --> split_type --> split_type) $ t2' $ i) $ j)
  56.433 -        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  56.434 +        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  56.435          val subgoal1                = (HOLogic.mk_Trueprop t2_eq_zero) :: terms1 @ [not_false]
  56.436          val subgoal2                = (map HOLogic.mk_Trueprop
  56.437                                          [t2_neq_zero, j_lt_t2, t1_eq_t2_times_i_plus_j])
  56.438 @@ -605,11 +604,11 @@
  56.439            (numeral ?k < 0 -->
  56.440              (ALL i j.
  56.441                numeral ?k < j & j <= 0 & ?n = numeral ?k * i + j --> ?P j))) *)
  56.442 -    | (Const (@{const_name Rings.modulo},
  56.443 +    | (Const (\<^const_name>\<open>Rings.modulo\<close>,
  56.444          Type ("fun", [Type ("Int.int", []), _])), (*DYNAMIC BINDING!*) [t1, t2]) =>
  56.445        let
  56.446          val rev_terms               = rev terms
  56.447 -        val zero                    = Const (@{const_name Groups.zero}, split_type)
  56.448 +        val zero                    = Const (\<^const_name>\<open>Groups.zero\<close>, split_type)
  56.449          val i                       = Bound 1
  56.450          val j                       = Bound 0
  56.451          val terms1                  = map (subst_term [(split_term, t1)]) rev_terms
  56.452 @@ -617,25 +616,25 @@
  56.453                                          (map (incr_boundvars 2) rev_terms)
  56.454          val t1'                     = incr_boundvars 2 t1
  56.455          val t2'                     = incr_boundvars 2 t2
  56.456 -        val t2_eq_zero              = Const (@{const_name HOL.eq},
  56.457 +        val t2_eq_zero              = Const (\<^const_name>\<open>HOL.eq\<close>,
  56.458                                          split_type --> split_type --> HOLogic.boolT) $ t2 $ zero
  56.459 -        val zero_lt_t2              = Const (@{const_name Orderings.less},
  56.460 +        val zero_lt_t2              = Const (\<^const_name>\<open>Orderings.less\<close>,
  56.461                                          split_type --> split_type --> HOLogic.boolT) $ zero $ t2'
  56.462 -        val t2_lt_zero              = Const (@{const_name Orderings.less},
  56.463 +        val t2_lt_zero              = Const (\<^const_name>\<open>Orderings.less\<close>,
  56.464                                          split_type --> split_type --> HOLogic.boolT) $ t2' $ zero
  56.465 -        val zero_leq_j              = Const (@{const_name Orderings.less_eq},
  56.466 +        val zero_leq_j              = Const (\<^const_name>\<open>Orderings.less_eq\<close>,
  56.467                                          split_type --> split_type --> HOLogic.boolT) $ zero $ j
  56.468 -        val j_leq_zero              = Const (@{const_name Orderings.less_eq},
  56.469 +        val j_leq_zero              = Const (\<^const_name>\<open>Orderings.less_eq\<close>,
  56.470                                          split_type --> split_type --> HOLogic.boolT) $ j $ zero
  56.471 -        val j_lt_t2                 = Const (@{const_name Orderings.less},
  56.472 +        val j_lt_t2                 = Const (\<^const_name>\<open>Orderings.less\<close>,
  56.473                                          split_type --> split_type--> HOLogic.boolT) $ j $ t2'
  56.474 -        val t2_lt_j                 = Const (@{const_name Orderings.less},
  56.475 +        val t2_lt_j                 = Const (\<^const_name>\<open>Orderings.less\<close>,
  56.476                                          split_type --> split_type--> HOLogic.boolT) $ t2' $ j
  56.477 -        val t1_eq_t2_times_i_plus_j = Const (@{const_name HOL.eq}, split_type --> split_type --> HOLogic.boolT) $ t1' $
  56.478 -                                       (Const (@{const_name Groups.plus}, split_type --> split_type --> split_type) $
  56.479 -                                         (Const (@{const_name Groups.times},
  56.480 +        val t1_eq_t2_times_i_plus_j = Const (\<^const_name>\<open>HOL.eq\<close>, split_type --> split_type --> HOLogic.boolT) $ t1' $
  56.481 +                                       (Const (\<^const_name>\<open>Groups.plus\<close>, split_type --> split_type --> split_type) $
  56.482 +                                         (Const (\<^const_name>\<open>Groups.times\<close>,
  56.483                                             split_type --> split_type --> split_type) $ t2' $ i) $ j)
  56.484 -        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  56.485 +        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  56.486          val subgoal1                = (HOLogic.mk_Trueprop t2_eq_zero) :: terms1 @ [not_false]
  56.487          val subgoal2                = (map HOLogic.mk_Trueprop [zero_lt_t2, zero_leq_j])
  56.488                                          @ hd terms2_3
  56.489 @@ -659,11 +658,11 @@
  56.490            (numeral ?k < 0 -->
  56.491              (ALL i j.
  56.492                numeral ?k < j & j <= 0 & ?n = numeral ?k * i + j --> ?P i))) *)
  56.493 -    | (Const (@{const_name Rings.divide},
  56.494 +    | (Const (\<^const_name>\<open>Rings.divide\<close>,
  56.495          Type ("fun", [Type ("Int.int", []), _])), (*DYNAMIC BINDING!*) [t1, t2]) =>
  56.496        let
  56.497          val rev_terms               = rev terms
  56.498 -        val zero                    = Const (@{const_name Groups.zero}, split_type)
  56.499 +        val zero                    = Const (\<^const_name>\<open>Groups.zero\<close>, split_type)
  56.500          val i                       = Bound 1
  56.501          val j                       = Bound 0
  56.502          val terms1                  = map (subst_term [(split_term, zero)]) rev_terms
  56.503 @@ -671,25 +670,25 @@
  56.504                                          (map (incr_boundvars 2) rev_terms)
  56.505          val t1'                     = incr_boundvars 2 t1
  56.506          val t2'                     = incr_boundvars 2 t2
  56.507 -        val t2_eq_zero              = Const (@{const_name HOL.eq},
  56.508 +        val t2_eq_zero              = Const (\<^const_name>\<open>HOL.eq\<close>,
  56.509                                          split_type --> split_type --> HOLogic.boolT) $ t2 $ zero
  56.510 -        val zero_lt_t2              = Const (@{const_name Orderings.less},
  56.511 +        val zero_lt_t2              = Const (\<^const_name>\<open>Orderings.less\<close>,
  56.512                                          split_type --> split_type --> HOLogic.boolT) $ zero $ t2'
  56.513 -        val t2_lt_zero              = Const (@{const_name Orderings.less},
  56.514 +        val t2_lt_zero              = Const (\<^const_name>\<open>Orderings.less\<close>,
  56.515                                          split_type --> split_type --> HOLogic.boolT) $ t2' $ zero
  56.516 -        val zero_leq_j              = Const (@{const_name Orderings.less_eq},
  56.517 +        val zero_leq_j              = Const (\<^const_name>\<open>Orderings.less_eq\<close>,
  56.518                                          split_type --> split_type --> HOLogic.boolT) $ zero $ j
  56.519 -        val j_leq_zero              = Const (@{const_name Orderings.less_eq},
  56.520 +        val j_leq_zero              = Const (\<^const_name>\<open>Orderings.less_eq\<close>,
  56.521                                          split_type --> split_type --> HOLogic.boolT) $ j $ zero
  56.522 -        val j_lt_t2                 = Const (@{const_name Orderings.less},
  56.523 +        val j_lt_t2                 = Const (\<^const_name>\<open>Orderings.less\<close>,
  56.524                                          split_type --> split_type--> HOLogic.boolT) $ j $ t2'
  56.525 -        val t2_lt_j                 = Const (@{const_name Orderings.less},
  56.526 +        val t2_lt_j                 = Const (\<^const_name>\<open>Orderings.less\<close>,
  56.527                                          split_type --> split_type--> HOLogic.boolT) $ t2' $ j
  56.528 -        val t1_eq_t2_times_i_plus_j = Const (@{const_name HOL.eq}, split_type --> split_type --> HOLogic.boolT) $ t1' $
  56.529 -                                       (Const (@{const_name Groups.plus}, split_type --> split_type --> split_type) $
  56.530 -                                         (Const (@{const_name Groups.times},
  56.531 +        val t1_eq_t2_times_i_plus_j = Const (\<^const_name>\<open>HOL.eq\<close>, split_type --> split_type --> HOLogic.boolT) $ t1' $
  56.532 +                                       (Const (\<^const_name>\<open>Groups.plus\<close>, split_type --> split_type --> split_type) $
  56.533 +                                         (Const (\<^const_name>\<open>Groups.times\<close>,
  56.534                                             split_type --> split_type --> split_type) $ t2' $ i) $ j)
  56.535 -        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ @{term False})
  56.536 +        val not_false               = HOLogic.mk_Trueprop (HOLogic.Not $ \<^term>\<open>False\<close>)
  56.537          val subgoal1                = (HOLogic.mk_Trueprop t2_eq_zero) :: terms1 @ [not_false]
  56.538          val subgoal2                = (map HOLogic.mk_Trueprop [zero_lt_t2, zero_leq_j])
  56.539                                          @ hd terms2_3
  56.540 @@ -734,7 +733,7 @@
  56.541  
  56.542  fun negated_term_occurs_positively (terms : term list) : bool =
  56.543    exists
  56.544 -    (fn (Trueprop $ (Const (@{const_name Not}, _) $ t)) =>
  56.545 +    (fn (Trueprop $ (Const (\<^const_name>\<open>Not\<close>, _) $ t)) =>
  56.546        member Envir.aeconv terms (Trueprop $ t)
  56.547        | _ => false)
  56.548      terms;
  56.549 @@ -959,9 +958,9 @@
  56.550  val global_setup =
  56.551    map_theory_simpset (fn ctxt => ctxt
  56.552      addSolver (mk_solver "lin_arith" (add_arith_facts #> Fast_Arith.prems_lin_arith_tac))) #>
  56.553 -  Attrib.setup @{binding arith_split} (Scan.succeed (Thm.declaration_attribute add_split))
  56.554 +  Attrib.setup \<^binding>\<open>arith_split\<close> (Scan.succeed (Thm.declaration_attribute add_split))
  56.555      "declaration of split rules for arithmetic procedure" #>
  56.556 -  Method.setup @{binding linarith}
  56.557 +  Method.setup \<^binding>\<open>linarith\<close>
  56.558      (Scan.succeed (fn ctxt =>
  56.559        METHOD (fn facts =>
  56.560          HEADGOAL
  56.561 @@ -972,7 +971,7 @@
  56.562  
  56.563  val setup =
  56.564    init_arith_data
  56.565 -  #> add_discrete_type @{type_name nat}
  56.566 +  #> add_discrete_type \<^type_name>\<open>nat\<close>
  56.567    #> add_lessD @{thm Suc_leI}
  56.568    #> add_simps (@{thms simp_thms} @ @{thms ring_distribs} @ [@{thm if_True}, @{thm if_False},
  56.569        @{thm minus_diff_eq},
  56.570 @@ -982,11 +981,11 @@
  56.571    #> add_simps [@{thm add_Suc}, @{thm add_Suc_right}, @{thm nat.inject},
  56.572        @{thm Suc_le_mono}, @{thm Suc_less_eq}, @{thm Zero_not_Suc},
  56.573        @{thm Suc_not_Zero}, @{thm le_0_eq}, @{thm One_nat_def}]
  56.574 -  #> add_simprocs [@{simproc group_cancel_add}, @{simproc group_cancel_diff},
  56.575 -      @{simproc group_cancel_eq}, @{simproc group_cancel_le},
  56.576 -      @{simproc group_cancel_less}]
  56.577 +  #> add_simprocs [\<^simproc>\<open>group_cancel_add\<close>, \<^simproc>\<open>group_cancel_diff\<close>,
  56.578 +      \<^simproc>\<open>group_cancel_eq\<close>, \<^simproc>\<open>group_cancel_le\<close>,
  56.579 +      \<^simproc>\<open>group_cancel_less\<close>]
  56.580       (*abel_cancel helps it work in abstract algebraic domains*)
  56.581 -  #> add_simprocs [@{simproc nateq_cancel_sums},@{simproc natless_cancel_sums},
  56.582 -      @{simproc natle_cancel_sums}];
  56.583 +  #> add_simprocs [\<^simproc>\<open>nateq_cancel_sums\<close>,\<^simproc>\<open>natless_cancel_sums\<close>,
  56.584 +      \<^simproc>\<open>natle_cancel_sums\<close>];
  56.585  
  56.586  end;
    57.1 --- a/src/HOL/Tools/monomorph.ML	Wed Dec 06 16:01:15 2017 +0100
    57.2 +++ b/src/HOL/Tools/monomorph.ML	Wed Dec 06 21:01:01 2017 +0100
    57.3 @@ -63,16 +63,16 @@
    57.4  
    57.5  (* configuration options *)
    57.6  
    57.7 -val max_rounds = Attrib.setup_config_int @{binding monomorph_max_rounds} (K 5)
    57.8 +val max_rounds = Attrib.setup_config_int \<^binding>\<open>monomorph_max_rounds\<close> (K 5)
    57.9  
   57.10  val max_new_instances =
   57.11 -  Attrib.setup_config_int @{binding monomorph_max_new_instances} (K 500)
   57.12 +  Attrib.setup_config_int \<^binding>\<open>monomorph_max_new_instances\<close> (K 500)
   57.13  
   57.14  val max_thm_instances =
   57.15 -  Attrib.setup_config_int @{binding monomorph_max_thm_instances} (K 20)
   57.16 +  Attrib.setup_config_int \<^binding>\<open>monomorph_max_thm_instances\<close> (K 20)
   57.17  
   57.18  val max_new_const_instances_per_round =
   57.19 -  Attrib.setup_config_int @{binding monomorph_max_new_const_instances_per_round} (K 5)
   57.20 +  Attrib.setup_config_int \<^binding>\<open>monomorph_max_new_const_instances_per_round\<close> (K 5)
   57.21  
   57.22  fun limit_rounds ctxt f =
   57.23    let
    58.1 --- a/src/HOL/Tools/nat_arith.ML	Wed Dec 06 16:01:15 2017 +0100
    58.2 +++ b/src/HOL/Tools/nat_arith.ML	Wed Dec 06 21:01:01 2017 +0100
    58.3 @@ -30,11 +30,11 @@
    58.4      [Conv.rewr_conv (Library.foldl (op RS) (rule0, path)),
    58.5       Conv.arg_conv (Raw_Simplifier.rewrite ctxt false norm_rules)]
    58.6  
    58.7 -fun add_atoms path (Const (@{const_name Groups.plus}, _) $ x $ y) =
    58.8 +fun add_atoms path (Const (\<^const_name>\<open>Groups.plus\<close>, _) $ x $ y) =
    58.9        add_atoms (add1::path) x #> add_atoms (add2::path) y
   58.10 -  | add_atoms path (Const (@{const_name Nat.Suc}, _) $ x) =
   58.11 +  | add_atoms path (Const (\<^const_name>\<open>Nat.Suc\<close>, _) $ x) =
   58.12        add_atoms (suc1::path) x
   58.13 -  | add_atoms _ (Const (@{const_name Groups.zero}, _)) = I
   58.14 +  | add_atoms _ (Const (\<^const_name>\<open>Groups.zero\<close>, _)) = I
   58.15    | add_atoms path x = cons (x, path)
   58.16  
   58.17  fun atoms t = add_atoms [] t []
    59.1 --- a/src/HOL/Tools/record.ML	Wed Dec 06 16:01:15 2017 +0100
    59.2 +++ b/src/HOL/Tools/record.ML	Wed Dec 06 21:01:01 2017 +0100
    59.3 @@ -73,7 +73,7 @@
    59.4  val iso_tuple_intro = @{thm isomorphic_tuple_intro};
    59.5  val iso_tuple_intros = Tactic.build_net @{thms isomorphic_tuple.intros};
    59.6  
    59.7 -val tuple_iso_tuple = (@{const_name Record.tuple_iso_tuple}, @{thm tuple_iso_tuple});
    59.8 +val tuple_iso_tuple = (\<^const_name>\<open>Record.tuple_iso_tuple\<close>, @{thm tuple_iso_tuple});
    59.9  
   59.10  structure Iso_Tuple_Thms = Theory_Data
   59.11  (
   59.12 @@ -111,13 +111,13 @@
   59.13    let
   59.14      val (leftT, rightT) = (fastype_of left, fastype_of right);
   59.15      val prodT = HOLogic.mk_prodT (leftT, rightT);
   59.16 -    val isomT = Type (@{type_name tuple_isomorphism}, [prodT, leftT, rightT]);
   59.17 +    val isomT = Type (\<^type_name>\<open>tuple_isomorphism\<close>, [prodT, leftT, rightT]);
   59.18    in
   59.19 -    Const (@{const_name Record.iso_tuple_cons}, isomT --> leftT --> rightT --> prodT) $
   59.20 +    Const (\<^const_name>\<open>Record.iso_tuple_cons\<close>, isomT --> leftT --> rightT --> prodT) $
   59.21        Const (fst tuple_iso_tuple, isomT) $ left $ right
   59.22    end;
   59.23  
   59.24 -fun dest_cons_tuple (Const (@{const_name Record.iso_tuple_cons}, _) $ Const _ $ t $ u) = (t, u)
   59.25 +fun dest_cons_tuple (Const (\<^const_name>\<open>Record.iso_tuple_cons\<close>, _) $ Const _ $ t $ u) = (t, u)
   59.26    | dest_cons_tuple t = raise TERM ("dest_cons_tuple", [t]);
   59.27  
   59.28  fun add_iso_tuple_type overloaded (b, alphas) (leftT, rightT) thy =
   59.29 @@ -149,7 +149,7 @@
   59.30          [((Binding.concealed (Thm.def_binding isom_binding), Logic.mk_equals (isom, body)), [])];
   59.31  
   59.32      val iso_tuple = isom_def RS (abs_inverse RS (rep_inject RS iso_tuple_intro));
   59.33 -    val cons = Const (@{const_name Record.iso_tuple_cons}, isomT --> leftT --> rightT --> absT);
   59.34 +    val cons = Const (\<^const_name>\<open>Record.iso_tuple_cons\<close>, isomT --> leftT --> rightT --> absT);
   59.35  
   59.36      val thm_thy =
   59.37        cdef_thy
   59.38 @@ -171,8 +171,8 @@
   59.39        val goal' = Envir.beta_eta_contract goal;
   59.40        val is =
   59.41          (case goal' of
   59.42 -          Const (@{const_name Trueprop}, _) $
   59.43 -            (Const (@{const_name isomorphic_tuple}, _) $ Const is) => is
   59.44 +          Const (\<^const_name>\<open>Trueprop\<close>, _) $
   59.45 +            (Const (\<^const_name>\<open>isomorphic_tuple\<close>, _) $ Const is) => is
   59.46          | _ => err "unexpected goal format" goal');
   59.47        val isthm =
   59.48          (case Symtab.lookup isthms (#1 is) of
   59.49 @@ -202,7 +202,7 @@
   59.50  val updacc_cong_triv = @{thm update_accessor_cong_assist_triv};
   59.51  val updacc_cong_from_eq = @{thm iso_tuple_update_accessor_cong_from_eq};
   59.52  
   59.53 -val codegen = Attrib.setup_config_bool @{binding record_codegen} (K true);
   59.54 +val codegen = Attrib.setup_config_bool \<^binding>\<open>record_codegen\<close> (K true);
   59.55  
   59.56  
   59.57  (** name components **)
   59.58 @@ -229,7 +229,7 @@
   59.59  
   59.60  (* timing *)
   59.61  
   59.62 -val timing = Attrib.setup_config_bool @{binding record_timing} (K false);
   59.63 +val timing = Attrib.setup_config_bool \<^binding>\<open>record_timing\<close> (K false);
   59.64  fun timeit_msg ctxt s x = if Config.get ctxt timing then (warning s; timeit x) else x ();
   59.65  fun timing_msg ctxt s = if Config.get ctxt timing then warning s else ();
   59.66  
   59.67 @@ -628,11 +628,11 @@
   59.68    | split_args (_ :: _) [] = raise Fail "expecting more fields"
   59.69    | split_args _ _ = ([], []);
   59.70  
   59.71 -fun field_type_tr ((Const (@{syntax_const "_field_type"}, _) $ Const (name, _) $ arg)) =
   59.72 +fun field_type_tr ((Const (\<^syntax_const>\<open>_field_type\<close>, _) $ Const (name, _) $ arg)) =
   59.73        (name, arg)
   59.74    | field_type_tr t = raise TERM ("field_type_tr", [t]);
   59.75  
   59.76 -fun field_types_tr (Const (@{syntax_const "_field_types"}, _) $ t $ u) =
   59.77 +fun field_types_tr (Const (\<^syntax_const>\<open>_field_types\<close>, _) $ t $ u) =
   59.78        field_type_tr t :: field_types_tr u
   59.79    | field_types_tr t = [field_type_tr t];
   59.80  
   59.81 @@ -673,17 +673,17 @@
   59.82      mk_ext (field_types_tr t)
   59.83    end;
   59.84  
   59.85 -fun record_type_tr ctxt [t] = record_field_types_tr (Syntax.const @{type_syntax unit}) ctxt t
   59.86 +fun record_type_tr ctxt [t] = record_field_types_tr (Syntax.const \<^type_syntax>\<open>unit\<close>) ctxt t
   59.87    | record_type_tr _ ts = raise TERM ("record_type_tr", ts);
   59.88  
   59.89  fun record_type_scheme_tr ctxt [t, more] = record_field_types_tr more ctxt t
   59.90    | record_type_scheme_tr _ ts = raise TERM ("record_type_scheme_tr", ts);
   59.91  
   59.92  
   59.93 -fun field_tr ((Const (@{syntax_const "_field"}, _) $ Const (name, _) $ arg)) = (name, arg)
   59.94 +fun field_tr ((Const (\<^syntax_const>\<open>_field\<close>, _) $ Const (name, _) $ arg)) = (name, arg)
   59.95    | field_tr t = raise TERM ("field_tr", [t]);
   59.96  
   59.97 -fun fields_tr (Const (@{syntax_const "_fields"}, _) $ t $ u) = field_tr t :: fields_tr u
   59.98 +fun fields_tr (Const (\<^syntax_const>\<open>_fields\<close>, _) $ t $ u) = field_tr t :: fields_tr u
   59.99    | fields_tr t = [field_tr t];
  59.100  
  59.101  fun record_fields_tr more ctxt t =
  59.102 @@ -706,18 +706,18 @@
  59.103        | mk_ext [] = more;
  59.104    in mk_ext (fields_tr t) end;
  59.105  
  59.106 -fun record_tr ctxt [t] = record_fields_tr (Syntax.const @{const_syntax Unity}) ctxt t
  59.107 +fun record_tr ctxt [t] = record_fields_tr (Syntax.const \<^const_syntax>\<open>Unity\<close>) ctxt t
  59.108    | record_tr _ ts = raise TERM ("record_tr", ts);
  59.109  
  59.110  fun record_scheme_tr ctxt [t, more] = record_fields_tr more ctxt t
  59.111    | record_scheme_tr _ ts = raise TERM ("record_scheme_tr", ts);
  59.112  
  59.113  
  59.114 -fun field_update_tr (Const (@{syntax_const "_field_update"}, _) $ Const (name, _) $ arg) =
  59.115 +fun field_update_tr (Const (\<^syntax_const>\<open>_field_update\<close>, _) $ Const (name, _) $ arg) =
  59.116        Syntax.const (suffix updateN name) $ Abs (Name.uu_, dummyT, arg)
  59.117    | field_update_tr t = raise TERM ("field_update_tr", [t]);
  59.118  
  59.119 -fun field_updates_tr (Const (@{syntax_const "_field_updates"}, _) $ t $ u) =
  59.120 +fun field_updates_tr (Const (\<^syntax_const>\<open>_field_updates\<close>, _) $ t $ u) =
  59.121        field_update_tr t :: field_updates_tr u
  59.122    | field_updates_tr t = [field_update_tr t];
  59.123  
  59.124 @@ -729,28 +729,28 @@
  59.125  val _ =
  59.126    Theory.setup
  59.127     (Sign.parse_translation
  59.128 -     [(@{syntax_const "_record_update"}, K record_update_tr),
  59.129 -      (@{syntax_const "_record"}, record_tr),
  59.130 -      (@{syntax_const "_record_scheme"}, record_scheme_tr),
  59.131 -      (@{syntax_const "_record_type"}, record_type_tr),
  59.132 -      (@{syntax_const "_record_type_scheme"}, record_type_scheme_tr)]);
  59.133 +     [(\<^syntax_const>\<open>_record_update\<close>, K record_update_tr),
  59.134 +      (\<^syntax_const>\<open>_record\<close>, record_tr),
  59.135 +      (\<^syntax_const>\<open>_record_scheme\<close>, record_scheme_tr),
  59.136 +      (\<^syntax_const>\<open>_record_type\<close>, record_type_tr),
  59.137 +      (\<^syntax_const>\<open>_record_type_scheme\<close>, record_type_scheme_tr)]);
  59.138  
  59.139  end;
  59.140  
  59.141  
  59.142  (* print translations *)
  59.143  
  59.144 -val type_abbr = Attrib.setup_config_bool @{binding record_type_abbr} (K true);
  59.145 -val type_as_fields = Attrib.setup_config_bool @{binding record_type_as_fields} (K true);
  59.146 +val type_abbr = Attrib.setup_config_bool \<^binding>\<open>record_type_abbr\<close> (K true);
  59.147 +val type_as_fields = Attrib.setup_config_bool \<^binding>\<open>record_type_as_fields\<close> (K true);
  59.148  
  59.149  
  59.150  local
  59.151  
  59.152  (* FIXME early extern (!??) *)
  59.153  (* FIXME Syntax.free (??) *)
  59.154 -fun field_type_tr' (c, t) = Syntax.const @{syntax_const "_field_type"} $ Syntax.const c $ t;
  59.155 -
  59.156 -fun field_types_tr' (t, u) = Syntax.const @{syntax_const "_field_types"} $ t $ u;
  59.157 +fun field_type_tr' (c, t) = Syntax.const \<^syntax_const>\<open>_field_type\<close> $ Syntax.const c $ t;
  59.158 +
  59.159 +fun field_types_tr' (t, u) = Syntax.const \<^syntax_const>\<open>_field_types\<close> $ t $ u;
  59.160  
  59.161  fun record_type_tr' ctxt t =
  59.162    let
  59.163 @@ -791,9 +791,9 @@
  59.164          (map (field_type_tr' o apsnd (Syntax_Phases.term_of_typ ctxt)) fields);
  59.165    in
  59.166      if not (Config.get ctxt type_as_fields) orelse null fields then raise Match
  59.167 -    else if moreT = HOLogic.unitT then Syntax.const @{syntax_const "_record_type"} $ u
  59.168 +    else if moreT = HOLogic.unitT then Syntax.const \<^syntax_const>\<open>_record_type\<close> $ u
  59.169      else
  59.170 -      Syntax.const @{syntax_const "_record_type_scheme"} $ u $
  59.171 +      Syntax.const \<^syntax_const>\<open>_record_type_scheme\<close> $ u $
  59.172          Syntax_Phases.term_of_typ ctxt moreT
  59.173    end;
  59.174  
  59.175 @@ -847,8 +847,8 @@
  59.176  local
  59.177  
  59.178  (* FIXME Syntax.free (??) *)
  59.179 -fun field_tr' (c, t) = Syntax.const @{syntax_const "_field"} $ Syntax.const c $ t;
  59.180 -fun fields_tr' (t, u) = Syntax.const @{syntax_const "_fields"} $ t $ u;
  59.181 +fun field_tr' (c, t) = Syntax.const \<^syntax_const>\<open>_field\<close> $ Syntax.const c $ t;
  59.182 +fun fields_tr' (t, u) = Syntax.const \<^syntax_const>\<open>_fields\<close> $ t $ u;
  59.183  
  59.184  fun record_tr' ctxt t =
  59.185    let
  59.186 @@ -876,8 +876,8 @@
  59.187      val u = foldr1 fields_tr' (map field_tr' fields);
  59.188    in
  59.189      (case more of
  59.190 -      Const (@{const_syntax Unity}, _) => Syntax.const @{syntax_const "_record"} $ u
  59.191 -    | _ => Syntax.const @{syntax_const "_record_scheme"} $ u $ more)
  59.192 +      Const (\<^const_syntax>\<open>Unity\<close>, _) => Syntax.const \<^syntax_const>\<open>_record\<close> $ u
  59.193 +    | _ => Syntax.const \<^syntax_const>\<open>_record_scheme\<close> $ u $ more)
  59.194    end;
  59.195  
  59.196  in
  59.197 @@ -903,7 +903,7 @@
  59.198          SOME name =>
  59.199            (case try Syntax_Trans.const_abs_tr' k of
  59.200              SOME t =>
  59.201 -              apfst (cons (Syntax.const @{syntax_const "_field_update"} $ Syntax.free name $ t))
  59.202 +              apfst (cons (Syntax.const \<^syntax_const>\<open>_field_update\<close> $ Syntax.free name $ t))
  59.203                  (field_updates_tr' ctxt u)
  59.204            | NONE => ([], tm))
  59.205        | NONE => ([], tm))
  59.206 @@ -913,8 +913,8 @@
  59.207    (case field_updates_tr' ctxt tm of
  59.208      ([], _) => raise Match
  59.209    | (ts, u) =>
  59.210 -      Syntax.const @{syntax_const "_record_update"} $ u $
  59.211 -        foldr1 (fn (v, w) => Syntax.const @{syntax_const "_field_updates"} $ v $ w) (rev ts));
  59.212 +      Syntax.const \<^syntax_const>\<open>_record_update\<close> $ u $
  59.213 +        foldr1 (fn (v, w) => Syntax.const \<^syntax_const>\<open>_field_updates\<close> $ v $ w) (rev ts));
  59.214  
  59.215  in
  59.216  
  59.217 @@ -938,7 +938,7 @@
  59.218  
  59.219  fun mk_comp_id f =
  59.220    let val T = range_type (fastype_of f)
  59.221 -  in HOLogic.mk_comp (Const (@{const_name Fun.id}, T --> T), f) end;
  59.222 +  in HOLogic.mk_comp (Const (\<^const_name>\<open>Fun.id\<close>, T --> T), f) end;
  59.223  
  59.224  fun get_upd_funs (upd $ _ $ t) = upd :: get_upd_funs t
  59.225    | get_upd_funs _ = [];
  59.226 @@ -1063,7 +1063,7 @@
  59.227  *)
  59.228  val simproc =
  59.229    Simplifier.make_simproc @{context} "record"
  59.230 -   {lhss = [@{term "x::'a::{}"}],
  59.231 +   {lhss = [\<^term>\<open>x::'a::{}\<close>],
  59.232      proc = fn _ => fn ctxt => fn ct =>
  59.233        let
  59.234          val thy = Proof_Context.theory_of ctxt;
  59.235 @@ -1147,7 +1147,7 @@
  59.236    both a more update and an update to a field within it.*)
  59.237  val upd_simproc =
  59.238    Simplifier.make_simproc @{context} "record_upd"
  59.239 -   {lhss = [@{term "x::'a::{}"}],
  59.240 +   {lhss = [\<^term>\<open>x::'a::{}\<close>],
  59.241      proc = fn _ => fn ctxt => fn ct =>
  59.242        let
  59.243          val thy = Proof_Context.theory_of ctxt;
  59.244 @@ -1218,7 +1218,7 @@
  59.245                  val (isnoop, skelf') = is_upd_noop s f term;
  59.246                  val funT = domain_type T;
  59.247                  fun mk_comp_local (f, f') =
  59.248 -                  Const (@{const_name Fun.comp}, funT --> funT --> funT) $ f $ f';
  59.249 +                  Const (\<^const_name>\<open>Fun.comp\<close>, funT --> funT --> funT) $ f $ f';
  59.250                in
  59.251                  if isnoop then
  59.252                    (upd $ skelf' $ lhs, rhs, vars,
  59.253 @@ -1270,10 +1270,10 @@
  59.254  *)
  59.255  val eq_simproc =
  59.256    Simplifier.make_simproc @{context} "record_eq"
  59.257 -   {lhss = [@{term "r = s"}],
  59.258 +   {lhss = [\<^term>\<open>r = s\<close>],
  59.259      proc = fn _ => fn ctxt => fn ct =>
  59.260        (case Thm.term_of ct of
  59.261 -        Const (@{const_name HOL.eq}, Type (_, [T, _])) $ _ $ _ =>
  59.262 +        Const (\<^const_name>\<open>HOL.eq\<close>, Type (_, [T, _])) $ _ $ _ =>
  59.263            (case rec_id ~1 T of
  59.264              "" => NONE
  59.265            | name =>
  59.266 @@ -1292,13 +1292,13 @@
  59.267      P t > 0: split up to given bound of record extensions.*)
  59.268  fun split_simproc P =
  59.269    Simplifier.make_simproc @{context} "record_split"
  59.270 -   {lhss = [@{term "x::'a::{}"}],
  59.271 +   {lhss = [\<^term>\<open>x::'a::{}\<close>],
  59.272      proc = fn _ => fn ctxt => fn ct =>
  59.273        (case Thm.term_of ct of
  59.274          Const (quantifier, Type (_, [Type (_, [T, _]), _])) $ _ =>
  59.275 -          if quantifier = @{const_name Pure.all} orelse
  59.276 -            quantifier = @{const_name All} orelse
  59.277 -            quantifier = @{const_name Ex}
  59.278 +          if quantifier = \<^const_name>\<open>Pure.all\<close> orelse
  59.279 +            quantifier = \<^const_name>\<open>All\<close> orelse
  59.280 +            quantifier = \<^const_name>\<open>Ex\<close>
  59.281            then
  59.282              (case rec_id ~1 T of
  59.283                "" => NONE
  59.284 @@ -1310,9 +1310,9 @@
  59.285                      | SOME (all_thm, All_thm, Ex_thm, _) =>
  59.286                          SOME
  59.287                            (case quantifier of
  59.288 -                            @{const_name Pure.all} => all_thm
  59.289 -                          | @{const_name All} => All_thm RS @{thm eq_reflection}
  59.290 -                          | @{const_name Ex} => Ex_thm RS @{thm eq_reflection}
  59.291 +                            \<^const_name>\<open>Pure.all\<close> => all_thm
  59.292 +                          | \<^const_name>\<open>All\<close> => All_thm RS @{thm eq_reflection}
  59.293 +                          | \<^const_name>\<open>Ex\<close> => Ex_thm RS @{thm eq_reflection}
  59.294                            | _ => raise Fail "split_simproc"))
  59.295                    else NONE
  59.296                  end)
  59.297 @@ -1321,7 +1321,7 @@
  59.298  
  59.299  val ex_sel_eq_simproc =
  59.300    Simplifier.make_simproc @{context} "ex_sel_eq"
  59.301 -   {lhss = [@{term "Ex t"}],
  59.302 +   {lhss = [\<^term>\<open>Ex t\<close>],
  59.303      proc = fn _ => fn ctxt => fn ct =>
  59.304        let
  59.305          val thy = Proof_Context.theory_of ctxt;
  59.306 @@ -1335,23 +1335,23 @@
  59.307                  else raise TERM ("", [x]);
  59.308                val sel' = Const (sel, Tsel) $ Bound 0;
  59.309                val (l, r) = if lr then (sel', x') else (x', sel');
  59.310 -            in Const (@{const_name HOL.eq}, Teq) $ l $ r end
  59.311 +            in Const (\<^const_name>\<open>HOL.eq\<close>, Teq) $ l $ r end
  59.312            else raise TERM ("", [Const (sel, Tsel)]);
  59.313  
  59.314 -        fun dest_sel_eq (Const (@{const_name HOL.eq}, Teq) $ (Const (sel, Tsel) $ Bound 0) $ X) =
  59.315 +        fun dest_sel_eq (Const (\<^const_name>\<open>HOL.eq\<close>, Teq) $ (Const (sel, Tsel) $ Bound 0) $ X) =
  59.316                (true, Teq, (sel, Tsel), X)
  59.317 -          | dest_sel_eq (Const (@{const_name HOL.eq}, Teq) $ X $ (Const (sel, Tsel) $ Bound 0)) =
  59.318 +          | dest_sel_eq (Const (\<^const_name>\<open>HOL.eq\<close>, Teq) $ X $ (Const (sel, Tsel) $ Bound 0)) =
  59.319                (false, Teq, (sel, Tsel), X)
  59.320            | dest_sel_eq _ = raise TERM ("", []);
  59.321        in
  59.322          (case t of
  59.323 -          Const (@{const_name Ex}, Tex) $ Abs (s, T, t) =>
  59.324 +          Const (\<^const_name>\<open>Ex\<close>, Tex) $ Abs (s, T, t) =>
  59.325             (let
  59.326               val eq = mkeq (dest_sel_eq t) 0;
  59.327               val prop =
  59.328                 Logic.list_all ([("r", T)],
  59.329                   Logic.mk_equals
  59.330 -                  (Const (@{const_name Ex}, Tex) $ Abs (s, T, eq), @{term True}));
  59.331 +                  (Const (\<^const_name>\<open>Ex\<close>, Tex) $ Abs (s, T, eq), \<^term>\<open>True\<close>));
  59.332              in
  59.333                SOME (Goal.prove_sorry_global thy [] [] prop
  59.334                  (fn _ => simp_tac (put_simpset (get_simpset thy) ctxt
  59.335 @@ -1379,7 +1379,7 @@
  59.336  
  59.337      val has_rec = exists_Const
  59.338        (fn (s, Type (_, [Type (_, [T, _]), _])) =>
  59.339 -          (s = @{const_name Pure.all} orelse s = @{const_name All} orelse s = @{const_name Ex})
  59.340 +          (s = \<^const_name>\<open>Pure.all\<close> orelse s = \<^const_name>\<open>All\<close> orelse s = \<^const_name>\<open>Ex\<close>)
  59.341              andalso is_recT T
  59.342          | _ => false);
  59.343  
  59.344 @@ -1427,11 +1427,11 @@
  59.345  
  59.346      val has_rec = exists_Const
  59.347        (fn (s, Type (_, [Type (_, [T, _]), _])) =>
  59.348 -          (s = @{const_name Pure.all} orelse s = @{const_name All}) andalso is_recT T
  59.349 +          (s = \<^const_name>\<open>Pure.all\<close> orelse s = \<^const_name>\<open>All\<close>) andalso is_recT T
  59.350          | _ => false);
  59.351  
  59.352 -    fun is_all (Const (@{const_name Pure.all}, _) $ _) = ~1
  59.353 -      | is_all (Const (@{const_name All}, _) $ _) = ~1
  59.354 +    fun is_all (Const (\<^const_name>\<open>Pure.all\<close>, _) $ _) = ~1
  59.355 +      | is_all (Const (\<^const_name>\<open>All\<close>, _) $ _) = ~1
  59.356        | is_all _ = 0;
  59.357    in
  59.358      if has_rec goal then
  59.359 @@ -1586,10 +1586,10 @@
  59.360      val inject_prop =  (* FIXME local x x' *)
  59.361        let val vars_more' = map (fn (Free (x, T)) => Free (x ^ "'", T)) vars_more in
  59.362          HOLogic.mk_conj (HOLogic.eq_const extT $
  59.363 -          mk_ext vars_more $ mk_ext vars_more', @{term True})
  59.364 +          mk_ext vars_more $ mk_ext vars_more', \<^term>\<open>True\<close>)
  59.365          ===
  59.366          foldr1 HOLogic.mk_conj
  59.367 -          (map HOLogic.mk_eq (vars_more ~~ vars_more') @ [@{term True}])
  59.368 +          (map HOLogic.mk_eq (vars_more ~~ vars_more') @ [\<^term>\<open>True\<close>])
  59.369        end;
  59.370  
  59.371      val induct_prop = (fold_rev Logic.all vars_more (Trueprop (P $ ext)), Trueprop (P $ s));
  59.372 @@ -1688,19 +1688,19 @@
  59.373  fun mk_random_eq tyco vs extN Ts =
  59.374    let
  59.375      (* FIXME local i etc. *)
  59.376 -    val size = @{term "i::natural"};
  59.377 -    fun termifyT T = HOLogic.mk_prodT (T, @{typ "unit => term"});
  59.378 +    val size = \<^term>\<open>i::natural\<close>;
  59.379 +    fun termifyT T = HOLogic.mk_prodT (T, \<^typ>\<open>unit \<Rightarrow> term\<close>);
  59.380      val T = Type (tyco, map TFree vs);
  59.381      val Tm = termifyT T;
  59.382      val params = Name.invent_names Name.context "x" Ts;
  59.383      val lhs = HOLogic.mk_random T size;
  59.384 -    val tc = HOLogic.mk_return Tm @{typ Random.seed}
  59.385 +    val tc = HOLogic.mk_return Tm \<^typ>\<open>Random.seed\<close>
  59.386        (HOLogic.mk_valtermify_app extN params T);
  59.387      val rhs =
  59.388        HOLogic.mk_ST
  59.389          (map (fn (v, T') =>
  59.390 -          ((HOLogic.mk_random T' size, @{typ Random.seed}), SOME (v, termifyT T'))) params)
  59.391 -        tc @{typ Random.seed} (SOME Tm, @{typ Random.seed});
  59.392 +          ((HOLogic.mk_random T' size, \<^typ>\<open>Random.seed\<close>), SOME (v, termifyT T'))) params)
  59.393 +        tc \<^typ>\<open>Random.seed\<close> (SOME Tm, \<^typ>\<open>Random.seed\<close>);
  59.394    in
  59.395      (lhs, rhs)
  59.396    end
  59.397 @@ -1708,16 +1708,16 @@
  59.398  fun mk_full_exhaustive_eq tyco vs extN Ts =
  59.399    let
  59.400      (* FIXME local i etc. *)
  59.401 -    val size = @{term "i::natural"};
  59.402 -    fun termifyT T = HOLogic.mk_prodT (T, @{typ "unit => term"});
  59.403 +    val size = \<^term>\<open>i::natural\<close>;
  59.404 +    fun termifyT T = HOLogic.mk_prodT (T, \<^typ>\<open>unit \<Rightarrow> term\<close>);
  59.405      val T = Type (tyco, map TFree vs);
  59.406 -    val test_function = Free ("f", termifyT T --> @{typ "(bool * term list) option"});
  59.407 +    val test_function = Free ("f", termifyT T --> \<^typ>\<open>(bool \<times> term list) option\<close>);
  59.408      val params = Name.invent_names Name.context "x" Ts;
  59.409      fun full_exhaustiveT T =
  59.410 -      (termifyT T --> @{typ "(bool * Code_Evaluation.term list) option"}) -->
  59.411 -        @{typ natural} --> @{typ "(bool * Code_Evaluation.term list) option"};
  59.412 +      (termifyT T --> \<^typ>\<open>(bool \<times> Code_Evaluation.term list) option\<close>) -->
  59.413 +        \<^typ>\<open>natural\<close> --> \<^typ>\<open>(bool \<times> Code_Evaluation.term list) option\<close>;
  59.414      fun mk_full_exhaustive T =
  59.415 -      Const (@{const_name "Quickcheck_Exhaustive.full_exhaustive_class.full_exhaustive"},
  59.416 +      Const (\<^const_name>\<open>Quickcheck_Exhaustive.full_exhaustive_class.full_exhaustive\<close>,
  59.417          full_exhaustiveT T);
  59.418      val lhs = mk_full_exhaustive T $ test_function $ size;
  59.419      val tc = test_function $ (HOLogic.mk_valtermify_app extN params T);
  59.420 @@ -1758,8 +1758,8 @@
  59.421      let
  59.422        val eq =
  59.423          HOLogic.mk_Trueprop (HOLogic.mk_eq
  59.424 -          (Const (@{const_name HOL.equal}, extT --> extT --> HOLogic.boolT),
  59.425 -           Const (@{const_name HOL.eq}, extT --> extT --> HOLogic.boolT)));
  59.426 +          (Const (\<^const_name>\<open>HOL.equal\<close>, extT --> extT --> HOLogic.boolT),
  59.427 +           Const (\<^const_name>\<open>HOL.eq\<close>, extT --> extT --> HOLogic.boolT)));
  59.428        fun tac ctxt eq_def =
  59.429          Class.intro_classes_tac ctxt []
  59.430          THEN rewrite_goals_tac ctxt [Simpdata.mk_eq eq_def]
  59.431 @@ -1770,11 +1770,11 @@
  59.432        fun mk_eq_refl ctxt =
  59.433          @{thm equal_refl}
  59.434          |> Thm.instantiate
  59.435 -          ([((("'a", 0), @{sort equal}), Thm.ctyp_of ctxt (Logic.varifyT_global extT))], [])
  59.436 +          ([((("'a", 0), \<^sort>\<open>equal\<close>), Thm.ctyp_of ctxt (Logic.varifyT_global extT))], [])
  59.437          |> Axclass.unoverload ctxt;
  59.438 -      val ensure_random_record = ensure_sort_record (@{sort random}, mk_random_eq);
  59.439 +      val ensure_random_record = ensure_sort_record (\<^sort>\<open>random\<close>, mk_random_eq);
  59.440        val ensure_exhaustive_record =
  59.441 -        ensure_sort_record (@{sort full_exhaustive}, mk_full_exhaustive_eq);
  59.442 +        ensure_sort_record (\<^sort>\<open>full_exhaustive\<close>, mk_full_exhaustive_eq);
  59.443        fun add_code eq_def thy =
  59.444          let
  59.445            val ctxt = Proof_Context.init_global thy;
  59.446 @@ -1808,8 +1808,8 @@
  59.447       distinct_discsss = [], exhaust_discs = [], exhaust_sels = [], collapses = [], expands = [],
  59.448       split_sels = [], split_sel_asms = [], case_eq_ifs = []};
  59.449  
  59.450 -fun lhs_of_equation (Const (@{const_name Pure.eq}, _) $ t $ _) = t
  59.451 -  | lhs_of_equation (@{const Trueprop} $ (Const (@{const_name HOL.eq}, _) $ t $ _)) = t;
  59.452 +fun lhs_of_equation (Const (\<^const_name>\<open>Pure.eq\<close>, _) $ t $ _) = t
  59.453 +  | lhs_of_equation (\<^const>\<open>Trueprop\<close> $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ t $ _)) = t;
  59.454  
  59.455  fun add_spec_rule rule =
  59.456    let val head = head_of (lhs_of_equation (Thm.prop_of rule)) in
  59.457 @@ -1858,7 +1858,7 @@
  59.458      val all_vars = parent_vars @ vars;
  59.459      val all_named_vars = (parent_names ~~ parent_vars) @ named_vars;
  59.460  
  59.461 -    val zeta = (singleton (Name.variant_list (map #1 alphas)) "'z", @{sort type});
  59.462 +    val zeta = (singleton (Name.variant_list (map #1 alphas)) "'z", \<^sort>\<open>type\<close>);
  59.463      val moreT = TFree zeta;
  59.464      val more = Free (moreN, moreT);
  59.465      val full_moreN = full (Binding.name moreN);
  59.466 @@ -2408,18 +2408,18 @@
  59.467  (* outer syntax *)
  59.468  
  59.469  val _ =
  59.470 -  Outer_Syntax.command @{command_keyword record} "define extensible record"
  59.471 +  Outer_Syntax.command \<^command_keyword>\<open>record\<close> "define extensible record"
  59.472      (Parse_Spec.overloaded -- (Parse.type_args_constrained -- Parse.binding) --
  59.473 -      (@{keyword "="} |-- Scan.option (Parse.typ --| @{keyword "+"}) --
  59.474 +      (\<^keyword>\<open>=\<close> |-- Scan.option (Parse.typ --| \<^keyword>\<open>+\<close>) --
  59.475          Scan.repeat1 Parse.const_binding)
  59.476      >> (fn ((overloaded, x), (y, z)) =>
  59.477          Toplevel.theory (add_record_cmd {overloaded = overloaded} x y z)));
  59.478  
  59.479  val opt_modes =
  59.480 -  Scan.optional (@{keyword "("} |-- Parse.!!! (Scan.repeat1 Parse.name --| @{keyword ")"})) []
  59.481 +  Scan.optional (\<^keyword>\<open>(\<close> |-- Parse.!!! (Scan.repeat1 Parse.name --| \<^keyword>\<open>)\<close>)) []
  59.482  
  59.483  val _ =
  59.484 -  Outer_Syntax.command @{command_keyword print_record} "print record definiton"
  59.485 +  Outer_Syntax.command \<^command_keyword>\<open>print_record\<close> "print record definiton"
  59.486      (opt_modes -- Parse.typ >> print_record);
  59.487  
  59.488  end
    60.1 --- a/src/HOL/Tools/sat.ML	Wed Dec 06 16:01:15 2017 +0100
    60.2 +++ b/src/HOL/Tools/sat.ML	Wed Dec 06 21:01:01 2017 +0100
    60.3 @@ -60,12 +60,12 @@
    60.4  structure SAT : SAT =
    60.5  struct
    60.6  
    60.7 -val trace = Attrib.setup_config_bool @{binding sat_trace} (K false);
    60.8 +val trace = Attrib.setup_config_bool \<^binding>\<open>sat_trace\<close> (K false);
    60.9  
   60.10  fun cond_tracing ctxt msg =
   60.11    if Config.get ctxt trace then tracing (msg ()) else ();
   60.12  
   60.13 -val solver = Attrib.setup_config_string @{binding sat_solver} (K "cdclite");
   60.14 +val solver = Attrib.setup_config_string \<^binding>\<open>sat_solver\<close> (K "cdclite");
   60.15    (*see HOL/Tools/sat_solver.ML for possible values*)
   60.16  
   60.17  val counter = Unsynchronized.ref 0;
   60.18 @@ -212,7 +212,7 @@
   60.19    let
   60.20      fun index_of_literal chyp =
   60.21        (case (HOLogic.dest_Trueprop o Thm.term_of) chyp of
   60.22 -        (Const (@{const_name Not}, _) $ atom) =>
   60.23 +        (Const (\<^const_name>\<open>Not\<close>, _) $ atom) =>
   60.24            SOME (~ (the (Termtab.lookup atom_table atom)))
   60.25        | atom => SOME (the (Termtab.lookup atom_table atom)))
   60.26        handle TERM _ => NONE;  (* 'chyp' is not a literal *)
   60.27 @@ -281,7 +281,7 @@
   60.28    let
   60.29      (* remove premises that equal "True" *)
   60.30      val clauses' = filter (fn clause =>
   60.31 -      (not_equal @{term True} o HOLogic.dest_Trueprop o Thm.term_of) clause
   60.32 +      (not_equal \<^term>\<open>True\<close> o HOLogic.dest_Trueprop o Thm.term_of) clause
   60.33          handle TERM ("dest_Trueprop", _) => true) clauses
   60.34      (* remove non-clausal premises -- of course this shouldn't actually   *)
   60.35      (* remove anything as long as 'rawsat_tac' is only called after the   *)
   60.36 @@ -321,7 +321,7 @@
   60.37          val _ =
   60.38            cond_tracing ctxt
   60.39              (fn () => "quick_and_dirty is set: proof reconstruction skipped, using oracle instead")
   60.40 -        val False_thm = Skip_Proof.make_thm_cterm @{cprop False}
   60.41 +        val False_thm = Skip_Proof.make_thm_cterm \<^cprop>\<open>False\<close>
   60.42        in
   60.43          (* 'fold Thm.weaken (rev sorted_clauses)' is linear, while 'fold    *)
   60.44          (* Thm.weaken sorted_clauses' would be quadratic, since we sorted   *)
    61.1 --- a/src/HOL/Tools/split_rule.ML	Wed Dec 06 16:01:15 2017 +0100
    61.2 +++ b/src/HOL/Tools/split_rule.ML	Wed Dec 06 21:01:01 2017 +0100
    61.3 @@ -17,7 +17,7 @@
    61.4  (** split rules **)
    61.5  
    61.6  fun internal_case_prod_const (Ta, Tb, Tc) =
    61.7 -  Const (@{const_name Product_Type.internal_case_prod},
    61.8 +  Const (\<^const_name>\<open>Product_Type.internal_case_prod\<close>,
    61.9      [[Ta, Tb] ---> Tc, HOLogic.mk_prodT (Ta, Tb)] ---> Tc);
   61.10  
   61.11  fun eval_internal_split ctxt =
   61.12 @@ -30,7 +30,7 @@
   61.13  (*In ap_split S T u, term u expects separate arguments for the factors of S,
   61.14    with result type T.  The call creates a new term expecting one argument
   61.15    of type S.*)
   61.16 -fun ap_split (Type (@{type_name Product_Type.prod}, [T1, T2])) T3 u =
   61.17 +fun ap_split (Type (\<^type_name>\<open>Product_Type.prod\<close>, [T1, T2])) T3 u =
   61.18        internal_case_prod_const (T1, T2, T3) $
   61.19        Abs ("v", T1,
   61.20            ap_split T2 T3
   61.21 @@ -111,11 +111,11 @@
   61.22  
   61.23  val _ =
   61.24    Theory.setup
   61.25 -   (Attrib.setup @{binding split_format}
   61.26 +   (Attrib.setup \<^binding>\<open>split_format\<close>
   61.27        (Scan.lift (Args.parens (Args.$$$ "complete")
   61.28          >> K (Thm.rule_attribute [] (complete_split_rule o Context.proof_of))))
   61.29        "split pair-typed subterms in premises, or function arguments" #>
   61.30 -    Attrib.setup @{binding split_rule}
   61.31 +    Attrib.setup \<^binding>\<open>split_rule\<close>
   61.32        (Scan.succeed (Thm.rule_attribute [] (split_rule o Context.proof_of)))
   61.33        "curries ALL function variables occurring in a rule's conclusion");
   61.34  
    62.1 --- a/src/HOL/Tools/try0.ML	Wed Dec 06 16:01:15 2017 +0100
    62.2 +++ b/src/HOL/Tools/try0.ML	Wed Dec 06 21:01:01 2017 +0100
    62.3 @@ -182,11 +182,11 @@
    62.4     || Scan.repeat parse_attr >> (fn quad => fold merge_attrs quad ([], [], [], []))) x;
    62.5  
    62.6  val _ =
    62.7 -  Outer_Syntax.command @{command_keyword try0} "try a combination of proof methods"
    62.8 +  Outer_Syntax.command \<^command_keyword>\<open>try0\<close> "try a combination of proof methods"
    62.9      (Scan.optional parse_attrs ([], [], [], []) #>> try0_trans);
   62.10  
   62.11  fun try_try0 auto = generic_try0 (if auto then Auto_Try else Try) NONE ([], [], [], []);
   62.12  
   62.13 -val _ = Try.tool_setup (try0N, (30, @{system_option auto_methods}, try_try0));
   62.14 +val _ = Try.tool_setup (try0N, (30, \<^system_option>\<open>auto_methods\<close>, try_try0));
   62.15  
   62.16  end;
    63.1 --- a/src/HOL/Tools/typedef.ML	Wed Dec 06 16:01:15 2017 +0100
    63.2 +++ b/src/HOL/Tools/typedef.ML	Wed Dec 06 21:01:01 2017 +0100
    63.3 @@ -85,7 +85,7 @@
    63.4  
    63.5  structure Typedef_Plugin = Plugin(type T = string);
    63.6  
    63.7 -val typedef_plugin = Plugin_Name.declare_setup @{binding typedef};
    63.8 +val typedef_plugin = Plugin_Name.declare_setup \<^binding>\<open>typedef\<close>;
    63.9  
   63.10  fun interpretation f =
   63.11    Typedef_Plugin.interpretation typedef_plugin
   63.12 @@ -99,7 +99,7 @@
   63.13  
   63.14  (* primitive typedef axiomatization -- for fresh typedecl *)
   63.15  
   63.16 -val typedef_overloaded = Attrib.setup_config_bool @{binding typedef_overloaded} (K false);
   63.17 +val typedef_overloaded = Attrib.setup_config_bool \<^binding>\<open>typedef_overloaded\<close> (K false);
   63.18  
   63.19  fun mk_inhabited A =
   63.20    let val T = HOLogic.dest_setT (Term.fastype_of A)
   63.21 @@ -108,7 +108,7 @@
   63.22  fun mk_typedef newT oldT RepC AbsC A =
   63.23    let
   63.24      val typedefC =
   63.25 -      Const (@{const_name type_definition},
   63.26 +      Const (\<^const_name>\<open>type_definition\<close>,
   63.27          (newT --> oldT) --> (oldT --> newT) --> HOLogic.mk_setT oldT --> HOLogic.boolT);
   63.28    in Logic.mk_implies (mk_inhabited A, HOLogic.mk_Trueprop (typedefC $ RepC $ AbsC $ A)) end;
   63.29  
   63.30 @@ -336,11 +336,11 @@
   63.31  (** outer syntax **)
   63.32  
   63.33  val _ =
   63.34 -  Outer_Syntax.local_theory_to_proof @{command_keyword typedef}
   63.35 +  Outer_Syntax.local_theory_to_proof \<^command_keyword>\<open>typedef\<close>
   63.36      "HOL type definition (requires non-emptiness proof)"
   63.37      (Parse_Spec.overloaded -- Parse.type_args_constrained -- Parse.binding -- Parse.opt_mixfix --
   63.38 -      (@{keyword "="} |-- Parse.term) --
   63.39 -      Scan.option (@{keyword "morphisms"} |-- Parse.!!! (Parse.binding -- Parse.binding))
   63.40 +      (\<^keyword>\<open>=\<close> |-- Parse.term) --
   63.41 +      Scan.option (\<^keyword>\<open>morphisms\<close> |-- Parse.!!! (Parse.binding -- Parse.binding))
   63.42      >> (fn (((((overloaded, vs), t), mx), A), opt_morphs) => fn lthy =>
   63.43          typedef_cmd {overloaded = overloaded} (t, vs, mx) A
   63.44            (SOME (make_morphisms t opt_morphs)) lthy));
    64.1 --- a/src/HOL/Tools/value_command.ML	Wed Dec 06 16:01:15 2017 +0100
    64.2 +++ b/src/HOL/Tools/value_command.ML	Wed Dec 06 21:01:01 2017 +0100
    64.3 @@ -62,18 +62,18 @@
    64.4    in Pretty.writeln p end;
    64.5  
    64.6  val opt_modes =
    64.7 -  Scan.optional (@{keyword "("} |-- Parse.!!! (Scan.repeat1 Parse.name --| @{keyword ")"})) [];
    64.8 +  Scan.optional (\<^keyword>\<open>(\<close> |-- Parse.!!! (Scan.repeat1 Parse.name --| \<^keyword>\<open>)\<close>)) [];
    64.9  
   64.10  val opt_evaluator =
   64.11 -  Scan.option (@{keyword "["} |-- Parse.name --| @{keyword "]"})
   64.12 +  Scan.option (\<^keyword>\<open>[\<close> |-- Parse.name --| \<^keyword>\<open>]\<close>)
   64.13    
   64.14  val _ =
   64.15 -  Outer_Syntax.command @{command_keyword value} "evaluate and print term"
   64.16 +  Outer_Syntax.command \<^command_keyword>\<open>value\<close> "evaluate and print term"
   64.17      (opt_evaluator -- opt_modes -- Parse.term
   64.18        >> (fn ((some_name, modes), t) => Toplevel.keep (value_cmd some_name modes t)));
   64.19  
   64.20  val _ = Theory.setup
   64.21 -  (Thy_Output.antiquotation @{binding value}
   64.22 +  (Thy_Output.antiquotation \<^binding>\<open>value\<close>
   64.23      (Scan.lift opt_evaluator -- Term_Style.parse -- Args.term)
   64.24      (fn {source, context, ...} => fn ((some_name, style), t) => Thy_Output.output context
   64.25        (Thy_Output.maybe_pretty_source Thy_Output.pretty_term context source
    65.1 --- a/src/HOL/Topological_Spaces.thy	Wed Dec 06 16:01:15 2017 +0100
    65.2 +++ b/src/HOL/Topological_Spaces.thy	Wed Dec 06 21:01:01 2017 +0100
    65.3 @@ -688,7 +688,7 @@
    65.4  
    65.5  named_theorems tendsto_intros "introduction rules for tendsto"
    65.6  setup \<open>
    65.7 -  Global_Theory.add_thms_dynamic (@{binding tendsto_eq_intros},
    65.8 +  Global_Theory.add_thms_dynamic (\<^binding>\<open>tendsto_eq_intros\<close>,
    65.9      fn context =>
   65.10        Named_Theorems.get (Context.proof_of context) @{named_theorems tendsto_intros}
   65.11        |> map_filter (try (fn thm => @{thm tendsto_eq_rhs} OF [thm])))
    66.1 --- a/src/Pure/Isar/attrib.ML	Wed Dec 06 16:01:15 2017 +0100
    66.2 +++ b/src/Pure/Isar/attrib.ML	Wed Dec 06 21:01:01 2017 +0100
    66.3 @@ -489,38 +489,38 @@
    66.4  (* theory setup *)
    66.5  
    66.6  val _ = Theory.setup
    66.7 - (setup @{binding tagged} (Scan.lift (Args.name -- Args.name) >> Thm.tag) "tagged theorem" #>
    66.8 -  setup @{binding untagged} (Scan.lift Args.name >> Thm.untag) "untagged theorem" #>
    66.9 -  setup @{binding kind} (Scan.lift Args.name >> Thm.kind) "theorem kind" #>
   66.10 -  setup @{binding THEN}
   66.11 + (setup \<^binding>\<open>tagged\<close> (Scan.lift (Args.name -- Args.name) >> Thm.tag) "tagged theorem" #>
   66.12 +  setup \<^binding>\<open>untagged\<close> (Scan.lift Args.name >> Thm.untag) "untagged theorem" #>
   66.13 +  setup \<^binding>\<open>kind\<close> (Scan.lift Args.name >> Thm.kind) "theorem kind" #>
   66.14 +  setup \<^binding>\<open>THEN\<close>
   66.15      (Scan.lift (Scan.optional (Args.bracks Parse.nat) 1) -- thm
   66.16        >> (fn (i, B) => Thm.rule_attribute [B] (fn _ => fn A => A RSN (i, B))))
   66.17      "resolution with rule" #>
   66.18 -  setup @{binding OF}
   66.19 +  setup \<^binding>\<open>OF\<close>
   66.20      (thms >> (fn Bs => Thm.rule_attribute Bs (fn _ => fn A => A OF Bs)))
   66.21      "rule resolved with facts" #>
   66.22 -  setup @{binding rename_abs}
   66.23 +  setup \<^binding>\<open>rename_abs\<close>
   66.24      (Scan.lift (Scan.repeat (Args.maybe Args.name)) >> (fn vs =>
   66.25        Thm.rule_attribute [] (K (Drule.rename_bvars' vs))))
   66.26      "rename bound variables in abstractions" #>
   66.27 -  setup @{binding unfolded}
   66.28 +  setup \<^binding>\<open>unfolded\<close>
   66.29      (thms >> (fn ths =>
   66.30        Thm.rule_attribute ths (fn context => Local_Defs.unfold (Context.proof_of context) ths)))
   66.31      "unfolded definitions" #>
   66.32 -  setup @{binding folded}
   66.33 +  setup \<^binding>\<open>folded\<close>
   66.34      (thms >> (fn ths =>
   66.35        Thm.rule_attribute ths (fn context => Local_Defs.fold (Context.proof_of context) ths)))
   66.36      "folded definitions" #>
   66.37 -  setup @{binding consumes}
   66.38 +  setup \<^binding>\<open>consumes\<close>
   66.39      (Scan.lift (Scan.optional Parse.int 1) >> Rule_Cases.consumes)
   66.40      "number of consumed facts" #>
   66.41 -  setup @{binding constraints}
   66.42 +  setup \<^binding>\<open>constraints\<close>
   66.43      (Scan.lift Parse.nat >> Rule_Cases.constraints)
   66.44      "number of equality constraints" #>
   66.45 -  setup @{binding cases_open}
   66.46 +  setup \<^binding>\<open>cases_open\<close>
   66.47      (Scan.succeed Rule_Cases.cases_open)
   66.48      "rule with open parameters" #>
   66.49 -  setup @{binding case_names}
   66.50 +  setup \<^binding>\<open>case_names\<close>
   66.51      (Scan.lift (Scan.repeat (Args.name --
   66.52        Scan.optional (Parse.$$$ "[" |-- Scan.repeat1 (Args.maybe Args.name) --| Parse.$$$ "]") []))
   66.53        >> (fn cs =>
   66.54 @@ -528,37 +528,37 @@
   66.55            (map #1 cs)
   66.56            (map (map (the_default Rule_Cases.case_hypsN) o #2) cs)))
   66.57      "named rule cases" #>
   66.58 -  setup @{binding case_conclusion}
   66.59 +  setup \<^binding>\<open>case_conclusion\<close>
   66.60      (Scan.lift (Args.name -- Scan.repeat Args.name) >> Rule_Cases.case_conclusion)
   66.61      "named conclusion of rule cases" #>
   66.62 -  setup @{binding params}
   66.63 +  setup \<^binding>\<open>params\<close>
   66.64      (Scan.lift (Parse.and_list1 (Scan.repeat Args.name)) >> Rule_Cases.params)
   66.65      "named rule parameters" #>
   66.66 -  setup @{binding rule_format}
   66.67 +  setup \<^binding>\<open>rule_format\<close>
   66.68      (Scan.lift (Args.mode "no_asm")
   66.69        >> (fn true => Object_Logic.rule_format_no_asm | false => Object_Logic.rule_format))
   66.70      "result put into canonical rule format" #>
   66.71 -  setup @{binding elim_format}
   66.72 +  setup \<^binding>\<open>elim_format\<close>
   66.73      (Scan.succeed (Thm.rule_attribute [] (K Tactic.make_elim)))
   66.74      "destruct rule turned into elimination rule format" #>
   66.75 -  setup @{binding no_vars}
   66.76 +  setup \<^binding>\<open>no_vars\<close>
   66.77      (Scan.succeed (Thm.rule_attribute [] (fn context => fn th =>
   66.78        let
   66.79          val ctxt = Variable.set_body false (Context.proof_of context);
   66.80          val ((_, [th']), _) = Variable.import true [th] ctxt;
   66.81        in th' end)))
   66.82      "imported schematic variables" #>
   66.83 -  setup @{binding atomize}
   66.84 +  setup \<^binding>\<open>atomize\<close>
   66.85      (Scan.succeed Object_Logic.declare_atomize) "declaration of atomize rule" #>
   66.86 -  setup @{binding rulify}
   66.87 +  setup \<^binding>\<open>rulify\<close>
   66.88      (Scan.succeed Object_Logic.declare_rulify) "declaration of rulify rule" #>
   66.89 -  setup @{binding rotated}
   66.90 +  setup \<^binding>\<open>rotated\<close>
   66.91      (Scan.lift (Scan.optional Parse.int 1
   66.92        >> (fn n => Thm.rule_attribute [] (fn _ => rotate_prems n)))) "rotated theorem premises" #>
   66.93 -  setup @{binding defn}
   66.94 +  setup \<^binding>\<open>defn\<close>
   66.95      (add_del Local_Defs.defn_add Local_Defs.defn_del)
   66.96      "declaration of definitional transformations" #>
   66.97 -  setup @{binding abs_def}
   66.98 +  setup \<^binding>\<open>abs_def\<close>
   66.99      (Scan.succeed (Thm.rule_attribute [] (Local_Defs.abs_def_rule o Context.proof_of)))
  66.100      "abstract over free variables of definitional theorem" #>
  66.101  
    67.1 --- a/src/Pure/Isar/calculation.ML	Wed Dec 06 16:01:15 2017 +0100
    67.2 +++ b/src/Pure/Isar/calculation.ML	Wed Dec 06 21:01:01 2017 +0100
    67.3 @@ -126,11 +126,11 @@
    67.4  (* concrete syntax *)
    67.5  
    67.6  val _ = Theory.setup
    67.7 - (Attrib.setup @{binding trans} (Attrib.add_del trans_add trans_del)
    67.8 + (Attrib.setup \<^binding>\<open>trans\<close> (Attrib.add_del trans_add trans_del)
    67.9      "declaration of transitivity rule" #>
   67.10 -  Attrib.setup @{binding sym} (Attrib.add_del sym_add sym_del)
   67.11 +  Attrib.setup \<^binding>\<open>sym\<close> (Attrib.add_del sym_add sym_del)
   67.12      "declaration of symmetry rule" #>
   67.13 -  Attrib.setup @{binding symmetric} (Scan.succeed symmetric)
   67.14 +  Attrib.setup \<^binding>\<open>symmetric\<close> (Scan.succeed symmetric)
   67.15      "resolution with symmetry rule" #>
   67.16    Global_Theory.add_thms
   67.17     [((Binding.empty, transitive_thm), [trans_add]),
    68.1 --- a/src/Pure/Isar/class.ML	Wed Dec 06 16:01:15 2017 +0100
    68.2 +++ b/src/Pure/Isar/class.ML	Wed Dec 06 21:01:01 2017 +0100
    68.3 @@ -782,9 +782,9 @@
    68.4    standard_intro_classes_tac ctxt facts;
    68.5  
    68.6  val _ = Theory.setup
    68.7 - (Method.setup @{binding intro_classes} (Scan.succeed (METHOD o intro_classes_tac))
    68.8 + (Method.setup \<^binding>\<open>intro_classes\<close> (Scan.succeed (METHOD o intro_classes_tac))
    68.9      "back-chain introduction rules of classes" #>
   68.10 -  Method.setup @{binding standard} (Scan.succeed (METHOD o standard_tac))
   68.11 +  Method.setup \<^binding>\<open>standard\<close> (Scan.succeed (METHOD o standard_tac))
   68.12      "standard proof step: Pure intro/elim rule or class introduction");
   68.13  
   68.14  
    69.1 --- a/src/Pure/Isar/code.ML	Wed Dec 06 16:01:15 2017 +0100
    69.2 +++ b/src/Pure/Isar/code.ML	Wed Dec 06 21:01:01 2017 +0100
    69.3 @@ -1264,7 +1264,7 @@
    69.4  
    69.5  structure Codetype_Plugin = Plugin(type T = string);
    69.6  
    69.7 -val codetype_plugin = Plugin_Name.declare_setup @{binding codetype};
    69.8 +val codetype_plugin = Plugin_Name.declare_setup \<^binding>\<open>codetype\<close>;
    69.9  
   69.10  fun type_interpretation f =
   69.11    Codetype_Plugin.interpretation codetype_plugin
   69.12 @@ -1539,7 +1539,7 @@
   69.13        || Scan.succeed (code_attribute
   69.14            add_maybe_abs_eqn_liberal);
   69.15    in
   69.16 -    Attrib.setup @{binding code} (Scan.lift code_attribute_parser)
   69.17 +    Attrib.setup \<^binding>\<open>code\<close> (Scan.lift code_attribute_parser)
   69.18          "declare theorems for code generation"
   69.19    end);
   69.20  
    70.1 --- a/src/Pure/Isar/context_rules.ML	Wed Dec 06 16:01:15 2017 +0100
    70.2 +++ b/src/Pure/Isar/context_rules.ML	Wed Dec 06 21:01:01 2017 +0100
    70.3 @@ -219,13 +219,13 @@
    70.4      Scan.option Parse.nat) >> (fn (f, n) => f n)) x;
    70.5  
    70.6  val _ = Theory.setup
    70.7 - (Attrib.setup @{binding intro} (add intro_bang intro intro_query)
    70.8 + (Attrib.setup \<^binding>\<open>intro\<close> (add intro_bang intro intro_query)
    70.9      "declaration of introduction rule" #>
   70.10 -  Attrib.setup @{binding elim} (add elim_bang elim elim_query)
   70.11 +  Attrib.setup \<^binding>\<open>elim\<close> (add elim_bang elim elim_query)
   70.12      "declaration of elimination rule" #>
   70.13 -  Attrib.setup @{binding dest} (add dest_bang dest dest_query)
   70.14 +  Attrib.setup \<^binding>\<open>dest\<close> (add dest_bang dest dest_query)
   70.15      "declaration of destruction rule" #>
   70.16 -  Attrib.setup @{binding rule} (Scan.lift Args.del >> K rule_del)
   70.17 +  Attrib.setup \<^binding>\<open>rule\<close> (Scan.lift Args.del >> K rule_del)
   70.18      "remove declaration of intro/elim/dest rule");
   70.19  
   70.20  end;
    71.1 --- a/src/Pure/Isar/isar_cmd.ML	Wed Dec 06 16:01:15 2017 +0100
    71.2 +++ b/src/Pure/Isar/isar_cmd.ML	Wed Dec 06 21:01:01 2017 +0100
    71.3 @@ -211,9 +211,9 @@
    71.4  val diag_goal = Proof.goal o Toplevel.proof_of o diag_state;
    71.5  
    71.6  val _ = Theory.setup
    71.7 -  (ML_Antiquotation.value (Binding.qualify true "Isar" @{binding state})
    71.8 +  (ML_Antiquotation.value (Binding.qualify true "Isar" \<^binding>\<open>state\<close>)
    71.9      (Scan.succeed "Isar_Cmd.diag_state ML_context") #>
   71.10 -   ML_Antiquotation.value (Binding.qualify true "Isar" @{binding goal})
   71.11 +   ML_Antiquotation.value (Binding.qualify true "Isar" \<^binding>\<open>goal\<close>)
   71.12      (Scan.succeed "Isar_Cmd.diag_goal ML_context"));
   71.13  
   71.14  
    72.1 --- a/src/Pure/Isar/locale.ML	Wed Dec 06 16:01:15 2017 +0100
    72.2 +++ b/src/Pure/Isar/locale.ML	Wed Dec 06 21:01:01 2017 +0100
    72.3 @@ -678,9 +678,9 @@
    72.4  val try_intro_locales_tac= gen_intro_locales_tac Method.try_intros_tac;
    72.5  
    72.6  val _ = Theory.setup
    72.7 - (Method.setup @{binding intro_locales} (Scan.succeed (METHOD o try_intro_locales_tac false))
    72.8 + (Method.setup \<^binding>\<open>intro_locales\<close> (Scan.succeed (METHOD o try_intro_locales_tac false))
    72.9      "back-chain introduction rules of locales without unfolding predicates" #>
   72.10 -  Method.setup @{binding unfold_locales} (Scan.succeed (METHOD o try_intro_locales_tac true))
   72.11 +  Method.setup \<^binding>\<open>unfold_locales\<close> (Scan.succeed (METHOD o try_intro_locales_tac true))
   72.12      "back-chain all introduction rules of locales");
   72.13  
   72.14  
    73.1 --- a/src/Pure/Isar/method.ML	Wed Dec 06 16:01:15 2017 +0100
    73.2 +++ b/src/Pure/Isar/method.ML	Wed Dec 06 21:01:01 2017 +0100
    73.3 @@ -266,7 +266,7 @@
    73.4  
    73.5  (* rule etc. -- single-step refinements *)
    73.6  
    73.7 -val rule_trace = Attrib.setup_config_bool @{binding rule_trace} (fn _ => false);
    73.8 +val rule_trace = Attrib.setup_config_bool \<^binding>\<open>rule_trace\<close> (fn _ => false);
    73.9  
   73.10  fun trace ctxt rules =
   73.11    if Config.get ctxt rule_trace andalso not (null rules) then
   73.12 @@ -795,13 +795,13 @@
   73.13  (* theory setup *)
   73.14  
   73.15  val _ = Theory.setup
   73.16 - (setup @{binding fail} (Scan.succeed (K fail)) "force failure" #>
   73.17 -  setup @{binding succeed} (Scan.succeed (K succeed)) "succeed" #>
   73.18 -  setup @{binding sleep} (Scan.lift Parse.real >> (fn s => fn _ => fn _ => sleep (seconds s)))
   73.19 + (setup \<^binding>\<open>fail\<close> (Scan.succeed (K fail)) "force failure" #>
   73.20 +  setup \<^binding>\<open>succeed\<close> (Scan.succeed (K succeed)) "succeed" #>
   73.21 +  setup \<^binding>\<open>sleep\<close> (Scan.lift Parse.real >> (fn s => fn _ => fn _ => sleep (seconds s)))
   73.22      "succeed after delay (in seconds)" #>
   73.23 -  setup @{binding "-"} (Scan.succeed (K (SIMPLE_METHOD all_tac)))
   73.24 +  setup \<^binding>\<open>-\<close> (Scan.succeed (K (SIMPLE_METHOD all_tac)))
   73.25      "insert current facts, nothing else" #>
   73.26 -  setup @{binding goal_cases} (Scan.lift (Scan.repeat Args.name_token) >> (fn names => fn _ =>
   73.27 +  setup \<^binding>\<open>goal_cases\<close> (Scan.lift (Scan.repeat Args.name_token) >> (fn names => fn _ =>
   73.28      CONTEXT_METHOD (fn _ => fn (ctxt, st) =>
   73.29        (case drop (Thm.nprems_of st) names of
   73.30          [] => NONE
   73.31 @@ -813,36 +813,36 @@
   73.32        |> (fn SOME msg => Seq.single (Seq.Error msg)
   73.33             | NONE => goal_cases_tac (map Token.content_of names) (ctxt, st)))))
   73.34      "bind cases for goals" #>
   73.35 -  setup @{binding insert} (Attrib.thms >> (K o insert))
   73.36 +  setup \<^binding>\<open>insert\<close> (Attrib.thms >> (K o insert))
   73.37      "insert theorems, ignoring facts" #>
   73.38 -  setup @{binding intro} (Attrib.thms >> (fn ths => fn ctxt => intro ctxt ths))
   73.39 +  setup \<^binding>\<open>intro\<close> (Attrib.thms >> (fn ths => fn ctxt => intro ctxt ths))
   73.40      "repeatedly apply introduction rules" #>
   73.41 -  setup @{binding elim} (Attrib.thms >> (fn ths => fn ctxt => elim ctxt ths))
   73.42 +  setup \<^binding>\<open>elim\<close> (Attrib.thms >> (fn ths => fn ctxt => elim ctxt ths))
   73.43      "repeatedly apply elimination rules" #>
   73.44 -  setup @{binding unfold} (Attrib.thms >> unfold_meth) "unfold definitions" #>
   73.45 -  setup @{binding fold} (Attrib.thms >> fold_meth) "fold definitions" #>
   73.46 -  setup @{binding atomize} (Scan.lift (Args.mode "full") >> atomize)
   73.47 +  setup \<^binding>\<open>unfold\<close> (Attrib.thms >> unfold_meth) "unfold definitions" #>
   73.48 +  setup \<^binding>\<open>fold\<close> (Attrib.thms >> fold_meth) "fold definitions" #>
   73.49 +  setup \<^binding>\<open>atomize\<close> (Scan.lift (Args.mode "full") >> atomize)
   73.50      "present local premises as object-level statements" #>
   73.51 -  setup @{binding rule} (Attrib.thms >> (fn ths => fn ctxt => some_rule ctxt ths))
   73.52 +  setup \<^binding>\<open>rule\<close> (Attrib.thms >> (fn ths => fn ctxt => some_rule ctxt ths))
   73.53      "apply some intro/elim rule" #>
   73.54 -  setup @{binding erule} (xrule_meth erule) "apply rule in elimination manner (improper)" #>
   73.55 -  setup @{binding drule} (xrule_meth drule) "apply rule in destruct manner (improper)" #>
   73.56 -  setup @{binding frule} (xrule_meth frule) "apply rule in forward manner (improper)" #>
   73.57 -  setup @{binding this} (Scan.succeed this) "apply current facts as rules" #>
   73.58 -  setup @{binding fact} (Attrib.thms >> fact) "composition by facts from context" #>
   73.59 -  setup @{binding assumption} (Scan.succeed assumption)
   73.60 +  setup \<^binding>\<open>erule\<close> (xrule_meth erule) "apply rule in elimination manner (improper)" #>
   73.61 +  setup \<^binding>\<open>drule\<close> (xrule_meth drule) "apply rule in destruct manner (improper)" #>
   73.62 +  setup \<^binding>\<open>frule\<close> (xrule_meth frule) "apply rule in forward manner (improper)" #>
   73.63 +  setup \<^binding>\<open>this\<close> (Scan.succeed this) "apply current facts as rules" #>
   73.64 +  setup \<^binding>\<open>fact\<close> (Attrib.thms >> fact) "composition by facts from context" #>
   73.65 +  setup \<^binding>\<open>assumption\<close> (Scan.succeed assumption)
   73.66      "proof by assumption, preferring facts" #>
   73.67 -  setup @{binding rename_tac} (Args.goal_spec -- Scan.lift (Scan.repeat1 Args.name) >>
   73.68 +  setup \<^binding>\<open>rename_tac\<close> (Args.goal_spec -- Scan.lift (Scan.repeat1 Args.name) >>
   73.69      (fn (quant, xs) => K (SIMPLE_METHOD'' quant (rename_tac xs))))
   73.70      "rename parameters of goal" #>
   73.71 -  setup @{binding rotate_tac} (Args.goal_spec -- Scan.lift (Scan.optional Parse.int 1) >>
   73.72 +  setup \<^binding>\<open>rotate_tac\<close> (Args.goal_spec -- Scan.lift (Scan.optional Parse.int 1) >>
   73.73      (fn (quant, i) => K (SIMPLE_METHOD'' quant (rotate_tac i))))
   73.74        "rotate assumptions of goal" #>
   73.75 -  setup @{binding tactic} (parse_tactic >> (K o METHOD))
   73.76 +  setup \<^binding>\<open>tactic\<close> (parse_tactic >> (K o METHOD))
   73.77      "ML tactic as proof method" #>
   73.78 -  setup @{binding raw_tactic} (parse_tactic >> (fn tac => fn _ => CONTEXT_TACTIC o tac))
   73.79 +  setup \<^binding>\<open>raw_tactic\<close> (parse_tactic >> (fn tac => fn _ => CONTEXT_TACTIC o tac))
   73.80      "ML tactic as raw proof method" #>
   73.81 -  setup @{binding use}
   73.82 +  setup \<^binding>\<open>use\<close>
   73.83      (Attrib.thms -- (Scan.lift (Parse.$$$ "in") |-- text_closure) >>
   73.84        (fn (thms, text) => fn ctxt => fn _ => evaluate_runtime text ctxt thms))
   73.85      "indicate method facts and context for method expression");
    74.1 --- a/src/Pure/Isar/overloading.ML	Wed Dec 06 16:01:15 2017 +0100
    74.2 +++ b/src/Pure/Isar/overloading.ML	Wed Dec 06 21:01:01 2017 +0100
    74.3 @@ -92,7 +92,7 @@
    74.4    | SOME t' => if t aconv t' then NONE else SOME t');
    74.5  
    74.6  val show_reverted_improvements =
    74.7 -  Attrib.setup_config_bool @{binding "show_reverted_improvements"} (K true);
    74.8 +  Attrib.setup_config_bool \<^binding>\<open>show_reverted_improvements\<close> (K true);
    74.9  
   74.10  fun improve_term_uncheck ts ctxt =
   74.11    let
    75.1 --- a/src/Pure/ML/ml_antiquotation.ML	Wed Dec 06 16:01:15 2017 +0100
    75.2 +++ b/src/Pure/ML/ml_antiquotation.ML	Wed Dec 06 21:01:01 2017 +0100
    75.3 @@ -41,7 +41,7 @@
    75.4    inline (Binding.make ("make_string", \<^here>)) (Args.context >> K ML_Pretty.make_string_fn) #>
    75.5  
    75.6    value (Binding.make ("binding", \<^here>))
    75.7 -    (Scan.lift (Parse.position Args.name) >> ML_Syntax.make_binding) #>
    75.8 +    (Scan.lift (Parse.position Args.embedded) >> ML_Syntax.make_binding) #>
    75.9  
   75.10    value (Binding.make ("cartouche", \<^here>))
   75.11      (Scan.lift Args.cartouche_input >> (fn source =>
    76.1 --- a/src/Pure/ML/ml_antiquotations.ML	Wed Dec 06 16:01:15 2017 +0100
    76.2 +++ b/src/Pure/ML/ml_antiquotations.ML	Wed Dec 06 21:01:01 2017 +0100
    76.3 @@ -10,13 +10,13 @@
    76.4  (* ML support *)
    76.5  
    76.6  val _ = Theory.setup
    76.7 - (ML_Antiquotation.inline @{binding undefined}
    76.8 + (ML_Antiquotation.inline \<^binding>\<open>undefined\<close>
    76.9      (Scan.succeed "(raise General.Match)") #>
   76.10  
   76.11 -  ML_Antiquotation.inline @{binding assert}
   76.12 +  ML_Antiquotation.inline \<^binding>\<open>assert\<close>
   76.13      (Scan.succeed "(fn b => if b then () else raise General.Fail \"Assertion failed\")") #>
   76.14  
   76.15 -  ML_Antiquotation.declaration @{binding print}
   76.16 +  ML_Antiquotation.declaration \<^binding>\<open>print\<close>
   76.17      (Scan.lift (Scan.optional Args.embedded "Output.writeln"))
   76.18        (fn src => fn output => fn ctxt =>
   76.19          let
   76.20 @@ -31,7 +31,7 @@
   76.21              "(fn x => (" ^ struct_name ^ "." ^ a ^ " (" ^ ML_Pretty.make_string_fn ^ " x); x))";
   76.22          in (K (env, body), ctxt') end) #>
   76.23  
   76.24 -  ML_Antiquotation.value @{binding rat}
   76.25 +  ML_Antiquotation.value \<^binding>\<open>rat\<close>
   76.26      (Scan.lift (Scan.optional (Args.$$$ "~" >> K ~1) 1 -- Parse.nat --
   76.27        Scan.optional (Args.$$$ "/" |-- Parse.nat) 1) >> (fn ((sign, a), b) =>
   76.28          "Rat.make " ^ ML_Syntax.print_pair ML_Syntax.print_int ML_Syntax.print_int (sign * a, b))))
   76.29 @@ -40,8 +40,8 @@
   76.30  (* formal entities *)
   76.31  
   76.32  val _ = Theory.setup
   76.33 - (ML_Antiquotation.value @{binding system_option}
   76.34 -    (Args.context -- Scan.lift (Parse.position Args.name) >> (fn (ctxt, (name, pos)) =>
   76.35 + (ML_Antiquotation.value \<^binding>\<open>system_option\<close>
   76.36 +    (Args.context -- Scan.lift (Parse.position Args.embedded) >> (fn (ctxt, (name, pos)) =>
   76.37        let
   76.38          val markup =
   76.39            Options.default_markup (name, pos) handle ERROR msg =>
   76.40 @@ -56,44 +56,44 @@
   76.41          val _ = Context_Position.report ctxt pos markup;
   76.42        in ML_Syntax.print_string name end)) #>
   76.43  
   76.44 -  ML_Antiquotation.value @{binding theory}
   76.45 -    (Args.context -- Scan.lift (Parse.position Args.name) >> (fn (ctxt, (name, pos)) =>
   76.46 +  ML_Antiquotation.value \<^binding>\<open>theory\<close>
   76.47 +    (Args.context -- Scan.lift (Parse.position Args.embedded) >> (fn (ctxt, (name, pos)) =>
   76.48        (Theory.check ctxt (name, pos);
   76.49         "Context.get_theory (Proof_Context.theory_of ML_context) " ^ ML_Syntax.print_string name))
   76.50      || Scan.succeed "Proof_Context.theory_of ML_context") #>
   76.51  
   76.52 -  ML_Antiquotation.value @{binding theory_context}
   76.53 -    (Args.context -- Scan.lift (Parse.position Args.name) >> (fn (ctxt, (name, pos)) =>
   76.54 +  ML_Antiquotation.value \<^binding>\<open>theory_context\<close>
   76.55 +    (Args.context -- Scan.lift (Parse.position Args.embedded) >> (fn (ctxt, (name, pos)) =>
   76.56        (Theory.check ctxt (name, pos);
   76.57         "Proof_Context.get_global (Proof_Context.theory_of ML_context) " ^
   76.58          ML_Syntax.print_string name))) #>
   76.59  
   76.60 -  ML_Antiquotation.inline @{binding context}
   76.61 +  ML_Antiquotation.inline \<^binding>\<open>context\<close>
   76.62      (Args.context >> (fn ctxt => ML_Context.struct_name ctxt ^ ".ML_context")) #>
   76.63  
   76.64 -  ML_Antiquotation.inline @{binding typ} (Args.typ >> (ML_Syntax.atomic o ML_Syntax.print_typ)) #>
   76.65 -  ML_Antiquotation.inline @{binding term} (Args.term >> (ML_Syntax.atomic o ML_Syntax.print_term)) #>
   76.66 -  ML_Antiquotation.inline @{binding prop} (Args.prop >> (ML_Syntax.atomic o ML_Syntax.print_term)) #>
   76.67 +  ML_Antiquotation.inline \<^binding>\<open>typ\<close> (Args.typ >> (ML_Syntax.atomic o ML_Syntax.print_typ)) #>
   76.68 +  ML_Antiquotation.inline \<^binding>\<open>term\<close> (Args.term >> (ML_Syntax.atomic o ML_Syntax.print_term)) #>
   76.69 +  ML_Antiquotation.inline \<^binding>\<open>prop\<close> (Args.prop >> (ML_Syntax.atomic o ML_Syntax.print_term)) #>
   76.70  
   76.71 -  ML_Antiquotation.value @{binding ctyp} (Args.typ >> (fn T =>
   76.72 +  ML_Antiquotation.value \<^binding>\<open>ctyp\<close> (Args.typ >> (fn T =>
   76.73      "Thm.ctyp_of ML_context " ^ ML_Syntax.atomic (ML_Syntax.print_typ T))) #>
   76.74  
   76.75 -  ML_Antiquotation.value @{binding cterm} (Args.term >> (fn t =>
   76.76 +  ML_Antiquotation.value \<^binding>\<open>cterm\<close> (Args.term >> (fn t =>
   76.77      "Thm.cterm_of ML_context " ^ ML_Syntax.atomic (ML_Syntax.print_term t))) #>
   76.78  
   76.79 -  ML_Antiquotation.value @{binding cprop} (Args.prop >> (fn t =>
   76.80 +  ML_Antiquotation.value \<^binding>\<open>cprop\<close> (Args.prop >> (fn t =>
   76.81      "Thm.cterm_of ML_context " ^ ML_Syntax.atomic (ML_Syntax.print_term t))) #>
   76.82  
   76.83 -  ML_Antiquotation.inline @{binding method}
   76.84 -    (Args.context -- Scan.lift (Parse.position Args.name) >> (fn (ctxt, (name, pos)) =>
   76.85 +  ML_Antiquotation.inline \<^binding>\<open>method\<close>
   76.86 +    (Args.context -- Scan.lift (Parse.position Args.embedded) >> (fn (ctxt, (name, pos)) =>
   76.87        ML_Syntax.print_string (Method.check_name ctxt (name, pos)))));
   76.88  
   76.89  
   76.90  (* locales *)
   76.91  
   76.92  val _ = Theory.setup
   76.93 - (ML_Antiquotation.inline @{binding locale}
   76.94 -   (Args.context -- Scan.lift (Parse.position Args.name) >> (fn (ctxt, (name, pos)) =>
   76.95 + (ML_Antiquotation.inline \<^binding>\<open>locale\<close>
   76.96 +   (Args.context -- Scan.lift (Parse.position Args.embedded) >> (fn (ctxt, (name, pos)) =>
   76.97        Locale.check (Proof_Context.theory_of ctxt) (name, pos)
   76.98        |> ML_Syntax.print_string)));
   76.99  
  76.100 @@ -106,10 +106,10 @@
  76.101    |> ML_Syntax.print_string);
  76.102  
  76.103  val _ = Theory.setup
  76.104 - (ML_Antiquotation.inline @{binding class} (class false) #>
  76.105 -  ML_Antiquotation.inline @{binding class_syntax} (class true) #>
  76.106 + (ML_Antiquotation.inline \<^binding>\<open>class\<close> (class false) #>
  76.107 +  ML_Antiquotation.inline \<^binding>\<open>class_syntax\<close> (class true) #>
  76.108  
  76.109 -  ML_Antiquotation.inline @{binding sort}
  76.110 +  ML_Antiquotation.inline \<^binding>\<open>sort\<close>
  76.111      (Args.context -- Scan.lift Args.embedded_inner_syntax >> (fn (ctxt, s) =>
  76.112        ML_Syntax.atomic (ML_Syntax.print_sort (Syntax.read_sort ctxt s)))));
  76.113  
  76.114 @@ -128,13 +128,13 @@
  76.115      in ML_Syntax.print_string res end);
  76.116  
  76.117  val _ = Theory.setup
  76.118 - (ML_Antiquotation.inline @{binding type_name}
  76.119 + (ML_Antiquotation.inline \<^binding>\<open>type_name\<close>
  76.120      (type_name "logical type" (fn (c, Type.LogicalType _) => c)) #>
  76.121 -  ML_Antiquotation.inline @{binding type_abbrev}
  76.122 +  ML_Antiquotation.inline \<^binding>\<open>type_abbrev\<close>
  76.123      (type_name "type abbreviation" (fn (c, Type.Abbreviation _) => c)) #>
  76.124 -  ML_Antiquotation.inline @{binding nonterminal}
  76.125 +  ML_Antiquotation.inline \<^binding>\<open>nonterminal\<close>
  76.126      (type_name "nonterminal" (fn (c, Type.Nonterminal) => c)) #>
  76.127 -  ML_Antiquotation.inline @{binding type_syntax}
  76.128 +  ML_Antiquotation.inline \<^binding>\<open>type_syntax\<close>
  76.129      (type_name "type" (fn (c, _) => Lexicon.mark_type c)));
  76.130  
  76.131  
  76.132 @@ -149,20 +149,20 @@
  76.133      in ML_Syntax.print_string res end);
  76.134  
  76.135  val _ = Theory.setup
  76.136 - (ML_Antiquotation.inline @{binding const_name}
  76.137 + (ML_Antiquotation.inline \<^binding>\<open>const_name\<close>
  76.138      (const_name (fn (consts, c) => (Consts.the_const consts c; c))) #>
  76.139 -  ML_Antiquotation.inline @{binding const_abbrev}
  76.140 +  ML_Antiquotation.inline \<^binding>\<open>const_abbrev\<close>
  76.141      (const_name (fn (consts, c) => (Consts.the_abbreviation consts c; c))) #>
  76.142 -  ML_Antiquotation.inline @{binding const_syntax}
  76.143 +  ML_Antiquotation.inline \<^binding>\<open>const_syntax\<close>
  76.144      (const_name (fn (_, c) => Lexicon.mark_const c)) #>
  76.145  
  76.146 -  ML_Antiquotation.inline @{binding syntax_const}
  76.147 +  ML_Antiquotation.inline \<^binding>\<open>syntax_const\<close>
  76.148      (Args.context -- Scan.lift (Parse.position Args.embedded) >> (fn (ctxt, (c, pos)) =>
  76.149        if is_some (Syntax.lookup_const (Proof_Context.syn_of ctxt) c)
  76.150        then ML_Syntax.print_string c
  76.151        else error ("Unknown syntax const: " ^ quote c ^ Position.here pos))) #>
  76.152  
  76.153 -  ML_Antiquotation.inline @{binding const}
  76.154 +  ML_Antiquotation.inline \<^binding>\<open>const\<close>
  76.155      (Args.context -- Scan.lift (Parse.position Args.embedded_inner_syntax) -- Scan.optional
  76.156          (Scan.lift (Args.$$$ "(") |-- Parse.enum1' "," Args.typ --| Scan.lift (Args.$$$ ")")) []
  76.157        >> (fn ((ctxt, (raw_c, pos)), Ts) =>
  76.158 @@ -201,7 +201,7 @@
  76.159  in
  76.160  
  76.161  val _ = Theory.setup
  76.162 - (ML_Antiquotation.value @{binding map}
  76.163 + (ML_Antiquotation.value \<^binding>\<open>map\<close>
  76.164      (Scan.lift parameter >> (fn n =>
  76.165        "fn f =>\n\
  76.166        \  let\n\
  76.167 @@ -209,7 +209,7 @@
  76.168        \      | map f" ^ cons n ^ " = f" ^ vars "x" n ^ " :: map f" ^ vars "xs" n ^ "\n\
  76.169        \      | map _" ^  dummy n ^ " = raise ListPair.UnequalLengths\n" ^
  76.170        "  in map f end")) #>
  76.171 -  ML_Antiquotation.value @{binding fold}
  76.172 +  ML_Antiquotation.value \<^binding>\<open>fold\<close>
  76.173      (Scan.lift parameter >> (fn n =>
  76.174        "fn f =>\n\
  76.175        \  let\n\
  76.176 @@ -217,7 +217,7 @@
  76.177        \      | fold f" ^ cons n ^ " a = fold f" ^ vars "xs" n ^ " (f" ^ vars "x" n ^ " a)\n\
  76.178        \      | fold _" ^  dummy n ^ " _ = raise ListPair.UnequalLengths\n" ^
  76.179        "  in fold f end")) #>
  76.180 -  ML_Antiquotation.value @{binding fold_map}
  76.181 +  ML_Antiquotation.value \<^binding>\<open>fold_map\<close>
  76.182      (Scan.lift parameter >> (fn n =>
  76.183        "fn f =>\n\
  76.184        \  let\n\
  76.185 @@ -229,7 +229,7 @@
  76.186        \          in (x :: xs, a'') end\n\
  76.187        \      | fold_map _" ^  dummy n ^ " _ = raise ListPair.UnequalLengths\n" ^
  76.188        "  in fold_map f end")) #>
  76.189 -  ML_Antiquotation.value @{binding split_list}
  76.190 +  ML_Antiquotation.value \<^binding>\<open>split_list\<close>
  76.191      (Scan.lift parameter >> (fn n =>
  76.192        "fn list =>\n\
  76.193        \  let\n\
  76.194 @@ -238,7 +238,7 @@
  76.195        \          let val" ^ tuple_vars "xs" n ^ " = split_list xs\n\
  76.196        \          in " ^ cons_tuple n ^ "end\n\
  76.197        \  in split_list list end")) #>
  76.198 -  ML_Antiquotation.value @{binding apply}
  76.199 +  ML_Antiquotation.value \<^binding>\<open>apply\<close>
  76.200      (Scan.lift (parameter -- Scan.option (Args.parens (Parse.position Parse.nat))) >>
  76.201        (fn (n, opt_index) =>
  76.202          let
  76.203 @@ -259,15 +259,15 @@
  76.204  (* outer syntax *)
  76.205  
  76.206  val _ = Theory.setup
  76.207 - (ML_Antiquotation.value @{binding keyword}
  76.208 -    (Args.context -- Scan.lift (Parse.position (Parse.name || Parse.keyword_with (K true)))
  76.209 + (ML_Antiquotation.value \<^binding>\<open>keyword\<close>
  76.210 +    (Args.context -- Scan.lift (Parse.position (Parse.embedded || Parse.keyword_with (K true)))
  76.211        >> (fn (ctxt, (name, pos)) =>
  76.212          if Keyword.is_keyword (Thy_Header.get_keywords' ctxt) name then
  76.213            (Context_Position.report ctxt pos (Token.keyword_markup (true, Markup.keyword2) name);
  76.214             "Parse.$$$ " ^ ML_Syntax.print_string name)
  76.215          else error ("Bad outer syntax keyword " ^ quote name ^ Position.here pos))) #>
  76.216 -  ML_Antiquotation.value @{binding command_keyword}
  76.217 -    (Args.context -- Scan.lift (Parse.position Parse.name) >> (fn (ctxt, (name, pos)) =>
  76.218 +  ML_Antiquotation.value \<^binding>\<open>command_keyword\<close>
  76.219 +    (Args.context -- Scan.lift (Parse.position Parse.embedded) >> (fn (ctxt, (name, pos)) =>
  76.220        (case Keyword.command_markup (Thy_Header.get_keywords' ctxt) name of
  76.221          SOME markup =>
  76.222           (Context_Position.reports ctxt [(pos, markup), (pos, Markup.keyword1)];
    77.1 --- a/src/Pure/ML/ml_thms.ML	Wed Dec 06 16:01:15 2017 +0100
    77.2 +++ b/src/Pure/ML/ml_thms.ML	Wed Dec 06 21:01:01 2017 +0100
    77.3 @@ -40,7 +40,7 @@
    77.4  (* attribute source *)
    77.5  
    77.6  val _ = Theory.setup
    77.7 -  (ML_Antiquotation.declaration @{binding attributes} Attrib.attribs
    77.8 +  (ML_Antiquotation.declaration \<^binding>\<open>attributes\<close> Attrib.attribs
    77.9      (fn _ => fn srcs => fn ctxt =>
   77.10        let val i = serial () in
   77.11          ctxt
   77.12 @@ -69,8 +69,8 @@
   77.13    in (decl, ctxt'') end;
   77.14  
   77.15  val _ = Theory.setup
   77.16 -  (ML_Antiquotation.declaration @{binding thm} (Attrib.thm >> single) (K (thm_binding "thm" true)) #>
   77.17 -   ML_Antiquotation.declaration @{binding thms} Attrib.thms (K (thm_binding "thms" false)));
   77.18 +  (ML_Antiquotation.declaration \<^binding>\<open>thm\<close> (Attrib.thm >> single) (K (thm_binding "thm" true)) #>
   77.19 +   ML_Antiquotation.declaration \<^binding>\<open>thms\<close> Attrib.thms (K (thm_binding "thms" false)));
   77.20  
   77.21  
   77.22  (* ad-hoc goals *)
   77.23 @@ -80,7 +80,7 @@
   77.24  val goal = Scan.unless (by || and_) Args.embedded_inner_syntax;
   77.25  
   77.26  val _ = Theory.setup
   77.27 -  (ML_Antiquotation.declaration @{binding lemma}
   77.28 +  (ML_Antiquotation.declaration \<^binding>\<open>lemma\<close>
   77.29      (Scan.lift (Args.mode "open" -- Parse.enum1 "and" (Scan.repeat1 goal) --
   77.30        (Parse.position by -- Method.parse -- Scan.option Method.parse)))
   77.31      (fn _ => fn ((is_open, raw_propss), (((_, by_pos), m1), m2)) => fn ctxt =>
    78.1 --- a/src/Pure/ML_Bootstrap.thy	Wed Dec 06 16:01:15 2017 +0100
    78.2 +++ b/src/Pure/ML_Bootstrap.thy	Wed Dec 06 21:01:01 2017 +0100
    78.3 @@ -34,7 +34,7 @@
    78.4      \<close>
    78.5  \<close>
    78.6  
    78.7 -ML \<open>@{assert} (not (can ML \<open>open RunCall\<close>))\<close>
    78.8 +ML \<open>\<^assert> (not (can ML \<open>open RunCall\<close>))\<close>
    78.9  
   78.10  
   78.11  subsection \<open>Switch to bootstrap environment\<close>
    79.1 --- a/src/Pure/PIDE/resources.ML	Wed Dec 06 16:01:15 2017 +0100
    79.2 +++ b/src/Pure/PIDE/resources.ML	Wed Dec 06 21:01:01 2017 +0100
    79.3 @@ -229,19 +229,19 @@
    79.4  in
    79.5  
    79.6  val _ = Theory.setup
    79.7 - (Thy_Output.antiquotation @{binding path} (Scan.lift (Parse.position Parse.path))
    79.8 + (Thy_Output.antiquotation \<^binding>\<open>path\<close> (Scan.lift (Parse.position Parse.path))
    79.9      (document_antiq NONE o #context) #>
   79.10 -  Thy_Output.antiquotation @{binding file} (Scan.lift (Parse.position Parse.path))
   79.11 +  Thy_Output.antiquotation \<^binding>\<open>file\<close> (Scan.lift (Parse.position Parse.path))
   79.12      (document_antiq (SOME File.check_file) o #context) #>
   79.13 -  Thy_Output.antiquotation @{binding dir} (Scan.lift (Parse.position Parse.path))
   79.14 +  Thy_Output.antiquotation \<^binding>\<open>dir\<close> (Scan.lift (Parse.position Parse.path))
   79.15      (document_antiq (SOME File.check_dir) o #context) #>
   79.16 -  ML_Antiquotation.value @{binding path}
   79.17 +  ML_Antiquotation.value \<^binding>\<open>path\<close>
   79.18      (Args.context -- Scan.lift (Parse.position Parse.path)
   79.19        >> uncurry (ML_antiq NONE)) #>
   79.20 -  ML_Antiquotation.value @{binding file}
   79.21 +  ML_Antiquotation.value \<^binding>\<open>file\<close>
   79.22      (Args.context -- Scan.lift (Parse.position Parse.path)
   79.23        >> uncurry (ML_antiq (SOME File.check_file))) #>
   79.24 -  ML_Antiquotation.value @{binding dir}
   79.25 +  ML_Antiquotation.value \<^binding>\<open>dir\<close>
   79.26      (Args.context -- Scan.lift (Parse.position Parse.path)
   79.27        >> uncurry (ML_antiq (SOME File.check_dir))));
   79.28  
    80.1 --- a/src/Pure/Proof/extraction.ML	Wed Dec 06 16:01:15 2017 +0100
    80.2 +++ b/src/Pure/Proof/extraction.ML	Wed Dec 06 21:01:01 2017 +0100
    80.3 @@ -470,9 +470,9 @@
    80.4        "(realizes (r) (!!x. PROP P (x))) ==  \
    80.5      \  (!!x. PROP realizes (r (x)) (PROP P (x)))"] #>
    80.6  
    80.7 -   Attrib.setup @{binding extraction_expand} (Scan.succeed (extraction_expand false))
    80.8 +   Attrib.setup \<^binding>\<open>extraction_expand\<close> (Scan.succeed (extraction_expand false))
    80.9       "specify theorems to be expanded during extraction" #>
   80.10 -   Attrib.setup @{binding extraction_expand_def} (Scan.succeed (extraction_expand true))
   80.11 +   Attrib.setup \<^binding>\<open>extraction_expand_def\<close> (Scan.succeed (extraction_expand true))
   80.12       "specify definitions to be expanded during extraction");
   80.13  
   80.14  
    81.1 --- a/src/Pure/Pure.thy	Wed Dec 06 16:01:15 2017 +0100
    81.2 +++ b/src/Pure/Pure.thy	Wed Dec 06 21:01:01 2017 +0100
    81.3 @@ -110,7 +110,7 @@
    81.4  subsection \<open>External file dependencies\<close>
    81.5  
    81.6  ML \<open>
    81.7 -  Outer_Syntax.command @{command_keyword external_file} "formal dependency on external file"
    81.8 +  Outer_Syntax.command \<^command_keyword>\<open>external_file\<close> "formal dependency on external file"
    81.9      (Parse.position Parse.path >> (fn (s, pos) => Toplevel.keep (fn st =>
   81.10        let
   81.11          val ctxt = Toplevel.context_of st;
   81.12 @@ -126,38 +126,38 @@
   81.13  ML \<open>
   81.14  local
   81.15  
   81.16 -val semi = Scan.option @{keyword ";"};
   81.17 +val semi = Scan.option \<^keyword>\<open>;\<close>;
   81.18  
   81.19  val _ =
   81.20 -  Outer_Syntax.command @{command_keyword ML_file} "read and evaluate Isabelle/ML file"
   81.21 +  Outer_Syntax.command \<^command_keyword>\<open>ML_file\<close> "read and evaluate Isabelle/ML file"
   81.22      (Resources.parse_files "ML_file" --| semi >> ML_File.ML NONE);
   81.23  
   81.24  val _ =
   81.25 -  Outer_Syntax.command @{command_keyword ML_file_debug}
   81.26 +  Outer_Syntax.command \<^command_keyword>\<open>ML_file_debug\<close>
   81.27      "read and evaluate Isabelle/ML file (with debugger information)"
   81.28      (Resources.parse_files "ML_file_debug" --| semi >> ML_File.ML (SOME true));
   81.29  
   81.30  val _ =
   81.31 -  Outer_Syntax.command @{command_keyword ML_file_no_debug}
   81.32 +  Outer_Syntax.command \<^command_keyword>\<open>ML_file_no_debug\<close>
   81.33      "read and evaluate Isabelle/ML file (no debugger information)"
   81.34      (Resources.parse_files "ML_file_no_debug" --| semi >> ML_File.ML (SOME false));
   81.35  
   81.36  val _ =
   81.37 -  Outer_Syntax.command @{command_keyword SML_file} "read and evaluate Standard ML file"
   81.38 +  Outer_Syntax.command \<^command_keyword>\<open>SML_file\<close> "read and evaluate Standard ML file"
   81.39      (Resources.parse_files "SML_file" --| semi >> ML_File.SML NONE);
   81.40  
   81.41  val _ =
   81.42 -  Outer_Syntax.command @{command_keyword SML_file_debug}
   81.43 +  Outer_Syntax.command \<^command_keyword>\<open>SML_file_debug\<close>
   81.44      "read and evaluate Standard ML file (with debugger information)"
   81.45      (Resources.parse_files "SML_file_debug" --| semi >> ML_File.SML (SOME true));
   81.46  
   81.47  val _ =
   81.48 -  Outer_Syntax.command @{command_keyword SML_file_no_debug}
   81.49 +  Outer_Syntax.command \<^command_keyword>\<open>SML_file_no_debug\<close>
   81.50      "read and evaluate Standard ML file (no debugger information)"
   81.51      (Resources.parse_files "SML_file_no_debug" --| semi >> ML_File.SML (SOME false));
   81.52  
   81.53  val _ =
   81.54 -  Outer_Syntax.command @{command_keyword SML_export} "evaluate SML within Isabelle/ML environment"
   81.55 +  Outer_Syntax.command \<^command_keyword>\<open>SML_export\<close> "evaluate SML within Isabelle/ML environment"
   81.56      (Parse.ML_source >> (fn source =>
   81.57        let
   81.58          val flags: ML_Compiler.flags =
   81.59 @@ -169,7 +169,7 @@
   81.60        end));
   81.61  
   81.62  val _ =
   81.63 -  Outer_Syntax.command @{command_keyword SML_import} "evaluate Isabelle/ML within SML environment"
   81.64 +  Outer_Syntax.command \<^command_keyword>\<open>SML_import\<close> "evaluate Isabelle/ML within SML environment"
   81.65      (Parse.ML_source >> (fn source =>
   81.66        let
   81.67          val flags: ML_Compiler.flags =
   81.68 @@ -182,7 +182,7 @@
   81.69        end));
   81.70  
   81.71  val _ =
   81.72 -  Outer_Syntax.command @{command_keyword ML_prf} "ML text within proof"
   81.73 +  Outer_Syntax.command \<^command_keyword>\<open>ML_prf\<close> "ML text within proof"
   81.74      (Parse.ML_source >> (fn source =>
   81.75        Toplevel.proof (Proof.map_context (Context.proof_map
   81.76          (ML_Context.exec (fn () =>
   81.77 @@ -190,52 +190,52 @@
   81.78            Proof.propagate_ml_env)));
   81.79  
   81.80  val _ =
   81.81 -  Outer_Syntax.command @{command_keyword ML_val} "diagnostic ML text"
   81.82 +  Outer_Syntax.command \<^command_keyword>\<open>ML_val\<close> "diagnostic ML text"
   81.83      (Parse.ML_source >> Isar_Cmd.ml_diag true);
   81.84  
   81.85  val _ =
   81.86 -  Outer_Syntax.command @{command_keyword ML_command} "diagnostic ML text (silent)"
   81.87 +  Outer_Syntax.command \<^command_keyword>\<open>ML_command\<close> "diagnostic ML text (silent)"
   81.88      (Parse.ML_source >> Isar_Cmd.ml_diag false);
   81.89  
   81.90  val _ =
   81.91 -  Outer_Syntax.command @{command_keyword setup} "ML setup for global theory"
   81.92 +  Outer_Syntax.command \<^command_keyword>\<open>setup\<close> "ML setup for global theory"
   81.93      (Parse.ML_source >> (Toplevel.theory o Isar_Cmd.setup));
   81.94  
   81.95  val _ =
   81.96 -  Outer_Syntax.local_theory @{command_keyword local_setup} "ML setup for local theory"
   81.97 +  Outer_Syntax.local_theory \<^command_keyword>\<open>local_setup\<close> "ML setup for local theory"
   81.98      (Parse.ML_source >> Isar_Cmd.local_setup);
   81.99  
  81.100  val _ =
  81.101 -  Outer_Syntax.command @{command_keyword oracle} "declare oracle"
  81.102 -    (Parse.range Parse.name -- (@{keyword =} |-- Parse.ML_source) >>
  81.103 +  Outer_Syntax.command \<^command_keyword>\<open>oracle\<close> "declare oracle"
  81.104 +    (Parse.range Parse.name -- (\<^keyword>\<open>=\<close> |-- Parse.ML_source) >>
  81.105        (fn (x, y) => Toplevel.theory (Isar_Cmd.oracle x y)));
  81.106  
  81.107  val _ =
  81.108 -  Outer_Syntax.local_theory @{command_keyword attribute_setup} "define attribute in ML"
  81.109 +  Outer_Syntax.local_theory \<^command_keyword>\<open>attribute_setup\<close> "define attribute in ML"
  81.110      (Parse.position Parse.name --
  81.111 -        Parse.!!! (@{keyword =} |-- Parse.ML_source -- Scan.optional Parse.text "")
  81.112 +        Parse.!!! (\<^keyword>\<open>=\<close> |-- Parse.ML_source -- Scan.optional Parse.text "")
  81.113        >> (fn (name, (txt, cmt)) => Attrib.attribute_setup name txt cmt));
  81.114  
  81.115  val _ =
  81.116 -  Outer_Syntax.local_theory @{command_keyword method_setup} "define proof method in ML"
  81.117 +  Outer_Syntax.local_theory \<^command_keyword>\<open>method_setup\<close> "define proof method in ML"
  81.118      (Parse.position Parse.name --
  81.119 -        Parse.!!! (@{keyword =} |-- Parse.ML_source -- Scan.optional Parse.text "")
  81.120 +        Parse.!!! (\<^keyword>\<open>=\<close> |-- Parse.ML_source -- Scan.optional Parse.text "")
  81.121        >> (fn (name, (txt, cmt)) => Method.method_setup name txt cmt));
  81.122  
  81.123  val _ =
  81.124 -  Outer_Syntax.local_theory @{command_keyword declaration} "generic ML declaration"
  81.125 +  Outer_Syntax.local_theory \<^command_keyword>\<open>declaration\<close> "generic ML declaration"
  81.126      (Parse.opt_keyword "pervasive" -- Parse.ML_source
  81.127        >> (fn (pervasive, txt) => Isar_Cmd.declaration {syntax = false, pervasive = pervasive} txt));
  81.128  
  81.129  val _ =
  81.130 -  Outer_Syntax.local_theory @{command_keyword syntax_declaration} "generic ML syntax declaration"
  81.131 +  Outer_Syntax.local_theory \<^command_keyword>\<open>syntax_declaration\<close> "generic ML syntax declaration"
  81.132      (Parse.opt_keyword "pervasive" -- Parse.ML_source
  81.133        >> (fn (pervasive, txt) => Isar_Cmd.declaration {syntax = true, pervasive = pervasive} txt));
  81.134  
  81.135  val _ =
  81.136 -  Outer_Syntax.local_theory @{command_keyword simproc_setup} "define simproc in ML"
  81.137 +  Outer_Syntax.local_theory \<^command_keyword>\<open>simproc_setup\<close> "define simproc in ML"
  81.138      (Parse.position Parse.name --
  81.139 -      (@{keyword "("} |-- Parse.enum1 "|" Parse.term --| @{keyword ")"} --| @{keyword =}) --
  81.140 +      (\<^keyword>\<open>(\<close> |-- Parse.enum1 "|" Parse.term --| \<^keyword>\<open>)\<close> --| \<^keyword>\<open>=\<close>) --
  81.141        Parse.ML_source >> (fn ((a, b), c) => Isar_Cmd.simproc_setup a b c));
  81.142  
  81.143  in end\<close>
  81.144 @@ -249,20 +249,20 @@
  81.145  local
  81.146  
  81.147  val _ =
  81.148 -  Outer_Syntax.local_theory @{command_keyword default_sort}
  81.149 +  Outer_Syntax.local_theory \<^command_keyword>\<open>default_sort\<close>
  81.150      "declare default sort for explicit type variables"
  81.151      (Parse.sort >> (fn s => fn lthy => Local_Theory.set_defsort (Syntax.read_sort lthy s) lthy));
  81.152  
  81.153  val _ =
  81.154 -  Outer_Syntax.local_theory @{command_keyword typedecl} "type declaration"
  81.155 +  Outer_Syntax.local_theory \<^command_keyword>\<open>typedecl\<close> "type declaration"
  81.156      (Parse.type_args -- Parse.binding -- Parse.opt_mixfix
  81.157        >> (fn ((args, a), mx) =>
  81.158            Typedecl.typedecl {final = true} (a, map (rpair dummyS) args, mx) #> snd));
  81.159  
  81.160  val _ =
  81.161 -  Outer_Syntax.local_theory @{command_keyword type_synonym} "declare type abbreviation"
  81.162 +  Outer_Syntax.local_theory \<^command_keyword>\<open>type_synonym\<close> "declare type abbreviation"
  81.163      (Parse.type_args -- Parse.binding --
  81.164 -      (@{keyword =} |-- Parse.!!! (Parse.typ -- Parse.opt_mixfix'))
  81.165 +      (\<^keyword>\<open>=\<close> |-- Parse.!!! (Parse.typ -- Parse.opt_mixfix'))
  81.166        >> (fn ((args, a), (rhs, mx)) => snd o Typedecl.abbrev_cmd (a, args, mx) rhs));
  81.167  
  81.168  in end\<close>
  81.169 @@ -274,11 +274,11 @@
  81.170  local
  81.171  
  81.172  val _ =
  81.173 -  Outer_Syntax.command @{command_keyword judgment} "declare object-logic judgment"
  81.174 +  Outer_Syntax.command \<^command_keyword>\<open>judgment\<close> "declare object-logic judgment"
  81.175      (Parse.const_binding >> (Toplevel.theory o Object_Logic.add_judgment_cmd));
  81.176  
  81.177  val _ =
  81.178 -  Outer_Syntax.command @{command_keyword consts} "declare constants"
  81.179 +  Outer_Syntax.command \<^command_keyword>\<open>consts\<close> "declare constants"
  81.180      (Scan.repeat1 Parse.const_binding >> (Toplevel.theory o Sign.add_consts_cmd));
  81.181  
  81.182  in end\<close>
  81.183 @@ -290,40 +290,40 @@
  81.184  local
  81.185  
  81.186  val _ =
  81.187 -  Outer_Syntax.command @{command_keyword nonterminal}
  81.188 +  Outer_Syntax.command \<^command_keyword>\<open>nonterminal\<close>
  81.189      "declare syntactic type constructors (grammar nonterminal symbols)"
  81.190      (Parse.and_list1 Parse.binding >> (Toplevel.theory o Sign.add_nonterminals_global));
  81.191  
  81.192  val _ =
  81.193 -  Outer_Syntax.command @{command_keyword syntax} "add raw syntax clauses"
  81.194 +  Outer_Syntax.command \<^command_keyword>\<open>syntax\<close> "add raw syntax clauses"
  81.195      (Parse.syntax_mode -- Scan.repeat1 Parse.const_decl
  81.196        >> (Toplevel.theory o uncurry Sign.add_syntax_cmd));
  81.197  
  81.198  val _ =
  81.199 -  Outer_Syntax.command @{command_keyword no_syntax} "delete raw syntax clauses"
  81.200 +  Outer_Syntax.command \<^command_keyword>\<open>no_syntax\<close> "delete raw syntax clauses"
  81.201      (Parse.syntax_mode -- Scan.repeat1 Parse.const_decl
  81.202        >> (Toplevel.theory o uncurry Sign.del_syntax_cmd));
  81.203  
  81.204  val trans_pat =
  81.205    Scan.optional
  81.206 -    (@{keyword "("} |-- Parse.!!! (Parse.inner_syntax Parse.name --| @{keyword ")"})) "logic"
  81.207 +    (\<^keyword>\<open>(\<close> |-- Parse.!!! (Parse.inner_syntax Parse.name --| \<^keyword>\<open>)\<close>)) "logic"
  81.208      -- Parse.inner_syntax Parse.string;
  81.209  
  81.210  fun trans_arrow toks =
  81.211 -  ((@{keyword \<rightharpoonup>} || @{keyword =>}) >> K Syntax.Parse_Rule ||
  81.212 -    (@{keyword \<leftharpoondown>} || @{keyword <=}) >> K Syntax.Print_Rule ||
  81.213 -    (@{keyword \<rightleftharpoons>} || @{keyword ==}) >> K Syntax.Parse_Print_Rule) toks;
  81.214 +  ((\<^keyword>\<open>\<rightharpoonup>\<close> || \<^keyword>\<open>=>\<close>) >> K Syntax.Parse_Rule ||
  81.215 +    (\<^keyword>\<open>\<leftharpoondown>\<close> || \<^keyword>\<open><=\<close>) >> K Syntax.Print_Rule ||
  81.216 +    (\<^keyword>\<open>\<rightleftharpoons>\<close> || \<^keyword>\<open>==\<close>) >> K Syntax.Parse_Print_Rule) toks;
  81.217  
  81.218  val trans_line =
  81.219    trans_pat -- Parse.!!! (trans_arrow -- trans_pat)
  81.220      >> (fn (left, (arr, right)) => arr (left, right));
  81.221  
  81.222  val _ =
  81.223 -  Outer_Syntax.command @{command_keyword translations} "add syntax translation rules"
  81.224 +  Outer_Syntax.command \<^command_keyword>\<open>translations\<close> "add syntax translation rules"
  81.225      (Scan.repeat1 trans_line >> (Toplevel.theory o Isar_Cmd.translations));
  81.226  
  81.227  val _ =
  81.228 -  Outer_Syntax.command @{command_keyword no_translations} "delete syntax translation rules"
  81.229 +  Outer_Syntax.command \<^command_keyword>\<open>no_translations\<close> "delete syntax translation rules"
  81.230      (Scan.repeat1 trans_line >> (Toplevel.theory o Isar_Cmd.no_translations));
  81.231  
  81.232  in end\<close>
  81.233 @@ -335,27 +335,27 @@
  81.234  local
  81.235  
  81.236  val _ =
  81.237 -  Outer_Syntax.command @{command_keyword parse_ast_translation}
  81.238 +  Outer_Syntax.command \<^command_keyword>\<open>parse_ast_translation\<close>
  81.239      "install parse ast translation functions"
  81.240      (Parse.ML_source >> (Toplevel.theory o Isar_Cmd.parse_ast_translation));
  81.241  
  81.242  val _ =
  81.243 -  Outer_Syntax.command @{command_keyword parse_translation}
  81.244 +  Outer_Syntax.command \<^command_keyword>\<open>parse_translation\<close>
  81.245      "install parse translation functions"
  81.246      (Parse.ML_source >> (Toplevel.theory o Isar_Cmd.parse_translation));
  81.247  
  81.248  val _ =
  81.249 -  Outer_Syntax.command @{command_keyword print_translation}
  81.250 +  Outer_Syntax.command \<^command_keyword>\<open>print_translation\<close>
  81.251      "install print translation functions"
  81.252      (Parse.ML_source >> (Toplevel.theory o Isar_Cmd.print_translation));
  81.253  
  81.254  val _ =
  81.255 -  Outer_Syntax.command @{command_keyword typed_print_translation}
  81.256 +  Outer_Syntax.command \<^command_keyword>\<open>typed_print_translation\<close>
  81.257      "install typed print translation functions"
  81.258      (Parse.ML_source >> (Toplevel.theory o Isar_Cmd.typed_print_translation));
  81.259  
  81.260  val _ =
  81.261 -  Outer_Syntax.command @{command_keyword print_ast_translation}
  81.262 +  Outer_Syntax.command \<^command_keyword>\<open>print_ast_translation\<close>
  81.263      "install print ast translation functions"
  81.264      (Parse.ML_source >> (Toplevel.theory o Isar_Cmd.print_ast_translation));
  81.265  
  81.266 @@ -368,13 +368,13 @@
  81.267  local
  81.268  
  81.269  val _ =
  81.270 -  Outer_Syntax.local_theory' @{command_keyword definition} "constant definition"
  81.271 +  Outer_Syntax.local_theory' \<^command_keyword>\<open>definition\<close> "constant definition"
  81.272      (Scan.option Parse_Spec.constdecl -- (Parse_Spec.opt_thm_name ":" -- Parse.prop) --
  81.273        Parse_Spec.if_assumes -- Parse.for_fixes >> (fn (((decl, spec), prems), params) =>
  81.274          #2 oo Specification.definition_cmd decl params prems spec));
  81.275  
  81.276  val _ =
  81.277 -  Outer_Syntax.local_theory' @{command_keyword abbreviation} "constant abbreviation"
  81.278 +  Outer_Syntax.local_theory' \<^command_keyword>\<open>abbreviation\<close> "constant abbreviation"
  81.279      (Parse.syntax_mode -- Scan.option Parse_Spec.constdecl -- Parse.prop -- Parse.for_fixes
  81.280        >> (fn (((mode, decl), spec), params) => Specification.abbreviation_cmd mode decl params spec));
  81.281  
  81.282 @@ -383,19 +383,19 @@
  81.283    Parse_Spec.if_assumes -- Parse.for_fixes >> (fn ((a, b), c) => (c, b, a));
  81.284  
  81.285  val _ =
  81.286 -  Outer_Syntax.command @{command_keyword axiomatization} "axiomatic constant specification"
  81.287 +  Outer_Syntax.command \<^command_keyword>\<open>axiomatization\<close> "axiomatic constant specification"
  81.288      (Scan.optional Parse.vars [] --
  81.289        Scan.optional (Parse.where_ |-- Parse.!!! axiomatization) ([], [], [])
  81.290        >> (fn (a, (b, c, d)) => Toplevel.theory (#2 o Specification.axiomatization_cmd a b c d)));
  81.291  
  81.292  val _ =
  81.293 -  Outer_Syntax.local_theory @{command_keyword alias} "name-space alias for constant"
  81.294 -    (Parse.binding -- (Parse.!!! @{keyword =} |-- Parse.position Parse.name)
  81.295 +  Outer_Syntax.local_theory \<^command_keyword>\<open>alias\<close> "name-space alias for constant"
  81.296 +    (Parse.binding -- (Parse.!!! \<^keyword>\<open>=\<close> |-- Parse.position Parse.name)
  81.297        >> Specification.alias_cmd);
  81.298  
  81.299  val _ =
  81.300 -  Outer_Syntax.local_theory @{command_keyword type_alias} "name-space alias for type constructor"
  81.301 -    (Parse.binding -- (Parse.!!! @{keyword =} |-- Parse.position Parse.name)
  81.302 +  Outer_Syntax.local_theory \<^command_keyword>\<open>type_alias\<close> "name-space alias for type constructor"
  81.303 +    (Parse.binding -- (Parse.!!! \<^keyword>\<open>=\<close> |-- Parse.position Parse.name)
  81.304        >> Specification.type_alias_cmd);
  81.305  
  81.306  in end\<close>
  81.307 @@ -407,25 +407,25 @@
  81.308  local
  81.309  
  81.310  val _ =
  81.311 -  Outer_Syntax.local_theory @{command_keyword type_notation}
  81.312 +  Outer_Syntax.local_theory \<^command_keyword>\<open>type_notation\<close>
  81.313      "add concrete syntax for type constructors"
  81.314      (Parse.syntax_mode -- Parse.and_list1 (Parse.type_const -- Parse.mixfix)
  81.315        >> (fn (mode, args) => Specification.type_notation_cmd true mode args));
  81.316  
  81.317  val _ =
  81.318 -  Outer_Syntax.local_theory @{command_keyword no_type_notation}
  81.319 +  Outer_Syntax.local_theory \<^command_keyword>\<open>no_type_notation\<close>
  81.320      "delete concrete syntax for type constructors"
  81.321      (Parse.syntax_mode -- Parse.and_list1 (Parse.type_const -- Parse.mixfix)
  81.322        >> (fn (mode, args) => Specification.type_notation_cmd false mode args));
  81.323  
  81.324  val _ =
  81.325 -  Outer_Syntax.local_theory @{command_keyword notation}
  81.326 +  Outer_Syntax.local_theory \<^command_keyword>\<open>notation\<close>
  81.327      "add concrete syntax for constants / fixed variables"
  81.328      (Parse.syntax_mode -- Parse.and_list1 (Parse.const -- Parse.mixfix)
  81.329        >> (fn (mode, args) => Specification.notation_cmd true mode args));
  81.330  
  81.331  val _ =
  81.332 -  Outer_Syntax.local_theory @{command_keyword no_notation}
  81.333 +  Outer_Syntax.local_theory \<^command_keyword>\<open>no_notation\<close>
  81.334      "delete concrete syntax for constants / fixed variables"
  81.335      (Parse.syntax_mode -- Parse.and_list1 (Parse.const -- Parse.mixfix)
  81.336        >> (fn (mode, args) => Specification.notation_cmd false mode args));
  81.337 @@ -459,11 +459,11 @@
  81.338        ((if schematic then Specification.schematic_theorem_cmd else Specification.theorem_cmd)
  81.339          long Thm.theoremK NONE (K I) binding includes elems concl)));
  81.340  
  81.341 -val _ = theorem @{command_keyword theorem} false "theorem";
  81.342 -val _ = theorem @{command_keyword lemma} false "lemma";
  81.343 -val _ = theorem @{command_keyword corollary} false "corollary";
  81.344 -val _ = theorem @{command_keyword proposition} false "proposition";
  81.345 -val _ = theorem @{command_keyword schematic_goal} true "schematic goal";
  81.346 +val _ = theorem \<^command_keyword>\<open>theorem\<close> false "theorem";
  81.347 +val _ = theorem \<^command_keyword>\<open>lemma\<close> false "lemma";
  81.348 +val _ = theorem \<^command_keyword>\<open>corollary\<close> false "corollary";
  81.349 +val _ = theorem \<^command_keyword>\<open>proposition\<close> false "proposition";
  81.350 +val _ = theorem \<^command_keyword>\<open>schematic_goal\<close> true "schematic goal";
  81.351  
  81.352  in end\<close>
  81.353  
  81.354 @@ -471,18 +471,18 @@
  81.355  local
  81.356  
  81.357  val _ =
  81.358 -  Outer_Syntax.local_theory' @{command_keyword lemmas} "define theorems"
  81.359 +  Outer_Syntax.local_theory' \<^command_keyword>\<open>lemmas\<close> "define theorems"
  81.360      (Parse_Spec.name_facts -- Parse.for_fixes >>
  81.361        (fn (facts, fixes) => #2 oo Specification.theorems_cmd Thm.theoremK facts fixes));
  81.362  
  81.363  val _ =
  81.364 -  Outer_Syntax.local_theory' @{command_keyword declare} "declare theorems"
  81.365 +  Outer_Syntax.local_theory' \<^command_keyword>\<open>declare\<close> "declare theorems"
  81.366      (Parse.and_list1 Parse.thms1 -- Parse.for_fixes
  81.367        >> (fn (facts, fixes) =>
  81.368            #2 oo Specification.theorems_cmd "" [(Binding.empty_atts, flat facts)] fixes));
  81.369  
  81.370  val _ =
  81.371 -  Outer_Syntax.local_theory @{command_keyword named_theorems}
  81.372 +  Outer_Syntax.local_theory \<^command_keyword>\<open>named_theorems\<close>
  81.373      "declare named collection of theorems"
  81.374      (Parse.and_list1 (Parse.binding -- Scan.optional Parse.text "") >>
  81.375        fold (fn (b, descr) => snd o Named_Theorems.declare b descr));
  81.376 @@ -503,19 +503,19 @@
  81.377          in fold (hide fully o prep ctxt) args thy end))));
  81.378  
  81.379  val _ =
  81.380 -  hide_names @{command_keyword hide_class} "classes" Sign.hide_class Parse.class
  81.381 +  hide_names \<^command_keyword>\<open>hide_class\<close> "classes" Sign.hide_class Parse.class
  81.382      Proof_Context.read_class;
  81.383  
  81.384  val _ =
  81.385 -  hide_names @{command_keyword hide_type} "types" Sign.hide_type Parse.type_const
  81.386 +  hide_names \<^command_keyword>\<open>hide_type\<close> "types" Sign.hide_type Parse.type_const
  81.387      ((#1 o dest_Type) oo Proof_Context.read_type_name {proper = true, strict = false});
  81.388  
  81.389  val _ =
  81.390 -  hide_names @{command_keyword hide_const} "consts" Sign.hide_const Parse.const
  81.391 +  hide_names \<^command_keyword>\<open>hide_const\<close> "consts" Sign.hide_const Parse.const
  81.392      ((#1 o dest_Const) oo Proof_Context.read_const {proper = true, strict = false});
  81.393  
  81.394  val _ =
  81.395 -  hide_names @{command_keyword hide_fact} "facts" Global_Theory.hide_fact
  81.396 +  hide_names \<^command_keyword>\<open>hide_fact\<close> "facts" Global_Theory.hide_fact
  81.397      (Parse.position Parse.name) (Global_Theory.check_fact o Proof_Context.theory_of);
  81.398  
  81.399  in end\<close>
  81.400 @@ -527,29 +527,29 @@
  81.401  local
  81.402  
  81.403  val _ =
  81.404 -  Outer_Syntax.maybe_begin_local_theory @{command_keyword bundle}
  81.405 +  Outer_Syntax.maybe_begin_local_theory \<^command_keyword>\<open>bundle\<close>
  81.406      "define bundle of declarations"
  81.407 -    ((Parse.binding --| @{keyword =}) -- Parse.thms1 -- Parse.for_fixes
  81.408 +    ((Parse.binding --| \<^keyword>\<open>=\<close>) -- Parse.thms1 -- Parse.for_fixes
  81.409        >> (uncurry Bundle.bundle_cmd))
  81.410      (Parse.binding --| Parse.begin >> Bundle.init);
  81.411  
  81.412  val _ =
  81.413 -  Outer_Syntax.local_theory @{command_keyword unbundle}
  81.414 +  Outer_Syntax.local_theory \<^command_keyword>\<open>unbundle\<close>
  81.415      "activate declarations from bundle in local theory"
  81.416      (Scan.repeat1 (Parse.position Parse.name) >> Bundle.unbundle_cmd);
  81.417  
  81.418  val _ =
  81.419 -  Outer_Syntax.command @{command_keyword include}
  81.420 +  Outer_Syntax.command \<^command_keyword>\<open>include\<close>
  81.421      "activate declarations from bundle in proof body"
  81.422      (Scan.repeat1 (Parse.position Parse.name) >> (Toplevel.proof o Bundle.include_cmd));
  81.423  
  81.424  val _ =
  81.425 -  Outer_Syntax.command @{command_keyword including}
  81.426 +  Outer_Syntax.command \<^command_keyword>\<open>including\<close>
  81.427      "activate declarations from bundle in goal refinement"
  81.428      (Scan.repeat1 (Parse.position Parse.name) >> (Toplevel.proof o Bundle.including_cmd));
  81.429  
  81.430  val _ =
  81.431 -  Outer_Syntax.command @{command_keyword print_bundles}
  81.432 +  Outer_Syntax.command \<^command_keyword>\<open>print_bundles\<close>
  81.433      "print bundles of declarations"
  81.434      (Parse.opt_bang >> (fn b => Toplevel.keep (Bundle.print_bundles b o Toplevel.context_of)));
  81.435  
  81.436 @@ -564,7 +564,7 @@
  81.437  local
  81.438  
  81.439  val _ =
  81.440 -  Outer_Syntax.command @{command_keyword context} "begin local theory context"
  81.441 +  Outer_Syntax.command \<^command_keyword>\<open>context\<close> "begin local theory context"
  81.442      ((Parse.position Parse.name >> (fn name =>
  81.443          Toplevel.begin_local_theory true (Named_Target.begin name)) ||
  81.444        Scan.optional Parse_Spec.includes [] -- Scan.repeat Parse_Spec.context_element
  81.445 @@ -572,7 +572,7 @@
  81.446        --| Parse.begin);
  81.447  
  81.448  val _ =
  81.449 -  Outer_Syntax.command @{command_keyword end} "end context"
  81.450 +  Outer_Syntax.command \<^command_keyword>\<open>end\<close> "end context"
  81.451      (Scan.succeed
  81.452        (Toplevel.exit o Toplevel.end_local_theory o Toplevel.close_target o
  81.453          Toplevel.end_proof (K Proof.end_notepad)));
  81.454 @@ -587,19 +587,19 @@
  81.455  
  81.456  val locale_val =
  81.457    Parse_Spec.locale_expression --
  81.458 -    Scan.optional (@{keyword +} |-- Parse.!!! (Scan.repeat1 Parse_Spec.context_element)) [] ||
  81.459 +    Scan.optional (\<^keyword>\<open>+\<close> |-- Parse.!!! (Scan.repeat1 Parse_Spec.context_element)) [] ||
  81.460    Scan.repeat1 Parse_Spec.context_element >> pair ([], []);
  81.461  
  81.462  val _ =
  81.463 -  Outer_Syntax.command @{command_keyword locale} "define named specification context"
  81.464 +  Outer_Syntax.command \<^command_keyword>\<open>locale\<close> "define named specification context"
  81.465      (Parse.binding --
  81.466 -      Scan.optional (@{keyword =} |-- Parse.!!! locale_val) (([], []), []) -- Parse.opt_begin
  81.467 +      Scan.optional (\<^keyword>\<open>=\<close> |-- Parse.!!! locale_val) (([], []), []) -- Parse.opt_begin
  81.468        >> (fn ((name, (expr, elems)), begin) =>
  81.469            Toplevel.begin_local_theory begin
  81.470              (Expression.add_locale_cmd name Binding.empty expr elems #> snd)));
  81.471  
  81.472  val _ =
  81.473 -  Outer_Syntax.command @{command_keyword experiment} "open private specification context"
  81.474 +  Outer_Syntax.command \<^command_keyword>\<open>experiment\<close> "open private specification context"
  81.475      (Scan.repeat Parse_Spec.context_element --| Parse.begin
  81.476        >> (fn elems =>
  81.477            Toplevel.begin_local_theory true (Experiment.experiment_cmd elems #> snd)));
  81.478 @@ -607,38 +607,38 @@
  81.479  val interpretation_args =
  81.480    Parse.!!! Parse_Spec.locale_expression --
  81.481      Scan.optional
  81.482 -      (@{keyword rewrites} |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":" -- Parse.prop)) [];
  81.483 +      (\<^keyword>\<open>rewrites\<close> |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":" -- Parse.prop)) [];
  81.484  
  81.485  val _ =
  81.486 -  Outer_Syntax.command @{command_keyword interpret}
  81.487 +  Outer_Syntax.command \<^command_keyword>\<open>interpret\<close>
  81.488      "prove interpretation of locale expression in proof context"
  81.489      (interpretation_args >> (fn (expr, equations) =>
  81.490        Toplevel.proof (Interpretation.interpret_cmd expr equations)));
  81.491  
  81.492  val interpretation_args_with_defs =
  81.493    Parse.!!! Parse_Spec.locale_expression --
  81.494 -    (Scan.optional (@{keyword defines} |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":"
  81.495 -      -- ((Parse.binding -- Parse.opt_mixfix') --| @{keyword =} -- Parse.term))) [] --
  81.496 +    (Scan.optional (\<^keyword>\<open>defines\<close> |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":"
  81.497 +      -- ((Parse.binding -- Parse.opt_mixfix') --| \<^keyword>\<open>=\<close> -- Parse.term))) [] --
  81.498      Scan.optional
  81.499 -      (@{keyword rewrites} |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":" -- Parse.prop)) []);
  81.500 +      (\<^keyword>\<open>rewrites\<close> |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":" -- Parse.prop)) []);
  81.501  
  81.502  val _ =
  81.503 -  Outer_Syntax.local_theory_to_proof @{command_keyword global_interpretation}
  81.504 +  Outer_Syntax.local_theory_to_proof \<^command_keyword>\<open>global_interpretation\<close>
  81.505      "prove interpretation of locale expression into global theory"
  81.506      (interpretation_args_with_defs >> (fn (expr, (defs, equations)) =>
  81.507        Interpretation.global_interpretation_cmd expr defs equations));
  81.508  
  81.509  val _ =
  81.510 -  Outer_Syntax.command @{command_keyword sublocale}
  81.511 +  Outer_Syntax.command \<^command_keyword>\<open>sublocale\<close>
  81.512      "prove sublocale relation between a locale and a locale expression"
  81.513 -    ((Parse.position Parse.name --| (@{keyword \<subseteq>} || @{keyword <}) --
  81.514 +    ((Parse.position Parse.name --| (\<^keyword>\<open>\<subseteq>\<close> || \<^keyword>\<open><\<close>) --
  81.515        interpretation_args_with_defs >> (fn (loc, (expr, (defs, equations))) =>
  81.516          Toplevel.theory_to_proof (Interpretation.global_sublocale_cmd loc expr defs equations)))
  81.517      || interpretation_args_with_defs >> (fn (expr, (defs, equations)) =>
  81.518          Toplevel.local_theory_to_proof NONE NONE (Interpretation.sublocale_cmd expr defs equations)));
  81.519  
  81.520  val _ =
  81.521 -  Outer_Syntax.command @{command_keyword interpretation}
  81.522 +  Outer_Syntax.command \<^command_keyword>\<open>interpretation\<close>
  81.523      "prove interpretation of locale expression in local theory or into global theory"
  81.524      (interpretation_args >> (fn (expr, equations) =>
  81.525        Toplevel.local_theory_to_proof NONE NONE
  81.526 @@ -654,29 +654,29 @@
  81.527  
  81.528  val class_val =
  81.529    Parse_Spec.class_expression --
  81.530 -    Scan.optional (@{keyword +} |-- Parse.!!! (Scan.repeat1 Parse_Spec.context_element)) [] ||
  81.531 +    Scan.optional (\<^keyword>\<open>+\<close> |-- Parse.!!! (Scan.repeat1 Parse_Spec.context_element)) [] ||
  81.532    Scan.repeat1 Parse_Spec.context_element >> pair [];
  81.533  
  81.534  val _ =
  81.535 -  Outer_Syntax.command @{command_keyword class} "define type class"
  81.536 -   (Parse.binding -- Scan.optional (@{keyword =} |-- class_val) ([], []) -- Parse.opt_begin
  81.537 +  Outer_Syntax.command \<^command_keyword>\<open>class\<close> "define type class"
  81.538 +   (Parse.binding -- Scan.optional (\<^keyword>\<open>=\<close> |-- class_val) ([], []) -- Parse.opt_begin
  81.539      >> (fn ((name, (supclasses, elems)), begin) =>
  81.540          Toplevel.begin_local_theory begin
  81.541            (Class_Declaration.class_cmd name supclasses elems #> snd)));
  81.542  
  81.543  val _ =
  81.544 -  Outer_Syntax.local_theory_to_proof @{command_keyword subclass} "prove a subclass relation"
  81.545 +  Outer_Syntax.local_theory_to_proof \<^command_keyword>\<open>subclass\<close> "prove a subclass relation"
  81.546      (Parse.class >> Class_Declaration.subclass_cmd);
  81.547  
  81.548  val _ =
  81.549 -  Outer_Syntax.command @{command_keyword instantiation} "instantiate and prove type arity"
  81.550 +  Outer_Syntax.command \<^command_keyword>\<open>instantiation\<close> "instantiate and prove type arity"
  81.551     (Parse.multi_arity --| Parse.begin
  81.552       >> (fn arities => Toplevel.begin_local_theory true (Class.instantiation_cmd arities)));
  81.553  
  81.554  val _ =
  81.555 -  Outer_Syntax.command @{command_keyword instance} "prove type arity or subclass relation"
  81.556 +  Outer_Syntax.command \<^command_keyword>\<open>instance\<close> "prove type arity or subclass relation"
  81.557    ((Parse.class --
  81.558 -    ((@{keyword \<subseteq>} || @{keyword <}) |-- Parse.!!! Parse.class) >> Class.classrel_cmd ||
  81.559 +    ((\<^keyword>\<open>\<subseteq>\<close> || \<^keyword>\<open><\<close>) |-- Parse.!!! Parse.class) >> Class.classrel_cmd ||
  81.560      Parse.multi_arity >> Class.instance_arity_cmd) >> Toplevel.theory_to_proof ||
  81.561      Scan.succeed (Toplevel.local_theory_to_proof NONE NONE (Class.instantiation_instance I)));
  81.562  
  81.563 @@ -689,9 +689,9 @@
  81.564  local
  81.565  
  81.566  val _ =
  81.567 -  Outer_Syntax.command @{command_keyword overloading} "overloaded definitions"
  81.568 -   (Scan.repeat1 (Parse.name --| (@{keyword ==} || @{keyword \<equiv>}) -- Parse.term --
  81.569 -      Scan.optional (@{keyword "("} |-- (@{keyword unchecked} >> K false) --| @{keyword ")"}) true
  81.570 +  Outer_Syntax.command \<^command_keyword>\<open>overloading\<close> "overloaded definitions"
  81.571 +   (Scan.repeat1 (Parse.name --| (\<^keyword>\<open>==\<close> || \<^keyword>\<open>\<equiv>\<close>) -- Parse.term --
  81.572 +      Scan.optional (\<^keyword>\<open>(\<close> |-- (\<^keyword>\<open>unchecked\<close> >> K false) --| \<^keyword>\<open>)\<close>) true
  81.573        >> Scan.triple1) --| Parse.begin
  81.574     >> (fn operations => Toplevel.begin_local_theory true (Overloading.overloading_cmd operations)));
  81.575  
  81.576 @@ -704,7 +704,7 @@
  81.577  local
  81.578  
  81.579  val _ =
  81.580 -  Outer_Syntax.local_theory_to_proof @{command_keyword notepad} "begin proof context"
  81.581 +  Outer_Syntax.local_theory_to_proof \<^command_keyword>\<open>notepad\<close> "begin proof context"
  81.582      (Parse.begin >> K Proof.begin_notepad);
  81.583  
  81.584  in end\<close>
  81.585 @@ -720,22 +720,22 @@
  81.586      >> (fn ((shows, (strict, assumes)), fixes) => (strict, fixes, assumes, shows));
  81.587  
  81.588  val _ =
  81.589 -  Outer_Syntax.command @{command_keyword have} "state local goal"
  81.590 +  Outer_Syntax.command \<^command_keyword>\<open>have\<close> "state local goal"
  81.591      (structured_statement >> (fn (a, b, c, d) =>
  81.592        Toplevel.proof' (fn int => Proof.have_cmd a NONE (K I) b c d int #> #2)));
  81.593  
  81.594  val _ =
  81.595 -  Outer_Syntax.command @{command_keyword show} "state local goal, to refine pending subgoals"
  81.596 +  Outer_Syntax.command \<^command_keyword>\<open>show\<close> "state local goal, to refine pending subgoals"
  81.597      (structured_statement >> (fn (a, b, c, d) =>
  81.598        Toplevel.proof' (fn int => Proof.show_cmd a NONE (K I) b c d int #> #2)));
  81.599  
  81.600  val _ =
  81.601 -  Outer_Syntax.command @{command_keyword hence} "old-style alias of \"then have\""
  81.602 +  Outer_Syntax.command \<^command_keyword>\<open>hence\<close> "old-style alias of \"then have\""
  81.603      (structured_statement >> (fn (a, b, c, d) =>
  81.604        Toplevel.proof' (fn int => Proof.chain #> Proof.have_cmd a NONE (K I) b c d int #> #2)));
  81.605  
  81.606  val _ =
  81.607 -  Outer_Syntax.command @{command_keyword thus} "old-style alias of  \"then show\""
  81.608 +  Outer_Syntax.command \<^command_keyword>\<open>thus\<close> "old-style alias of  \"then show\""
  81.609      (structured_statement >> (fn (a, b, c, d) =>
  81.610        Toplevel.proof' (fn int => Proof.chain #> Proof.show_cmd a NONE (K I) b c d int #> #2)));
  81.611  
  81.612 @@ -750,31 +750,31 @@
  81.613  val facts = Parse.and_list1 Parse.thms1;
  81.614  
  81.615  val _ =
  81.616 -  Outer_Syntax.command @{command_keyword then} "forward chaining"
  81.617 +  Outer_Syntax.command \<^command_keyword>\<open>then\<close> "forward chaining"
  81.618      (Scan.succeed (Toplevel.proof Proof.chain));
  81.619  
  81.620  val _ =
  81.621 -  Outer_Syntax.command @{command_keyword from} "forward chaining from given facts"
  81.622 +  Outer_Syntax.command \<^command_keyword>\<open>from\<close> "forward chaining from given facts"
  81.623      (facts >> (Toplevel.proof o Proof.from_thmss_cmd));
  81.624  
  81.625  val _ =
  81.626 -  Outer_Syntax.command @{command_keyword with} "forward chaining from given and current facts"
  81.627 +  Outer_Syntax.command \<^command_keyword>\<open>with\<close> "forward chaining from given and current facts"
  81.628      (facts >> (Toplevel.proof o Proof.with_thmss_cmd));
  81.629  
  81.630  val _ =
  81.631 -  Outer_Syntax.command @{command_keyword note} "define facts"
  81.632 +  Outer_Syntax.command \<^command_keyword>\<open>note\<close> "define facts"
  81.633      (Parse_Spec.name_facts >> (Toplevel.proof o Proof.note_thmss_cmd));
  81.634  
  81.635  val _ =
  81.636 -  Outer_Syntax.command @{command_keyword supply} "define facts during goal refinement (unstructured)"
  81.637 +  Outer_Syntax.command \<^command_keyword>\<open>supply\<close> "define facts during goal refinement (unstructured)"
  81.638      (Parse_Spec.name_facts >> (Toplevel.proof o Proof.supply_cmd));
  81.639  
  81.640  val _ =
  81.641 -  Outer_Syntax.command @{command_keyword using} "augment goal facts"
  81.642 +  Outer_Syntax.command \<^command_keyword>\<open>using\<close> "augment goal facts"
  81.643      (facts >> (Toplevel.proof o Proof.using_cmd));
  81.644  
  81.645  val _ =
  81.646 -  Outer_Syntax.command @{command_keyword unfolding} "unfold definitions in goal and facts"
  81.647 +  Outer_Syntax.command \<^command_keyword>\<open>unfolding\<close> "unfold definitions in goal and facts"
  81.648      (facts >> (Toplevel.proof o Proof.unfolding_cmd));
  81.649  
  81.650  in end\<close>
  81.651 @@ -790,51 +790,51 @@
  81.652      >> (fn ((shows, assumes), fixes) => (fixes, assumes, shows));
  81.653  
  81.654  val _ =
  81.655 -  Outer_Syntax.command @{command_keyword fix} "fix local variables (Skolem constants)"
  81.656 +  Outer_Syntax.command \<^command_keyword>\<open>fix\<close> "fix local variables (Skolem constants)"
  81.657      (Parse.vars >> (Toplevel.proof o Proof.fix_cmd));
  81.658  
  81.659  val _ =
  81.660 -  Outer_Syntax.command @{command_keyword assume} "assume propositions"
  81.661 +  Outer_Syntax.command \<^command_keyword>\<open>assume\<close> "assume propositions"
  81.662      (structured_statement >> (fn (a, b, c) => Toplevel.proof (Proof.assume_cmd a b c)));
  81.663  
  81.664  val _ =
  81.665 -  Outer_Syntax.command @{command_keyword presume} "assume propositions, to be established later"
  81.666 +  Outer_Syntax.command \<^command_keyword>\<open>presume\<close> "assume propositions, to be established later"
  81.667      (structured_statement >> (fn (a, b, c) => Toplevel.proof (Proof.presume_cmd a b c)));
  81.668  
  81.669  val _ =
  81.670 -  Outer_Syntax.command @{command_keyword define} "local definition (non-polymorphic)"
  81.671 +  Outer_Syntax.command \<^command_keyword>\<open>define\<close> "local definition (non-polymorphic)"
  81.672      ((Parse.vars --| Parse.where_) -- Parse_Spec.statement -- Parse.for_fixes
  81.673        >> (fn ((a, b), c) => Toplevel.proof (Proof.define_cmd a c b)));
  81.674  
  81.675  val _ =
  81.676 -  Outer_Syntax.command @{command_keyword consider} "state cases rule"
  81.677 +  Outer_Syntax.command \<^command_keyword>\<open>consider\<close> "state cases rule"
  81.678      (Parse_Spec.obtains >> (Toplevel.proof' o Obtain.consider_cmd));
  81.679  
  81.680  val _ =
  81.681 -  Outer_Syntax.command @{command_keyword obtain} "generalized elimination"
  81.682 +  Outer_Syntax.command \<^command_keyword>\<open>obtain\<close> "generalized elimination"
  81.683      (Parse.parbinding -- Scan.optional (Parse.vars --| Parse.where_) [] -- structured_statement
  81.684        >> (fn ((a, b), (c, d, e)) => Toplevel.proof' (Obtain.obtain_cmd a b c d e)));
  81.685  
  81.686  val _ =
  81.687 -  Outer_Syntax.command @{command_keyword guess} "wild guessing (unstructured)"
  81.688 +  Outer_Syntax.command \<^command_keyword>\<open>guess\<close> "wild guessing (unstructured)"
  81.689      (Scan.optional Parse.vars [] >> (Toplevel.proof' o Obtain.guess_cmd));
  81.690  
  81.691  val _ =
  81.692 -  Outer_Syntax.command @{command_keyword let} "bind text variables"
  81.693 -    (Parse.and_list1 (Parse.and_list1 Parse.term -- (@{keyword =} |-- Parse.term))
  81.694 +  Outer_Syntax.command \<^command_keyword>\<open>let\<close> "bind text variables"
  81.695 +    (Parse.and_list1 (Parse.and_list1 Parse.term -- (\<^keyword>\<open>=\<close> |-- Parse.term))
  81.696        >> (Toplevel.proof o Proof.let_bind_cmd));
  81.697  
  81.698  val _ =
  81.699 -  Outer_Syntax.command @{command_keyword write} "add concrete syntax for constants / fixed variables"
  81.700 +  Outer_Syntax.command \<^command_keyword>\<open>write\<close> "add concrete syntax for constants / fixed variables"
  81.701      (Parse.syntax_mode -- Parse.and_list1 (Parse.const -- Parse.mixfix)
  81.702      >> (fn (mode, args) => Toplevel.proof (Proof.write_cmd mode args)));
  81.703  
  81.704  val _ =
  81.705 -  Outer_Syntax.command @{command_keyword case} "invoke local context"
  81.706 +  Outer_Syntax.command \<^command_keyword>\<open>case\<close> "invoke local context"
  81.707      (Parse_Spec.opt_thm_name ":" --
  81.708 -      (@{keyword "("} |--
  81.709 +      (\<^keyword>\<open>(\<close> |--
  81.710          Parse.!!! (Parse.position Parse.name -- Scan.repeat (Parse.maybe Parse.binding)
  81.711 -          --| @{keyword ")"}) ||
  81.712 +          --| \<^keyword>\<open>)\<close>) ||
  81.713          Parse.position Parse.name >> rpair []) >> (Toplevel.proof o Proof.case_cmd));
  81.714  
  81.715  in end\<close>
  81.716 @@ -846,15 +846,15 @@
  81.717  local
  81.718  
  81.719  val _ =
  81.720 -  Outer_Syntax.command @{command_keyword "{"} "begin explicit proof block"
  81.721 +  Outer_Syntax.command \<^command_keyword>\<open>{\<close> "begin explicit proof block"
  81.722      (Scan.succeed (Toplevel.proof Proof.begin_block));
  81.723  
  81.724  val _ =
  81.725 -  Outer_Syntax.command @{command_keyword "}"} "end explicit proof block"
  81.726 +  Outer_Syntax.command \<^command_keyword>\<open>}\<close> "end explicit proof block"
  81.727      (Scan.succeed (Toplevel.proof Proof.end_block));
  81.728  
  81.729  val _ =
  81.730 -  Outer_Syntax.command @{command_keyword next} "enter next proof block"
  81.731 +  Outer_Syntax.command \<^command_keyword>\<open>next\<close> "enter next proof block"
  81.732      (Scan.succeed (Toplevel.proof Proof.next_block));
  81.733  
  81.734  in end\<close>
  81.735 @@ -866,40 +866,40 @@
  81.736  local
  81.737  
  81.738  val _ =
  81.739 -  Outer_Syntax.command @{command_keyword qed} "conclude proof"
  81.740 +  Outer_Syntax.command \<^command_keyword>\<open>qed\<close> "conclude proof"
  81.741      (Scan.option Method.parse >> (fn m =>
  81.742       (Option.map Method.report m;
  81.743        Isar_Cmd.qed m)));
  81.744  
  81.745  val _ =
  81.746 -  Outer_Syntax.command @{command_keyword by} "terminal backward proof"
  81.747 +  Outer_Syntax.command \<^command_keyword>\<open>by\<close> "terminal backward proof"
  81.748      (Method.parse -- Scan.option Method.parse >> (fn (m1, m2) =>
  81.749       (Method.report m1;
  81.750        Option.map Method.report m2;
  81.751        Isar_Cmd.terminal_proof (m1, m2))));
  81.752  
  81.753  val _ =
  81.754 -  Outer_Syntax.command @{command_keyword ".."} "default proof"
  81.755 +  Outer_Syntax.command \<^command_keyword>\<open>..\<close> "default proof"
  81.756      (Scan.succeed Isar_Cmd.default_proof);
  81.757  
  81.758  val _ =
  81.759 -  Outer_Syntax.command @{command_keyword "."} "immediate proof"
  81.760 +  Outer_Syntax.command \<^command_keyword>\<open>.\<close> "immediate proof"
  81.761      (Scan.succeed Isar_Cmd.immediate_proof);
  81.762  
  81.763  val _ =
  81.764 -  Outer_Syntax.command @{command_keyword done} "done proof"
  81.765 +  Outer_Syntax.command \<^command_keyword>\<open>done\<close> "done proof"
  81.766      (Scan.succeed Isar_Cmd.done_proof);
  81.767  
  81.768  val _ =
  81.769 -  Outer_Syntax.command @{command_keyword sorry} "skip proof (quick-and-dirty mode only!)"
  81.770 +  Outer_Syntax.command \<^command_keyword>\<open>sorry\<close> "skip proof (quick-and-dirty mode only!)"
  81.771      (Scan.succeed Isar_Cmd.skip_proof);
  81.772  
  81.773  val _ =
  81.774 -  Outer_Syntax.command @{command_keyword \<proof>} "dummy proof (quick-and-dirty mode only!)"
  81.775 +  Outer_Syntax.command \<^command_keyword>\<open>\<proof>\<close> "dummy proof (quick-and-dirty mode only!)"
  81.776      (Scan.succeed Isar_Cmd.skip_proof);
  81.777  
  81.778  val _ =
  81.779 -  Outer_Syntax.command @{command_keyword oops} "forget proof"
  81.780 +  Outer_Syntax.command \<^command_keyword>\<open>oops\<close> "forget proof"
  81.781      (Scan.succeed (Toplevel.forget_proof true));
  81.782  
  81.783  in end\<close>
  81.784 @@ -911,23 +911,23 @@
  81.785  local
  81.786  
  81.787  val _ =
  81.788 -  Outer_Syntax.command @{command_keyword defer} "shuffle internal proof state"
  81.789 +  Outer_Syntax.command \<^command_keyword>\<open>defer\<close> "shuffle internal proof state"
  81.790      (Scan.optional Parse.nat 1 >> (Toplevel.proof o Proof.defer));
  81.791  
  81.792  val _ =
  81.793 -  Outer_Syntax.command @{command_keyword prefer} "shuffle internal proof state"
  81.794 +  Outer_Syntax.command \<^command_keyword>\<open>prefer\<close> "shuffle internal proof state"
  81.795      (Parse.nat >> (Toplevel.proof o Proof.prefer));
  81.796  
  81.797  val _ =
  81.798 -  Outer_Syntax.command @{command_keyword apply} "initial goal refinement step (unstructured)"
  81.799 +  Outer_Syntax.command \<^command_keyword>\<open>apply\<close> "initial goal refinement step (unstructured)"
  81.800      (Method.parse >> (fn m => (Method.report m; Toplevel.proofs (Proof.apply m))));
  81.801  
  81.802  val _ =
  81.803 -  Outer_Syntax.command @{command_keyword apply_end} "terminal goal refinement step (unstructured)"
  81.804 +  Outer_Syntax.command \<^command_keyword>\<open>apply_end\<close> "terminal goal refinement step (unstructured)"
  81.805      (Method.parse >> (fn m => (Method.report m; Toplevel.proofs (Proof.apply_end m))));
  81.806  
  81.807  val _ =
  81.808 -  Outer_Syntax.command @{command_keyword proof} "backward proof step"
  81.809 +  Outer_Syntax.command \<^command_keyword>\<open>proof\<close> "backward proof step"
  81.810      (Scan.option Method.parse >> (fn m =>
  81.811        (Option.map Method.report m;
  81.812         Toplevel.proof (fn state =>
  81.813 @@ -952,15 +952,15 @@
  81.814  
  81.815  val for_params =
  81.816    Scan.optional
  81.817 -    (@{keyword for} |--
  81.818 +    (\<^keyword>\<open>for\<close> |--
  81.819        Parse.!!! ((Scan.option Parse.dots >> is_some) --
  81.820          (Scan.repeat1 (Parse.position (Parse.maybe Parse.name)))))
  81.821      (false, []);
  81.822  
  81.823  val _ =
  81.824 -  Outer_Syntax.command @{command_keyword subgoal}
  81.825 +  Outer_Syntax.command \<^command_keyword>\<open>subgoal\<close>
  81.826      "focus on first subgoal within backward refinement"
  81.827 -    (opt_fact_binding -- (Scan.option (@{keyword premises} |-- Parse.!!! opt_fact_binding)) --
  81.828 +    (opt_fact_binding -- (Scan.option (\<^keyword>\<open>premises\<close> |-- Parse.!!! opt_fact_binding)) --
  81.829        for_params >> (fn ((a, b), c) =>
  81.830          Toplevel.proofs (Seq.make_results o Seq.single o #2 o Subgoal.subgoal_cmd a b c)));
  81.831  
  81.832 @@ -973,28 +973,28 @@
  81.833  local
  81.834  
  81.835  val calculation_args =
  81.836 -  Scan.option (@{keyword "("} |-- Parse.!!! ((Parse.thms1 --| @{keyword ")"})));
  81.837 +  Scan.option (\<^keyword>\<open>(\<close> |-- Parse.!!! ((Parse.thms1 --| \<^keyword>\<open>)\<close>)));
  81.838  
  81.839  val _ =
  81.840 -  Outer_Syntax.command @{command_keyword also} "combine calculation and current facts"
  81.841 +  Outer_Syntax.command \<^command_keyword>\<open>also\<close> "combine calculation and current facts"
  81.842      (calculation_args >> (Toplevel.proofs' o Calculation.also_cmd));
  81.843  
  81.844  val _ =
  81.845 -  Outer_Syntax.command @{command_keyword finally}
  81.846 +  Outer_Syntax.command \<^command_keyword>\<open>finally\<close>
  81.847      "combine calculation and current facts, exhibit result"
  81.848      (calculation_args >> (Toplevel.proofs' o Calculation.finally_cmd));
  81.849  
  81.850  val _ =
  81.851 -  Outer_Syntax.command @{command_keyword moreover} "augment calculation by current facts"
  81.852 +  Outer_Syntax.command \<^command_keyword>\<open>moreover\<close> "augment calculation by current facts"
  81.853      (Scan.succeed (Toplevel.proof' Calculation.moreover));
  81.854  
  81.855  val _ =
  81.856 -  Outer_Syntax.command @{command_keyword ultimately}
  81.857 +  Outer_Syntax.command \<^command_keyword>\<open>ultimately\<close>
  81.858      "augment calculation by current facts, exhibit result"
  81.859      (Scan.succeed (Toplevel.proof' Calculation.ultimately));
  81.860  
  81.861  val _ =
  81.862 -  Outer_Syntax.command @{command_keyword print_trans_rules} "print transitivity rules"
  81.863 +  Outer_Syntax.command \<^command_keyword>\<open>print_trans_rules\<close> "print transitivity rules"
  81.864      (Scan.succeed (Toplevel.keep (Calculation.print_rules o Toplevel.context_of)));
  81.865  
  81.866  in end\<close>
  81.867 @@ -1009,7 +1009,7 @@
  81.868    Output.report [Markup.markup (Markup.bad ()) "Explicit backtracking"];
  81.869  
  81.870  val _ =
  81.871 -  Outer_Syntax.command @{command_keyword back} "explicit backtracking of proof command"
  81.872 +  Outer_Syntax.command \<^command_keyword>\<open>back\<close> "explicit backtracking of proof command"
  81.873      (Scan.succeed
  81.874       (Toplevel.actual_proof (fn prf => (report_back (); Proof_Node.back prf)) o
  81.875        Toplevel.skip_proof report_back));
  81.876 @@ -1023,123 +1023,123 @@
  81.877  local
  81.878  
  81.879  val opt_modes =
  81.880 -  Scan.optional (@{keyword "("} |-- Parse.!!! (Scan.repeat1 Parse.name --| @{keyword ")"})) [];
  81.881 +  Scan.optional (\<^keyword>\<open>(\<close> |-- Parse.!!! (Scan.repeat1 Parse.name --| \<^keyword>\<open>)\<close>)) [];
  81.882  
  81.883  val _ =
  81.884 -  Outer_Syntax.command @{command_keyword help}
  81.885 +  Outer_Syntax.command \<^command_keyword>\<open>help\<close>
  81.886      "retrieve outer syntax commands according to name patterns"
  81.887      (Scan.repeat Parse.name >>
  81.888        (fn pats => Toplevel.keep (fn st => Outer_Syntax.help (Toplevel.theory_of st) pats)));
  81.889  
  81.890  val _ =
  81.891 -  Outer_Syntax.command @{command_keyword print_commands} "print outer syntax commands"
  81.892 +  Outer_Syntax.command \<^command_keyword>\<open>print_commands\<close> "print outer syntax commands"
  81.893      (Scan.succeed (Toplevel.keep (Outer_Syntax.print_commands o Toplevel.theory_of)));
  81.894  
  81.895  val _ =
  81.896 -  Outer_Syntax.command @{command_keyword print_options} "print configuration options"
  81.897 +  Outer_Syntax.command \<^command_keyword>\<open>print_options\<close> "print configuration options"
  81.898      (Parse.opt_bang >> (fn b => Toplevel.keep (Attrib.print_options b o Toplevel.context_of)));
  81.899  
  81.900  val _ =
  81.901 -  Outer_Syntax.command @{command_keyword print_context}
  81.902 +  Outer_Syntax.command \<^command_keyword>\<open>print_context\<close>
  81.903      "print context of local theory target"
  81.904      (Scan.succeed (Toplevel.keep (Pretty.writeln_chunks o Toplevel.pretty_context)));
  81.905  
  81.906  val _ =
  81.907 -  Outer_Syntax.command @{command_keyword print_theory}
  81.908 +  Outer_Syntax.command \<^command_keyword>\<open>print_theory\<close>
  81.909      "print logical theory contents"
  81.910      (Parse.opt_bang >> (fn b =>
  81.911        Toplevel.keep (Pretty.writeln o Proof_Display.pretty_theory b o Toplevel.context_of)));
  81.912  
  81.913  val _ =
  81.914 -  Outer_Syntax.command @{command_keyword print_definitions}
  81.915 +  Outer_Syntax.command \<^command_keyword>\<open>print_definitions\<close>
  81.916      "print dependencies of definitional theory content"
  81.917      (Parse.opt_bang >> (fn b =>
  81.918        Toplevel.keep (Pretty.writeln o Proof_Display.pretty_definitions b o Toplevel.context_of)));
  81.919  
  81.920  val _ =
  81.921 -  Outer_Syntax.command @{command_keyword print_syntax}
  81.922 +  Outer_Syntax.command \<^command_keyword>\<open>print_syntax\<close>
  81.923      "print inner syntax of context"
  81.924      (Scan.succeed (Toplevel.keep (Proof_Context.print_syntax o Toplevel.context_of)));
  81.925  
  81.926  val _ =
  81.927 -  Outer_Syntax.command @{command_keyword print_defn_rules}
  81.928 +  Outer_Syntax.command \<^command_keyword>\<open>print_defn_rules\<close>
  81.929      "print definitional rewrite rules of context"
  81.930      (Scan.succeed (Toplevel.keep (Local_Defs.print_rules o Toplevel.context_of)));
  81.931  
  81.932  val _ =
  81.933 -  Outer_Syntax.command @{command_keyword print_abbrevs}
  81.934 +  Outer_Syntax.command \<^command_keyword>\<open>print_abbrevs\<close>
  81.935      "print constant abbreviations of context"
  81.936      (Parse.opt_bang >> (fn b =>
  81.937        Toplevel.keep (Proof_Context.print_abbrevs b o Toplevel.context_of)));
  81.938  
  81.939  val _ =
  81.940 -  Outer_Syntax.command @{command_keyword print_theorems}
  81.941 +  Outer_Syntax.command \<^command_keyword>\<open>print_theorems\<close>
  81.942      "print theorems of local theory or proof context"
  81.943      (Parse.opt_bang >> (fn b =>
  81.944        Toplevel.keep (Pretty.writeln o Pretty.chunks o Isar_Cmd.pretty_theorems b)));
  81.945  
  81.946  val _ =
  81.947 -  Outer_Syntax.command @{command_keyword print_locales}
  81.948 +  Outer_Syntax.command \<^command_keyword>\<open>print_locales\<close>
  81.949      "print locales of this theory"
  81.950      (Parse.opt_bang >> (fn b =>
  81.951        Toplevel.keep (Locale.print_locales b o Toplevel.theory_of)));
  81.952  
  81.953  val _ =
  81.954 -  Outer_Syntax.command @{command_keyword print_classes}
  81.955 +  Outer_Syntax.command \<^command_keyword>\<open>print_classes\<close>
  81.956      "print classes of this theory"
  81.957      (Scan.succeed (Toplevel.keep (Class.print_classes o Toplevel.context_of)));
  81.958  
  81.959  val _ =
  81.960 -  Outer_Syntax.command @{command_keyword print_locale}
  81.961 +  Outer_Syntax.command \<^command_keyword>\<open>print_locale\<close>
  81.962      "print locale of this theory"
  81.963      (Parse.opt_bang -- Parse.position Parse.name >> (fn (b, name) =>
  81.964        Toplevel.keep (fn state => Locale.print_locale (Toplevel.theory_of state) b name)));
  81.965  
  81.966  val _ =
  81.967 -  Outer_Syntax.command @{command_keyword print_interps}
  81.968 +  Outer_Syntax.command \<^command_keyword>\<open>print_interps\<close>
  81.969      "print interpretations of locale for this theory or proof context"
  81.970      (Parse.position Parse.name >> (fn name =>
  81.971        Toplevel.keep (fn state => Locale.print_registrations (Toplevel.context_of state) name)));
  81.972  
  81.973  val _ =
  81.974 -  Outer_Syntax.command @{command_keyword print_dependencies}
  81.975 +  Outer_Syntax.command \<^command_keyword>\<open>print_dependencies\<close>
  81.976      "print dependencies of locale expression"
  81.977      (Parse.opt_bang -- Parse_Spec.locale_expression >> (fn (b, expr) =>
  81.978        Toplevel.keep (fn state => Expression.print_dependencies (Toplevel.context_of state) b expr)));
  81.979  
  81.980  val _ =
  81.981 -  Outer_Syntax.command @{command_keyword print_attributes}
  81.982 +  Outer_Syntax.command \<^command_keyword>\<open>print_attributes\<close>
  81.983      "print attributes of this theory"
  81.984      (Parse.opt_bang >> (fn b => Toplevel.keep (Attrib.print_attributes b o Toplevel.context_of)));
  81.985  
  81.986  val _ =
  81.987 -  Outer_Syntax.command @{command_keyword print_simpset}
  81.988 +  Outer_Syntax.command \<^command_keyword>\<open>print_simpset\<close>
  81.989      "print context of Simplifier"
  81.990      (Parse.opt_bang >> (fn b =>
  81.991        Toplevel.keep (Pretty.writeln o Simplifier.pretty_simpset b o Toplevel.context_of)));
  81.992  
  81.993  val _ =
  81.994 -  Outer_Syntax.command @{command_keyword print_rules} "print intro/elim rules"
  81.995 +  Outer_Syntax.command \<^command_keyword>\<open>print_rules\<close> "print intro/elim rules"
  81.996      (Scan.succeed (Toplevel.keep (Context_Rules.print_rules o Toplevel.context_of)));
  81.997  
  81.998  val _ =
  81.999 -  Outer_Syntax.command @{command_keyword print_methods} "print methods of this theory"
 81.1000 +  Outer_Syntax.command \<^command_keyword>\<open>print_methods\<close> "print methods of this theory"
 81.1001      (Parse.opt_bang >> (fn b => Toplevel.keep (Method.print_methods b o Toplevel.context_of)));
 81.1002  
 81.1003  val _ =
 81.1004 -  Outer_Syntax.command @{command_keyword print_antiquotations}
 81.1005 +  Outer_Syntax.command \<^command_keyword>\<open>print_antiquotations\<close>
 81.1006      "print document antiquotations"
 81.1007      (Parse.opt_bang >> (fn b =>
 81.1008        Toplevel.keep (Thy_Output.print_antiquotations b o Toplevel.context_of)));
 81.1009  
 81.1010  val _ =
 81.1011 -  Outer_Syntax.command @{command_keyword print_ML_antiquotations}
 81.1012 +  Outer_Syntax.command \<^command_keyword>\<open>print_ML_antiquotations\<close>
 81.1013      "print ML antiquotations"
 81.1014      (Parse.opt_bang >> (fn b =>
 81.1015        Toplevel.keep (ML_Context.print_antiquotations b o Toplevel.context_of)));
 81.1016  
 81.1017  val _ =
 81.1018 -  Outer_Syntax.command @{command_keyword locale_deps} "visualize locale dependencies"
 81.1019 +  Outer_Syntax.command \<^command_keyword>\<open>locale_deps\<close> "visualize locale dependencies"
 81.1020      (Scan.succeed
 81.1021        (Toplevel.keep (Toplevel.theory_of #> (fn thy =>
 81.1022          Locale.pretty_locale_deps thy
 81.1023 @@ -1148,68 +1148,68 @@
 81.1024          |> Graph_Display.display_graph_old))));
 81.1025  
 81.1026  val _ =
 81.1027 -  Outer_Syntax.command @{command_keyword print_term_bindings}
 81.1028 +  Outer_Syntax.command \<^command_keyword>\<open>print_term_bindings\<close>
 81.1029      "print term bindings of proof context"
 81.1030      (Scan.succeed
 81.1031        (Toplevel.keep
 81.1032          (Pretty.writeln_chunks o Proof_Context.pretty_term_bindings o Toplevel.context_of)));
 81.1033  
 81.1034  val _ =
 81.1035 -  Outer_Syntax.command @{command_keyword print_facts} "print facts of proof context"
 81.1036 +  Outer_Syntax.command \<^command_keyword>\<open>print_facts\<close> "print facts of proof context"
 81.1037      (Parse.opt_bang >> (fn b =>
 81.1038        Toplevel.keep (Proof_Context.print_local_facts b o Toplevel.context_of)));
 81.1039  
 81.1040  val _ =
 81.1041 -  Outer_Syntax.command @{command_keyword print_cases} "print cases of proof context"
 81.1042 +  Outer_Syntax.command \<^command_keyword>\<open>print_cases\<close> "print cases of proof context"
 81.1043      (Scan.succeed
 81.1044        (Toplevel.keep (Pretty.writeln_chunks o Proof_Context.pretty_cases o Toplevel.context_of)));
 81.1045  
 81.1046  val _ =
 81.1047 -  Outer_Syntax.command @{command_keyword print_statement}
 81.1048 +  Outer_Syntax.command \<^command_keyword>\<open>print_statement\<close>
 81.1049      "print theorems as long statements"
 81.1050      (opt_modes -- Parse.thms1 >> Isar_Cmd.print_stmts);
 81.1051  
 81.1052  val _ =
 81.1053 -  Outer_Syntax.command @{command_keyword thm} "print theorems"
 81.1054 +  Outer_Syntax.command \<^command_keyword>\<open>thm\<close> "print theorems"
 81.1055      (opt_modes -- Parse.thms1 >> Isar_Cmd.print_thms);
 81.1056  
 81.1057  val _ =
 81.1058 -  Outer_Syntax.command @{command_keyword prf} "print proof terms of theorems"
 81.1059 +  Outer_Syntax.command \<^command_keyword>\<open>prf\<close> "print proof terms of theorems"
 81.1060      (opt_modes -- Scan.option Parse.thms1 >> Isar_Cmd.print_prfs false);
 81.1061  
 81.1062  val _ =
 81.1063 -  Outer_Syntax.command @{command_keyword full_prf} "print full proof terms of theorems"
 81.1064 +  Outer_Syntax.command \<^command_keyword>\<open>full_prf\<close> "print full proof terms of theorems"
 81.1065      (opt_modes -- Scan.option Parse.thms1 >> Isar_Cmd.print_prfs true);
 81.1066  
 81.1067  val _ =
 81.1068 -  Outer_Syntax.command @{command_keyword prop} "read and print proposition"
 81.1069 +  Outer_Syntax.command \<^command_keyword>\<open>prop\<close> "read and print proposition"
 81.1070      (opt_modes -- Parse.term >> Isar_Cmd.print_prop);
 81.1071  
 81.1072  val _ =
 81.1073 -  Outer_Syntax.command @{command_keyword term} "read and print term"
 81.1074 +  Outer_Syntax.command \<^command_keyword>\<open>term\<close> "read and print term"
 81.1075      (opt_modes -- Parse.term >> Isar_Cmd.print_term);
 81.1076  
 81.1077  val _ =
 81.1078 -  Outer_Syntax.command @{command_keyword typ} "read and print type"
 81.1079 -    (opt_modes -- (Parse.typ -- Scan.option (@{keyword ::} |-- Parse.!!! Parse.sort))
 81.1080 +  Outer_Syntax.command \<^command_keyword>\<open>typ\<close> "read and print type"
 81.1081 +    (opt_modes -- (Parse.typ -- Scan.option (\<^keyword>\<open>::\<close> |-- Parse.!!! Parse.sort))
 81.1082        >> Isar_Cmd.print_type);
 81.1083  
 81.1084  val _ =
 81.1085 -  Outer_Syntax.command @{command_keyword print_codesetup} "print code generator setup"
 81.1086 +  Outer_Syntax.command \<^command_keyword>\<open>print_codesetup\<close> "print code generator setup"
 81.1087      (Scan.succeed (Toplevel.keep (Code.print_codesetup o Toplevel.theory_of)));
 81.1088  
 81.1089  val _ =
 81.1090 -  Outer_Syntax.command @{command_keyword print_state}
 81.1091 +  Outer_Syntax.command \<^command_keyword>\<open>print_state\<close>
 81.1092      "print current proof state (if present)"
 81.1093      (opt_modes >> (fn modes =>
 81.1094        Toplevel.keep (Print_Mode.with_modes modes (Output.state o Toplevel.string_of_state))));
 81.1095  
 81.1096  val _ =
 81.1097 -  Outer_Syntax.command @{command_keyword welcome} "print welcome message"
 81.1098 +  Outer_Syntax.command \<^command_keyword>\<open>welcome\<close> "print welcome message"
 81.1099      (Scan.succeed (Toplevel.keep (fn _ => writeln (Session.welcome ()))));
 81.1100  
 81.1101  val _ =
 81.1102 -  Outer_Syntax.command @{command_keyword display_drafts}
 81.1103 +  Outer_Syntax.command \<^comma