# HG changeset patch # User wenzelm # Date 1727721059 -7200 # Node ID dd59daa3c37a88430595f9a989596da14fe91bad # Parent 83596aea48cb59a88a6903e6f7ccd4264862c7bf clarified inner-syntax markup, notably for enumerations: prefer "notation=mixfix" over "entity" via 'syntax_consts' (see also 70076ba563d2); diff -r 83596aea48cb -r dd59daa3c37a NEWS --- a/NEWS Mon Sep 30 13:00:42 2024 +0200 +++ b/NEWS Mon Sep 30 20:30:59 2024 +0200 @@ -28,14 +28,6 @@ *** HOL *** -* Enumerations for tuples, sets, lists etc. now use specific grammar -productions and separate syntax constants: this allows PIDE markup -(hyperlinks) for the separators (commas). For example, instead of -generic nonterminal "args" and syntax constant "_args" from Pure, HOL -lists now use nonterminal "list_args" and syntax constant "_list_args". -Rare INCOMPATIBILITY for ambitious syntax translations and grammar -modifications (e.g. via 'no_syntax'). - * Theory "HOL.Wellfounded": - Removed lemma wellorder.wfP_less. Use wellorder.wfp_on_less instead. Minor INCOMPATIBILITIES. diff -r 83596aea48cb -r dd59daa3c37a src/Benchmarks/Quickcheck_Benchmark/Needham_Schroeder_Base.thy --- a/src/Benchmarks/Quickcheck_Benchmark/Needham_Schroeder_Base.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/Benchmarks/Quickcheck_Benchmark/Needham_Schroeder_Base.thy Mon Sep 30 20:30:59 2024 +0200 @@ -27,12 +27,12 @@ | Crypt key msg syntax - "_MTuple" :: "['a, args] => 'a * 'b" ("(2\_,/ _\)") + "_MTuple" :: "['a, args] \ 'a * 'b" (\(\indent=2 notation=\mixfix message tuple\\\_,/ _\)\) syntax_consts - "_MTuple" == MPair + MPair translations - "\x, y, z\" == "\x, \y, z\\" - "\x, y\" == "CONST MPair x y" + "\x, y, z\" \ "\x, \y, z\\" + "\x, y\" \ "CONST MPair x y" inductive_set parts :: "msg set => msg set" diff -r 83596aea48cb -r dd59daa3c37a src/Doc/Datatypes/Datatypes.thy --- a/src/Doc/Datatypes/Datatypes.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/Doc/Datatypes/Datatypes.thy Mon Sep 30 20:30:59 2024 +0200 @@ -452,8 +452,11 @@ \noindent Incidentally, this is how the traditional syntax can be set up: \ - - syntax "_list" :: "list_args \ 'a list" (\[(_)]\) +(*<*) +no_syntax + "_list" :: "args => 'a list" (\[(\notation=\mixfix list enumeration\\_)]\) +(*>*) + syntax "_list" :: "args \ 'a list" (\[(_)]\) text \\blankline\ diff -r 83596aea48cb -r dd59daa3c37a src/Doc/Tutorial/Protocol/Message.thy --- a/src/Doc/Tutorial/Protocol/Message.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/Doc/Tutorial/Protocol/Message.thy Mon Sep 30 20:30:59 2024 +0200 @@ -79,13 +79,10 @@ (*<*) text\Concrete syntax: messages appear as \\A,B,NA\\, etc...\ -nonterminal mtuple_args syntax - "" :: "'a \ mtuple_args" ("_") - "_MTuple_args" :: "'a \ mtuple_args \ mtuple_args" ("_,/ _") - "_MTuple" :: "['a, mtuple_args] \ 'a * 'b" ("(2\_,/ _\)") + "_MTuple" :: "['a, args] \ 'a * 'b" ("(\indent=2 notation=\mixfix message tuple\\\_,/ _\)") syntax_consts - "_MTuple_args" "_MTuple" \ MPair + MPair translations "\x, y, z\" \ "\x, \y, z\\" "\x, y\" \ "CONST MPair x y" diff -r 83596aea48cb -r dd59daa3c37a src/HOL/Auth/Message.thy --- a/src/HOL/Auth/Message.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/Auth/Message.thy Mon Sep 30 20:30:59 2024 +0200 @@ -49,13 +49,10 @@ text\Concrete syntax: messages appear as \\A,B,NA\\, etc...\ -nonterminal mtuple_args syntax - "" :: "'a \ mtuple_args" (\_\) - "_MTuple_args" :: "'a \ mtuple_args \ mtuple_args" (\_,/ _\) - "_MTuple" :: "['a, mtuple_args] \ 'a * 'b" (\(2\_,/ _\)\) + "_MTuple" :: "['a, args] \ 'a * 'b" (\(\indent=2 notation=\mixfix message tuple\\\_,/ _\)\) syntax_consts - "_MTuple_args" "_MTuple" \ MPair + MPair translations "\x, y, z\" \ "\x, \y, z\\" "\x, y\" \ "CONST MPair x y" diff -r 83596aea48cb -r dd59daa3c37a src/HOL/Codegenerator_Test/Code_Lazy_Test.thy --- a/src/HOL/Codegenerator_Test/Code_Lazy_Test.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/Codegenerator_Test/Code_Lazy_Test.thy Mon Sep 30 20:30:59 2024 +0200 @@ -23,13 +23,10 @@ code_lazy_type llist no_notation lazy_llist (\_\) -nonterminal llist_args syntax - "" :: "'a \ llist_args" (\_\) - "_llist_args" :: "'a \ llist_args \ llist_args" (\_,/ _\) - "_llist" :: "llist_args => 'a list" (\\<^bold>[(_)\<^bold>]\) + "_llist" :: "args => 'a list" (\\<^bold>[(\notation=\mixfix lazy list enumeration\\_)\<^bold>]\) syntax_consts - "_llist_args" "_llist" == lazy_llist + lazy_llist translations "\<^bold>[x, xs\<^bold>]" == "x\<^bold>#\<^bold>[xs\<^bold>]" "\<^bold>[x\<^bold>]" == "x\<^bold>#\<^bold>[\<^bold>]" diff -r 83596aea48cb -r dd59daa3c37a src/HOL/Computational_Algebra/Polynomial.thy --- a/src/HOL/Computational_Algebra/Polynomial.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/Computational_Algebra/Polynomial.thy Mon Sep 30 20:30:59 2024 +0200 @@ -348,13 +348,10 @@ subsection \List-style syntax for polynomials\ -nonterminal poly_args syntax - "" :: "'a \ poly_args" (\_\) - "_poly_args" :: "'a \ poly_args \ poly_args" (\_,/ _\) - "_poly" :: "poly_args \ 'a poly" (\[:(_):]\) + "_poly" :: "args \ 'a poly" (\[:(\notation=\mixfix polynomial enumeration\\_):]\) syntax_consts - "_poly_args" "_poly" \ pCons + pCons translations "[:x, xs:]" \ "CONST pCons x [:xs:]" "[:x:]" \ "CONST pCons x 0" diff -r 83596aea48cb -r dd59daa3c37a src/HOL/HOLCF/IOA/Sequence.thy --- a/src/HOL/HOLCF/IOA/Sequence.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/HOLCF/IOA/Sequence.thy Mon Sep 30 20:30:59 2024 +0200 @@ -69,14 +69,11 @@ subsection \List enumeration\ -nonterminal llist_args syntax - "" :: "'a \ llist_args" (\_\) - "_list_args" :: "'a \ llist_args \ llist_args" (\_,/ _\) - "_totlist" :: "llist_args \ 'a Seq" (\[(_)!]\) - "_partlist" :: "llist_args \ 'a Seq" (\[(_)?]\) + "_totlist" :: "args \ 'a Seq" (\[(\notation=\mixfix total list enumeration\\_)!]\) + "_partlist" :: "args \ 'a Seq" (\[(\notation=\mixfix partial list enumeration\\_)?]\) syntax_consts - "_totlist" "_partlist" \ Consq + Consq translations "[x, xs!]" \ "x \ [xs!]" "[x!]" \ "x\nil" diff -r 83596aea48cb -r dd59daa3c37a src/HOL/HOLCF/Sprod.thy --- a/src/HOL/HOLCF/Sprod.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/HOLCF/Sprod.thy Mon Sep 30 20:30:59 2024 +0200 @@ -40,13 +40,10 @@ definition ssplit :: "('a \ 'b \ 'c) \ ('a ** 'b) \ 'c" where "ssplit = (\ f p. seq\p\(f\(sfst\p)\(ssnd\p)))" -nonterminal stuple_args syntax - "" :: "logic \ stuple_args" (\_\) - "_stuple_args" :: "logic \ stuple_args \ stuple_args" (\_,/ _\) - "_stuple" :: "[logic, stuple_args] \ logic" (\(1'(:_,/ _:'))\) + "_stuple" :: "[logic, args] \ logic" (\(\indent=1 notation=\mixfix strict tuple\\'(:_,/ _:'))\) syntax_consts - "_stuple_args" "_stuple" \ spair + spair translations "(:x, y, z:)" \ "(:x, (:y, z:):)" "(:x, y:)" \ "CONST spair\x\y" diff -r 83596aea48cb -r dd59daa3c37a src/HOL/Library/FSet.thy --- a/src/HOL/Library/FSet.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/Library/FSet.thy Mon Sep 30 20:30:59 2024 +0200 @@ -164,13 +164,10 @@ lift_definition finsert :: "'a \ 'a fset \ 'a fset" is insert parametric Lifting_Set.insert_transfer by simp -nonterminal fset_args syntax - "" :: "'a \ fset_args" (\_\) - "_fset_args" :: "'a \ fset_args \ fset_args" (\_,/ _\) - "_fset" :: "fset_args => 'a fset" (\{|(_)|}\) + "_fset" :: "args => 'a fset" (\{|(\notation=\mixfix finite set enumeration\\_)|}\) syntax_consts - "_fset_args" "_fset" == finsert + finsert translations "{|x, xs|}" == "CONST finsert x {|xs|}" "{|x|}" == "CONST finsert x {||}" diff -r 83596aea48cb -r dd59daa3c37a src/HOL/Library/Multiset.thy --- a/src/HOL/Library/Multiset.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/Library/Multiset.thy Mon Sep 30 20:30:59 2024 +0200 @@ -91,13 +91,10 @@ "\a M b. if b = a then Suc (M b) else M b" by (rule add_mset_in_multiset) -nonterminal multiset_args syntax - "" :: "'a \ multiset_args" (\_\) - "_multiset_args" :: "'a \ multiset_args \ multiset_args" (\_,/ _\) - "_multiset" :: "multiset_args \ 'a multiset" (\{#(_)#}\) + "_multiset" :: "args \ 'a multiset" (\{#(\notation=\mixfix multiset enumeration\\_)#}\) syntax_consts - "_multiset_args" "_multiset" == add_mset + add_mset translations "{#x, xs#}" == "CONST add_mset x {#xs#}" "{#x#}" == "CONST add_mset x {#}" diff -r 83596aea48cb -r dd59daa3c37a src/HOL/List.thy --- a/src/HOL/List.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/List.thy Mon Sep 30 20:30:59 2024 +0200 @@ -45,13 +45,10 @@ text \List enumeration\ -nonterminal list_args syntax - "" :: "'a \ list_args" (\_\) - "_list_args" :: "'a \ list_args \ list_args" (\_,/ _\) - "_list" :: "list_args => 'a list" (\[(_)]\) + "_list" :: "args => 'a list" (\[(\notation=\mixfix list enumeration\\_)]\) syntax_consts - "_list_args" "_list" == Cons + Cons translations "[x, xs]" == "x#[xs]" "[x]" == "x#[]" diff -r 83596aea48cb -r dd59daa3c37a src/HOL/Metis_Examples/Message.thy --- a/src/HOL/Metis_Examples/Message.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/Metis_Examples/Message.thy Mon Sep 30 20:30:59 2024 +0200 @@ -48,13 +48,10 @@ text\Concrete syntax: messages appear as \\A,B,NA\\, etc...\ -nonterminal mtuple_args syntax - "" :: "'a \ mtuple_args" (\_\) - "_MTuple_args" :: "'a \ mtuple_args \ mtuple_args" (\_,/ _\) - "_MTuple" :: "['a, mtuple_args] \ 'a * 'b" (\(2\_,/ _\)\) + "_MTuple" :: "['a, args] \ 'a * 'b" (\(\indent=2 notation=\mixfix message tuple\\\_,/ _\)\) syntax_consts - "_MTuple_args" "_MTuple" \ MPair + MPair translations "\x, y, z\" \ "\x, \y, z\\" "\x, y\" \ "CONST MPair x y" diff -r 83596aea48cb -r dd59daa3c37a src/HOL/Prolog/Test.thy --- a/src/HOL/Prolog/Test.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/Prolog/Test.thy Mon Sep 30 20:30:59 2024 +0200 @@ -18,13 +18,10 @@ text \List enumeration\ -nonterminal list_args syntax - "" :: "'a \ list_args" (\_\) - "_list_args" :: "'a \ list_args \ list_args" (\_,/ _\) - "_list" :: "list_args => 'a list" (\[(_)]\) + "_list" :: "args => 'a list" (\[(\notation=\mixfix list enumeration\\_)]\) syntax_consts - "_list_args" "_list" == Cons + Cons translations "[x, xs]" == "x#[xs]" "[x]" == "x#[]" diff -r 83596aea48cb -r dd59daa3c37a src/HOL/Quotient_Examples/Lift_FSet.thy --- a/src/HOL/Quotient_Examples/Lift_FSet.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/Quotient_Examples/Lift_FSet.thy Mon Sep 30 20:30:59 2024 +0200 @@ -95,13 +95,10 @@ end -nonterminal fset_args syntax - "" :: "'a \ fset_args" (\_\) - "_fset_args" :: "'a \ fset_args \ fset_args" (\_,/ _\) - "_fset" :: "fset_args => 'a fset" (\{|(_)|}\) + "_fset" :: "args => 'a fset" (\{|(\notation=\mixfix finite set enumeration\\_)|}\) syntax_consts - "_fset_args" "_fset" == fcons + fcons translations "{|x, xs|}" == "CONST fcons x {|xs|}" "{|x|}" == "CONST fcons x {||}" diff -r 83596aea48cb -r dd59daa3c37a src/HOL/Quotient_Examples/Quotient_FSet.thy --- a/src/HOL/Quotient_Examples/Quotient_FSet.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/Quotient_Examples/Quotient_FSet.thy Mon Sep 30 20:30:59 2024 +0200 @@ -288,13 +288,10 @@ "insert_fset :: 'a \ 'a fset \ 'a fset" is "Cons" by auto -nonterminal fset_args syntax - "" :: "'a \ fset_args" (\_\) - "_fset_args" :: "'a \ fset_args \ fset_args" (\_,/ _\) - "_fset" :: "fset_args => 'a fset" (\{|(_)|}\) + "_fset" :: "args => 'a fset" (\{|(\notation=\mixfix finite set enumeration\\_)|}\) syntax_consts - "_fset_args" "_fset" == insert_fset + insert_fset translations "{|x, xs|}" == "CONST insert_fset x {|xs|}" "{|x|}" == "CONST insert_fset x {||}" diff -r 83596aea48cb -r dd59daa3c37a src/HOL/SET_Protocol/Message_SET.thy --- a/src/HOL/SET_Protocol/Message_SET.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/SET_Protocol/Message_SET.thy Mon Sep 30 20:30:59 2024 +0200 @@ -68,16 +68,13 @@ (*Concrete syntax: messages appear as \\A,B,NA\\, etc...*) -nonterminal mtuple_args syntax - "" :: "'a \ mtuple_args" (\_\) - "_MTuple_args" :: "'a \ mtuple_args \ mtuple_args" (\_,/ _\) - "_MTuple" :: "['a, mtuple_args] \ 'a * 'b" (\(2\_,/ _\)\) + "_MTuple" :: "['a, args] \ 'a * 'b" (\(\indent=2 notation=\mixfix message tuple\\\_,/ _\)\) syntax_consts - "_MTuple_args" "_MTuple" \ MPair + MPair translations - "\x, y, z\" == "\x, \y, z\\" - "\x, y\" == "CONST MPair x y" + "\x, y, z\" \ "\x, \y, z\\" + "\x, y\" \ "CONST MPair x y" definition nat_of_agent :: "agent \ nat" where diff -r 83596aea48cb -r dd59daa3c37a src/HOL/Set.thy --- a/src/HOL/Set.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/Set.thy Mon Sep 30 20:30:59 2024 +0200 @@ -143,13 +143,10 @@ definition insert :: "'a \ 'a set \ 'a set" where insert_compr: "insert a B = {x. x = a \ x \ B}" -nonterminal finset_args syntax - "" :: "'a \ finset_args" (\_\) - "_Finset_args" :: "'a \ finset_args \ finset_args" (\_,/ _\) - "_Finset" :: "finset_args \ 'a set" (\{(_)}\) + "_Finset" :: "args \ 'a set" (\{(\notation=\mixfix set enumeration\\_)}\) syntax_consts - "_Finset_args" "_Finset" \ insert + insert translations "{x, xs}" \ "CONST insert x {xs}" "{x}" \ "CONST insert x {}" diff -r 83596aea48cb -r dd59daa3c37a src/HOL/Tools/string_syntax.ML --- a/src/HOL/Tools/string_syntax.ML Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/Tools/string_syntax.ML Mon Sep 30 20:30:59 2024 +0200 @@ -123,7 +123,7 @@ fun list_ast_tr' [args] = Ast.Appl [Ast.Constant \<^syntax_const>\_String\, - (mk_string_ast o maps dest_char_ast o Ast.unfold_ast \<^syntax_const>\_list_args\) args] + (mk_string_ast o maps dest_char_ast o Ast.unfold_ast \<^syntax_const>\_args\) args] | list_ast_tr' _ = raise Match; diff -r 83596aea48cb -r dd59daa3c37a src/HOL/ex/Code_Lazy_Demo.thy --- a/src/HOL/ex/Code_Lazy_Demo.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/HOL/ex/Code_Lazy_Demo.thy Mon Sep 30 20:30:59 2024 +0200 @@ -39,13 +39,10 @@ = LNil (\\<^bold>\\<^bold>\\) | LCons (lhd: 'a) (ltl: "'a llist") (infixr \###\ 65) -nonterminal llist_args syntax - "" :: "'a \ llist_args" (\_\) - "_llist_args" :: "'a \ llist_args \ llist_args" (\_,/ _\) - "_llist" :: "llist_args => 'a list" (\\<^bold>\(_)\<^bold>\\) + "_llist" :: "args => 'a list" (\\<^bold>\(\notation=\mixfix lazy list enumeration\\_)\<^bold>\\) syntax_consts - "_llist_args" "_llist" == LCons + LCons translations "\<^bold>\x, xs\<^bold>\" == "x###\<^bold>\xs\<^bold>\" "\<^bold>\x\<^bold>\" == "x###\<^bold>\\<^bold>\" diff -r 83596aea48cb -r dd59daa3c37a src/ZF/List.thy --- a/src/ZF/List.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/ZF/List.thy Mon Sep 30 20:30:59 2024 +0200 @@ -15,11 +15,8 @@ notation Nil (\[]\) -nonterminal list_args syntax - "" :: "i \ list_args" (\_\) - "_List_args" :: "[i, list_args] \ list_args" (\_,/ _\) - "_List" :: "list_args \ i" (\[(\notation=\mixfix list enumeration\\_)]\) + "_List" :: "is \ i" (\[(\notation=\mixfix list enumeration\\_)]\) syntax_consts Cons translations diff -r 83596aea48cb -r dd59daa3c37a src/ZF/ZF_Base.thy --- a/src/ZF/ZF_Base.thy Mon Sep 30 13:00:42 2024 +0200 +++ b/src/ZF/ZF_Base.thy Mon Sep 30 20:30:59 2024 +0200 @@ -129,11 +129,11 @@ definition succ :: "i \ i" where "succ(i) \ cons(i, i)" -nonterminal "finset_args" +nonterminal "is" syntax - "" :: "i \ finset_args" (\_\) - "_Finset_args" :: "[i, finset_args] \ finset_args" (\_,/ _\) - "_Finset" :: "finset_args \ i" (\{(\notation=\mixfix set enumeration\\_)}\) + "" :: "i \ is" (\_\) + "_Enum" :: "[i, is] \ is" (\_,/ _\) + "_Finset" :: "is \ i" (\{(\notation=\mixfix set enumeration\\_)}\) syntax_consts cons translations