# HG changeset patch # User wenzelm # Date 1724591792 -7200 # Node ID 29837d4809e7a891bc0f9bd91a029d6ba0a5d39c # Parent db4ac82659f4a0855f6e92df8bd876fcd1d84e5c tuned whitespace; diff -r db4ac82659f4 -r 29837d4809e7 src/HOL/Groups_Big.thy --- a/src/HOL/Groups_Big.thy Sun Aug 25 15:11:41 2024 +0200 +++ b/src/HOL/Groups_Big.thy Sun Aug 25 15:16:32 2024 +0200 @@ -654,17 +654,21 @@ "_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" + text \Instead of \<^term>\\x\{x. P}. e\ we introduce the shorter \\x|P. e\.\ syntax (ASCII) "_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 @@ -672,19 +676,19 @@ "\x|P. t" => "CONST sum (\x. t) {x. P}" print_translation \ -let - fun sum_tr' [Abs (x, Tx, t), Const (\<^const_syntax>\Collect\, _) $ Abs (y, Ty, P)] = - if x <> y then raise Match - else - let - val x' = Syntax_Trans.mark_bound_body (x, Tx); - val t' = subst_bound (x', t); - val P' = subst_bound (x', P); - in - Syntax.const \<^syntax_const>\_qsum\ $ Syntax_Trans.mark_bound_abs (x, Tx) $ P' $ t' - end - | sum_tr' _ = raise Match; -in [(\<^const_syntax>\sum\, K sum_tr')] end + let + fun sum_tr' [Abs (x, Tx, t), Const (\<^const_syntax>\Collect\, _) $ Abs (y, Ty, P)] = + if x <> y then raise Match + else + let + val x' = Syntax_Trans.mark_bound_body (x, Tx); + val t' = subst_bound (x', t); + val P' = subst_bound (x', P); + in + Syntax.const \<^syntax_const>\_qsum\ $ Syntax_Trans.mark_bound_abs (x, Tx) $ P' $ t' + end + | sum_tr' _ = raise Match; + in [(\<^const_syntax>\sum\, K sum_tr')] end \ @@ -1420,19 +1424,24 @@ "_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" + text \Instead of \<^term>\\x\{x. P}. e\ we introduce the shorter \\x|P. e\.\ syntax (ASCII) "_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 db4ac82659f4 -r 29837d4809e7 src/HOL/Set.thy --- a/src/HOL/Set.thy Sun Aug 25 15:11:41 2024 +0200 +++ b/src/HOL/Set.thy Sun Aug 25 15:16:32 2024 +0200 @@ -241,11 +241,11 @@ "_setleEx1" \ Ex1 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" - "\!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" + "\A\B. P" \ "\A. A \ B \ P" + "\!A\B. P" \ "\!A. A \ B \ P" print_translation \ let