|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
% This file:
% https://anggtwu.net/LATEX/2026defs-comprehensions.tex.html
% https://anggtwu.net/LATEX/2026defs-comprehensions.tex
% (find-angg "LATEX/2026defs-comprehensions.tex")
% Author: Eduardo Ochs <eduardoochs@gmail.com>
%
% (defun e () (interactive) (find-angg "LATEX/2026defs-comprehensions.tex"))
% Used by:
% (bafp 12 "comprehensions")
% (bafa "comprehensions")
% (wld2026p 99 "set-comprehensions")
% (wld2026a "set-comprehensions")
% (find-LATEX "2025-2-C2-example-6.tex" "nodepthnoheight")
\def\setdepthto #1#2{\setbox1\hbox{$#2$}%
\dp1=#1%
\box1}
\def\nodepthnoheight#1{\setbox1\hbox{$#1$}%
\dp1=0pt%
\ht1=10pt%
\box1}
\def\vbtsmash #1{\nodepthnoheight{\myvcenter{\vbt{#1}}}}
%L dofile "PictureDots1.lua" -- (find-LATEX "PictureDots1.lua")
\pu
\def\picturedots(#1,#2)(#3,#4)#5{\expr{
PictureDots.from(#1,#2, #3,#4, "#5"):topict():pgat("patc")
}}
% See: (find-LATEX "Verbatim3.lua" "Verbatim" " defvbt =")
% (find-LATEX "Verbatim3.lua" "dednat6" "defvbt =")
% (find-LATEX "Verbatim3.lua" "dednat6-tests")
% (find-LATEX "edrx21.sty" "defvbt")
% (find-LATEX "edrx21.sty" "defvbt" "\\vbtbgboxcolor")
%L dofile "Verbatim3.lua" -- (find-LATEX "Verbatim3.lua")
\pu
\def\vbtbgboxcolor{YellowOrangeLight!45}
% For: (find-angg "LUA/Comprehensions1.lua" "Comprehension-tests")
\def\comprehensionbox#1{\vbtbgbox{\ensuremath{\mat{#1}}}}
\def\V{\mathbf{V}}
\def\F{\mathbf{F}}
\def\Stop{\omit\vrule\phantom{$\scriptstyle($}\hss}
\def\Stop{\omit|\hss}
\def\HLine{\hline\\[0pt]}
\def\HLine{\hline}
\def\undtext#1#2{\underbrace{\mathstrut#1}_{\mathstrut\text{#2}}}
\def\ug#1{\undtext{#1}{gen}}
\def\uf#1{\undtext{#1}{filt}}
\def\ue#1{\undtext{#1}{expr}}
%V for a=2,4 do
%V print(10*a)
%V end
%L
%L defvbt "compr 10*a"
\pu
%V for a=2,4 do
%V if a^2<10 then
%V print(a)
%V end
%V end
%L
%L defvbt "compr a^2<10"
\pu
%V for x=1,6 do
%V for y=6,6-x do
%V print(x,y)
%V end
%V end
%L
%L defvbt "compr triangle"
\pu
\sa {compr 10*a} { \setofst {10a} {a∈\{2,3,4\}} }
\sa {compr 10*a u} { \setofst {\ue{10a}} {\ug{a∈\{2,3,4\}}} }
\sa {compr 10*a u;} { \setofsc {\ug{a∈\{2,3,4\}}} {\ue{10a}} }
\sa {compr a^2<10} { \setofst {a∈\{2,3,4\}} {a^2<10} }
\sa {compr a^2<10 u} { \setofst {\ug{a∈\{2,3,4\}}} {\uf{a^2<10}} }
\sa {compr a^2<10 u;} { \setofsc {\ug{a∈\{2,3,4\}}, \uf{a^2<10}} {\ue{a}} }
\sa {compr triangle;} {
\setofsc { x∈\{1,\ldots,5\},
y∈\{x,\ldots,6-x\}
}
{ (x,y) }
}
\sa {compr triangle u;} {
\setofsc {\ug{x∈\{1,\ldots,5\}},
\ug{y∈\{x,\ldots,6-x\}}
}
{\ue{(x,y)}}
}
\sa {compr triangle dots} {
\picturedots(0,0)(6,6){ 1,1 1,2 1,3 1,4 1,5 2,2 2,3 2,4 3,3 }
}
\sa {compr triangle dots wrong} {
\picturedots(0,0)(6,6){ 1,1 1,2 1,3 1,4 1,5 2,2 2,3 2,4 3,3 4,3 }
}
\sa {compr triangle tree thin} {
\comprehensionbox{
x & y & (x,y) \\\HLine
1 & 1 & (1,1) \\
& 2 & (1,2) \\
& 3 & (1,3) \\
& 4 & (1,4) \\
& 5 & (1,5) \\
2 & 2 & (2,2) \\
& 3 & (2,3) \\
& 4 & (2,4) \\
3 & 3 & (3,3) \\
4 & \Stop \\
5 & \Stop \\
}}
\sa {compr triangle tree wide} {
\comprehensionbox{
x & 6-x & \{x,\ldots,6-x\} & y & (x,y) \\\HLine
1 & 5 & \{1,2,3,4,5\} & 1 & (1,1) \\
& & & 2 & (1,2) \\
& & & 3 & (1,3) \\
& & & 4 & (1,4) \\
& & & 5 & (1,5) \\
2 & 4 & \{2,3,4\} & 2 & (2,2) \\
& & & 3 & (2,3) \\
& & & 4 & (2,4) \\
3 & 3 & \{3\} & 3 & (3,3) \\
4 & 2 & \{\} & \Stop \\
5 & 1 & \{\} & \Stop \\
}}
% Local Variables:
% coding: utf-8-unix
% End: