Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
% (find-LATEX "2021lean-nng.tex")
% (defun c () (interactive) (find-LATEXsh "lualatex -record 2021lean-nng.tex" :end))
% (defun C () (interactive) (find-LATEXSH "lualatex 2021lean-nng.tex" "Success!!!"))
% (defun D () (interactive) (find-pdf-page      "~/LATEX/2021lean-nng.pdf"))
% (defun d () (interactive) (find-pdftools-page "~/LATEX/2021lean-nng.pdf"))
% (defun e () (interactive) (find-LATEX "2021lean-nng.tex"))
% (defun l () (interactive) (find-LATEX "2021lean.lua"))
% (defun u () (interactive) (find-latex-upload-links "2021lean-nng"))
% (defun v () (interactive) (find-2a '(e) '(d)))
% (defun cv () (interactive) (C) (ee-kill-this-buffer) (v) (g))
% (defun d0 () (interactive) (find-ebuffer "2021lean-nng.pdf"))
%          (code-eec-LATEX "2021lean-nng")
% (find-pdf-page   "~/LATEX/2021lean-nng.pdf")
% (find-sh0 "cp -v  ~/LATEX/2021lean-nng.pdf /tmp/")
% (find-sh0 "cp -v  ~/LATEX/2021lean-nng.pdf /tmp/pen/")
%   file:///home/edrx/LATEX/2021lean-nng.pdf
%               file:///tmp/2021lean-nng.pdf
%           file:///tmp/pen/2021lean-nng.pdf
%  http://anggtwu.net/LATEX/2021lean-nng.pdf
% (find-LATEX "2019.mk")
% (find-lualatex-links "2021lean-nng")

% «.re»			(to "re")
% «.use_proofsty_lean»	(to "use_proofsty_lean")
% «.defftch»		(to "defftch")
% «.tree»		(to "tree")

\documentclass[oneside,12pt]{article}
\usepackage[colorlinks,citecolor=DarkRed,urlcolor=DarkRed]{hyperref} % (find-es "tex" "hyperref")
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{pict2e}
\usepackage[x11names,svgnames]{xcolor} % (find-es "tex" "xcolor")
%\usepackage{colorweb}                 % (find-es "tex" "colorweb")
%\usepackage{tikz}
\usepackage{stmaryrd}
%
% (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{edrx21}               % (find-LATEX "edrx21.sty")
\input edrxaccents.tex            % (find-LATEX "edrxaccents.tex")
\input edrx21chars.tex            % (find-LATEX "edrx21chars.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")
%
%\usepackage[backend=biber,
%   style=alphabetic]{biblatex}            % (find-es "tex" "biber")
%\addbibresource{catsem-slides.bib}        % (find-LATEX "catsem-slides.bib")
%
\usepackage{kluwer-fitch}                % (find-LATEX "fitch.sty")
%
% (find-es "tex" "geometry")
\usepackage[%a6paper, landscape,
            top=1.5cm, bottom=.25cm, left=1cm, right=1cm, includefoot
           ]{geometry}
\begin{document}

\catcode`\^^J=10
\directlua{dofile "dednat6load.lua"}  % (find-LATEX "dednat6load.lua")

\def\incgr#1#2{\myvcenter{\includegraphics[#1]{#2}}}
\def\scale#1#2{\scalebox{#1}{$#2$}}

% %L dofile "edrxtikz.lua"  -- (find-LATEX "edrxtikz.lua")
% %L dofile "edrxpict.lua"  -- (find-LATEX "edrxpict.lua")
% \pu


%L -- «re»  (to ".re")
%L -- (find-es "luatex" "re")
%L re = require "re"
%L
%L -- «use_proofsty_lean»  (to ".use_proofsty_lean")
%L -- (find-LATEX "2021lean.lua" "use_proofsty_lean")
%L dofile "2021lean.lua"
%L use_proofsty_lean()
%L
%L dofile "2021fitch.lua"


\pu

% «defftch»  (to ".defftch")
% (find-LATEX "edrx21.sty" "defub")
\directlua{dofile "2021fitch.lua"}    % (find-LATEX "2021fitch.lua")
\def\defftch#1#2{\expandafter\def\csname ftch-#1\endcsname{#2}}
\def\ifftchundefined#1{\expandafter\ifx\csname ftch-#1\endcsname\relax}
\def\ftch#1{\ifftchundefined{#1}
    \errmessage{UNDEFINED FTCH: #1}
  \else
    \csname ftch-#1\endcsname
  \fi
}


% «tree»  (to ".tree")
% (find-es "dednat" "lean-nng")
%



Tutorial world:

%:
%:
%:      x,y,z:mynat
%:   ------------------
%:   refl:[x*y+z=x*y+z]
%:
%:   ^tutorial-1/4
%:
%:   ----------------------               --------------            
%:   refl:[2*(x+7)=2*(x+7)]   h:[y=x+7]   refl:[2*y=2*y]   h:[y=x+7]   
%:   ----------------------------------   --------------------------   
%:     (rw.h):[2*y=2*(x+7)]                 (rw←h):[2*y=2*(x+7)]    
%:                                                                 
%:     ^tutorial-2/4a                       ^tutorial-2/4b          
%:
%:  --------------------                   --------------------------------
%:  refl:[succ.b=succ.b]    h:[succ.a=b]   refl:[succ(succ.a)=succ(succ.a)]    h:[succ.a=b]   
%:  ------------------------------------   ------------------------------------------------   
%:    (rw.h):[succ(succ.a)=succ.b]           (rw←h):[succ(succ.a)=succ.b]
%:                                                                                
%:    ^tutorial-3/4a                         ^tutorial-3/4b
%:
%:    --------------------
%:    refl:[succ.a=succ.a]  add_zero:[a+0=a]    add_succ:[a+succ.d=succ(a+d)]    
%:    --------------------------------------    -----------------------------   
%:    (rw.add_zero):[succ(a+0)=succ.a]          add_succ:[a+succ.0=succ(a+0)]                   
%:    -----------------------------------------------------------------------
%:    (rw.add_succ):[a+succ.0=succ.a]
%:
%:    ^tutorial-4/4
%:
%:
%:
\pu

Level 1/4: 
$$\ded{tutorial-1/4}$$

Level 2/4:
$$\ded{tutorial-2/4a}$$
$$\ded{tutorial-2/4b}$$

Level 3/4:
$$\ded{tutorial-3/4a}$$
$$\ded{tutorial-3/4b}$$

Level 4/4:
$$\ded{tutorial-4/4}$$



\bsk
\bsk
\bsk
\bsk


Note: this is a {\sl very improvised} translation of the first
exercises

of the Natural Numbers Game to Natural Deduction. I started learning

Lean in the beginning of oct/2021 and started to typeset these tress in

2021oct13, so this is very new and full of guesses --- mainly of the

kind ``with the right abbreviations I can write this term in this way''.

\msk

Some links:

{\footnotesize

\url{https://www.ma.imperial.ac.uk/~buzzard/xena/natural_number_game/}

\url{http://math.andrej.com/2021/06/24/the-dawn-of-formalized-mathematics/}

\url{http://math.andrej.com/asset/data/the-dawn-of-formalized-mathematics.pdf}

\url{http://www.youtube.com/watch?v=fty9QL4aSRc} Vladislav Zavialov - Haskell to Core

\url{https://leanprover-community.github.io/mathlib_docs/tactic/explode.html\#tactic.explode}

% (favp 35)
%    http://angg.twu.net/LATEX/2020favorite-conventions.pdf#page=35
\url{http://angg.twu.net/LATEX/2020favorite-conventions.pdf#page=35} $⟦·⟧$

%    http://angg.twu.net/LATEX/2021lean-nng.pdf
\url{http://angg.twu.net/LATEX/2021lean-nng.pdf} this PDF

\url{http://angg.twu.net/math-b.html} my home page

\url{http://angg.twu.net/dednat6.html}

}




\newpage


Addition world:
%:                                   ---------------------
%:                add_zero:[a+0=a]   refl:[succ(d)=succ.d]  (hd:[0+d=d])^1   add_succ:[a+succ.d=succ(a+d)]
%:   ----------   ----------------   -------------------------------------   -----------------------------
%:   refl:[0=0]   add_zero:[0+0=0]   (rw.hd):[succ(0+d)=succ.d]              add_succ:[0+succ.d=succ(0+d)]
%:   -----------------------------   ---------------------------------------------------------------------
%:   (rw.add_zero):[0+0=0]           (rw.add_succ):[0+succ.d=succ.d]
%:   -------------------------------------------------------------------1
%:   (induction.n.with.d.hd):[0+n=n]
%:
%:   ^addition-1/6a
%:
%:                           ---------------------
%:                           refl:[succ(d)=succ.d]  (hd:[0+d=d])^1
%:   ----------              -------------------------------------
%:   refl:[0=0]              (rw.hd):[succ(0+d)=succ.d]
%:   ---------------------   -------------------------------
%:   (rw.add_zero):[0+0=0]   (rw.add_succ):[0+succ.d=succ.d]
%:   -------------------------------------------------------1
%:   (induction.n.with.d.hd):[0+n=n]
%:
%:   ^addition-1/6b
%:
%:                             ---------------------
%:                             refl:[succ(d)=succ.d]  (hd:[0+d=d])^1
%:   ----------                -------------------------------------
%:   refl:[0=0]                (rw.hd):[succ(0+d)=succ.d]
%:   -----------------------   -----------------------------------
%:   (rw.add_zero.0):[0+0=0]   (rw.add_succ.0.d):[0+succ.d=succ.d]
%:   -----------------------------------------------------------1
%:   (induction.n.with.d.hd):[0+n=n]
%:
%:   ^addition-1/6c
%:
%:
%:
%:                                       (hd:[(a+b)+d=a+(b+d)])^1
%:                                       -------------------------------------
%:                                       (rw.hd):[succ((a+b)+d)=succ(a+(b+d))]
%:   --------------                      -----------------------------------------
%:   refl:[a+b=a+b]                      (rw.add_succ):[succ((a+b)+d)=a+succ(b+d)]
%:   ---------------------------         ------------------------------------------
%:   (rw.add_zero):[a+b=a+(b+0)]         (rw.add_succ):[succ((a+b)+d)=a+(b+succ.d)]
%:   -------------------------------     -------------------------------------------
%:   (rw.add_zero):[(a+b)+0=a+(b+0)]     (rw.add_succ):[(a+b)+(succ.d)=a+(b+succ.d)]
%:   -------------------------------------------------------------------------------1
%:   (induction.c.with.d.hd):[(a+b)+c=a+(b+c)]
%:
%:   ^addition-2/6
%:
%:                                                    (hc:[(succ a)+c=succ(a+c)])^1
%:   --------------------                             ------------------------------------------
%:   refl:[succ.a=succ.a]                             (rw.hc):[succ((succ.a)+c)=succ(succ(a+c))]
%:   ----------------------------------               ----------------------------------------------------
%:   (rw.add_zero.a):[succ.a=succ(a+0)]               (rw.add_succ.a.c):[succ((succ.a)+c)=succ(a+succ.c)]
%:   --------------------------------------------     -----------------------------------------------------
%:   (rw.add_zero(succ.a)):[(succ.a)+0=succ(a+0)]     (rw.add_succ.(succ.a).c):[(succ.a)+(succ.c)=succ(a+succ.c)]
%:   -------------------------------------------------------------------------------------1
%:   (induction.b.with.c.hc):[(succ.a)+b=succ(a+b)]
%:
%:   ^addition-3/6
%:
%:
%:  
%:                                       (hc:[a+c=c+a)])^1
%:   ----------                       -----------------------------
%:   refl:[a=a]                       (rw.hc):[succ(a+c)=succ(c+a)]
%:   -----------------------          ----------------------------------------
%:   (rw.zero_add.a):[a=0+a]          (rw.succ_add.c.a):[succ(a+c)=(succ.c)+a]
%:   -------------------------        -----------------------------------------
%:   (rw.add_zero.a):[a+0=0+a]        (rw.add_succ.a.c):[a+(succ.c)=(succ.c)+a]
%:   --------------------------------------------------------------------------1
%:   (induction.b.with.c.hc):[a+b=b+a]
%:
%:   ^addition-4/6
%:
\pu

Level 1/6:
$$\scale{0.85}{\ded{addition-1/6a}}$$
$$\scale{0.85}{\ded{addition-1/6b}}$$
$$\scale{0.85}{\ded{addition-1/6c}}$$

Level 2/6:
$$\scale{0.85}{\ded{addition-2/6}}$$

Level 3/6:
$$\scale{0.85}{\ded{addition-3/6}}$$

Level 4/6:
$$\scale{0.85}{\ded{addition-3/6}}$$

Level 5/6:

(I didn't draw the tree)

\msk

Level 6/6:

(I didn't draw the tree)

\newpage

Function world:

% (find-LATEX "2021fitch.lua")
% (find-LATEX "2021lean.lua")

\def\tac#1#2{(#1)(#2)}
\def\tac#1#2{#1 \; \ColorRed{⇒} \; #2}
\def\tac#1#2{$#1 \; \ColorRed{⇒} \; #2$}

%L FitchGrid.__index.texmiddle = function (fg, str)
%L    return lean_stranslate(str)
%L  end
%L FitchGrid.__index.texright = function (fg, str)
%L    return lean_stranslate(str)
%L  end
%L FitchGrid.__index.texright = function (fg, str)
%L    return "Hi"
%L  end



Level 1/9:
\msk

%F   / P,Q:Type
%F   | p:P
%F   | h:(P→Q)
%F   | ----
%F   \ α:Q           \tac{exact.h.p}{α:=h.p}
%L
%L defftch "function-1/9"
$\pu
  \ftch{function-1/9}
$

\bsk

Level 2/9:
\msk

%F   / / n:mynat
%F   | | ----
%F   | \ β:mynat         \tac{exact.2*n+3}{β:=2*n+3}
%F   \ α:(mynat→mynat)   \tac{intro.n}{α:=λn:mynat..β}
%L
%L defftch "function-2/9"
$\pu
  \ftch{function-2/9}
$

Level 3/9:
\msk

%F / P,Q,R,S,T,U:Type
%F | p:P
%F | h:P→Q
%F | i:Q→R
%F | j:Q→T
%F | k:S→T
%F | l:T→U
%F | -----
%F | q:Q      \tac{have.q:=h(p)}{}
%F | t:T      \tac{have.t:=j(q)}{}
%F \ u:U      \tac{exact.l.t}{u:=l.t}
%L defftch "function-3/9"
$$\pu
  \ftch{function-3/9}
$$





\newpage




%\printbibliography

\GenericWarning{Success:}{Success!!!}  % Used by `M-x cv'

\end{document}

%  __  __       _        
% |  \/  | __ _| | _____ 
% | |\/| |/ _` | |/ / _ \
% | |  | | (_| |   <  __/
% |_|  |_|\__,_|_|\_\___|
%                        
% <make>

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-LATEXfile "2019planar-has-1.mk")
make -f 2019.mk STEM=2021lean-nng veryclean
make -f 2019.mk STEM=2021lean-nng pdf

% Local Variables:
% coding: utf-8-unix
% ee-tla: "lea"
% End: