# HG changeset patch # User wenzelm # Date 1727953291 -7200 # Node ID 92768949a9234945bc1c5f54158df5011bbe67e0 # Parent 28ef01901650e95601ae2124cb43054ecc3d460a# Parent ad5fc948e053b866f9dbf62cefb7a2ed0689cb0a merged diff -r 28ef01901650 -r 92768949a923 NEWS --- a/NEWS Wed Oct 02 18:32:36 2024 +0200 +++ b/NEWS Thu Oct 03 13:01:31 2024 +0200 @@ -9,6 +9,10 @@ *** General *** +* Command "open_bundle b" is like "bundle b" followed by "unbundle b", +so its declarations are applied immediately, but also named for later +re-use. + * Inner syntax translations now support formal dependencies via commands 'syntax_types' or 'syntax_consts'. This is essentially an abstract specification of the effect of 'translations' (or translation functions @@ -43,6 +47,19 @@ *** HOL *** +* Various declaration bundles support adhoc modification of notation, +notably like this: + + unbundle no_list_syntax + unbundle no_listcompr_syntax + unbundle no_rtrancl_syntax + unbundle no_trancl_syntax + unbundle no_reflcl_syntax + +This is more robust than individual 'no_syntax' / 'no_notation' +commands, which need to copy mixfix declarations from elsewhere and thus +break after changes in the library. + * Theory "HOL.Wellfounded": - Removed lemma wellorder.wfP_less. Use wellorder.wfp_on_less instead. Minor INCOMPATIBILITIES. diff -r 28ef01901650 -r 92768949a923 src/Benchmarks/Quickcheck_Benchmark/Needham_Schroeder_Base.thy --- a/src/Benchmarks/Quickcheck_Benchmark/Needham_Schroeder_Base.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/Benchmarks/Quickcheck_Benchmark/Needham_Schroeder_Base.thy Thu Oct 03 13:01:31 2024 +0200 @@ -28,8 +28,6 @@ syntax "_MTuple" :: "['a, args] \ 'a * 'b" (\(\indent=2 notation=\mixfix message tuple\\\_,/ _\)\) -syntax_consts - MPair translations "\x, y, z\" \ "\x, \y, z\\" "\x, y\" \ "CONST MPair x y" diff -r 28ef01901650 -r 92768949a923 src/CCL/Set.thy --- a/src/CCL/Set.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/CCL/Set.thy Thu Oct 03 13:01:31 2024 +0200 @@ -19,8 +19,6 @@ syntax "_Coll" :: "[idt, o] \ 'a set" (\(\indent=1 notation=\mixfix Collect\\{_./ _})\) -syntax_consts - Collect translations "{x. P}" == "CONST Collect(\x. P)" diff -r 28ef01901650 -r 92768949a923 src/CCL/Term.thy --- a/src/CCL/Term.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/CCL/Term.thy Thu Oct 03 13:01:31 2024 +0200 @@ -51,7 +51,6 @@ syntax "_let1" :: "[idt,i,i]\i" (\(\indent=3 notation=\mixfix let be in\\let _ be _/ in _)\ [0,0,60] 60) -syntax_consts let1 translations "let x be a in e" == "CONST let1(a, \x. e)" definition letrec :: "[[i,i\i]\i,(i\i)\i]\i" @@ -73,7 +72,6 @@ (\(\indent=3 notation=\mixfix letrec be in\\letrec _ _ _ be _/ in _)\ [0,0,0,0,60] 60) "_letrec3" :: "[idt,idt,idt,idt,i,i]\i" (\(\indent=3 notation=\mixfix letrec be in\\letrec _ _ _ _ be _/ in _)\ [0,0,0,0,0,60] 60) -syntax_consts letrec letrec2 letrec3 parse_translation \ let fun abs_tr t u = Syntax_Trans.abs_tr [t, u]; diff -r 28ef01901650 -r 92768949a923 src/CCL/Type.thy --- a/src/CCL/Type.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/CCL/Type.thy Thu Oct 03 13:01:31 2024 +0200 @@ -14,8 +14,6 @@ syntax "_Subtype" :: "[idt, 'a set, o] \ 'a set" (\(\indent=1 notation=\mixfix Subtype\\{_: _ ./ _})\) -syntax_consts - Subtype translations "{x: A. B}" == "CONST Subtype(A, \x. B)" diff -r 28ef01901650 -r 92768949a923 src/Doc/Datatypes/Datatypes.thy --- a/src/Doc/Datatypes/Datatypes.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/Doc/Datatypes/Datatypes.thy Thu Oct 03 13:01:31 2024 +0200 @@ -453,8 +453,7 @@ Incidentally, this is how the traditional syntax can be set up: \ (*<*) -no_syntax - "_list" :: "args => 'a list" (\[(\notation=\mixfix list enumeration\\_)]\) +unbundle no_list_syntax (*>*) syntax "_list" :: "args \ 'a list" (\[(_)]\) diff -r 28ef01901650 -r 92768949a923 src/Doc/Isar_Ref/Spec.thy --- a/src/Doc/Isar_Ref/Spec.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/Doc/Isar_Ref/Spec.thy Thu Oct 03 13:01:31 2024 +0200 @@ -231,7 +231,7 @@ (\secref{sec:locale}). \<^rail>\ - @@{command bundle} @{syntax name} + (@@{command bundle} | @@{command open_bundle}) @{syntax name} \ ( '=' @{syntax thms} @{syntax for_fixes} | @'begin') ; @@{command print_bundles} ('!'?) @@ -258,6 +258,9 @@ b\'' or ``\<^theory_text>\lemma a [simp]: B \\'' are also admitted, but the name bindings are not recorded in the bundle. + \<^descr> \<^theory_text>\open_bundle b\ is like \<^theory_text>\bundle b\ followed by \<^theory_text>\unbundle b\, so its + declarations are applied immediately, but also named for later re-use. + \<^descr> \<^theory_text>\print_bundles\ prints the named bundles that are available in the current context; the ``\!\'' option indicates extra verbosity. diff -r 28ef01901650 -r 92768949a923 src/Doc/Tutorial/Protocol/Message.thy --- a/src/Doc/Tutorial/Protocol/Message.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/Doc/Tutorial/Protocol/Message.thy Thu Oct 03 13:01:31 2024 +0200 @@ -81,8 +81,6 @@ text\Concrete syntax: messages appear as \\A,B,NA\\, etc...\ syntax "_MTuple" :: "['a, args] \ 'a * 'b" ("(\indent=2 notation=\mixfix message tuple\\\_,/ _\)") -syntax_consts - MPair translations "\x, y, z\" \ "\x, \y, z\\" "\x, y\" \ "CONST MPair x y" diff -r 28ef01901650 -r 92768949a923 src/FOL/IFOL.thy --- a/src/FOL/IFOL.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/FOL/IFOL.thy Thu Oct 03 13:01:31 2024 +0200 @@ -747,8 +747,6 @@ "" :: \letbind => letbinds\ (\_\) "_binds" :: \[letbind, letbinds] => letbinds\ (\_;/ _\) "_Let" :: \[letbinds, 'a] => 'a\ (\(\notation=\mixfix let in\\let (_)/ in (_))\ 10) -syntax_consts - Let translations "_Let(_binds(b, bs), e)" == "_Let(b, _Let(bs, e))" "let x = a in e" == "CONST Let(a, \x. e)" diff -r 28ef01901650 -r 92768949a923 src/HOL/Analysis/Bochner_Integration.thy --- a/src/HOL/Analysis/Bochner_Integration.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Analysis/Bochner_Integration.thy Thu Oct 03 13:01:31 2024 +0200 @@ -890,7 +890,8 @@ "integral\<^sup>L M f = (if \x. has_bochner_integral M f x then THE x. has_bochner_integral M f x else 0)" syntax - "_lebesgue_integral" :: "pttrn \ real \ 'a measure \ real" (\\((2 _./ _)/ \_)\ [60,61] 110) + "_lebesgue_integral" :: "pttrn \ real \ 'a measure \ real" + (\(\indent=1 notation=\binder integral\\\(2 _./ _)/ \_)\ [60,61] 110) syntax_consts "_lebesgue_integral" == lebesgue_integral @@ -899,7 +900,8 @@ "\ x. f \M" == "CONST lebesgue_integral M (\x. f)" syntax - "_ascii_lebesgue_integral" :: "pttrn \ 'a measure \ real \ real" (\(3LINT (1_)/|(_)./ _)\ [0,110,60] 60) + "_ascii_lebesgue_integral" :: "pttrn \ 'a measure \ real \ real" + (\(\indent=3 notation=\mixfix LINT\\LINT (1_)/|(_)./ _)\ [0,110,60] 60) syntax_consts "_ascii_lebesgue_integral" == lebesgue_integral diff -r 28ef01901650 -r 92768949a923 src/HOL/Analysis/Bounded_Continuous_Function.thy --- a/src/HOL/Analysis/Bounded_Continuous_Function.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Analysis/Bounded_Continuous_Function.thy Thu Oct 03 13:01:31 2024 +0200 @@ -10,7 +10,7 @@ definition\<^marker>\tag important\ "bcontfun = {f. continuous_on UNIV f \ bounded (range f)}" -typedef (overloaded) ('a, 'b) bcontfun (\(_ \\<^sub>C /_)\ [22, 21] 21) = +typedef (overloaded) ('a, 'b) bcontfun (\(\notation=\infix \\<^sub>C\\_ \\<^sub>C /_)\ [22, 21] 21) = "bcontfun::('a::topological_space \ 'b::metric_space) set" morphisms apply_bcontfun Bcontfun by (auto intro: continuous_intros simp: bounded_def bcontfun_def) diff -r 28ef01901650 -r 92768949a923 src/HOL/Analysis/Bounded_Linear_Function.thy --- a/src/HOL/Analysis/Bounded_Linear_Function.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Analysis/Bounded_Linear_Function.thy Thu Oct 03 13:01:31 2024 +0200 @@ -116,7 +116,7 @@ subsection \Type of bounded linear functions\ -typedef\<^marker>\tag important\ (overloaded) ('a, 'b) blinfun (\(_ \\<^sub>L /_)\ [22, 21] 21) = +typedef\<^marker>\tag important\ (overloaded) ('a, 'b) blinfun (\(\notation=\infix \\<^sub>L\\_ \\<^sub>L /_)\ [22, 21] 21) = "{f::'a::real_normed_vector\'b::real_normed_vector. bounded_linear f}" morphisms blinfun_apply Blinfun by (blast intro: bounded_linear_intros) diff -r 28ef01901650 -r 92768949a923 src/HOL/Analysis/Cross3.thy --- a/src/HOL/Analysis/Cross3.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Analysis/Cross3.thy Thu Oct 03 13:01:31 2024 +0200 @@ -21,12 +21,14 @@ end -bundle cross3_syntax begin +bundle cross3_syntax +begin notation cross3 (infixr \\\ 80) no_notation Product_Type.Times (infixr \\\ 80) end -bundle no_cross3_syntax begin +bundle no_cross3_syntax +begin no_notation cross3 (infixr \\\ 80) notation Product_Type.Times (infixr \\\ 80) end diff -r 28ef01901650 -r 92768949a923 src/HOL/Analysis/Finite_Cartesian_Product.thy --- a/src/HOL/Analysis/Finite_Cartesian_Product.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Analysis/Finite_Cartesian_Product.thy Thu Oct 03 13:01:31 2024 +0200 @@ -20,20 +20,16 @@ declare vec_lambda_inject [simplified, simp] -bundle vec_syntax begin -notation - vec_nth (infixl \$\ 90) and - vec_lambda (binder \\\ 10) +open_bundle vec_syntax +begin +notation vec_nth (infixl \$\ 90) and vec_lambda (binder \\\ 10) end -bundle no_vec_syntax begin -no_notation - vec_nth (infixl \$\ 90) and - vec_lambda (binder \\\ 10) +bundle no_vec_syntax +begin +no_notation vec_nth (infixl \$\ 90) and vec_lambda (binder \\\ 10) end -unbundle vec_syntax - text \ Concrete syntax for \('a, 'b) vec\: \<^item> \'a^'b\ becomes \('a, 'b::finite) vec\ diff -r 28ef01901650 -r 92768949a923 src/HOL/Analysis/Finite_Product_Measure.thy --- a/src/HOL/Analysis/Finite_Product_Measure.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Analysis/Finite_Product_Measure.thy Thu Oct 03 13:01:31 2024 +0200 @@ -169,7 +169,8 @@ "Pi\<^sub>M I M \ PiM I M" syntax - "_PiM" :: "pttrn \ 'i set \ 'a measure \ ('i => 'a) measure" (\(3\\<^sub>M _\_./ _)\ 10) + "_PiM" :: "pttrn \ 'i set \ 'a measure \ ('i => 'a) measure" + (\(\indent=3 notation=\binder \\<^sub>M\\\\<^sub>M _\_./ _)\ 10) syntax_consts "_PiM" == PiM translations diff -r 28ef01901650 -r 92768949a923 src/HOL/Analysis/Infinite_Set_Sum.thy --- a/src/HOL/Analysis/Infinite_Set_Sum.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Analysis/Infinite_Set_Sum.thy Thu Oct 03 13:01:31 2024 +0200 @@ -96,10 +96,10 @@ syntax (ASCII) "_infsetsum" :: "pttrn \ 'a set \ 'b \ 'b::{banach, second_countable_topology}" - (\(3INFSETSUM _:_./ _)\ [0, 51, 10] 10) + (\(\indent=3 notation=\binder INFSETSUM\\INFSETSUM _:_./ _)\ [0, 51, 10] 10) syntax "_infsetsum" :: "pttrn \ 'a set \ 'b \ 'b::{banach, second_countable_topology}" - (\(2\\<^sub>a_\_./ _)\ [0, 51, 10] 10) + (\(\indent=2 notation=\binder \\<^sub>a\\\\<^sub>a_\_./ _)\ [0, 51, 10] 10) syntax_consts "_infsetsum" \ infsetsum translations \ \Beware of argument permutation!\ @@ -107,10 +107,10 @@ syntax (ASCII) "_uinfsetsum" :: "pttrn \ 'a set \ 'b \ 'b::{banach, second_countable_topology}" - (\(3INFSETSUM _:_./ _)\ [0, 51, 10] 10) + (\(\indent=3 notation=\binder INFSETSUM\\INFSETSUM _:_./ _)\ [0, 51, 10] 10) syntax "_uinfsetsum" :: "pttrn \ 'b \ 'b::{banach, second_countable_topology}" - (\(2\\<^sub>a_./ _)\ [0, 10] 10) + (\(\indent=2 notation=\binder \\<^sub>a\\\\<^sub>a_./ _)\ [0, 10] 10) syntax_consts "_uinfsetsum" \ infsetsum translations \ \Beware of argument permutation!\ @@ -118,10 +118,10 @@ syntax (ASCII) "_qinfsetsum" :: "pttrn \ bool \ 'a \ 'a::{banach, second_countable_topology}" - (\(3INFSETSUM _ |/ _./ _)\ [0, 0, 10] 10) + (\(\indent=3 notation=\binder INFSETSUM\\INFSETSUM _ |/ _./ _)\ [0, 0, 10] 10) syntax "_qinfsetsum" :: "pttrn \ bool \ 'a \ 'a::{banach, second_countable_topology}" - (\(2\\<^sub>a_ | (_)./ _)\ [0, 0, 10] 10) + (\(\indent=2 notation=\binder \\<^sub>a\\\\<^sub>a_ | (_)./ _)\ [0, 0, 10] 10) syntax_consts "_qinfsetsum" \ infsetsum translations diff -r 28ef01901650 -r 92768949a923 src/HOL/Analysis/Infinite_Sum.thy --- a/src/HOL/Analysis/Infinite_Sum.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Analysis/Infinite_Sum.thy Thu Oct 03 13:01:31 2024 +0200 @@ -47,27 +47,29 @@ "f abs_summable_on A \ (\x. norm (f x)) summable_on A" syntax (ASCII) - "_infsum" :: "pttrn \ 'a set \ 'b \ 'b::topological_comm_monoid_add" (\(3INFSUM (_/:_)./ _)\ [0, 51, 10] 10) + "_infsum" :: "pttrn \ 'a set \ 'b \ 'b::topological_comm_monoid_add" + (\(\indent=3 notation=\binder INFSUM\\INFSUM (_/:_)./ _)\ [0, 51, 10] 10) syntax - "_infsum" :: "pttrn \ 'a set \ 'b \ 'b::topological_comm_monoid_add" (\(2\\<^sub>\(_/\_)./ _)\ [0, 51, 10] 10) + "_infsum" :: "pttrn \ 'a set \ 'b \ 'b::topological_comm_monoid_add" + (\(\indent=2 notation=\binder \\<^sub>\\\\\<^sub>\(_/\_)./ _)\ [0, 51, 10] 10) syntax_consts "_infsum" \ infsum translations \ \Beware of argument permutation!\ "\\<^sub>\i\A. b" \ "CONST infsum (\i. b) A" syntax (ASCII) - "_univinfsum" :: "pttrn \ 'a \ 'a" (\(3INFSUM _./ _)\ [0, 10] 10) + "_univinfsum" :: "pttrn \ 'a \ 'a" (\(\indent=3 notation=\binder INFSUM\\INFSUM _./ _)\ [0, 10] 10) syntax - "_univinfsum" :: "pttrn \ 'a \ 'a" (\(2\\<^sub>\_./ _)\ [0, 10] 10) + "_univinfsum" :: "pttrn \ 'a \ 'a" (\(\indent=2 notation=\binder \\<^sub>\\\\\<^sub>\_./ _)\ [0, 10] 10) syntax_consts "_univinfsum" \ infsum translations "\\<^sub>\x. t" \ "CONST infsum (\x. t) (CONST UNIV)" syntax (ASCII) - "_qinfsum" :: "pttrn \ bool \ 'a \ 'a" (\(3INFSUM _ |/ _./ _)\ [0, 0, 10] 10) + "_qinfsum" :: "pttrn \ bool \ 'a \ 'a" (\(\indent=3 notation=\binder INFSUM\\INFSUM _ |/ _./ _)\ [0, 0, 10] 10) syntax - "_qinfsum" :: "pttrn \ bool \ 'a \ 'a" (\(2\\<^sub>\_ | (_)./ _)\ [0, 0, 10] 10) + "_qinfsum" :: "pttrn \ bool \ 'a \ 'a" (\(\indent=2 notation=\binder \\<^sub>\\\\\<^sub>\_ | (_)./ _)\ [0, 0, 10] 10) syntax_consts "_qinfsum" \ infsum translations diff -r 28ef01901650 -r 92768949a923 src/HOL/Analysis/Inner_Product.thy --- a/src/HOL/Analysis/Inner_Product.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Analysis/Inner_Product.thy Thu Oct 03 13:01:31 2024 +0200 @@ -391,9 +391,8 @@ subsection \Gradient derivative\ definition\<^marker>\tag important\ - gderiv :: - "['a::real_inner \ real, 'a, 'a] \ bool" - (\(GDERIV (_)/ (_)/ :> (_))\ [1000, 1000, 60] 60) + gderiv :: "['a::real_inner \ real, 'a, 'a] \ bool" + (\(\notation=\mixfix GDERIV\\GDERIV (_)/ (_)/ :> (_))\ [1000, 1000, 60] 60) where "GDERIV f x :> D \ FDERIV f x :> (\h. inner h D)" @@ -462,11 +461,13 @@ lemmas has_derivative_norm = GDERIV_norm [unfolded gderiv_def] -bundle inner_syntax begin +bundle inner_syntax +begin notation inner (infix \\\ 70) end -bundle no_inner_syntax begin +bundle no_inner_syntax +begin no_notation inner (infix \\\ 70) end diff -r 28ef01901650 -r 92768949a923 src/HOL/Analysis/Interval_Integral.thy --- a/src/HOL/Analysis/Interval_Integral.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Analysis/Interval_Integral.thy Thu Oct 03 13:01:31 2024 +0200 @@ -146,7 +146,7 @@ syntax "_ascii_interval_lebesgue_integral" :: "pttrn \ real \ real \ real measure \ real \ real" - (\(5LINT _=_.._|_. _)\ [0,60,60,61,100] 60) + (\(\indent=5 notation=\binder LINT\\LINT _=_.._|_. _)\ [0,60,60,61,100] 60) syntax_consts "_ascii_interval_lebesgue_integral" == interval_lebesgue_integral @@ -160,7 +160,7 @@ syntax "_ascii_interval_lebesgue_borel_integral" :: "pttrn \ real \ real \ real \ real" - (\(4LBINT _=_.._. _)\ [0,60,60,61] 60) + (\(\indent=4 notation=\binder LBINT\\LBINT _=_.._. _)\ [0,60,60,61] 60) syntax_consts "_ascii_interval_lebesgue_borel_integral" == interval_lebesgue_integral @@ -1049,7 +1049,7 @@ syntax "_complex_lebesgue_borel_integral" :: "pttrn \ real \ complex" - (\(2CLBINT _. _)\ [0,60] 60) + (\(\indent=2 notation=\binder CLBINT\\CLBINT _. _)\ [0,60] 60) syntax_consts "_complex_lebesgue_borel_integral" == complex_lebesgue_integral @@ -1057,7 +1057,7 @@ translations "CLBINT x. f" == "CONST complex_lebesgue_integral CONST lborel (\x. f)" syntax "_complex_set_lebesgue_borel_integral" :: "pttrn \ real set \ real \ complex" - (\(3CLBINT _:_. _)\ [0,60,61] 60) + (\(\indent=3 notation=\binder CLBINT\\CLBINT _:_. _)\ [0,60,61] 60) syntax_consts "_complex_set_lebesgue_borel_integral" == complex_set_lebesgue_integral @@ -1075,7 +1075,7 @@ syntax "_ascii_complex_interval_lebesgue_borel_integral" :: "pttrn \ ereal \ ereal \ real \ complex" - (\(4CLBINT _=_.._. _)\ [0,60,60,61] 60) + (\(\indent=4 notation=\binder CLBINT\\CLBINT _=_.._. _)\ [0,60,60,61] 60) syntax_consts "_ascii_complex_interval_lebesgue_borel_integral" == complex_interval_lebesgue_integral diff -r 28ef01901650 -r 92768949a923 src/HOL/Analysis/Lipschitz.thy --- a/src/HOL/Analysis/Lipschitz.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Analysis/Lipschitz.thy Thu Oct 03 13:01:31 2024 +0200 @@ -12,15 +12,16 @@ definition\<^marker>\tag important\ lipschitz_on where "lipschitz_on C U f \ (0 \ C \ (\x \ U. \y\U. dist (f x) (f y) \ C * dist x y))" -bundle lipschitz_syntax begin +open_bundle lipschitz_syntax +begin notation\<^marker>\tag important\ lipschitz_on (\_-lipschitz'_on\ [1000]) end -bundle no_lipschitz_syntax begin + +bundle no_lipschitz_syntax +begin no_notation lipschitz_on (\_-lipschitz'_on\ [1000]) end -unbundle lipschitz_syntax - lemma lipschitz_onI: "L-lipschitz_on X f" if "\x y. x \ X \ y \ X \ dist (f x) (f y) \ L * dist x y" "0 \ L" using that by (auto simp: lipschitz_on_def) diff -r 28ef01901650 -r 92768949a923 src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy --- a/src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy Thu Oct 03 13:01:31 2024 +0200 @@ -820,7 +820,7 @@ "integral\<^sup>N M f = (SUP g \ {g. simple_function M g \ g \ f}. integral\<^sup>S M g)" syntax - "_nn_integral" :: "pttrn \ ennreal \ 'a measure \ ennreal" (\\\<^sup>+((2 _./ _)/ \_)\ [60,61] 110) + "_nn_integral" :: "pttrn \ ennreal \ 'a measure \ ennreal" (\(\indent=2 notation=\binder integral\\\\<^sup>+(2 _./ _)/ \_)\ [60,61] 110) syntax_consts "_nn_integral" == nn_integral diff -r 28ef01901650 -r 92768949a923 src/HOL/Analysis/Set_Integral.thy --- a/src/HOL/Analysis/Set_Integral.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Analysis/Set_Integral.thy Thu Oct 03 13:01:31 2024 +0200 @@ -24,7 +24,7 @@ syntax "_ascii_set_lebesgue_integral" :: "pttrn \ 'a set \ 'a measure \ real \ real" - (\(4LINT (_):(_)/|(_)./ _)\ [0,0,0,10] 10) + (\(\indent=4 notation=\binder LINT\\LINT (_):(_)/|(_)./ _)\ [0,0,0,10] 10) syntax_consts "_ascii_set_lebesgue_integral" == set_lebesgue_integral @@ -43,11 +43,11 @@ syntax "_lebesgue_borel_integral" :: "pttrn \ real \ real" - (\(2LBINT _./ _)\ [0,10] 10) + (\(\indent=2 notation=\binder LBINT\\LBINT _./ _)\ [0,10] 10) syntax "_set_lebesgue_borel_integral" :: "pttrn \ real set \ real \ real" - (\(3LBINT _:_./ _)\ [0,0,10] 10) + (\(\indent=3 notation=\binder LBINT\\LBINT _:_./ _)\ [0,0,10] 10) section \Basic properties\ @@ -587,7 +587,7 @@ syntax "_ascii_complex_lebesgue_integral" :: "pttrn \ 'a measure \ real \ real" - (\(3CLINT _|_. _)\ [0,0,10] 10) + (\(\indent=3 notation=\binder CLINT\\CLINT _|_. _)\ [0,0,10] 10) syntax_consts "_ascii_complex_lebesgue_integral" == complex_lebesgue_integral @@ -624,7 +624,7 @@ syntax "_ascii_complex_set_lebesgue_integral" :: "pttrn \ 'a set \ 'a measure \ real \ real" - (\(4CLINT _:_|_. _)\ [0,0,0,10] 10) + (\(\indent=4 notation=\binder CLINT\\CLINT _:_|_. _)\ [0,0,0,10] 10) syntax_consts "_ascii_complex_set_lebesgue_integral" == complex_set_lebesgue_integral @@ -647,10 +647,10 @@ syntax "_set_nn_integral" :: "pttrn => 'a set => 'a measure => ereal => ereal" -(\(\\<^sup>+((_)\(_)./ _)/\_)\ [0,0,0,110] 10) +(\(\notation=\binder integral\\\\<^sup>+((_)\(_)./ _)/\_)\ [0,0,0,110] 10) "_set_lebesgue_integral" :: "pttrn => 'a set => 'a measure => ereal => ereal" -(\(\((_)\(_)./ _)/\_)\ [0,0,0,110] 10) +(\(\notation=\binder integral\\\((_)\(_)./ _)/\_)\ [0,0,0,110] 10) syntax_consts "_set_nn_integral" == set_nn_integral and diff -r 28ef01901650 -r 92768949a923 src/HOL/Analysis/Sparse_In.thy --- a/src/HOL/Analysis/Sparse_In.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Analysis/Sparse_In.thy Thu Oct 03 13:01:31 2024 +0200 @@ -165,14 +165,14 @@ "cosparse A = Abs_filter (\P. {x. \P x} sparse_in A)" syntax - "_eventually_cosparse" :: "pttrn => 'a set => bool => bool" (\(3\\<^sub>\_\_./ _)\ [0, 0, 10] 10) + "_eventually_cosparse" :: "pttrn => 'a set => bool => bool" (\(\indent=3 notation=\binder \\\\\\<^sub>\_\_./ _)\ [0, 0, 10] 10) syntax_consts "_eventually_cosparse" == eventually translations "\\<^sub>\x\A. P" == "CONST eventually (\x. P) (CONST cosparse A)" syntax - "_qeventually_cosparse" :: "pttrn \ bool \ 'a \ 'a" (\(3\\<^sub>\_ | (_)./ _)\ [0, 0, 10] 10) + "_qeventually_cosparse" :: "pttrn \ bool \ 'a \ 'a" (\(\indent=3 notation=\binder \\\\\\<^sub>\_ | (_)./ _)\ [0, 0, 10] 10) syntax_consts "_qeventually_cosparse" == eventually translations diff -r 28ef01901650 -r 92768949a923 src/HOL/Auth/Message.thy --- a/src/HOL/Auth/Message.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Auth/Message.thy Thu Oct 03 13:01:31 2024 +0200 @@ -51,8 +51,6 @@ text\Concrete syntax: messages appear as \\A,B,NA\\, etc...\ syntax "_MTuple" :: "['a, args] \ 'a * 'b" (\(\indent=2 notation=\mixfix message tuple\\\_,/ _\)\) -syntax_consts - MPair translations "\x, y, z\" \ "\x, \y, z\\" "\x, y\" \ "CONST MPair x y" diff -r 28ef01901650 -r 92768949a923 src/HOL/Code_Evaluation.thy --- a/src/HOL/Code_Evaluation.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Code_Evaluation.thy Thu Oct 03 13:01:31 2024 +0200 @@ -54,10 +54,7 @@ bundle term_syntax begin - -notation App (infixl \<\>\ 70) - and valapp (infixl \{\}\ 70) - +notation App (infixl \<\>\ 70) and valapp (infixl \{\}\ 70) end diff -r 28ef01901650 -r 92768949a923 src/HOL/Codegenerator_Test/Code_Lazy_Test.thy --- a/src/HOL/Codegenerator_Test/Code_Lazy_Test.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Codegenerator_Test/Code_Lazy_Test.thy Thu Oct 03 13:01:31 2024 +0200 @@ -24,9 +24,7 @@ no_notation lazy_llist (\_\) syntax - "_llist" :: "args => 'a list" (\\<^bold>[(\notation=\mixfix lazy list enumeration\\_)\<^bold>]\) -syntax_consts - lazy_llist + "_llist" :: "args => 'a list" (\(\indent=1 notation=\mixfix lazy list enumeration\\\<^bold>[_\<^bold>])\) translations "\<^bold>[x, xs\<^bold>]" == "x\<^bold>#\<^bold>[xs\<^bold>]" "\<^bold>[x\<^bold>]" == "x\<^bold>#\<^bold>[\<^bold>]" diff -r 28ef01901650 -r 92768949a923 src/HOL/Combinatorics/Perm.thy --- a/src/HOL/Combinatorics/Perm.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Combinatorics/Perm.thy Thu Oct 03 13:01:31 2024 +0200 @@ -792,20 +792,18 @@ subsection \Syntax\ -bundle no_permutation_syntax +open_bundle no_permutation_syntax begin - no_notation swap (\\_ \ _\\) - no_notation cycle (\\_\\) - no_notation "apply" (infixl \\$\\ 999) +no_notation swap (\\_ \ _\\) +no_notation cycle (\\_\\) +no_notation "apply" (infixl \\$\\ 999) end bundle permutation_syntax begin - notation swap (\\_ \ _\\) - notation cycle (\\_\\) - notation "apply" (infixl \\$\\ 999) +notation swap (\\_ \ _\\) +notation cycle (\\_\\) +notation "apply" (infixl \\$\\ 999) end -unbundle no_permutation_syntax - end diff -r 28ef01901650 -r 92768949a923 src/HOL/Computational_Algebra/Formal_Laurent_Series.thy --- a/src/HOL/Computational_Algebra/Formal_Laurent_Series.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Computational_Algebra/Formal_Laurent_Series.thy Thu Oct 03 13:01:31 2024 +0200 @@ -25,7 +25,7 @@ setup_lifting type_definition_fls -unbundle fps_notation +unbundle fps_syntax notation fls_nth (infixl \$$\ 75) lemmas fls_eqI = iffD1[OF fls_nth_inject, OF iffD2, OF fun_eq_iff, OF allI] @@ -4603,7 +4603,7 @@ no_notation fls_nth (infixl \$$\ 75) -bundle fls_notation +bundle fps_syntax begin notation fls_nth (infixl \$$\ 75) end diff -r 28ef01901650 -r 92768949a923 src/HOL/Computational_Algebra/Formal_Power_Series.thy --- a/src/HOL/Computational_Algebra/Formal_Power_Series.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Computational_Algebra/Formal_Power_Series.thy Thu Oct 03 13:01:31 2024 +0200 @@ -6193,7 +6193,7 @@ (* TODO: Figure out better notation for this thing *) no_notation fps_nth (infixl \$\ 75) -bundle fps_notation +bundle fps_syntax begin notation fps_nth (infixl \$\ 75) end diff -r 28ef01901650 -r 92768949a923 src/HOL/Computational_Algebra/Polynomial.thy --- a/src/HOL/Computational_Algebra/Polynomial.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Computational_Algebra/Polynomial.thy Thu Oct 03 13:01:31 2024 +0200 @@ -349,9 +349,7 @@ subsection \List-style syntax for polynomials\ syntax - "_poly" :: "args \ 'a poly" (\[:(\notation=\mixfix polynomial enumeration\\_):]\) -syntax_consts - pCons + "_poly" :: "args \ 'a poly" (\(\indent=2 notation=\mixfix polynomial enumeration\\[:_:])\) translations "[:x, xs:]" \ "CONST pCons x [:xs:]" "[:x:]" \ "CONST pCons x 0" diff -r 28ef01901650 -r 92768949a923 src/HOL/Computational_Algebra/Polynomial_FPS.thy --- a/src/HOL/Computational_Algebra/Polynomial_FPS.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Computational_Algebra/Polynomial_FPS.thy Thu Oct 03 13:01:31 2024 +0200 @@ -9,7 +9,7 @@ begin context - includes fps_notation + includes fps_syntax begin definition fps_of_poly where diff -r 28ef01901650 -r 92768949a923 src/HOL/Decision_Procs/Approximation.thy --- a/src/HOL/Decision_Procs/Approximation.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Decision_Procs/Approximation.thy Thu Oct 03 13:01:31 2024 +0200 @@ -1143,7 +1143,8 @@ section "Avoid pollution of name space" -bundle floatarith_notation begin +bundle floatarith_syntax +begin notation Add (\Add\) notation Minus (\Minus\) @@ -1166,7 +1167,8 @@ end -bundle no_floatarith_notation begin +bundle no_floatarith_syntax +begin no_notation Add (\Add\) no_notation Minus (\Minus\) diff -r 28ef01901650 -r 92768949a923 src/HOL/Fun.thy --- a/src/HOL/Fun.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Fun.thy Thu Oct 03 13:01:31 2024 +0200 @@ -846,9 +846,6 @@ "_updbinds":: "updbind \ updbinds \ updbinds" (\_,/ _\) "_Update" :: "'a \ updbinds \ 'a" (\_/'((2_)')\ [1000, 0] 900) -syntax_consts - fun_upd - translations "_Update f (_updbinds b bs)" \ "_Update (_Update f b) bs" "f(x:=y)" \ "CONST fun_upd f x y" diff -r 28ef01901650 -r 92768949a923 src/HOL/HOL.thy --- a/src/HOL/HOL.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOL.thy Thu Oct 03 13:01:31 2024 +0200 @@ -191,11 +191,11 @@ nonterminal case_syn and cases_syn syntax "_case_syntax" :: "['a, cases_syn] \ 'b" (\(\notation=\mixfix case expression\\case _ of/ _)\ 10) - "_case1" :: "['a, 'b] \ case_syn" (\(\indent=2 notation=\mixfix case pattern\\_ \/ _)\ 10) + "_case1" :: "['a, 'b] \ case_syn" (\(\indent=2 notation=\mixfix case clause\\_ \/ _)\ 10) "" :: "case_syn \ cases_syn" (\_\) "_case2" :: "[case_syn, cases_syn] \ cases_syn" (\_/ | _\) syntax (ASCII) - "_case1" :: "['a, 'b] \ case_syn" (\(\indent=2 notation=\mixfix case pattern\\_ =>/ _)\ 10) + "_case1" :: "['a, 'b] \ case_syn" (\(\indent=2 notation=\mixfix case clause\\_ =>/ _)\ 10) notation (ASCII) All (binder \ALL \ 10) and diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/Cfun.thy --- a/src/HOL/HOLCF/Cfun.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/Cfun.thy Thu Oct 03 13:01:31 2024 +0200 @@ -16,17 +16,17 @@ definition "cfun = {f::'a \ 'b. cont f}" -cpodef ('a, 'b) cfun (\(_ \/ _)\ [1, 0] 0) = "cfun :: ('a \ 'b) set" +cpodef ('a, 'b) cfun (\(\notation=\infix \\\_ \/ _)\ [1, 0] 0) = "cfun :: ('a \ 'b) set" by (auto simp: cfun_def intro: cont_const adm_cont) type_notation (ASCII) cfun (infixr \->\ 0) notation (ASCII) - Rep_cfun (\(_$/_)\ [999,1000] 999) + Rep_cfun (\(\notation=\infix $\\_$/_)\ [999,1000] 999) notation - Rep_cfun (\(_\/_)\ [999,1000] 999) + Rep_cfun (\(\notation=\infix \\\_\/_)\ [999,1000] 999) subsection \Syntax for continuous lambda abstraction\ @@ -47,10 +47,10 @@ text \Syntax for nested abstractions\ syntax (ASCII) - "_Lambda" :: "[cargs, logic] \ logic" (\(3LAM _./ _)\ [1000, 10] 10) + "_Lambda" :: "[cargs, logic] \ logic" (\(\indent=3 notation=\binder LAM\\LAM _./ _)\ [1000, 10] 10) syntax - "_Lambda" :: "[cargs, logic] \ logic" (\(3\ _./ _)\ [1000, 10] 10) + "_Lambda" :: "[cargs, logic] \ logic" (\(\indent=3 notation=\binder \\\\ _./ _)\ [1000, 10] 10) syntax_consts "_Lambda" \ Abs_cfun diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/ConvexPD.thy --- a/src/HOL/HOLCF/ConvexPD.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/ConvexPD.thy Thu Oct 03 13:01:31 2024 +0200 @@ -119,7 +119,7 @@ subsection \Type definition\ -typedef 'a convex_pd (\('(_')\)\) = +typedef 'a convex_pd (\(\notation=\postfix convex_pd\\'(_')\)\) = "{S::'a pd_basis set. convex_le.ideal S}" by (rule convex_le.ex_ideal) @@ -178,13 +178,8 @@ (infixl \\\\ 65) where "xs \\ ys == convex_plus\xs\ys" -nonterminal convex_pd_args syntax - "" :: "logic \ convex_pd_args" (\_\) - "_convex_pd_args" :: "logic \ convex_pd_args \ convex_pd_args" (\_,/ _\) - "_convex_pd" :: "convex_pd_args \ logic" (\{_}\\) -syntax_consts - "_convex_pd_args" "_convex_pd" == convex_add + "_convex_pd" :: "args \ logic" (\(\indent=1 notation=\mixfix convex_pd enumeration\\{_}\)\) translations "{x,xs}\" == "{x}\ \\ {xs}\" "{x}\" == "CONST convex_unit\x" @@ -350,10 +345,7 @@ syntax "_convex_bind" :: "[logic, logic, logic] \ logic" - (\(3\\_\_./ _)\ [0, 0, 10] 10) - -syntax_consts - "_convex_bind" == convex_bind + (\(\indent=3 notation=\binder convex_bind\\\\_\_./ _)\ [0, 0, 10] 10) translations "\\x\xs. e" == "CONST convex_bind\xs\(\ x. e)" diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/FOCUS/Fstream.thy --- a/src/HOL/HOLCF/FOCUS/Fstream.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/FOCUS/Fstream.thy Thu Oct 03 13:01:31 2024 +0200 @@ -29,16 +29,16 @@ "<> == \" abbreviation - fscons' :: "'a \ 'a fstream \ 'a fstream" (\(_\_)\ [66,65] 65) where + fscons' :: "'a \ 'a fstream \ 'a fstream" (\(\notation=\infix \\\_\_)\ [66,65] 65) where "a\s == fscons a\s" abbreviation - fsfilter' :: "'a set \ 'a fstream \ 'a fstream" (\(_\_)\ [64,63] 63) where + fsfilter' :: "'a set \ 'a fstream \ 'a fstream" (\(\notation=\infix \\\_\_)\ [64,63] 63) where "A\s == fsfilter A\s" notation (ASCII) - fscons' (\(_~>_)\ [66,65] 65) and - fsfilter' (\(_'(C')_)\ [64,63] 63) + fscons' (\(\notation=\infix ~>\\_~>_)\ [66,65] 65) and + fsfilter' (\(\notation=\infix (C)\\_'(C')_)\ [64,63] 63) lemma Def_maximal: "a = Def d \ a\b \ b = Def d" diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/FOCUS/Fstreams.thy --- a/src/HOL/HOLCF/FOCUS/Fstreams.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/FOCUS/Fstreams.thy Thu Oct 03 13:01:31 2024 +0200 @@ -44,11 +44,11 @@ "<> == \" abbreviation - fsfilter' :: "'a set \ 'a fstream \ 'a fstream" (\(_\_)\ [64,63] 63) where + fsfilter' :: "'a set \ 'a fstream \ 'a fstream" (\(\notation=\infix \\\_\_)\ [64,63] 63) where "A\s == fsfilter A\s" notation (ASCII) - fsfilter' (\(_'(C')_)\ [64,63] 63) + fsfilter' (\(\notation=\infix (C)\\_'(C')_)\ [64,63] 63) lemma ft_fsingleton[simp]: "ft\() = Def a" diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/IOA/Sequence.thy --- a/src/HOL/HOLCF/IOA/Sequence.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/IOA/Sequence.thy Thu Oct 03 13:01:31 2024 +0200 @@ -63,17 +63,15 @@ UU \ UU | Def y \ (if P y then x ## (h \ xs) else h \ xs))))" -abbreviation Consq_syn (\(_/\_)\ [66, 65] 65) +abbreviation Consq_syn (\(\notation=\infix \\\_/\_)\ [66, 65] 65) where "a \ s \ Consq a \ s" subsection \List enumeration\ syntax - "_totlist" :: "args \ 'a Seq" (\[(\notation=\mixfix total list enumeration\\_)!]\) - "_partlist" :: "args \ 'a Seq" (\[(\notation=\mixfix partial list enumeration\\_)?]\) -syntax_consts - Consq + "_totlist" :: "args \ 'a Seq" (\(\indent=1 notation=\mixfix total list enumeration\\[_!])\) + "_partlist" :: "args \ 'a Seq" (\(\indent=1 notation=\mixfix partial list enumeration\\[_?])\) translations "[x, xs!]" \ "x \ [xs!]" "[x!]" \ "x\nil" diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/IOA/TL.thy --- a/src/HOL/HOLCF/IOA/TL.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/IOA/TL.thy Thu Oct 03 13:01:31 2024 +0200 @@ -22,7 +22,7 @@ where "Init P s = P (unlift (HD \ s))" \ \this means that for \nil\ and \UU\ the effect is unpredictable\ -definition Next :: "'a temporal \ 'a temporal" (\\(_)\ [80] 80) +definition Next :: "'a temporal \ 'a temporal" (\(\indent=1 notation=\prefix Next\\\_)\ [80] 80) where "(\P) s \ (if TL \ s = UU \ TL \ s = nil then P s else P (TL \ s))" definition suffix :: "'a Seq \ 'a Seq \ bool" @@ -31,10 +31,10 @@ definition tsuffix :: "'a Seq \ 'a Seq \ bool" where "tsuffix s2 s \ s2 \ nil \ s2 \ UU \ suffix s2 s" -definition Box :: "'a temporal \ 'a temporal" (\\(_)\ [80] 80) +definition Box :: "'a temporal \ 'a temporal" (\(\indent=1 notation=\prefix Box\\\_)\ [80] 80) where "(\P) s \ (\s2. tsuffix s2 s \ P s2)" -definition Diamond :: "'a temporal \ 'a temporal" (\\(_)\ [80] 80) +definition Diamond :: "'a temporal \ 'a temporal" (\(\indent=1 notation=\prefix Diamond\\\_)\ [80] 80) where "\P = (\<^bold>\ (\(\<^bold>\ P)))" definition Leadsto :: "'a temporal \ 'a temporal \ 'a temporal" (infixr \\\ 22) diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/LowerPD.thy --- a/src/HOL/HOLCF/LowerPD.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/LowerPD.thy Thu Oct 03 13:01:31 2024 +0200 @@ -74,7 +74,7 @@ subsection \Type definition\ -typedef 'a lower_pd (\('(_')\)\) = +typedef 'a lower_pd (\(\notation=\postfix lower_pd\\'(_')\)\) = "{S::'a pd_basis set. lower_le.ideal S}" by (rule lower_le.ex_ideal) @@ -133,13 +133,8 @@ (infixl \\\\ 65) where "xs \\ ys == lower_plus\xs\ys" -nonterminal lower_pd_args syntax - "" :: "logic \ lower_pd_args" (\_\) - "_lower_pd_args" :: "logic \ lower_pd_args \ lower_pd_args" (\_,/ _\) - "_lower_pd" :: "lower_pd_args \ logic" (\{_}\\) -syntax_consts - "_lower_pd_args" "_lower_pd" == lower_add + "_lower_pd" :: "args \ logic" (\(\indent=1 notation=\mixfix lower_pd enumeration\\{_}\)\) translations "{x,xs}\" == "{x}\ \\ {xs}\" "{x}\" == "CONST lower_unit\x" @@ -344,10 +339,7 @@ syntax "_lower_bind" :: "[logic, logic, logic] \ logic" - (\(3\\_\_./ _)\ [0, 0, 10] 10) - -syntax_consts - "_lower_bind" == lower_bind + (\(\indent=3 notation=\binder lower_bind\\\\_\_./ _)\ [0, 0, 10] 10) translations "\\x\xs. e" == "CONST lower_bind\xs\(\ x. e)" diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/Pcpo.thy --- a/src/HOL/HOLCF/Pcpo.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/Pcpo.thy Thu Oct 03 13:01:31 2024 +0200 @@ -151,10 +151,7 @@ end text \Old "UU" syntax:\ - -syntax UU :: logic -syntax_consts UU \ bottom -translations "UU" \ "CONST bottom" +abbreviation (input) "UU \ bottom" text \Simproc to rewrite \<^term>\\ = x\ to \<^term>\x = \\.\ setup \Reorient_Proc.add (fn \<^Const_>\bottom _\ => true | _ => false)\ diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/Porder.thy --- a/src/HOL/HOLCF/Porder.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/Porder.thy Thu Oct 03 13:01:31 2024 +0200 @@ -113,10 +113,10 @@ end syntax (ASCII) - "_BLub" :: "[pttrn, 'a set, 'b] \ 'b" (\(3LUB _:_./ _)\ [0,0, 10] 10) + "_BLub" :: "[pttrn, 'a set, 'b] \ 'b" (\(\indent=3 notation=\binder LUB\\LUB _:_./ _)\ [0,0, 10] 10) syntax - "_BLub" :: "[pttrn, 'a set, 'b] \ 'b" (\(3\_\_./ _)\ [0,0, 10] 10) + "_BLub" :: "[pttrn, 'a set, 'b] \ 'b" (\(\indent=3 notation=\binder \\\\_\_./ _)\ [0,0, 10] 10) syntax_consts "_BLub" \ lub diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/Sprod.thy --- a/src/HOL/HOLCF/Sprod.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/Sprod.thy Thu Oct 03 13:01:31 2024 +0200 @@ -16,7 +16,7 @@ definition "sprod = {p::'a \ 'b. p = \ \ (fst p \ \ \ snd p \ \)}" -pcpodef ('a, 'b) sprod (\(_ \/ _)\ [21,20] 20) = "sprod :: ('a \ 'b) set" +pcpodef ('a, 'b) sprod (\(\notation=\infix strict product\\_ \/ _)\ [21,20] 20) = "sprod :: ('a \ 'b) set" by (simp_all add: sprod_def) instance sprod :: ("{chfin,pcpo}", "{chfin,pcpo}") chfin @@ -42,8 +42,6 @@ syntax "_stuple" :: "[logic, args] \ logic" (\(\indent=1 notation=\mixfix strict tuple\\'(:_,/ _:'))\) -syntax_consts - spair translations "(:x, y, z:)" \ "(:x, (:y, z:):)" "(:x, y:)" \ "CONST spair\x\y" diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/Ssum.thy --- a/src/HOL/HOLCF/Ssum.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/Ssum.thy Thu Oct 03 13:01:31 2024 +0200 @@ -19,7 +19,7 @@ (fst p = TT \ fst (snd p) \ \ \ snd (snd p) = \) \ (fst p = FF \ fst (snd p) = \ \ snd (snd p) \ \)}" -pcpodef ('a, 'b) ssum (\(_ \/ _)\ [21, 20] 20) = "ssum :: (tr \ 'a \ 'b) set" +pcpodef ('a, 'b) ssum (\(\notation=\infix strict sum\\_ \/ _)\ [21, 20] 20) = "ssum :: (tr \ 'a \ 'b) set" by (simp_all add: ssum_def) instance ssum :: ("{chfin,pcpo}", "{chfin,pcpo}") chfin diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/Tr.thy --- a/src/HOL/HOLCF/Tr.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/Tr.thy Thu Oct 03 13:01:31 2024 +0200 @@ -63,7 +63,7 @@ definition tr_case :: "'a \ 'a \ tr \ 'a" where "tr_case = (\ t e (Def b). if b then t else e)" -abbreviation cifte_syn :: "[tr, 'c, 'c] \ 'c" (\(If (_)/ then (_)/ else (_))\ [0, 0, 60] 60) +abbreviation cifte_syn :: "[tr, 'c, 'c] \ 'c" (\(\notation=\mixfix If expression\\If (_)/ then (_)/ else (_))\ [0, 0, 60] 60) where "If b then e1 else e2 \ tr_case\e1\e2\b" translations diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/Up.thy --- a/src/HOL/HOLCF/Up.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/Up.thy Thu Oct 03 13:01:31 2024 +0200 @@ -14,7 +14,7 @@ subsection \Definition of new type for lifting\ -datatype 'a u (\(_\<^sub>\)\ [1000] 999) = Ibottom | Iup 'a +datatype 'a u (\(\notation=\postfix lifting\\_\<^sub>\)\ [1000] 999) = Ibottom | Iup 'a primrec Ifup :: "('a \ 'b::pcpo) \ 'a u \ 'b" where diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/UpperPD.thy --- a/src/HOL/HOLCF/UpperPD.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/UpperPD.thy Thu Oct 03 13:01:31 2024 +0200 @@ -72,7 +72,7 @@ subsection \Type definition\ -typedef 'a upper_pd (\('(_')\)\) = +typedef 'a upper_pd (\(\notation=\postfix upper_pd\\'(_')\)\) = "{S::'a pd_basis set. upper_le.ideal S}" by (rule upper_le.ex_ideal) @@ -131,13 +131,8 @@ (infixl \\\\ 65) where "xs \\ ys == upper_plus\xs\ys" -nonterminal upper_pd_args syntax - "" :: "logic \ upper_pd_args" (\_\) - "_upper_pd_args" :: "logic \ upper_pd_args \ upper_pd_args" (\_,/ _\) - "_upper_pd" :: "upper_pd_args \ logic" (\{_}\\) -syntax_consts - "_upper_pd_args" "_upper_pd" == upper_add + "_upper_pd" :: "args \ logic" (\(\indent=1 notation=\mixfix upper_pd enumeration\\{_}\)\) translations "{x,xs}\" == "{x}\ \\ {xs}\" "{x}\" == "CONST upper_unit\x" @@ -337,10 +332,7 @@ syntax "_upper_bind" :: "[logic, logic, logic] \ logic" - (\(3\\_\_./ _)\ [0, 0, 10] 10) - -syntax_consts - "_upper_bind" == upper_bind + (\(\indent=3 notation=\binder upper_bind\\\\_\_./ _)\ [0, 0, 10] 10) translations "\\x\xs. e" == "CONST upper_bind\xs\(\ x. e)" diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/ex/Letrec.thy --- a/src/HOL/HOLCF/ex/Letrec.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/ex/Letrec.thy Thu Oct 03 13:01:31 2024 +0200 @@ -15,15 +15,12 @@ nonterminal recbinds and recbindt and recbind syntax - "_recbind" :: "[logic, logic] \ recbind" (\(2_ =/ _)\ 10) + "_recbind" :: "[logic, logic] \ recbind" (\(\indent=2 notation=\mixfix Letrec binding\\_ =/ _)\ 10) "" :: "recbind \ recbindt" (\_\) "_recbindt" :: "[recbind, recbindt] \ recbindt" (\_,/ _\) "" :: "recbindt \ recbinds" (\_\) "_recbinds" :: "[recbindt, recbinds] \ recbinds" (\_;/ _\) - "_Letrec" :: "[recbinds, logic] \ logic" (\(Letrec (_)/ in (_))\ 10) - -syntax_consts - "_recbind" "_recbinds" "_recbindt" "_Letrec" == CLetrec + "_Letrec" :: "[recbinds, logic] \ logic" (\(\notation=\mixfix Letrec expression\\Letrec (_)/ in (_))\ 10) translations (recbindt) "x = a, (y,ys) = (b,bs)" == (recbindt) "(x,y,ys) = (a,b,bs)" diff -r 28ef01901650 -r 92768949a923 src/HOL/HOLCF/ex/Pattern_Match.thy --- a/src/HOL/HOLCF/ex/Pattern_Match.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/HOLCF/ex/Pattern_Match.thy Thu Oct 03 13:01:31 2024 +0200 @@ -103,14 +103,14 @@ nonterminal Case_pat and Case_syn and Cases_syn syntax - "_Case_syntax":: "['a, Cases_syn] => 'b" (\(Case _ of/ _)\ 10) - "_Case1" :: "[Case_pat, 'b] => Case_syn" (\(2_ \/ _)\ 10) + "_Case_syntax":: "['a, Cases_syn] => 'b" (\(\notation=\mixfix Case expression\\Case _ of/ _)\ 10) + "_Case1" :: "[Case_pat, 'b] => Case_syn" (\(\indent=2 notation=\mixfix Case clause\\_ \/ _)\ 10) "" :: "Case_syn => Cases_syn" (\_\) "_Case2" :: "[Case_syn, Cases_syn] => Cases_syn" (\_/ | _\) "_strip_positions" :: "'a => Case_pat" (\_\) syntax (ASCII) - "_Case1" :: "[Case_pat, 'b] => Case_syn" (\(2_ =>/ _)\ 10) + "_Case1" :: "[Case_pat, 'b] => Case_syn" (\(\indent=2 notation=\mixfix Case clause\\_ =>/ _)\ 10) translations "_Case_syntax x ms" == "CONST cases\(ms\x)" diff -r 28ef01901650 -r 92768949a923 src/HOL/Library/FSet.thy --- a/src/HOL/Library/FSet.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Library/FSet.thy Thu Oct 03 13:01:31 2024 +0200 @@ -165,9 +165,7 @@ by simp syntax - "_fset" :: "args => 'a fset" (\{|(\notation=\mixfix finite set enumeration\\_)|}\) -syntax_consts - finsert + "_fset" :: "args => 'a fset" (\(\indent=2 notation=\mixfix finite set enumeration\\{|_|})\) translations "{|x, xs|}" == "CONST finsert x {|xs|}" "{|x|}" == "CONST finsert x {||}" @@ -194,26 +192,49 @@ end syntax (input) - "_fBall" :: "pttrn \ 'a fset \ bool \ bool" (\(3! (_/|:|_)./ _)\ [0, 0, 10] 10) - "_fBex" :: "pttrn \ 'a fset \ bool \ bool" (\(3? (_/|:|_)./ _)\ [0, 0, 10] 10) + "_fBall" :: "pttrn \ 'a fset \ bool \ bool" (\(\indent=3 notation=\binder finite !\\! (_/|:|_)./ _)\ [0, 0, 10] 10) + "_fBex" :: "pttrn \ 'a fset \ bool \ bool" (\(\indent=3 notation=\binder finite ?\\? (_/|:|_)./ _)\ [0, 0, 10] 10) + "_fBex1" :: "pttrn \ 'a fset \ bool \ bool" (\(\indent=3 notation=\binder finite ?!\\?! (_/:_)./ _)\ [0, 0, 10] 10) syntax - "_fBall" :: "pttrn \ 'a fset \ bool \ bool" (\(3\(_/|\|_)./ _)\ [0, 0, 10] 10) - "_fBex" :: "pttrn \ 'a fset \ bool \ bool" (\(3\(_/|\|_)./ _)\ [0, 0, 10] 10) + "_fBall" :: "pttrn \ 'a fset \ bool \ bool" (\(\indent=3 notation=\binder finite \\\\(_/|\|_)./ _)\ [0, 0, 10] 10) + "_fBex" :: "pttrn \ 'a fset \ bool \ bool" (\(\indent=3 notation=\binder finite \\\\(_/|\|_)./ _)\ [0, 0, 10] 10) + "_fBnex" :: "pttrn \ 'a fset \ bool \ bool" (\(\indent=3 notation=\binder finite \\\\(_/|\|_)./ _)\ [0, 0, 10] 10) + "_fBex1" :: "pttrn \ 'a fset \ bool \ bool" (\(\indent=3 notation=\binder finite \!\\\!(_/|\|_)./ _)\ [0, 0, 10] 10) syntax_consts - "_fBall" \ FSet.Ball and - "_fBex" \ FSet.Bex + "_fBall" "_fBnex" \ fBall and + "_fBex" \ fBex and + "_fBex1" \ Ex1 translations "\x|\|A. P" \ "CONST FSet.Ball A (\x. P)" "\x|\|A. P" \ "CONST FSet.Bex A (\x. P)" + "\x|\|A. P" \ "CONST fBall A (\x. \ P)" + "\!x|\|A. P" \ "\!x. x |\| A \ P" print_translation \ [Syntax_Trans.preserve_binder_abs2_tr' \<^const_syntax>\fBall\ \<^syntax_const>\_fBall\, Syntax_Trans.preserve_binder_abs2_tr' \<^const_syntax>\fBex\ \<^syntax_const>\_fBex\] \ \ \to avoid eta-contraction of body\ +syntax + "_setlessfAll" :: "[idt, 'a, bool] \ bool" (\(\indent=3 notation=\binder finite \\\\_|\|_./ _)\ [0, 0, 10] 10) + "_setlessfEx" :: "[idt, 'a, bool] \ bool" (\(\indent=3 notation=\binder finite \\\\_|\|_./ _)\ [0, 0, 10] 10) + "_setlefAll" :: "[idt, 'a, bool] \ bool" (\(\indent=3 notation=\binder finite \\\\_|\|_./ _)\ [0, 0, 10] 10) + "_setlefEx" :: "[idt, 'a, bool] \ bool" (\(\indent=3 notation=\binder finite \\\\_|\|_./ _)\ [0, 0, 10] 10) + +syntax_consts + "_setlessfAll" "_setlefAll" \ All and + "_setlessfEx" "_setlefEx" \ Ex + +translations + "\A|\|B. P" \ "\A. A |\| B \ P" + "\A|\|B. P" \ "\A. A |\| B \ P" + "\A|\|B. P" \ "\A. A |\| B \ P" + "\A|\|B. P" \ "\A. A |\| B \ P" + + context includes lifting_syntax begin diff -r 28ef01901650 -r 92768949a923 src/HOL/Library/Landau_Symbols.thy --- a/src/HOL/Library/Landau_Symbols.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Library/Landau_Symbols.thy Thu Oct 03 13:01:31 2024 +0200 @@ -1741,7 +1741,7 @@ abbreviation (input) asymp_equiv_at_top where "asymp_equiv_at_top f g \ f \[at_top] g" -bundle asymp_equiv_notation +bundle asymp_equiv_syntax begin notation asymp_equiv_at_top (infix \\\ 50) end diff -r 28ef01901650 -r 92768949a923 src/HOL/Library/Multiset.thy --- a/src/HOL/Library/Multiset.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Library/Multiset.thy Thu Oct 03 13:01:31 2024 +0200 @@ -92,9 +92,7 @@ by (rule add_mset_in_multiset) syntax - "_multiset" :: "args \ 'a multiset" (\{#(\notation=\mixfix multiset enumeration\\_)#}\) -syntax_consts - add_mset + "_multiset" :: "args \ 'a multiset" (\(\indent=2 notation=\mixfix multiset enumeration\\{#_#})\) translations "{#x, xs#}" == "CONST add_mset x {#xs#}" "{#x#}" == "CONST add_mset x {#}" diff -r 28ef01901650 -r 92768949a923 src/HOL/List.thy --- a/src/HOL/List.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/List.thy Thu Oct 03 13:01:31 2024 +0200 @@ -46,12 +46,16 @@ text \List enumeration\ syntax - "_list" :: "args => 'a list" (\[(\notation=\mixfix list enumeration\\_)]\) -syntax_consts - Cons + "_list" :: "args \ 'a list" (\(\indent=1 notation=\mixfix list enumeration\\[_])\) translations - "[x, xs]" == "x#[xs]" - "[x]" == "x#[]" + "[x, xs]" \ "x#[xs]" + "[x]" \ "x#[]" + +bundle no_list_syntax +begin +no_syntax + "_list" :: "args \ 'a list" (\(\indent=1 notation=\mixfix list enumeration\\[_])\) +end subsection \Basic list processing functions\ @@ -137,9 +141,6 @@ "_lupdbinds" :: "[lupdbind, lupdbinds] => lupdbinds" (\_,/ _\) "_LUpdate" :: "['a, lupdbinds] => 'a" (\_/[(_)]\ [1000,0] 900) -syntax_consts - list_update - translations "_LUpdate xs (_lupdbinds b bs)" == "_LUpdate (_LUpdate xs b) bs" "xs[i:=x]" == "CONST list_update xs i x" @@ -456,6 +457,13 @@ syntax (ASCII) "_lc_gen" :: "'a \ 'a list \ lc_qual" (\_ <- _\) +bundle no_listcompr_syntax +begin +no_syntax + "_listcompr" :: "'a \ lc_qual \ lc_quals \ 'a list" (\[_ . __\) + "_lc_end" :: "lc_quals" (\]\) +end + parse_translation \ let val NilC = Syntax.const \<^const_syntax>\Nil\; diff -r 28ef01901650 -r 92768949a923 src/HOL/Metis_Examples/Message.thy --- a/src/HOL/Metis_Examples/Message.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Metis_Examples/Message.thy Thu Oct 03 13:01:31 2024 +0200 @@ -50,8 +50,6 @@ text\Concrete syntax: messages appear as \\A,B,NA\\, etc...\ syntax "_MTuple" :: "['a, args] \ 'a * 'b" (\(\indent=2 notation=\mixfix message tuple\\\_,/ _\)\) -syntax_consts - MPair translations "\x, y, z\" \ "\x, \y, z\\" "\x, y\" \ "CONST MPair x y" diff -r 28ef01901650 -r 92768949a923 src/HOL/Product_Type.thy --- a/src/HOL/Product_Type.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Product_Type.thy Thu Oct 03 13:01:31 2024 +0200 @@ -294,7 +294,6 @@ "_patterns" :: "pttrn \ patterns \ patterns" (\_,/ _\) "_unit" :: pttrn (\'(')\) syntax_consts - Pair and "_pattern" "_patterns" \ case_prod and "_unit" \ case_unit translations @@ -804,10 +803,8 @@ bundle state_combinator_syntax begin - notation fcomp (infixl \\>\ 60) notation scomp (infixl \\\\ 60) - end context @@ -1000,15 +997,19 @@ definition Sigma :: "'a set \ ('a \ 'b set) \ ('a \ 'b) set" where "Sigma A B \ \x\A. \y\B x. {Pair x y}" -abbreviation Times :: "'a set \ 'b set \ ('a \ 'b) set" (infixr \\\ 80) +context +begin +qualified abbreviation Times :: "'a set \ 'b set \ ('a \ 'b) set" (infixr \\\ 80) where "A \ B \ Sigma A (\_. B)" +end -hide_const (open) Times - -bundle no_Set_Product_syntax begin +bundle no_Set_Product_syntax +begin no_notation Product_Type.Times (infixr \\\ 80) end -bundle Set_Product_syntax begin + +bundle Set_Product_syntax +begin notation Product_Type.Times (infixr \\\ 80) end diff -r 28ef01901650 -r 92768949a923 src/HOL/Prolog/Test.thy --- a/src/HOL/Prolog/Test.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Prolog/Test.thy Thu Oct 03 13:01:31 2024 +0200 @@ -19,9 +19,7 @@ text \List enumeration\ syntax - "_list" :: "args => 'a list" (\[(\notation=\mixfix list enumeration\\_)]\) -syntax_consts - Cons + "_list" :: "args => 'a list" (\(\indent=1 notation=\mixfix list enumeration\\[_])\) translations "[x, xs]" == "x#[xs]" "[x]" == "x#[]" diff -r 28ef01901650 -r 92768949a923 src/HOL/Quotient_Examples/Lift_FSet.thy --- a/src/HOL/Quotient_Examples/Lift_FSet.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Quotient_Examples/Lift_FSet.thy Thu Oct 03 13:01:31 2024 +0200 @@ -96,9 +96,7 @@ end syntax - "_fset" :: "args => 'a fset" (\{|(\notation=\mixfix finite set enumeration\\_)|}\) -syntax_consts - fcons + "_fset" :: "args => 'a fset" (\(\indent=2 notation=\mixfix finite set enumeration\\{|_|})\) translations "{|x, xs|}" == "CONST fcons x {|xs|}" "{|x|}" == "CONST fcons x {||}" diff -r 28ef01901650 -r 92768949a923 src/HOL/Quotient_Examples/Quotient_FSet.thy --- a/src/HOL/Quotient_Examples/Quotient_FSet.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Quotient_Examples/Quotient_FSet.thy Thu Oct 03 13:01:31 2024 +0200 @@ -289,9 +289,7 @@ is "Cons" by auto syntax - "_fset" :: "args => 'a fset" (\{|(\notation=\mixfix finite set enumeration\\_)|}\) -syntax_consts - insert_fset + "_fset" :: "args => 'a fset" (\(\indent=2 notation=\mixfix finite set enumeration\\{|_|})\) translations "{|x, xs|}" == "CONST insert_fset x {|xs|}" "{|x|}" == "CONST insert_fset x {||}" diff -r 28ef01901650 -r 92768949a923 src/HOL/Real_Asymp/Multiseries_Expansion.thy --- a/src/HOL/Real_Asymp/Multiseries_Expansion.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Real_Asymp/Multiseries_Expansion.thy Thu Oct 03 13:01:31 2024 +0200 @@ -1716,7 +1716,7 @@ shows "f \[at_top] eval_monom (dominant_term_ms_aux xs) basis" (is ?thesis1) and "eventually (\x. sgn (f x) = sgn (fst (dominant_term_ms_aux xs))) at_top" (is ?thesis2) proof - - include asymp_equiv_notation + include asymp_equiv_syntax from xs(2,1) obtain xs' C b e basis' where xs': "trimmed C" "xs = MSLCons (C, e) xs'" "basis = b # basis'" "is_expansion_aux xs' (\x. f x - eval C x * b x powr e) (b # basis')" diff -r 28ef01901650 -r 92768949a923 src/HOL/Real_Asymp/Real_Asymp_Examples.thy --- a/src/HOL/Real_Asymp/Real_Asymp_Examples.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Real_Asymp/Real_Asymp_Examples.thy Thu Oct 03 13:01:31 2024 +0200 @@ -4,7 +4,7 @@ begin context - includes asymp_equiv_notation + includes asymp_equiv_syntax begin subsection \Dominik Gruntz's examples\ diff -r 28ef01901650 -r 92768949a923 src/HOL/SET_Protocol/Message_SET.thy --- a/src/HOL/SET_Protocol/Message_SET.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/SET_Protocol/Message_SET.thy Thu Oct 03 13:01:31 2024 +0200 @@ -70,8 +70,6 @@ (*Concrete syntax: messages appear as \\A,B,NA\\, etc...*) syntax "_MTuple" :: "['a, args] \ 'a * 'b" (\(\indent=2 notation=\mixfix message tuple\\\_,/ _\)\) -syntax_consts - MPair translations "\x, y, z\" \ "\x, \y, z\\" "\x, y\" \ "CONST MPair x y" diff -r 28ef01901650 -r 92768949a923 src/HOL/Set.thy --- a/src/HOL/Set.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Set.thy Thu Oct 03 13:01:31 2024 +0200 @@ -39,18 +39,14 @@ text \Set comprehensions\ syntax - "_Coll" :: "pttrn \ bool \ 'a set" (\(\indent=1 notation=\mixfix Collect\\{_./ _})\) -syntax_consts - "_Coll" \ Collect + "_Coll" :: "pttrn \ bool \ 'a set" (\(\indent=1 notation=\mixfix set comprehension\\{_./ _})\) translations "{x. P}" \ "CONST Collect (\x. P)" syntax (ASCII) - "_Collect" :: "pttrn \ 'a set \ bool \ 'a set" (\(\indent=1 notation=\mixfix Collect\\{(_/: _)./ _})\) + "_Collect" :: "pttrn \ 'a set \ bool \ 'a set" (\(\indent=1 notation=\mixfix set comprehension\\{(_/: _)./ _})\) syntax - "_Collect" :: "pttrn \ 'a set \ bool \ 'a set" (\(\indent=1 notation=\mixfix Collect\\{(_/ \ _)./ _})\) -syntax_consts - "_Collect" \ Collect + "_Collect" :: "pttrn \ 'a set \ bool \ 'a set" (\(\indent=1 notation=\mixfix set comprehension\\{(_/ \ _)./ _})\) translations "{p:A. P}" \ "CONST Collect (\p. p \ A \ P)" @@ -144,9 +140,7 @@ where insert_compr: "insert a B = {x. x = a \ x \ B}" syntax - "_Finset" :: "args \ 'a set" (\{(\notation=\mixfix set enumeration\\_)}\) -syntax_consts - insert + "_Finset" :: "args \ 'a set" (\(\indent=1 notation=\mixfix set enumeration\\{_})\) translations "{x, xs}" \ "CONST insert x {xs}" "{x}" \ "CONST insert x {}" diff -r 28ef01901650 -r 92768949a923 src/HOL/Tools/Lifting/lifting_setup.ML --- a/src/HOL/Tools/Lifting/lifting_setup.ML Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Tools/Lifting/lifting_setup.ML Thu Oct 03 13:01:31 2024 +0200 @@ -245,7 +245,7 @@ lthy |> Local_Theory.declaration {syntax = false, pervasive = true, pos = \<^here>} (fn phi => Lifting_Info.init_restore_data bundle_name (phi_qinfo phi)) - |> Bundle.bundle ((binding, [restore_lifting_att])) [] + |> Bundle.bundle {open_bundle = false} ((binding, [restore_lifting_att])) [] |> pair binding end diff -r 28ef01901650 -r 92768949a923 src/HOL/Transfer.thy --- a/src/HOL/Transfer.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Transfer.thy Thu Oct 03 13:01:31 2024 +0200 @@ -13,8 +13,8 @@ bundle lifting_syntax begin - notation rel_fun (infixr \===>\ 55) - notation map_fun (infixr \--->\ 55) +notation rel_fun (infixr \===>\ 55) +notation map_fun (infixr \--->\ 55) end context includes lifting_syntax diff -r 28ef01901650 -r 92768949a923 src/HOL/Transitive_Closure.thy --- a/src/HOL/Transitive_Closure.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/Transitive_Closure.thy Thu Oct 03 13:01:31 2024 +0200 @@ -64,6 +64,36 @@ tranclp (\(\notation=\postfix ++\\_^++)\ [1000] 1000) and reflclp (\(\notation=\postfix ==\\_^==)\ [1000] 1000) +bundle no_rtrancl_syntax +begin +no_notation + rtrancl (\(\notation=\postfix *\\_\<^sup>*)\ [1000] 999) and + rtranclp (\(\notation=\postfix **\\_\<^sup>*\<^sup>*)\ [1000] 1000) +no_notation (ASCII) + rtrancl (\(\notation=\postfix *\\_^*)\ [1000] 999) and + rtranclp (\(\notation=\postfix **\\_^**)\ [1000] 1000) +end + +bundle no_trancl_syntax +begin +no_notation + trancl (\(\notation=\postfix +\\_\<^sup>+)\ [1000] 999) and + tranclp (\(\notation=\postfix ++\\_\<^sup>+\<^sup>+)\ [1000] 1000) +no_notation (ASCII) + trancl (\(\notation=\postfix +\\_^+)\ [1000] 999) and + tranclp (\(\notation=\postfix ++\\_^++)\ [1000] 1000) +end + +bundle no_reflcl_syntax +begin +no_notation + reflcl (\(\notation=\postfix =\\_\<^sup>=)\ [1000] 999) and + reflclp (\(\notation=\postfix ==\\_\<^sup>=\<^sup>=)\ [1000] 1000) +no_notation (ASCII) + reflcl (\(\notation=\postfix =\\_^=)\ [1000] 999) and + reflclp (\(\notation=\postfix ==\\_^==)\ [1000] 1000) +end + subsection \Reflexive closure\ diff -r 28ef01901650 -r 92768949a923 src/HOL/ex/Code_Lazy_Demo.thy --- a/src/HOL/ex/Code_Lazy_Demo.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/HOL/ex/Code_Lazy_Demo.thy Thu Oct 03 13:01:31 2024 +0200 @@ -40,9 +40,7 @@ | LCons (lhd: 'a) (ltl: "'a llist") (infixr \###\ 65) syntax - "_llist" :: "args => 'a list" (\\<^bold>\(\notation=\mixfix lazy list enumeration\\_)\<^bold>\\) -syntax_consts - LCons + "_llist" :: "args => 'a list" (\(\indent=1 notation=\mixfix lazy list enumeration\\\<^bold>\_\<^bold>\)\) translations "\<^bold>\x, xs\<^bold>\" == "x###\<^bold>\xs\<^bold>\" "\<^bold>\x\<^bold>\" == "x###\<^bold>\\<^bold>\" diff -r 28ef01901650 -r 92768949a923 src/Pure/Isar/bundle.ML --- a/src/Pure/Isar/bundle.ML Wed Oct 02 18:32:36 2024 +0200 +++ b/src/Pure/Isar/bundle.ML Thu Oct 03 13:01:31 2024 +0200 @@ -13,11 +13,6 @@ val read: Proof.context -> xstring * Position.T -> Attrib.thms val extern: Proof.context -> string -> xstring val print_bundles: bool -> Proof.context -> unit - val bundle: binding * Attrib.thms -> - (binding * typ option * mixfix) list -> local_theory -> local_theory - val bundle_cmd: binding * (Facts.ref * Token.src list) list -> - (binding * string option * mixfix) list -> local_theory -> local_theory - val init: binding -> theory -> local_theory val unbundle: name list -> local_theory -> local_theory val unbundle_cmd: (xstring * Position.T) list -> local_theory -> local_theory val includes: name list -> Proof.context -> Proof.context @@ -26,6 +21,11 @@ val include_cmd: (xstring * Position.T) list -> Proof.state -> Proof.state val including: name list -> Proof.state -> Proof.state val including_cmd: (xstring * Position.T) list -> Proof.state -> Proof.state + val bundle: {open_bundle: bool} -> binding * Attrib.thms -> + (binding * typ option * mixfix) list -> local_theory -> local_theory + val bundle_cmd: {open_bundle: bool} -> binding * (Facts.ref * Token.src list) list -> + (binding * string option * mixfix) list -> local_theory -> local_theory + val init: {open_bundle: bool} -> binding -> theory -> local_theory end; structure Bundle: BUNDLE = @@ -53,6 +53,7 @@ fun check ctxt = #1 o Name_Space.check (Context.Proof ctxt) (get_all ctxt); +val get_global = Name_Space.get o get_all_generic o Context.Theory; val get = Name_Space.get o get_all_generic o Context.Proof; fun read ctxt = get ctxt o check ctxt; @@ -60,6 +61,19 @@ fun extern ctxt = Name_Space.extern ctxt (Name_Space.space_of_table (get_all ctxt)); +(* context and morphisms *) + +val trim_context_bundle = + map (fn (fact, atts) => (map Thm.trim_context fact, (map o map) Token.trim_context atts)); + +fun transfer_bundle thy = + map (fn (fact, atts) => (map (Thm.transfer thy) fact, (map o map) (Token.transfer thy) atts)); + +fun transform_bundle phi = + map (fn (fact, atts) => (Morphism.fact phi fact, (map o map) (Token.transform phi) atts)); + + + (* target -- bundle under construction *) fun the_target thy = @@ -93,18 +107,51 @@ -(** define bundle **) +(** open bundles **) + +fun apply_bundle loc bundle ctxt = + let val notes = if loc then Local_Theory.notes else Attrib.local_notes "" in + ctxt + |> Context_Position.set_visible false + |> notes [(Binding.empty_atts, bundle)] |> snd + |> Context_Position.restore_visible ctxt + end; -(* context and morphisms *) +local + +fun gen_unbundle loc prep args ctxt = + let + val thy = Proof_Context.theory_of ctxt; + val bundle = maps (prep ctxt) args |> transfer_bundle thy; + in apply_bundle loc bundle ctxt end; + +fun gen_includes prep = gen_unbundle false prep; + +fun gen_include prep bs = + Proof.assert_forward #> Proof.map_context (gen_includes prep bs) #> Proof.reset_facts; -val trim_context_bundle = - map (fn (fact, atts) => (map Thm.trim_context fact, (map o map) Token.trim_context atts)); +fun gen_including prep bs = + Proof.assert_backward #> Proof.map_context (gen_includes prep bs); + +in + +val unbundle = gen_unbundle true get; +val unbundle_cmd = gen_unbundle true read; + +val includes = gen_includes get; +val includes_cmd = gen_includes read; -fun transfer_bundle thy = - map (fn (fact, atts) => (map (Thm.transfer thy) fact, (map o map) (Token.transfer thy) atts)); +val include_ = gen_include get; +val include_cmd = gen_include read; + +val including = gen_including get; +val including_cmd = gen_including read; -fun transform_bundle phi = - map (fn (fact, atts) => (Morphism.fact phi fact, (map o map) (Token.transform phi) atts)); +end; + + + +(** define bundle **) fun define_bundle (b, bundle) context = let @@ -118,7 +165,7 @@ local -fun gen_bundle prep_fact prep_att add_fixes (binding, raw_bundle) raw_fixes lthy = +fun gen_bundle prep_fact prep_att add_fixes {open_bundle} (binding, raw_bundle) raw_fixes lthy = let val (_, ctxt') = add_fixes raw_fixes lthy; val bundle0 = raw_bundle @@ -133,6 +180,7 @@ (fn phi => fn context => let val psi = Morphism.set_trim_context'' context phi in #2 (define_bundle (Morphism.binding psi binding, transform_bundle psi bundle) context) end) + |> open_bundle ? apply_bundle true bundle end; in @@ -149,22 +197,29 @@ fun bad_operation _ = error "Not possible in bundle target"; -fun conclude invisible binding = +fun conclude {open_bundle, invisible} binding = Local_Theory.background_theory_result (fn thy => - thy - |> invisible ? Context_Position.set_visible_global false - |> Context.Theory - |> define_bundle (binding, the_target thy) - ||> (Context.the_theory - #> invisible ? Context_Position.restore_visible_global thy - #> reset_target)); + let + val (name, thy') = thy + |> invisible ? Context_Position.set_visible_global false + |> Context.Theory + |> define_bundle (binding, the_target thy) + ||> Context.the_theory; + val bundle = get_global thy' name; + val thy'' = thy' + |> open_bundle ? + (Context_Position.set_visible_global false #> + Attrib.global_notes "" [(Binding.empty_atts, bundle)] #> snd) + |> Context_Position.restore_visible_global thy + |> reset_target; + in (name, thy'') end); fun pretty binding lthy = let val bundle = the_target (Proof_Context.theory_of lthy); val (name, lthy') = lthy |> Local_Theory.raw_theory (Context_Position.set_visible_global false) - |> conclude true binding; + |> conclude {open_bundle = false, invisible = true} binding; val thy_ctxt' = Proof_Context.init_global (Proof_Context.theory_of lthy'); val markup_name = Name_Space.markup_extern thy_ctxt' (Name_Space.space_of_table (get_all thy_ctxt')) name; @@ -189,12 +244,12 @@ in -fun init binding thy = +fun init {open_bundle} binding thy = thy |> Local_Theory.init {background_naming = Sign.naming_of thy, setup = set_target [] #> Proof_Context.init_global, - conclude = conclude false binding #> #2} + conclude = conclude {open_bundle = open_bundle, invisible = false} binding #> #2} {define = bad_operation, notes = bundle_notes, abbrev = bad_operation, @@ -205,47 +260,4 @@ end; - - -(** activate bundles **) - -local - -fun gen_activate notes prep_bundle args ctxt = - let - val thy = Proof_Context.theory_of ctxt; - val decls = maps (prep_bundle ctxt) args |> transfer_bundle thy; - in - ctxt - |> Context_Position.set_visible false - |> notes [(Binding.empty_atts, decls)] |> #2 - |> Context_Position.restore_visible ctxt - end; - -fun gen_unbundle prep_bundle = gen_activate Local_Theory.notes prep_bundle; - -fun gen_includes prep_bundle = gen_activate (Attrib.local_notes "") prep_bundle; - -fun gen_include prep_bundle bs = - Proof.assert_forward #> Proof.map_context (gen_includes prep_bundle bs) #> Proof.reset_facts; - -fun gen_including prep_bundle bs = - Proof.assert_backward #> Proof.map_context (gen_includes prep_bundle bs) - -in - -val unbundle = gen_unbundle get; -val unbundle_cmd = gen_unbundle read; - -val includes = gen_includes get; -val includes_cmd = gen_includes read; - -val include_ = gen_include get; -val include_cmd = gen_include read; - -val including = gen_including get; -val including_cmd = gen_including read; - end; - -end; diff -r 28ef01901650 -r 92768949a923 src/Pure/Pure.thy --- a/src/Pure/Pure.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/Pure/Pure.thy Thu Oct 03 13:01:31 2024 +0200 @@ -37,7 +37,7 @@ "declaration" "syntax_declaration" "parse_ast_translation" "parse_translation" "print_translation" "typed_print_translation" "print_ast_translation" "oracle" :: thy_decl % "ML" - and "bundle" :: thy_decl_block + and "bundle" "open_bundle" :: thy_decl_block and "unbundle" :: thy_decl and "include" "including" :: prf_decl and "print_bundles" :: diag @@ -637,26 +637,34 @@ ML \ local +fun bundle_cmd open_bundle = + (Parse.binding --| \<^keyword>\=\) -- Parse.thms1 -- Parse.for_fixes + >> (uncurry (Bundle.bundle_cmd {open_bundle = open_bundle})); + +fun bundle_begin open_bundle = + Parse.binding --| Parse.begin >> Bundle.init {open_bundle = open_bundle}; + val _ = Outer_Syntax.maybe_begin_local_theory \<^command_keyword>\bundle\ - "define bundle of declarations" - ((Parse.binding --| \<^keyword>\=\) -- Parse.thms1 -- Parse.for_fixes - >> (uncurry Bundle.bundle_cmd)) - (Parse.binding --| Parse.begin >> Bundle.init); + "define bundle of declarations" (bundle_cmd false) (bundle_begin false); + +val _ = + Outer_Syntax.maybe_begin_local_theory \<^command_keyword>\open_bundle\ + "define and open bundle of declarations" (bundle_cmd true) (bundle_begin true); val _ = Outer_Syntax.local_theory \<^command_keyword>\unbundle\ - "activate declarations from bundle in local theory" + "open bundle in local theory" (Scan.repeat1 Parse.name_position >> Bundle.unbundle_cmd); val _ = Outer_Syntax.command \<^command_keyword>\include\ - "activate declarations from bundle in proof body" + "open bundle in proof body" (Scan.repeat1 Parse.name_position >> (Toplevel.proof o Bundle.include_cmd)); val _ = Outer_Syntax.command \<^command_keyword>\including\ - "activate declarations from bundle in goal refinement" + "open bundle in goal refinement" (Scan.repeat1 Parse.name_position >> (Toplevel.proof o Bundle.including_cmd)); val _ = diff -r 28ef01901650 -r 92768949a923 src/ZF/Induct/Multiset.thy --- a/src/ZF/Induct/Multiset.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/ZF/Induct/Multiset.thy Thu Oct 03 13:01:31 2024 +0200 @@ -75,8 +75,6 @@ syntax "_MColl" :: "[pttrn, i, o] \ i" (\(\indent=1 notation=\mixfix multiset comprehension\\{# _ \ _./ _#})\) -syntax_consts - MCollect translations "{#x \ M. P#}" == "CONST MCollect(M, \x. P)" diff -r 28ef01901650 -r 92768949a923 src/ZF/List.thy --- a/src/ZF/List.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/ZF/List.thy Thu Oct 03 13:01:31 2024 +0200 @@ -16,9 +16,7 @@ notation Nil (\[]\) syntax - "_List" :: "is \ i" (\[(\notation=\mixfix list enumeration\\_)]\) -syntax_consts - Cons + "_List" :: "is \ i" (\(\indent=1 notation=\mixfix list enumeration\\[_])\) translations "[x, xs]" == "CONST Cons(x, [xs])" "[x]" == "CONST Cons(x, [])" diff -r 28ef01901650 -r 92768949a923 src/ZF/ZF_Base.thy --- a/src/ZF/ZF_Base.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/ZF/ZF_Base.thy Thu Oct 03 13:01:31 2024 +0200 @@ -56,8 +56,6 @@ syntax "_Replace" :: "[pttrn, pttrn, i, o] \ i" (\(\indent=1 notation=\mixfix relational replacement\\{_ ./ _ \ _, _})\) -syntax_consts - Replace translations "{y. x\A, Q}" \ "CONST Replace(A, \x y. Q)" @@ -69,8 +67,6 @@ syntax "_RepFun" :: "[i, pttrn, i] \ i" (\(\indent=1 notation=\mixfix functional replacement\\{_ ./ _ \ _})\ [51,0,51]) -syntax_consts - RepFun translations "{b. x\A}" \ "CONST RepFun(A, \x. b)" @@ -81,8 +77,6 @@ syntax "_Collect" :: "[pttrn, i, o] \ i" (\(\indent=1 notation=\mixfix set comprehension\\{_ \ _ ./ _})\) -syntax_consts - Collect translations "{x\A. P}" \ "CONST Collect(A, \x. P)" @@ -133,9 +127,7 @@ syntax "" :: "i \ is" (\_\) "_Enum" :: "[i, is] \ is" (\_,/ _\) - "_Finset" :: "is \ i" (\{(\notation=\mixfix set enumeration\\_)}\) -syntax_consts - cons + "_Finset" :: "is \ i" (\(\indent=1 notation=\mixfix set enumeration\\{_})\) translations "{x, xs}" == "CONST cons(x, {xs})" "{x}" == "CONST cons(x, 0)" @@ -196,9 +188,7 @@ syntax "" :: "i \ tuple_args" (\_\) "_Tuple_args" :: "[i, tuple_args] \ tuple_args" (\_,/ _\) - "_Tuple" :: "[i, tuple_args] \ i" (\\(\notation=\mixfix tuple enumeration\\_,/ _)\\) -syntax_consts - Pair + "_Tuple" :: "[i, tuple_args] \ i" (\(\indent=1 notation=\mixfix tuple enumeration\\\_,/ _\)\) translations "\x, y, z\" == "\x, \y, z\\" "\x, y\" == "CONST Pair(x, y)" diff -r 28ef01901650 -r 92768949a923 src/ZF/func.thy --- a/src/ZF/func.thy Wed Oct 02 18:32:36 2024 +0200 +++ b/src/ZF/func.thy Thu Oct 03 13:01:31 2024 +0200 @@ -452,8 +452,6 @@ "" :: "updbind \ updbinds" (\_\) "_updbinds" :: "[updbind, updbinds] \ updbinds" (\_,/ _\) "_Update" :: "[i, updbinds] \ i" (\_/'((_)')\ [900,0] 900) -syntax_consts - update translations "_Update (f, _updbinds(b,bs))" == "_Update (_Update(f,b), bs)" "f(x:=y)" == "CONST update(f,x,y)"