547 "_upto_setsum" :: "idt \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'b" ("(3\<Sum>_<_./ _)" [0,0,10] 10) |
547 "_upto_setsum" :: "idt \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'b" ("(3\<Sum>_<_./ _)" [0,0,10] 10) |
548 syntax (HTML output) |
548 syntax (HTML output) |
549 "_from_to_setsum" :: "idt \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'b" ("(3\<Sum>_ = _.._./ _)" [0,0,0,10] 10) |
549 "_from_to_setsum" :: "idt \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'b" ("(3\<Sum>_ = _.._./ _)" [0,0,0,10] 10) |
550 "_from_upto_setsum" :: "idt \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'b" ("(3\<Sum>_ = _..<_./ _)" [0,0,0,10] 10) |
550 "_from_upto_setsum" :: "idt \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'b" ("(3\<Sum>_ = _..<_./ _)" [0,0,0,10] 10) |
551 "_upto_setsum" :: "idt \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'b" ("(3\<Sum>_<_./ _)" [0,0,10] 10) |
551 "_upto_setsum" :: "idt \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'b" ("(3\<Sum>_<_./ _)" [0,0,10] 10) |
552 syntax (latex output) |
552 syntax (latex_sum output) |
553 "_from_to_setsum" :: "idt \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'b" |
553 "_from_to_setsum" :: "idt \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'b" |
554 ("(3\<^raw:$\sum_{>_ = _\<^raw:}^{>_\<^raw:}$> _)" [0,0,0,10] 10) |
554 ("(3\<^raw:$\sum_{>_ = _\<^raw:}^{>_\<^raw:}$> _)" [0,0,0,10] 10) |
555 "_from_upto_setsum" :: "idt \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'b" |
555 "_from_upto_setsum" :: "idt \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'b" |
556 ("(3\<^raw:$\sum_{>_ = _\<^raw:}^{<>_\<^raw:}$> _)" [0,0,0,10] 10) |
556 ("(3\<^raw:$\sum_{>_ = _\<^raw:}^{<>_\<^raw:}$> _)" [0,0,0,10] 10) |
557 "_upto_setsum" :: "idt \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'b" |
557 "_upto_setsum" :: "idt \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'b" |
561 "\<Sum>x=a..b. t" == "setsum (%x. t) {a..b}" |
561 "\<Sum>x=a..b. t" == "setsum (%x. t) {a..b}" |
562 "\<Sum>x=a..<b. t" == "setsum (%x. t) {a..<b}" |
562 "\<Sum>x=a..<b. t" == "setsum (%x. t) {a..<b}" |
563 "\<Sum>i<n. t" == "setsum (\<lambda>i. t) {..<n}" |
563 "\<Sum>i<n. t" == "setsum (\<lambda>i. t) {..<n}" |
564 |
564 |
565 text{* The above introduces some pretty alternative syntaxes for |
565 text{* The above introduces some pretty alternative syntaxes for |
566 summation over intervals as shown on the left-hand side: |
566 summation over intervals: |
567 \begin{center} |
567 \begin{center} |
568 \begin{tabular}{lll} |
568 \begin{tabular}{lll} |
569 Sets & Indexed & TeX\\ |
569 Old & New & \LaTeX\\ |
570 @{term[source]"\<Sum>x\<in>{a..b}. e"} & @{term[source]"\<Sum>x=a..b. e"} & @{term"\<Sum>x=a..b. e"}\\ |
570 @{term[source]"\<Sum>x\<in>{a..b}. e"} & @{term"\<Sum>x=a..b. e"} & @{term[mode=latex_sum]"\<Sum>x=a..b. e"}\\ |
571 @{term[source]"\<Sum>x\<in>{a..<b}. e"} & @{term[source]"\<Sum>x=a..<b. e"} & @{term"\<Sum>x=a..<b. e"}\\ |
571 @{term[source]"\<Sum>x\<in>{a..<b}. e"} & @{term"\<Sum>x=a..<b. e"} & @{term[mode=latex_sum]"\<Sum>x=a..<b. e"}\\ |
572 @{term[source]"\<Sum>x\<in>{..<b}. e"} & @{term[source]"\<Sum>x<b. e"} & @{term"\<Sum>x<b. e"} |
572 @{term[source]"\<Sum>x\<in>{..<b}. e"} & @{term"\<Sum>x<b. e"} & @{term[mode=latex_sum]"\<Sum>x<b. e"} |
573 \end{tabular} |
573 \end{tabular} |
574 \end{center} |
574 \end{center} |
|
575 The left column shows the term before introduction of the new syntax, |
|
576 the middle column shows the new (default) syntax, and the right column |
|
577 shows a special syntax. The latter is only meaningful for latex output |
|
578 and has to be activated explicitly by setting the print mode to |
|
579 \texttt{latex\_sum} (e.g.\ via \texttt{mode=latex\_sum} in |
|
580 antiquotations). It is not the default \LaTeX\ output because it only |
|
581 works well with italic-style formulae, not tt-style. |
575 |
582 |
576 Note that for uniformity on @{typ nat} it is better to use |
583 Note that for uniformity on @{typ nat} it is better to use |
577 @{term"\<Sum>x::nat=0..<n. e"} rather than @{text"\<Sum>x<n. e"}: @{text setsum} may |
584 @{term"\<Sum>x::nat=0..<n. e"} rather than @{text"\<Sum>x<n. e"}: @{text setsum} may |
578 not provide all lemmas available for @{term"{m..<n}"} also in the |
585 not provide all lemmas available for @{term"{m..<n}"} also in the |
579 special form for @{term"{..<n}"}. *} |
586 special form for @{term"{..<n}"}. *} |