Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
% (find-angg "LATEX/2019ebl-mesa-slides.tex") % (defun c () (interactive) (find-LATEXsh "lualatex -record 2019ebl-mesa-slides.tex" :end)) % (defun d () (interactive) (find-pdf-page "~/LATEX/2019ebl-mesa-slides.pdf")) % (defun d () (interactive) (find-pdftools-page "~/LATEX/2019ebl-mesa-slides.pdf")) % (defun b () (interactive) (find-zsh "bibtex 2019ebl-mesa-slides; makeindex 2019ebl-mesa-slides")) % (defun e () (interactive) (find-LATEX "2019ebl-mesa-slides.tex")) % (defun u () (interactive) (find-latex-upload-links "2019ebl-mesa-slides")) % (find-xpdfpage "~/LATEX/2019ebl-mesa-slides.pdf") % (find-sh0 "cp -v ~/LATEX/2019ebl-mesa-slides.pdf /tmp/") % (find-sh0 "cp -v ~/LATEX/2019ebl-mesa-slides.pdf /tmp/pen/") % file:///home/edrx/LATEX/2019ebl-mesa-slides.pdf % file:///tmp/2019ebl-mesa-slides.pdf % file:///tmp/pen/2019ebl-mesa-slides.pdf % http://angg.twu.net/LATEX/2019ebl-mesa-slides.pdf % «.defs» (to "defs") % «.title-page» (to "title-page") % «.abstract» (to "abstract") % % «.start-with-DM» (to "start-with-DM") % «.PURO» (to "PURO") % «.DM-PURO» (to "DM-PURO") % «.BMOs» (to "BMOs") % «.graphical-reprs» (to "graphical-reprs") % «.set-comprehensions» (to "set-comprehensions") % «.set-comprehensions-2» (to "set-comprehensions-2") % «.spoiler» (to "spoiler") % «.abuse-of-language» (to "abuse-of-language") % «.abuse-of-language-2» (to "abuse-of-language-2") % «.lambda-in-DM» (to "lambda-in-DM") % «.substitution» (to "substitution") % «.substitution-2» (to "substitution-2") % «.substitution-and-lambda» (to "substitution-and-lambda") % % «.dm-at-puro» (to "dm-at-puro") % «.dm-layers» (to "dm-layers") % «.set-comprehensionsb» (to "set-comprehensionsb") % «.set-comprehensionsb-2» (to "set-comprehensionsb-2") % «.positional» (to "positional") % «.propositions» (to "propositions") % «.propositions-2» (to "propositions-2") % «.propositions-3» (to "propositions-3") % «.context-sequents» (to "context-sequents") % «.context-sequents-2» (to "context-sequents-2") % % «.dicas-GA» (to "dicas-GA") % «.smalltalk» (to "smalltalk") \documentclass[oneside]{book} \usepackage[colorlinks]{hyperref} % (find-es "tex" "hyperref") %\usepackage[latin1]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{pict2e} \usepackage[x11names,svgnames]{xcolor} % (find-es "tex" "xcolor") %\usepackage{color} % (find-LATEX "edrx15.sty" "colors") %\usepackage{colorweb} % (find-es "tex" "colorweb") %\usepackage{tikz} % % (find-dn6 "preamble6.lua" "preamble0") \usepackage{proof} % For derivation trees ("%:" lines) \input diagxy % For 2D diagrams ("%D" lines) \xyoption{curve} % For the ".curve=" feature in 2D diagrams % \usepackage{edrx15} % (find-LATEX "edrx15.sty") \input edrxaccents.tex % (find-LATEX "edrxaccents.tex") \input edrxchars.tex % (find-LATEX "edrxchars.tex") \input edrxheadfoot.tex % (find-LATEX "edrxheadfoot.tex") \input edrxgac2.tex % (find-LATEX "edrxgac2.tex") \input 2017planar-has-defs.tex % (find-LATEX "2017planar-has-defs.tex") % % (find-angg ".emacs.papers" "latexgeom") % (find-LATEXfile "2016-2-GA-VR.tex" "{geometry}") % (find-latexgeomtext "total={6.5in,8.75in},") \usepackage[paperwidth=11.5cm, paperheight=9.5cm, %total={6.5in,4in}, %textwidth=4in, paperwidth=4.5in, %textheight=5in, paperheight=4.5in, %a4paper, top=1.5cm, bottom=.5cm, left=1cm, right=1cm, includefoot ]{geometry} % \begin{document} \catcode`\^^J=10 \directlua{dofile "dednat6load.lua"} % (find-LATEX "dednat6load.lua") %L dofile "edrxtikz.lua" -- (find-LATEX "edrxtikz.lua") %L dofile "edrxpict.lua" -- (find-LATEX "edrxpict.lua") \pu \setlength{\parindent}{0em} % ____ __ % | _ \ ___ / _|___ % | | | |/ _ \ |_/ __| % | |_| | __/ _\__ \ % |____/ \___|_| |___/ % % «defs» (to ".defs") % «colors» (to ".colors") % (find-angg ".emacs.papers" "xcolor") \long\def\ColorRed #1{{\color{Red1}#1}} \long\def\ColorBrown #1{{\color{Brown}#1}} \long\def\ColorBook #1{{\color{brown}#1}} \long\def\ColorViolet#1{{\color{MagentaVioletLight}#1}} \long\def\ColorViolet#1{{\color{Violet!50!black}#1}} \long\def\ColorGreen #1{{\color{SpringDarkHard}#1}} \long\def\ColorGreen #1{{\color{SpringGreenDark}#1}} \long\def\ColorGreen #1{{\color{SpringGreen4}#1}} \long\def\ColorGray #1{{\color{GrayLight}#1}} \long\def\ColorGray #1{{\color{black!30!white}#1}} \def\V{\mathbf{T}} \def\F{\mathbf{F}} \def\smile{\ensuremath{{=})}} \def\frown{\ensuremath{{=}(}} \def\smirk{\ensuremath{{=}/}} \def\und#1#2{\underbrace{#1}_{#2}} \def\und#1#2{\underbrace{#1}_{\text{#2}}} \def\ug#1{\und{#1}{gen}} \def\uf#1{\und{#1}{filt}} \def\ue#1{\und{#1}{expr}} \def\uC#1{\und{#1}{context}} \def\uCH#1{\und{#1}{context / hypotheses}} \def\uvt#1{\und{#1}{v:T}} \def\uterm#1{\und{#1}{term}} \def\utype#1{\und{#1}{type}} \def\uconc#1{\und{#1}{conclusion}} \def\Sets{\mathsf{Sets}} \def\TALA{\mathsf{TA}_λ^→} \def\app {\mathsf{app}} \def\pair{\mathsf{pair}} \def\picturedotsa(#1,#2)(#3,#4)#5{% \vcenter{\hbox{% \beginpicture(#1,#2)(#3,#4)% \pictaxes% \pictdots{#5}% \end{picture}% }}% } \def\myvcenter#1{\begin{matrix}#1\end{matrix}} \def\setofst#1#2{\{\,#1\;|\;#2\,\}} \def\setofsc#1#2{\{\,#1\;;\;#2\,\}} \setlength{\parindent}{0em} \def\O{\mathcal{O}} \def\T{\mathbf{T}} \def\F{\mathbf{F}} \def\antitabular{\hskip-5.5pt} % _____ _ _ _ % |_ _(_) |_| | ___ % | | | | __| |/ _ \ % | | | | |_| | __/ % |_| |_|\__|_|\___| % % «title-page» (to ".title-page") \begin{center} {\Large \bf Como ensinar Matemática Discreta para calouros com português muito ruim } \msk Eduardo Ochs (UFF, Rio das Ostras, RJ, Brazil) \footnotesize \url{http://angg.twu.net/math-b.html\#ebl2019-m} \end{center} \newpage \noedrxfooter % _ _ _ _ % / \ | |__ ___| |_ _ __ __ _ ___| |_ % / _ \ | '_ \/ __| __| '__/ _` |/ __| __| % / ___ \| |_) \__ \ |_| | | (_| | (__| |_ % /_/ \_\_.__/|___/\__|_| \__,_|\___|\__| % % «abstract» (to ".abstract") {\bf Mesa redonda: ``Algumas abordagens para disciplinas de Lógica em cursos de graduação'' Resumo (da minha apresentação na mesa): } \msk Considere a seguinte situação: um curso de Matemática Discreta para calouros, com conteúdo muito grande, num campus em que entram muitos alunos muito fracos com muito pouca base matemática e português muito ruim; além disso nos pedem pra que ensinemos o máximo possível nesse curso e não deixemos passar alunos que não tiverem aprendido o suficiente, porque este curso de Matemática Discreta é pré-requisito para cursos que exigem uma certa maturidade matemática, e ele deve servir como ``filtro''... como estruturar um curso assim pra que ele funcione bem? \newpage {\bf (Resumo, continuação)} O problema mais básico aqui é: que linguagem utilizar? Os alunos sempre começam tentando discutir suas idéias em português, tanto entre si quanto com o professor, mas o português deles é impreciso demais, e não há tempo hábil para debugá-lo no curso! Então precisamos ir introduzindo desde o início notações matemáticas precisas que sejam fáceis o suficiente de usar, e aí usar sempre exemplos em notação matemática... a linguagem matemática adequada vira a base que torna as discussões em português possíveis. \newpage {\bf (Resumo, continuação)} Nesta palestra vou mostrar como esta ``linguagem matemática adequada para calouros'' pode ser dividida em três camadas: uma camada mais básica, em que tudo pode ser calculado até o resultado final num número finito de passos sem precisar de criatividade praticamente nenhuma; uma camada média, em que alguns objetos infinitos, como $\mathbb{N}$ ou $\mathbb{Z}$, passam a ser permitidos; e uma camada acima destas que inclui uma linguagem para provas formais. Além disto vou mostrar modos de visualizar vários dos objetos matemáticos do curso, e discutir alguns pontos em que esta abordagem do curso ainda tem ``buracos''. % (emap 2 "eduardo") % (ema "eduardo") % (lodp 1 "title-page") % (lod "title-page") % (ntyp 7 "motivation-3") % (nty "motivation-3") %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (ntyp 9 "start-with-DM") % (nty "start-with-DM") \newpage % ____ __ __ _ ____ _ _ ____ ___ % | _ \| \/ | __ _| |_ | _ \| | | | _ \ / _ \ % | | | | |\/| | / _` | __| | |_) | | | | |_) | | | | % | |_| | | | | | (_| | |_ | __/| |_| | _ <| |_| | % |____/|_| |_| \__,_|\__| |_| \___/|_| \_\\___/ % % «dm-at-puro» (to ".dm-at-puro") % (lodp 2 "dm-at-puro") % (lod "dm-at-puro") {\bf Discrete Mathematics at PURO/UFF} I teach in a campus that UFF has in Rio das Ostras, in the countryside of the state of Rio de Janeiro... The entrance of the campus looks like this: \msk \begin{tabular}{c} % http://angg.twu.net/blergh.html % (xz "~/LATEX/2019logicday-PURO.jpg") \includegraphics[height=120pt]{2019logicday-PURO.jpg} \\ \end{tabular} \quad $⇐$ \quad \begin{tabular}[c]{l} ``PURO'': \\ Pólo Universitário \\ de Rio das Ostras \\ \end{tabular} \newpage % ____ _ _ _ _ _ ____ __ __ % / ___|| |_ __ _ _ __| |_ __ _(_) |_| |__ | _ \| \/ | % \___ \| __/ _` | '__| __| \ \ /\ / / | __| '_ \ | | | | |\/| | % ___) | || (_| | | | |_ \ V V /| | |_| | | | | |_| | | | | % |____/ \__\__,_|_| \__| \_/\_/ |_|\__|_| |_| |____/|_| |_| % % «start-with-DM» (to ".start-with-DM") % (ntyp 9 "start-with-DM") % (nty "start-with-DM") {\bf (Let's start with) Discrete Mathematics} I teach in a city called Rio das Ostras, in the countryside of the state of Rio de Janeiro, in a big federal university (``UFF''), but in one of its smallest campi, away from the capital. I sometimes teach Discrete Mathematics to Computer Science students there. \msk Many of the students there --- even in CompSci --- enter the university with very little knowledge of: 1) how to deal with variables, 2) how to write their calculations, 3) how to test their ideas. \msk Discrete Mathematics is a first-semester course there. Let me explain my approach to fix (1), (2), and (3). \newpage % ____ __ __ ____ ____ _ _ ____ ___ % | _ \| \/ | / __ \ | _ \| | | | _ \ / _ \ % | | | | |\/| | / / _` | | |_) | | | | |_) | | | | % | |_| | | | | | | (_| | | __/| |_| | _ <| |_| | % |____/|_| |_| \ \__,_| |_| \___/|_| \_\\___/ % \____/ % % «DM-PURO» (to ".DM-PURO") % (ntyp 11 "DM-PURO") % (nty "DM-PURO") {\bf Discrete Mathematics at PURO/UFF} % ``PURO'' = Pólo Universitário de Rio das Ostras. I structured the Discrete Mathematics (``DM'') course in three layers. \msk {\bf Layer 1} consists of \ColorRed{calculating things} and learning how to use \ColorRed{mathematical notation} and \ColorRed{definitions}. Layer 2 introduces some infinite objects, like $\N$ and $\Z$. Layer 3 introduces a \ColorRed{formal} language for doing proofs. \msk Everything in Layer 1 can be calculated in a \ColorRed{finite} number of steps with \ColorRed{very little creativity}. \msk One of the basic things that we learn in Layer 1 is {\bf set comprehensions} --- that {\color{DarkGreen!75!black}(ta-daaa! Magic!!!!!!)} are the base for \ColorRed{$λ$-calculus} and \ColorRed{Type Theory}. % (find-sh "dict comprehension") \newpage % ____ __ __ ___ % | __ )| \/ |/ _ \ ___ % | _ \| |\/| | | | / __| % | |_) | | | | |_| \__ \ % |____/|_| |_|\___/|___/ % % «BMOs» (to ".BMOs") % (ntyp 12 "BMOs") % (nty "BMOs") {\bf Basic Mathematical Objects} Here's a definition (``for adults'') of the mathematical objects that we deal with in Level 1. Notation: $\mathcal{O}$ is the set of BMOs. \msk a) Numbers belong to $\O$; $\Z⊂\O$. b) The truth-values belong to $\O$: $\{\T, \F\}⊂\O$. c) $\O$ is closed by ``finite lists'' and ``finite sets''. \ColorViolet{d) Finite strings belong to $\O$.} \msk \def\str#1{\ensuremath{\text{``{\tt#1}''}}} Item (d) is only introduced at the end of the course, when we show that ``valid expressions'' can be defined formally... \str{1+2*(3+4)} is ``valid'', but \str{)+)} is not. \msk \ColorRed{Some graphical representations are allowed.} \newpage % ____ _ _ _ % / ___|_ __ __ _ _ __ | |__ (_) ___ __ _| | % | | _| '__/ _` | '_ \| '_ \| |/ __/ _` | | % | |_| | | | (_| | |_) | | | | | (_| (_| | | % \____|_| \__,_| .__/|_| |_|_|\___\__,_|_| % |_| % % «graphical-reprs» (to ".graphical-reprs") % (ntyp 13 "graphical-reprs") % (nty "graphical-reprs") {\bf Some graphical representations} We define graphical representations for: a) (finite) subsets of $\Z^2$, b) functions whose domains are (a), c) directed graphs... % (lodp 8 "positional") % (lod "positional") %D diagram 12345 %D 2Dx 100 +12 +12 %D 2D 100 1 %D 2D %D 2D +12 2 3 %D 2D %D 2D +12 4 %D 2D %D 2D +15 5 %D 2D %D (( 1 2 -> 1 3 -> 2 4 -> 3 4 -> 4 5 -> %D )) %D enddiagram %D \pu \unitlength=8pt \def\closeddot{\circle*{0.4}} \def\closeddot{\circle*{0.5}} \msk \resizebox{!}{55pt}{% $\begin{array}{c} K = \csm{ & (1,3), & \\ (0,2), & & (2,2), \\ & (1,1), & \\ & (1,0) & \\ } = \;\picturedotsa(0,0)(2,3){ 1,3 0,2 2,2 1,1 1,0 }\; = \;\picturedots (0,0)(2,3){ 1,3 0,2 2,2 1,1 1,0 }\; % \\[15pt] % f = \csm{ & ((1,3),1), & \\ ((0,2),0), & & ((2,2),2), \\ & ((1,1),1), & \\ & ((1,0),1) & \\ } = \sm{ & 1 & \\ 0 & & 2 \\ & 1 & \\ & 1 & \\ } % \\ % (V,A) = \left( \{1,2,3,4,5\}, \csm{(1,2),(1,3),\\(2,4),(3,4),\\(4,5)} \right) = \diag{12345} \\ \end{array} $} \newpage % ____ _ _ % / ___|___ _ __ ___ _ __ _ __ ___| |__ ___ _ __ ___(_) ___ _ __ ___ % | | / _ \| '_ ` _ \| '_ \| '__/ _ \ '_ \ / _ \ '_ \/ __| |/ _ \| '_ \/ __| % | |__| (_) | | | | | | |_) | | | __/ | | | __/ | | \__ \ | (_) | | | \__ \ % \____\___/|_| |_| |_| .__/|_| \___|_| |_|\___|_| |_|___/_|\___/|_| |_|___/ % |_| % % «set-comprehensions» (to ".set-comprehensions") % (ntyp 14 "set-comprehensions") % (nty "set-comprehensions") {\bf Layer 1: Set Comprehensions} One of the first things that I present to students is a syntax for \ColorRed{set comprehensions} using ``generators'', ``filters'' and a ``result expression''... \unitlength=5pt \def\closeddot{\circle*{0.2}} \bsk $\begin{array}{lll} \{\uC{\ug{a∈\{1,2\}}, \ug{b∈\{2,3\}}, \uf{a<b} }; \; \ue{(a,b)} \} &=& \{(1,2),(1,3),(2,3)\} \\[-10pt] &=& \picturedotsa(0,0)(3,4){ 1,2 1,3 2,3 } \\ \end{array} $ \bsk Note the `;' instead of a `$|$'! These things can be calculated from left to right using trees in a finite number of steps. \newpage % ____ ____ % / ___|___ _ __ ___ _ __ _ __ ___ |___ \ % | | / _ \| '_ ` _ \| '_ \| '__/ __| __) | % | |__| (_) | | | | | | |_) | | \__ \ / __/ % \____\___/|_| |_| |_| .__/|_| |___/ |_____| % |_| % % «set-comprehensions-2» (to ".set-comprehensions-2") % (ntyp 15 "set-comprehensions-2") % (nty "set-comprehensions-2") {\bf Layer 1: Set Comprehensions (2)} I make the students work in groups, and they solve the $5+19+16+9+16+7$ exercises quickly. I suggest this table-ish way to draw the trees... To calculate $\setofsc {a∈\{1,2\}, b∈\{2,3\}, a<b} {10a+b} = \{12,13,23\}$ we draw: \def\tbl#1#2{\fbox{$\begin{array}{#1}#2\end{array}$}} \def\tbl#1#2{\fbox{$\sm{#2}$}} \def\tbl#1#2{\fbox{$\mat{#2}$}} \def\tbl#1#2{$\mat{#2}$} % "Stop": % (find-es "tex" "vrule") \def\S{\omit\vrule\phantom{$\scriptstyle($}\hss} % stop \msk \tbl{ccc}{ a & b & a<b & 10a+b \\\hline 1 & 2 & \V & 12 \\ 1 & 3 & \V & 13 \\ 2 & 2 & \F & \S \\ 2 & 3 & \V & 23 \\ } \msk the vertical bar means ``abort''. Valid \ColorRed{values for the context}: $(1,2,\V)$, $(1,3,\V)$, $(2,3,\V)$. \newpage % ____ _ _ % / ___| _ __ ___ (_) | ___ _ __ % \___ \| '_ \ / _ \| | |/ _ \ '__| % ___) | |_) | (_) | | | __/ | % |____/| .__/ \___/|_|_|\___|_| % |_| % % «spoiler» (to ".spoiler") % (ntyp 16 "spoiler") % (nty "spoiler") {\bf Layer 1: Set Comprehensions --- SPOILER} Spoiler: the idea of \ColorRed{context} will be reused in many other contexts later, but with slightly different notations... Compare: \msk $\begin{array}{rl} 1) & \setofsc {a∈\{1,2\}, b∈\{2,3\}, a<b} {10a+b} = \{12,13,23\} \\ 2) & a⠆\{1,2\}, b⠆\{2,3\}, a<b ⊢ (10a+b)⠆\N \\ 3) & a⠆\{1,2\}, b⠆\{2,3\} ⊢ a<b \qquad\text{\ColorRed{$⇐$ this is false!}} \\ 4) & A⠆\Sets, B⠆\Sets ⊢ A⠆\Sets \\ 5) & A⠆\Sets, B⠆\Sets ⊢ A×B⠆\Sets \\ 6) & A⠆\Sets, B⠆\Sets, a⠆A, f⠆A→B ⊢ f(a)⠆B \\ 7) & A⠆\Sets, B⠆\Sets, a⠆A, b⠆B ⊢ (a,b)⠆A×B \\ 8) & A⠆\Sets, B⠆\Sets, a⠆A ⊢ (λb⠆B.(a,b))⠆B→A×B \\ \end{array} $ \newpage % _ _ __ _ __ % / \ | |__ _ _ ___ ___ _ / / __ _ | |__ \ \ % / _ \ | '_ \| | | / __|/ _ (_) | | / _` | | '_ \ | | % / ___ \| |_) | |_| \__ \ __/_ | | | (_| |_ | |_) | | | % /_/ \_\_.__/ \__,_|___/\___(_) | | \__,_( ) |_.__/ | | % \_\ |/ /_/ % % «abuse-of-language» (to ".abuse-of-language") % (ntyp 17 "abuse-of-language") % (nty "abuse-of-language") {\bf An abuse of language} Remember that I make the students do $5+19+16+9+16+7$ exercises about set comprehensions... some of the exercises are about cartesian products, and some introduce new notations, like: \msk $\{x∈\{2,3,4\} ,y∈\{2,3,4\}, y=3; (x,y)\}$ $\{\ColorRed{x,y}∈\{2,3,4\}, y=3; (x,y)\}$ $\{\ColorRed{(x,y)}∈\{2,3,4\}^2, y=3; (x,y)\}$ \msk This abuse of language will be incredibly important later when we discuss type systems. We will allow things like: \msk $A⠆\Sets, B⠆\Sets, \ColorRed{(a,b)}⠆A×B, f⠆A→B ⊢ fa⠆B$ \msk How do we make $(a,b)$ behave as \ColorRed{a} variable? (In the singular!) \newpage % _ _ ________ % / \ | |__ _ _ ___ ___ / /___ \ \ % / _ \ | '_ \| | | / __|/ _ \ | | __) | | % / ___ \| |_) | |_| \__ \ __/ | | / __/| | % /_/ \_\_.__/ \__,_|___/\___| | ||_____| | % \_\ /_/ % % «abuse-of-language-2» (to ".abuse-of-language-2") % (ntyp 18 "abuse-of-language-2") % (nty "abuse-of-language-2") {\bf An abuse of language (2)} Short answer: $\ColorRed{(a,b)}$ becomes a ``long name'' for a variable \ColorRed{$p$}, $\ColorRed{a}$ becomes an abbreviation for $\ColorRed{π(a,b)}$, i.e., $\ColorRed{πp}$, $\ColorRed{b}$ becomes an abbreviation for $\ColorRed{π'(a,b)}$, i.e., $\ColorRed{π'p}$, \msk $A⠆\Sets, B⠆\Sets, \ColorRed{(a,b)}⠆A×B, f⠆A→B ⊢ f(\ColorRed{a})⠆B$ becomes: $A⠆\Sets, B⠆\Sets, \ColorRed{p}⠆A×B, f⠆A→B ⊢ f(\ColorRed{πp})⠆B$ \msk (More on ``long names'' later!) \newpage % _ _ _ _ ____ __ __ % | | __ _ _ __ ___ | |__ __| | __ _ (_)_ __ | _ \| \/ | % | | / _` | '_ ` _ \| '_ \ / _` |/ _` | | | '_ \ | | | | |\/| | % | |__| (_| | | | | | | |_) | (_| | (_| | | | | | | | |_| | | | | % |_____\__,_|_| |_| |_|_.__/ \__,_|\__,_| |_|_| |_| |____/|_| |_| % % «lambda-in-DM» (to ".lambda-in-DM") % (ntyp 19 "lambda-in-DM") % (nty "lambda-in-DM") {\bf $λ$-notation in Discrete Mathematics} In DM we see \ColorRed{functions} as \ColorRed{sets of input-output pairs}... If $\begin{array}[t]{rrcl} f: & \{1,2,3\} &→& \{10,20,30\} \\ & x & \mto & 10x \end{array}$ then $f = \csm{(1,10),\\ (2,20),\\ (3,30)\\ }$. \msk The students learn that, e.g., \msk $\csm{(1,10),\\ (2,20),\\ (3,30)}(2) = 20$, and $\csm{(1,10),\\ (2,20),\\ (3,30)}(4) = \ColorRed{\mathbf{ERROR}}$. \msk We see (in passing) that $(\ColorRed{λ}x∈\{1,2,3\}.10x) = \{ x∈\{1,2,3\}; (x,10x) \} = \csm{(1,10),\\ (2,20),\\ (3,30)} $. \newpage % ____ _ _ _ _ _ _ % / ___| _ _| |__ ___| |_(_) |_ _ _| |_(_) ___ _ __ % \___ \| | | | '_ \/ __| __| | __| | | | __| |/ _ \| '_ \ % ___) | |_| | |_) \__ \ |_| | |_| |_| | |_| | (_) | | | | % |____/ \__,_|_.__/|___/\__|_|\__|\__,_|\__|_|\___/|_| |_| % % «substitution» (to ".substitution") % (ntyp 20 "substitution") % (nty "substitution") % (gam181p 3 "substituicao") % (gam181 "substituicao") {\bf (Simultaneous) substitution} I also teach, right in the beginning of the course, a \ColorRed{notation} for (simultaneous) substitution... (Because I can't rely on the students' Portuguese!...) Examples: $$\def\newa{\psm{∫⊙\\◻}} \begin{array}{l} % ((x+y)·z) \subst{ x:=a+y \\ y:=b+z \\ z:=c+x \\ } \\ =\;\; ((a+y)+(b+z))·(c+x) \\[20pt] % (\text{Vanessão 20 reais}) \bmat{\text{a} := \newa} \\ =\;\; (\text{V$\newa$ness$\widetilde{\newa}$o 20 re$\newa$is}) \\[5pt] \end{array} $$ \newpage % ____ _ _ _ _ _ _ ____ % / ___| _ _| |__ ___| |_(_) |_ _ _| |_(_) ___ _ __ |___ \ % \___ \| | | | '_ \/ __| __| | __| | | | __| |/ _ \| '_ \ __) | % ___) | |_| | |_) \__ \ |_| | |_| |_| | |_| | (_) | | | | / __/ % |____/ \__,_|_.__/|___/\__|_|\__|\__,_|\__|_|\___/|_| |_| |_____| % % «substitution-2» (to ".substitution-2") % (ntyp 21 "substitution-2") % (nty "substitution-2") % (gam181p 3 "substituicao") % (gam181 "substituicao") % (gam181 "substituicao" "equações") {\bf (Simultaneous) substitution (2)} This is useful to test equations, \msk $\begin{array}{l} (x^2-4=0) \bmat{x:=3} = (9-4=0) = 𝐛F \\[2pt] (x^2-4=0) \bmat{x:=2} = (4-4=0) = 𝐛T \\ \end{array} $ \msk and to define a way to calculate expressions with quantifiers: \msk $\begin{array}{rcl} (∀a∈\{2,3,5\}.a^2<10) &=& (a^2<10)[a:=2] \;∧ \\&& (a^2<10)[a:=3] \;∧ \\&& (a^2<10)[a:=5] \\ &=& (2^2<10) ∧ (3^2<10) ∧ (4^2<10) \\ &=& (4<10) ∧ (9<10) ∧ (16<10) \\ &=& \V ∧ \V ∧ \F \\ &=& \F \\ \end{array} $ \newpage % ____ _ _ _ _ _ % / ___| _ _| |__ ___| |_ | | __ _ _ __ ___ | |__ __| | __ _ % \___ \| | | | '_ \/ __| __| | | / _` | '_ ` _ \| '_ \ / _` |/ _` | % ___) | |_| | |_) \__ \ |_ | |__| (_| | | | | | | |_) | (_| | (_| | % |____/ \__,_|_.__/|___/\__| |_____\__,_|_| |_| |_|_.__/ \__,_|\__,_| % % «substitution-and-lambda» (to ".substitution-and-lambda") % (ntyp 22 "substitution-and-lambda") % (nty "substitution-and-lambda") {\bf Substitution and $λ$-calculus} ...and I mention, \ColorRed{very} briefly, that we can use substitution to calculate with $λ$-terms: \msk $\begin{array}{rcl} (λx∈\{1,2,3\}.10x)(2) &=& (10x)[x:=2] \\ &=& 10·2 \\ &=& 20 \\ \end{array} $ \msk \ColorRed{Some} students later take an optional seminar course that is a \ColorRed{very basic} introduction to $λ$-calculus and Category Theory... In it they learn how to handle \ColorRed{untyped} $λ$-terms... \newpage % ____ __ __ _ ____ _ _ ____ ___ ________ % | _ \| \/ | __ _| |_ | _ \| | | | _ \ / _ \ / /___ \ \ % | | | | |\/| | / _` | __| | |_) | | | | |_) | | | | | | __) | | % | |_| | | | | | (_| | |_ | __/| |_| | _ <| |_| | | | / __/| | % |____/|_| |_| \__,_|\__| |_| \___/|_| \_\\___/ | ||_____| | % \_\ /_/ {\bf Discrete Mathematics at PURO/UFF (2)} Discrete Mathematics is taught to first-semester Computer Science students there. Most of these students enter the university with {\sl very little knowledge} of how to use variables, and when they attempt to spell out their ideas in Portuguese, either speaking or writing, they are \ColorRed{too imprecise}... They ask ``can I do xxx yyy?'' and if I say ``yes'' they write weird atrocities in the test, and when I mark them as wrong they blame me (``you said I could do that!''); if I say ``no, you can't do that'' then they do other atrocites and blame me, too. {\ColorRed{I don't have time to debug their Portuguese!}} \newpage % ____ __ __ _ % | _ \| \/ | | | __ _ _ _ ___ _ __ ___ % | | | | |\/| | | |/ _` | | | |/ _ \ '__/ __| % | |_| | | | | | | (_| | |_| | __/ | \__ \ % |____/|_| |_| |_|\__,_|\__, |\___|_| |___/ % |___/ % % «dm-layers» (to ".dm-layers") % (lodp 4 "dm-layers") % (lod "dm-layers") {\bf Discrete Mathematics at PURO/UFF (3)} ...so I decided that I would stress mathetical notation --- Almost all ideas on the blackboard (whiteboard, actually) would have examples in mathematical notation. \ssk I structured the course of Discrete Mathematics in three layers (presented more or less in parallel): \ssk Layer 1: \ColorRed{Calculating} things in a system with numbers, truth-values, sets and lists where everything can be calculated in a \ColorRed{finite} number of steps with almost no creativity required. \ssk Layer 2: some infinite objects, like $\N$ and $\Z$, are allowed; we learn how to ``calculate'', e.g., $∃k∈\Z.10k=23$ \ssk Layer 3: we add formal proofs. \newpage {\bf Layer 1: Calculating things} ...in a system with numbers, truth-values, sets and lists where everything can be calculated in a \ColorRed{finite} number of steps with almost no creativity required. Example: $\antitabular \begin{array}{rcl} (∀a∈\{2,3,5\}.a^2<10) &=& (a^2<10)[a:=2] \;∧ \\&& (a^2<10)[a:=3] \;∧ \\&& (a^2<10)[a:=5] \\ &=& (2^2<10) ∧ (3^2<10) ∧ (4^2<10) \\ &=& (4<10) ∧ (9<10) ∧ (16<10) \\ &=& \V ∧ \V ∧ \F \\ &=& \F \\ \end{array} $ Note the substituion operator: $(a^2<10)[a:=3] = (3^2<10)$. \newpage % ____ _ _ % / ___|___ _ __ ___ _ __ _ __ ___| |__ ___ _ __ ___(_) ___ _ __ ___ % | | / _ \| '_ ` _ \| '_ \| '__/ _ \ '_ \ / _ \ '_ \/ __| |/ _ \| '_ \/ __| % | |__| (_) | | | | | | |_) | | | __/ | | | __/ | | \__ \ | (_) | | | \__ \ % \____\___/|_| |_| |_| .__/|_| \___|_| |_|\___|_| |_|___/_|\___/|_| |_|___/ % |_| % % «set-comprehensionsb» (to ".set-comprehensionsb") % (lodp 6 "set-comprehensions") % (lod "set-comprehensions") {\bf Layer 1: Set Comprehensions} I wrote a lengthy explanation of set comprehensions, using ``generators'', ``filters'' and a ``result expression''. The students started by learning how to calculate things like these (note the `;' instead of a `$|$'; these `$\{\ldots;\ldots\}$'s are calculated from left to right!): \unitlength=5pt \def\closeddot{\circle*{0.4}} \unitlength=5pt \def\closeddot{\circle*{0.2}} $$\begin{array}{lll} \{\ug{a∈\{1,2\}}, \ug{b∈\{2,3\}}, \uf{a≠b}; \ue{(a,b)}\} \\[10pt] = \;\; \{(1,2),(1,3),(2,3)\} \\[5pt] = \;\; \picturedotsa(0,0)(3,4){ 1,2 1,3 2,3 } \\ \end{array} $$ ...then $\setofst{a∈\{2,3,4\}}{a^2<10}$ and $\setofst{10a+b}{a∈\{1,2\},b∈\{3,4\}}$. \newpage % «set-comprehensionsb-2» (to ".set-comprehensionsb-2") % (lodp 7 "set-comprehensions-2") % (lod "set-comprehensions-2") {\bf Layer 1: Set Comprehensions (2)} The ``lengthy explanation of set comprehensions'' using ``generators'', ``filters'' and a ``result expression'', has: 2 pages of explanations, 2 pages of exercises (5+19+16+9+16+7 exercises), 1 page of answers, all using a graphical notation --- for example: 2) $ A = \picturedotsa(0,0)(4,4){ 1,2 2,1 } \quad B = \picturedotsa(0,0)(4,4){ 1,2 2,1 3,0 } \quad C = \picturedotsa(0,0)(4,4){ 0,3 1,2 2,1 3,0 } \quad D = \picturedotsa(0,0)(4,4){ 0,3 .5,2.5 1,2 1.5,1.5 2,1 2.5,.5 3,0 } $ \msk $ \quad E = \picturedotsa(0,0)(4,4){ 1,3 2,3 3,3 1,4 2,4 3,4 } \quad F = \picturedotsa(0,0)(4,4){ 3,1 4,1 3,2 4,2 3,3 4,3 } \quad G = \picturedotsa(0,0)(4,4){ 1,3 2,3 3,3 1,4 2,4 3,4 } \quad H = \picturedotsa(0,0)(4,4){ 3,2 4,2 } $ \msk $ \quad I = \picturedotsa(0,0)(4,4){ 1,3 2,3 1,4 } \quad J = \picturedotsa(0,0)(4,4){ 2,3 3,3 1,4 2,4 3,4 } \quad K = \picturedotsa(0,0)(4,4){ 1,4 2,4 3,4 4,4 1,3 2,3 3,3 4,3 1,2 2,2 3,2 4,2 1,1 2,1 3,1 4,1 } \quad L = \picturedotsa(0,0)(4,4){ 0,4 1,4 2,4 3,4 4,4 0,3 1,3 2,3 3,3 4,3 0,2 1,2 2,2 3,2 4,2 0,1 1,1 2,1 3,1 4,1 0,0 1,0 2,0 3,0 4,0 } $ \newpage % ____ _ _ _ _ % | _ \ ___ ___(_) |_(_) ___ _ __ __ _| | % | |_) / _ \/ __| | __| |/ _ \| '_ \ / _` | | % | __/ (_) \__ \ | |_| | (_) | | | | (_| | | % |_| \___/|___/_|\__|_|\___/|_| |_|\__,_|_| % % «positional» (to ".positional") % (lodp 8 "positional") % (lod "positional") {\bf Positional notations} ...then we adapt the graphical notation for subsets of $\Z^2$... we define a convention for omitting the axes, \unitlength=8pt \def\closeddot{\circle*{0.4}} \def\closeddot{\circle*{0.5}} $$K = \csm{ & (1,3), & \\ (0,2), & & (2,2), \\ & (1,1), & \\ & (1,0) & \\ } = \;\picturedotsa(0,0)(2,3){ 1,3 0,2 2,2 1,1 1,0 }\; = \;\picturedots (0,0)(2,3){ 1,3 0,2 2,2 1,1 1,0 }\; $$ we define a positional notation for functions, % $$f = \csm{ & ((1,3),1), & \\ ((0,2),0), & & ((2,2),2), \\ & ((1,1),1), & \\ & ((1,0),1) & \\ } = \sm{ & 1 & \\ 0 & & 2 \\ & 1 & \\ & 1 & \\ } $$ and for subsets, partial functions, and characteristic functons: % $$% A = \sm{ & • & \\ · & & • \\ & • & \\ & · & \\ } ⊂ \sm{ & • & \\ • & & • \\ & • & \\ & • & \\ } % = K \qquad % g = \sm{ & 1 & \\ · & & 2 \\ & 1 & \\ & · & \\ } % : A → \N \qquad \sm{ & 1 & \\ 0 & & 1 \\ & 1 & \\ & 0 & \\ } $$ \newpage % ____ _ _ _ % | _ \ _ __ ___ _ __ ___ ___(_) |_(_) ___ _ __ ___ % | |_) | '__/ _ \| '_ \ / _ \/ __| | __| |/ _ \| '_ \/ __| % | __/| | | (_) | |_) | (_) \__ \ | |_| | (_) | | | \__ \ % |_| |_| \___/| .__/ \___/|___/_|\__|_|\___/|_| |_|___/ % |_| % % «propositions» (to ".propositions") % (lodp 9 "propositions") % (lod "propositions") {\bf Propositions} Let $W = \{0,1,2,3\}×\{0,1,2\} = \picturedotsa(0,0)(3,2){ 0,2 1,2 2,2 3,2 0,1 1,1 2,1 3,1 0,0 1,0, 2,0, 3,0 } $ \; . (Our ``set of worlds''). A {\sl proposition on $A$} is a function $P:A→\{\F,\V\}$. Let $P,Q,R$ be these propositions on $W$: $P = \setofst{((x,y),z)}{(x,y)∈W, z=(x≤1 ∧ y≥1)}$ $Q = \setofst{((x,y),z)}{(x,y)∈W, z=(1≤x≤2 ∧ y≥1)}$ $R = \setofst{((x,y),z)}{(x,y)∈W, z=(0≤x≤2 ∧ y≤1)}$ or: $\begin{array}{lcc} P = P(x,y) = (x≤1 ∧ y≥1) &=& \sm{\V&\V&\F&\F \\ \V&\V&\F&\F \\ \F&\F&\F&\F} \\[7pt] Q = Q(x,y) = (1≤x≤2 ∧ y≥1) &=& \sm{\F&\V&\V&\F \\ \F&\V&\V&\F \\ \F&\F&\F&\F} \\[7pt] R = R(x,y) = (0≤x≤2 ∧ y≤1) &=& \sm{\F&\F&\F&\F \\ \V&\V&\V&\F \\ \V&\V&\V&\F} \\ \end{array} $ \newpage % «propositions-2» (to ".propositions-2") % (lodp 10 "propositions-2") % (lod "propositions-2") {\bf Propositions (2)} In a (long) series of exercises the students learned to visualize these and lots of other propositions on $W$ --- actually this set of propositions, $\calS = \{ ⊤,\; ⊥,\; P,\; Q,\; R,\; P∧Q,\; P∨Q,\; P→Q \} $ and I asked them to draw the Hasse diagram of the partial order on $\calS$. They got this: % %D diagram hasse-props %D 2Dx 100 +20 +20 +15 +20 %D 2D 100 T %D 2D %D 2D +20 PvQ P->Q R %D 2D %D 2D +20 P Q %D 2D %D 2D +20 P&Q %D 2D %D 2D +20 F %D 2D %D ren T F PvQ P&Q P->Q ==> ⊤ ⊥ P{∨}Q P{∧}Q P{→}Q %D %D (( F P&Q -> %D P&Q P -> P&Q Q -> %D P PvQ -> Q PvQ -> Q P->Q -> %D PvQ T -> P->Q T -> %D F R -> .curve= _10pt R T -> .curve= _10pt %D )) %D enddiagram %D %D diagram hasse-props-2 %D 2Dx 100 +20 +20 +15 +20 %D 2D 100 T %D 2D %D 2D +20 PvQ P->Q R %D 2D %D 2D +20 P Q %D 2D %D 2D +20 P&Q %D 2D %D 2D +20 F %D 2D %D ren T ==> \sm{1111\\1111\\1111} %D ren F ==> \sm{0000\\0000\\0000} %D ren P ==> \sm{1100\\1100\\0000} %D ren Q ==> \sm{0110\\0110\\0000} %D ren R ==> \sm{0000\\1110\\1110} %D ren PvQ ==> \sm{1110\\1110\\0000} %D ren P&Q ==> \sm{0100\\0100\\0000} %D ren P->Q ==> \sm{0111\\0111\\1111} %D %D (( F P&Q -> %D P&Q P -> P&Q Q -> %D P PvQ -> Q PvQ -> Q P->Q -> %D PvQ T -> P->Q T -> %D F R -> .curve= _10pt R T -> .curve= _10pt %D )) %D enddiagram %D \pu $$\resizebox{0.6\width}{!}{$ \diag{hasse-props} $} $$ \newpage % «propositions-3» (to ".propositions-3") % (lodp 11 "propositions-3") % (lod "propositions-3") {\bf Propositions (3)} Using `0's and `1's instead of `$\F$'s and `$\T$'s, what they got was: \msk $\diag{hasse-props-2} \quad \diag{hasse-props} $ \newpage % ____ _ % / ___| ___ __ _ _ _ ___ _ __ | |_ ___ % \___ \ / _ \/ _` | | | |/ _ \ '_ \| __/ __| % ___) | __/ (_| | |_| | __/ | | | |_\__ \ % |____/ \___|\__, |\__,_|\___|_| |_|\__|___/ % |_| % % «context-sequents» (to ".context-sequents") % (lodp 12 "context-sequents") % (lod "context-sequents") {\bf Comprehensions $→$ contexts $→$ sequents} The part at the left of the `;' in a `$\{\ldots;\ldots\}$' is called the ``context''. For example: % $$\{\und{\ug{a∈\{1,2\}}, \ug{b∈\{2,3\}}, \uf{a≠b}, \ug{c∈\{1,\ldots,a+b\}}}{context}; \ue{10a+c}\} $$ The {\sl set of possible values} for this context is: % $$\{\uC{\ug{a∈\{1,2\}}, \ug{b∈\{2,3\}}, \uf{a≠b}, \ug{c∈\{1,\ldots,a+b\}}}; \ue{(a,b,c)}\} $$ \newpage % «context-sequents-2» (to ".context-sequents-2") % (lodp 13 "context-sequents-2") % (lod "context-sequents-2") {\bf Comprehensions $→$ contexts $→$ sequents (2)} This is surprisingly similar to contexts in sequents! % $$\uC{\ug{a∈\Z}, \ug{b∈\{1,2,3\}}, \uf{\mathsf{prime}(4a+b)}}⊢b=3$$ The sequent above can be seen as a (false!) proposition. We used this in the course to debug proofs. Our formal proofs were written as series of numbered lines, each line starting by either ``Suppose'' of ``Then''. Each ``Then'' line had an associated sequent --- its context was made of all the open ``Suppose''s. For each ``Then'' line in a valid proof its associated sequent had to be a true proposition. \newpage % ____ _ % / ___| / \ % | | _ / _ \ % | |_| |/ ___ \ % \____/_/ \_\ % % «dicas-GA» (to ".dicas-GA") {\bf Dicas (do início do curso de Geometria Analítica)} \msk Você {\bf VAI TER QUE} aprender a \ColorRed{definir} seus objetos --- pontos, retas, conjuntos, círculos, etc... isso provavelmente vai ser algo novo pra você e é algo que precisa de MUITO treino. Dá pra passar em Cálculo 1 e em Prog 1 só aprendendo a ``ler'' as definições que o professor e os livros mostram, mas em Geometria Analítica NÃO DÁ, em GA você vai ter que aprender a ler {\bf E A ESCREVER} definições. \msk 2) Cada ``seja'' ou ``sejam'' que aparece nestas folhas é uma definição, e você pode usá-los como exemplos de definições bem-escritas (ééé!!!!) pra aprender jeitos de escrever as suas definições. 3) Em ``matematiquês'' a gente quase não usa termos como ``ele'', ``ela'', ``isso'', ``aquilo'' e ``lá'' --- ao invés disso a gente dá \ColorRed{nomes curtos} pros objetos ou usa expressões matemáticas pra eles cujo resultado é o objeto que a gente quer (como nas pags $\_$ e $\_$)... mas {\sl quando a gente está discutindo problemas no papel ou no quadro} a gente pode ser referir a determinados objetos {\sl apontando pra eles com o dedo} e dizendo ``esse aqui''. \newpage % ____ _ _ _____ _ _ % / ___| _ __ ___ __ _| | |_ _|_ _| | | __ % \___ \| '_ ` _ \ / _` | | | | |/ _` | | |/ / % ___) | | | | | | (_| | | | | | (_| | | < % |____/|_| |_| |_|\__,_|_|_| |_|\__,_|_|_|\_\ % % «smalltalk» (to ".smalltalk") {\bf Dan Ingalls interview on SmallTalk} It started to hit home in the Spring of '74 after I taught Smalltalk to 20 PARC nonprogrammer \ColorRed{adults}. They were able to get \ColorRed{through the initial material faster than the children}, but just as it looked like an overwhelming success was at hand, they started to crash on problems that didn't look to me to be much harder than the ones they had just been doing well on. One of them was a project thought up by one of the adults, which was to make a little database system that could act like a card file or rolodex. They \ColorRed{couldn't even come close} to programming it. I was very surprised because I ``knew'' that such a project was \ColorRed{well below the mythical ``two pages''} for end-users we were working within. That night I worote it out, and the next day I showed all of them how to do it. Still, none of them were able to do it by themselves. Later, I sat in the room pondering the board from my talk. Finally, I counted the number of \ColorRed{nonobvious ideas} in this little program. They came to \ColorRed{17}. And some of them were like the concept of the arch in building design: very hard to discover, if you don't already know them. The connection to literacy was painfully clear. It isn't enough to just learn to read and write. There is also a literature that renders ideas. Language is used to read and write about them, but at some point the organization of ideas starts to dominate mere language abilities. And it help greatly to have some powerful ideas under one's belt to better acquire more powerful ideas [Papert 70s]. So, we decided we should teach design. And Adele came up with another brillian stroke to deal with this. She decided that what was needed was in \ColorRed{intermediary between the vague ideas about the problem and the very detailed} writing and debugging that had to be done to get it to run in Smalltalk. She called the intermediary forms design templates. \end{document} % Local Variables: % coding: utf-8-unix % ee-tla: "ems" % End: