# HG changeset patch # User wenzelm # Date 1724590939 -7200 # Node ID be8c0e039a5ed82d88998bb2d77ae3d78ce99582 # Parent 4641f0fdaa59585aadd63778a180eed4a31da0c1 more markup for syntax consts; diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/BNF_Cardinal_Arithmetic.thy --- a/src/HOL/BNF_Cardinal_Arithmetic.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/BNF_Cardinal_Arithmetic.thy Sun Aug 25 15:02:19 2024 +0200 @@ -275,6 +275,9 @@ "pttrn => ('a * 'a) set => 'b * 'b set => (('a * 'b) * ('a * 'b)) set" ("(3CSUM _:_. _)" [0, 51, 10] 10) +syntax_consts + "_Csum" == Csum + translations "CSUM i:r. rs" == "CONST Csum r (%i. rs)" diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/Complete_Lattices.thy --- a/src/HOL/Complete_Lattices.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/Complete_Lattices.thy Sun Aug 25 15:02:19 2024 +0200 @@ -32,6 +32,10 @@ "_SUP1" :: "pttrns \ 'b \ 'b" ("(3\_./ _)" [0, 10] 10) "_SUP" :: "pttrn \ 'a set \ 'b \ 'b" ("(3\_\_./ _)" [0, 0, 10] 10) +syntax_consts + "_INF1" "_INF" \ Inf and + "_SUP1" "_SUP" \ Sup + translations "\x y. f" \ "\x. \y. f" "\x. f" \ "\(CONST range (\x. f))" @@ -850,6 +854,9 @@ "_INTER1" :: "pttrns \ 'b set \ 'b set" ("(3\(\unbreakable\\<^bsub>_\<^esub>)/ _)" [0, 10] 10) "_INTER" :: "pttrn \ 'a set \ 'b set \ 'b set" ("(3\(\unbreakable\\<^bsub>_\_\<^esub>)/ _)" [0, 0, 10] 10) +syntax_consts + "_INTER1" "_INTER" \ Inter + translations "\x y. f" \ "\x. \y. f" "\x. f" \ "\(CONST range (\x. f))" @@ -1013,6 +1020,9 @@ "_UNION1" :: "pttrns => 'b set => 'b set" ("(3\(\unbreakable\\<^bsub>_\<^esub>)/ _)" [0, 10] 10) "_UNION" :: "pttrn => 'a set => 'b set => 'b set" ("(3\(\unbreakable\\<^bsub>_\_\<^esub>)/ _)" [0, 0, 10] 10) +syntax_consts + "_UNION1" "_UNION" \ Union + translations "\x y. f" \ "\x. \y. f" "\x. f" \ "\(CONST range (\x. f))" diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/Filter.thy --- a/src/HOL/Filter.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/Filter.thy Sun Aug 25 15:02:19 2024 +0200 @@ -41,6 +41,8 @@ syntax "_eventually" :: "pttrn => 'a filter => bool => bool" ("(3\\<^sub>F _ in _./ _)" [0, 0, 10] 10) +syntax_consts + "_eventually" == eventually translations "\\<^sub>Fx in F. P" == "CONST eventually (\x. P) F" @@ -159,6 +161,8 @@ syntax "_frequently" :: "pttrn \ 'a filter \ bool \ bool" ("(3\\<^sub>F _ in _./ _)" [0, 0, 10] 10) +syntax_consts + "_frequently" == frequently translations "\\<^sub>Fx in F. P" == "CONST frequently (\x. P) F" @@ -1305,6 +1309,9 @@ syntax "_LIM" :: "pttrns \ 'a \ 'b \ 'a \ bool" ("(3LIM (_)/ (_)./ (_) :> (_))" [1000, 10, 0, 10] 10) +syntax_consts + "_LIM" == filterlim + translations "LIM x F1. f :> F2" == "CONST filterlim (\x. f) F2 F1" diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/Fun.thy --- a/src/HOL/Fun.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/Fun.thy Sun Aug 25 15:02:19 2024 +0200 @@ -846,6 +846,9 @@ "_updbinds":: "updbind \ updbinds \ updbinds" ("_,/ _") "_Update" :: "'a \ updbinds \ 'a" ("_/'((_)')" [1000, 0] 900) +syntax_consts + "_updbind" "_updbinds" "_Update" \ fun_upd + translations "_Update f (_updbinds b bs)" \ "_Update (_Update f b) bs" "f(x:=y)" \ "CONST fun_upd f x y" diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/GCD.thy --- a/src/HOL/GCD.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/GCD.thy Sun Aug 25 15:02:19 2024 +0200 @@ -153,6 +153,10 @@ "_LCM1" :: "pttrns \ 'b \ 'b" ("(3LCM _./ _)" [0, 10] 10) "_LCM" :: "pttrn \ 'a set \ 'b \ 'b" ("(3LCM _\_./ _)" [0, 0, 10] 10) +syntax_consts + "_GCD1" "_GCD" \ Gcd and + "_LCM1" "_LCM" \ Lcm + translations "GCD x y. f" \ "GCD x. GCD y. f" "GCD x. f" \ "CONST Gcd (CONST range (\x. f))" @@ -2933,6 +2937,8 @@ syntax "_type_char" :: "type => nat" ("(1CHAR/(1'(_')))") +syntax_consts "_type_char" == semiring_char + translations "CHAR('t)" => "CONST semiring_char (CONST Pure.type :: 't itself)" print_translation \ diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/Groups_Big.thy --- a/src/HOL/Groups_Big.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/Groups_Big.thy Sun Aug 25 15:02:19 2024 +0200 @@ -654,6 +654,8 @@ "_sum" :: "pttrn \ 'a set \ 'b \ 'b::comm_monoid_add" ("(3SUM (_/:_)./ _)" [0, 51, 10] 10) syntax "_sum" :: "pttrn \ 'a set \ 'b \ 'b::comm_monoid_add" ("(2\(_/\_)./ _)" [0, 51, 10] 10) +syntax_consts + "_sum" \ sum translations \ \Beware of argument permutation!\ "\i\A. b" \ "CONST sum (\i. b) A" @@ -663,6 +665,9 @@ "_qsum" :: "pttrn \ bool \ 'a \ 'a" ("(3SUM _ |/ _./ _)" [0, 0, 10] 10) syntax "_qsum" :: "pttrn \ bool \ 'a \ 'a" ("(2\_ | (_)./ _)" [0, 0, 10] 10) +syntax_consts + "_qsum" == sum + translations "\x|P. t" => "CONST sum (\x. t) {x. P}" @@ -1415,6 +1420,8 @@ "_prod" :: "pttrn => 'a set => 'b => 'b::comm_monoid_mult" ("(4PROD (_/:_)./ _)" [0, 51, 10] 10) syntax "_prod" :: "pttrn => 'a set => 'b => 'b::comm_monoid_mult" ("(2\(_/\_)./ _)" [0, 51, 10] 10) +syntax_consts + "_prod" == prod translations \ \Beware of argument permutation!\ "\i\A. b" == "CONST prod (\i. b) A" @@ -1424,6 +1431,8 @@ "_qprod" :: "pttrn \ bool \ 'a \ 'a" ("(4PROD _ |/ _./ _)" [0, 0, 10] 10) syntax "_qprod" :: "pttrn \ bool \ 'a \ 'a" ("(2\_ | (_)./ _)" [0, 0, 10] 10) +syntax_consts + "_qprod" == prod translations "\x|P. t" => "CONST prod (\x. t) {x. P}" diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/Groups_List.thy --- a/src/HOL/Groups_List.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/Groups_List.thy Sun Aug 25 15:02:19 2024 +0200 @@ -101,6 +101,8 @@ "_sum_list" :: "pttrn => 'a list => 'b => 'b" ("(3SUM _<-_. _)" [0, 51, 10] 10) syntax "_sum_list" :: "pttrn => 'a list => 'b => 'b" ("(3\_\_. _)" [0, 51, 10] 10) +syntax_consts + "_sum_list" == sum_list translations \ \Beware of argument permutation!\ "\x\xs. b" == "CONST sum_list (CONST map (\x. b) xs)" @@ -598,6 +600,8 @@ "_prod_list" :: "pttrn => 'a list => 'b => 'b" ("(3PROD _<-_. _)" [0, 51, 10] 10) syntax "_prod_list" :: "pttrn => 'a list => 'b => 'b" ("(3\_\_. _)" [0, 51, 10] 10) +syntax_consts + "_prod_list" \ prod_list translations \ \Beware of argument permutation!\ "\x\xs. b" \ "CONST prod_list (CONST map (\x. b) xs)" diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/HOL.thy --- a/src/HOL/HOL.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/HOL.thy Sun Aug 25 15:02:19 2024 +0200 @@ -129,6 +129,9 @@ syntax (ASCII) "_Uniq" :: "pttrn \ bool \ bool" ("(4?< _./ _)" [0, 10] 10) syntax "_Uniq" :: "pttrn \ bool \ bool" ("(2\\<^sub>\\<^sub>1 _./ _)" [0, 10] 10) + +syntax_consts "_Uniq" \ Uniq + translations "\\<^sub>\\<^sub>1x. P" \ "CONST Uniq (\x. P)" print_translation \ @@ -141,6 +144,9 @@ syntax (input) "_Ex1" :: "pttrn \ bool \ bool" ("(3?! _./ _)" [0, 10] 10) syntax "_Ex1" :: "pttrn \ bool \ bool" ("(3\!_./ _)" [0, 10] 10) + +syntax_consts "_Ex1" \ Ex1 + translations "\!x. P" \ "CONST Ex1 (\x. P)" print_translation \ @@ -151,6 +157,9 @@ syntax "_Not_Ex" :: "idts \ bool \ bool" ("(3\_./ _)" [0, 10] 10) "_Not_Ex1" :: "pttrn \ bool \ bool" ("(3\!_./ _)" [0, 10] 10) +syntax_consts + "_Not_Ex" \ Ex and + "_Not_Ex1" \ Ex1 translations "\x. P" \ "\ (\x. P)" "\!x. P" \ "\ (\!x. P)" @@ -171,6 +180,7 @@ where "A \ B \ A = B" syntax "_The" :: "[pttrn, bool] \ 'a" ("(3THE _./ _)" [0, 10] 10) +syntax_consts "_The" \ The translations "THE x. P" \ "CONST The (\x. P)" print_translation \ [(\<^const_syntax>\The\, fn _ => fn [Abs abs] => @@ -227,6 +237,8 @@ definition Let :: "'a \ ('a \ 'b) \ 'b" where "Let s f \ f s" +syntax_consts + "_bind" "_binds" "_Let" \ Let translations "_Let (_binds b bs) e" \ "_Let b (_Let bs e)" "let x = a in e" \ "CONST Let a (\x. e)" diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/Hilbert_Choice.thy --- a/src/HOL/Hilbert_Choice.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/Hilbert_Choice.thy Sun Aug 25 15:02:19 2024 +0200 @@ -22,6 +22,9 @@ "_Eps" :: "pttrn \ bool \ 'a" ("(3@ _./ _)" [0, 10] 10) syntax "_Eps" :: "pttrn \ bool \ 'a" ("(3SOME _./ _)" [0, 10] 10) + +syntax_consts "_Eps" \ Eps + translations "SOME x. P" \ "CONST Eps (\x. P)" diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/Lattices_Big.thy --- a/src/HOL/Lattices_Big.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/Lattices_Big.thy Sun Aug 25 15:02:19 2024 +0200 @@ -470,6 +470,10 @@ "_MAX1" :: "pttrns \ 'b \ 'b" ("(3MAX _./ _)" [0, 10] 10) "_MAX" :: "pttrn \ 'a set \ 'b \ 'b" ("(3MAX _\_./ _)" [0, 0, 10] 10) +syntax_consts + "_MIN1" "_MIN" \ Min and + "_MAX1" "_MAX" \ Max + translations "MIN x y. f" \ "MIN x. MIN y. f" "MIN x. f" \ "CONST Min (CONST range (\x. f))" @@ -478,6 +482,7 @@ "MAX x. f" \ "CONST Max (CONST range (\x. f))" "MAX x\A. f" \ "CONST Max ((\x. f) ` A)" + text \An aside: \<^const>\Min\/\<^const>\Max\ on linear orders as special case of \<^const>\Inf_fin\/\<^const>\Sup_fin\\ lemma Inf_fin_Min: @@ -919,6 +924,8 @@ syntax "_arg_min" :: "('b \ 'a) \ pttrn \ bool \ 'b" ("(3ARG'_MIN _ _./ _)" [1000, 0, 10] 10) +syntax_consts + "_arg_min" \ arg_min translations "ARG_MIN f x. P" \ "CONST arg_min f (\x. P)" @@ -1036,6 +1043,8 @@ syntax "_arg_max" :: "('b \ 'a) \ pttrn \ bool \ 'a" ("(3ARG'_MAX _ _./ _)" [1000, 0, 10] 10) +syntax_consts + "_arg_max" \ arg_max translations "ARG_MAX f x. P" \ "CONST arg_max f (\x. P)" diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/List.thy --- a/src/HOL/List.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/List.thy Sun Aug 25 15:02:19 2024 +0200 @@ -46,6 +46,9 @@ \ \list Enumeration\ "_list" :: "args => 'a list" ("[(_)]") +syntax_consts + "_list" == Cons + translations "[x, xs]" == "x#[xs]" "[x]" == "x#[]" @@ -83,6 +86,8 @@ "_filter" :: "[pttrn, 'a list, bool] => 'a list" ("(1[_<-_./ _])") syntax "_filter" :: "[pttrn, 'a list, bool] => 'a list" ("(1[_\_ ./ _])") +syntax_consts + "_filter" \ filter translations "[x<-xs . P]" \ "CONST filter (\x. P) xs" @@ -132,6 +137,9 @@ "_lupdbinds" :: "[lupdbind, lupdbinds] => lupdbinds" ("_,/ _") "_LUpdate" :: "['a, lupdbinds] => 'a" ("_/[(_)]" [1000,0] 900) +syntax_consts + "_lupdbind" "_lupdbinds" "_LUpdate" == list_update + translations "_LUpdate xs (_lupdbinds b bs)" == "_LUpdate (_LUpdate xs b) bs" "xs[i:=x]" == "CONST list_update xs i x" diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/Map.thy --- a/src/HOL/Map.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/Map.thy Sun Aug 25 15:02:19 2024 +0200 @@ -67,6 +67,9 @@ syntax (ASCII) "_maplet" :: "['a, 'a] \ maplet" ("_ /|->/ _") +syntax_consts + "_maplet" "_Maplets" "_Map" \ fun_upd + translations "_Update f (_maplet x y)" \ "f(x := CONST Some y)" "_Maplets m ms" \ "_updbinds m ms" @@ -76,6 +79,7 @@ "_Map (_maplet x y)" \ "_Update (\u. CONST None) (_maplet x y)" "_Map (_updbinds m (_maplet x y))" \ "_Update (_Map m) (_maplet x y)" + text \Updating with lists:\ primrec map_of :: "('a \ 'b) list \ 'a \ 'b" where @@ -98,6 +102,9 @@ syntax (ASCII) "_maplets" :: "['a, 'a] \ maplet" ("_ /[|->]/ _") +syntax_consts + "_maplets" \ map_upds + translations "_Update m (_maplets xs ys)" \ "CONST map_upds m xs ys" diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/Orderings.thy --- a/src/HOL/Orderings.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/Orderings.thy Sun Aug 25 15:02:19 2024 +0200 @@ -745,6 +745,10 @@ "_All_neq" :: "[idt, 'a, bool] => bool" ("(3! _~=_./ _)" [0, 0, 10] 10) "_Ex_neq" :: "[idt, 'a, bool] => bool" ("(3? _~=_./ _)" [0, 0, 10] 10) +syntax_consts + "_All_less" "_All_less_eq" "_All_greater" "_All_greater_eq" "_All_neq" \ All and + "_Ex_less" "_Ex_less_eq" "_Ex_greater" "_Ex_greater_eq" "_Ex_neq" \ Ex + translations "\x "\x. x < y \ P" "\x "\x. x < y \ P" diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/Product_Type.thy --- a/src/HOL/Product_Type.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/Product_Type.thy Sun Aug 25 15:02:19 2024 +0200 @@ -293,6 +293,10 @@ "" :: "pttrn \ patterns" ("_") "_patterns" :: "pttrn \ patterns \ patterns" ("_,/ _") "_unit" :: pttrn ("'(')") +syntax_consts + "_tuple" "_tuple_arg" "_tuple_args" \ Pair and + "_pattern" "_patterns" \ case_prod and + "_unit" \ case_unit translations "(x, y)" \ "CONST Pair x y" "_pattern x y" \ "CONST Pair x y" @@ -1010,6 +1014,8 @@ syntax "_Sigma" :: "pttrn \ 'a set \ 'b set \ ('a \ 'b) set" ("(3SIGMA _:_./ _)" [0, 0, 10] 10) +syntax_consts + "_Sigma" \ Sigma translations "SIGMA x:A. B" \ "CONST Sigma A (\x. B)" diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/Set.thy --- a/src/HOL/Set.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/Set.thy Sun Aug 25 15:02:19 2024 +0200 @@ -40,6 +40,8 @@ syntax "_Coll" :: "pttrn \ bool \ 'a set" ("(1{_./ _})") +syntax_consts + "_Coll" \ Collect translations "{x. P}" \ "CONST Collect (\x. P)" @@ -47,6 +49,8 @@ "_Collect" :: "pttrn \ 'a set \ bool \ 'a set" ("(1{(_/: _)./ _})") syntax "_Collect" :: "pttrn \ 'a set \ bool \ 'a set" ("(1{(_/ \ _)./ _})") +syntax_consts + "_Collect" \ Collect translations "{p:A. P}" \ "CONST Collect (\p. p \ A \ P)" @@ -141,6 +145,8 @@ syntax "_Finset" :: "args \ 'a set" ("{(_)}") +syntax_consts + "_Finset" \ insert translations "{x, xs}" \ "CONST insert x {xs}" "{x}" \ "CONST insert x {}" @@ -203,6 +209,12 @@ "_Bex1" :: "pttrn \ 'a set \ bool \ bool" ("(3\!(_/\_)./ _)" [0, 0, 10] 10) "_Bleast" :: "id \ 'a set \ bool \ 'a" ("(3LEAST(_/\_)./ _)" [0, 0, 10] 10) +syntax_consts + "_Ball" \ Ball and + "_Bex" \ Bex and + "_Bex1" \ Ex1 and + "_Bleast" \ Least + translations "\x\A. P" \ "CONST Ball A (\x. P)" "\x\A. P" \ "CONST Bex A (\x. P)" @@ -223,6 +235,11 @@ "_setleEx" :: "[idt, 'a, bool] \ bool" ("(3\_\_./ _)" [0, 0, 10] 10) "_setleEx1" :: "[idt, 'a, bool] \ bool" ("(3\!_\_./ _)" [0, 0, 10] 10) +syntax_consts + "_setlessAll" "_setleAll" \ All and + "_setlessEx" "_setleEx" \ Ex and + "_setleEx1" \ Ex1 + translations "\A\B. P" \ "\A. A \ B \ P" "\A\B. P" \ "\A. A \ B \ P" @@ -272,6 +289,8 @@ syntax "_Setcompr" :: "'a \ idts \ bool \ 'a set" ("(1{_ |/_./ _})") +syntax_consts + "_Setcompr" \ Collect parse_translation \ let diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/Set_Interval.thy --- a/src/HOL/Set_Interval.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/Set_Interval.thy Sun Aug 25 15:02:19 2024 +0200 @@ -84,6 +84,10 @@ "_INTER_le" :: "'a => 'a => 'b set => 'b set" ("(3\_\_./ _)" [0, 0, 10] 10) "_INTER_less" :: "'a => 'a => 'b set => 'b set" ("(3\_<_./ _)" [0, 0, 10] 10) +syntax_consts + "_UNION_le" "_UNION_less" \ Union and + "_INTER_le" "_INTER_less" \ Inter + translations "\i\n. A" \ "\i\{..n}. A" "\i "\i\{.. 'a \ 'b \ 'b" ("(3\_<_./ _)" [0,0,10] 10) "_upto_sum" :: "idt \ 'a \ 'b \ 'b" ("(3\_\_./ _)" [0,0,10] 10) +syntax_consts + "_from_to_sum" "_from_upto_sum" "_upt_sum" "_upto_sum" == sum + translations "\x=a..b. t" == "CONST sum (\x. t) {a..b}" "\x=a..x. t) {a.. 'a \ 'b \ 'b" ("(3\_<_./ _)" [0,0,10] 10) "_upto_prod" :: "idt \ 'a \ 'b \ 'b" ("(3\_\_./ _)" [0,0,10] 10) +syntax_consts + "_from_to_prod" "_from_upto_prod" "_upt_prod" "_upto_prod" \ prod + translations "\x=a..b. t" \ "CONST prod (\x. t) {a..b}" "\x=a.. "CONST prod (\x. t) {a.. char" ("CHR _") "_Char_ord" :: "num_const \ char" ("CHR _") +syntax_consts + "_Char" "_Char_ord" \ Char type_synonym string = "char list" @@ -522,6 +524,8 @@ syntax "_Literal" :: "str_position \ String.literal" ("STR _") "_Ascii" :: "num_const \ String.literal" ("STR _") +syntax_consts + "_Literal" "_Ascii" \ String.Literal ML_file \Tools/literal.ML\ diff -r 4641f0fdaa59 -r be8c0e039a5e src/HOL/Typerep.thy --- a/src/HOL/Typerep.thy Sun Aug 25 12:43:43 2024 +0200 +++ b/src/HOL/Typerep.thy Sun Aug 25 15:02:19 2024 +0200 @@ -19,6 +19,8 @@ syntax "_TYPEREP" :: "type => logic" ("(1TYPEREP/(1'(_')))") +syntax_consts + "_TYPEREP" \ typerep parse_translation \ let