From db535e5c3035030bc1089528ad5fc12b9eef14ad Mon Sep 17 00:00:00 2001 From: braxtonhall Date: Mon, 24 Oct 2022 12:34:39 -0700 Subject: Add Paulette --- entries/pkoronkevich/tex/README.md | 1 + entries/pkoronkevich/tex/fib.tex | 28 ++++++++++++++++++++++++++++ entries/pkoronkevich/tex/render.pdf | Bin 0 -> 21761 bytes entries/pkoronkevich/tex/render.png | Bin 0 -> 297404 bytes 4 files changed, 29 insertions(+) create mode 100644 entries/pkoronkevich/tex/README.md create mode 100644 entries/pkoronkevich/tex/fib.tex create mode 100644 entries/pkoronkevich/tex/render.pdf create mode 100644 entries/pkoronkevich/tex/render.png (limited to 'entries/pkoronkevich') diff --git a/entries/pkoronkevich/tex/README.md b/entries/pkoronkevich/tex/README.md new file mode 100644 index 0000000..225773b --- /dev/null +++ b/entries/pkoronkevich/tex/README.md @@ -0,0 +1 @@ +fib.tex preview \ No newline at end of file diff --git a/entries/pkoronkevich/tex/fib.tex b/entries/pkoronkevich/tex/fib.tex new file mode 100644 index 0000000..22781d1 --- /dev/null +++ b/entries/pkoronkevich/tex/fib.tex @@ -0,0 +1,28 @@ +\documentclass[11pt]{article} +\usepackage[fleqn]{amsmath} + +\newcommand{\one}{\lambda f . \lambda x . f \ x} +\newcommand{\two}{\lambda f . \lambda x . f \ (f \ x)} +\newcommand{\tru}{\lambda x . \lambda y . x} +\newcommand{\flse}{\lambda x . \lambda y . y} +\newcommand{\isz}{\lambda n . n \ (\lambda c . \flse) \ \tru} +\newcommand{\ife}{\lambda p . \lambda a . \lambda b . p \ a \ b} +\newcommand{\suc}{\lambda n . \lambda f . \lambda x . f \ (n \ f \ x)} +\newcommand{\plus}{\lambda m . \lambda n . m \ (\suc) \ n} +\newcommand{\pred}{\lambda n . \lambda f . \lambda x . n \ (\lambda g . \lambda h . h \ (g \ f)) \ (\lambda u . x) \ (\lambda u . u)} +\newcommand{\sub}{\lambda m . \lambda n . n \ (\pred) \ m} +\newcommand{\fix}{\lambda g . (\lambda x . g \ (x \ x)) \ (\lambda x . g \ (x \ x))} +\newcommand{\appo}[2]{#1 \ #2} +\newcommand{\appt}[3]{#1 \ #2 \ #3} + +\begin{document} +\begin{gather*} + \fix \\ % recursive function application + \quad \lambda r . \lambda n . (\ife) \\ % of fib, which takes itself and n, if expression + \quad \ \appo{(\isz)}{n} \\ % is n zero + \quad \ (\one) \\ % if so, return 1 + \quad \ (\plus) \\ % if not, add + \qquad \appo{r}{(\appo{(\pred)}{n})} \\ % the first recursive call, n - 1, to + \qquad \appo{r}{(\appt{(\sub)}{n}{\two})} % the second recursive call, n - 2 +\end{gather*} +\end{document} diff --git a/entries/pkoronkevich/tex/render.pdf b/entries/pkoronkevich/tex/render.pdf new file mode 100644 index 0000000..b69f747 Binary files /dev/null and b/entries/pkoronkevich/tex/render.pdf differ diff --git a/entries/pkoronkevich/tex/render.png b/entries/pkoronkevich/tex/render.png new file mode 100644 index 0000000..2e172cc Binary files /dev/null and b/entries/pkoronkevich/tex/render.png differ -- cgit v1.2.3-70-g09d2 From d6cab23a8b6879a58eadac239001acc40372cbb6 Mon Sep 17 00:00:00 2001 From: braxtonhall Date: Mon, 24 Oct 2022 13:04:02 -0700 Subject: Update Paulette's fib --- entries/pkoronkevich/tex/fib.tex | 3 ++- entries/pkoronkevich/tex/render.pdf | Bin 21761 -> 21807 bytes entries/pkoronkevich/tex/render.png | Bin 297404 -> 387387 bytes 3 files changed, 2 insertions(+), 1 deletion(-) (limited to 'entries/pkoronkevich') diff --git a/entries/pkoronkevich/tex/fib.tex b/entries/pkoronkevich/tex/fib.tex index 22781d1..cef9138 100644 --- a/entries/pkoronkevich/tex/fib.tex +++ b/entries/pkoronkevich/tex/fib.tex @@ -11,6 +11,7 @@ \newcommand{\plus}{\lambda m . \lambda n . m \ (\suc) \ n} \newcommand{\pred}{\lambda n . \lambda f . \lambda x . n \ (\lambda g . \lambda h . h \ (g \ f)) \ (\lambda u . x) \ (\lambda u . u)} \newcommand{\sub}{\lambda m . \lambda n . n \ (\pred) \ m} +\newcommand{\lleq}{\lambda m . \lambda n . \\ \qquad \isz \ ((\sub) \\ \qquad \ m \ n)} \newcommand{\fix}{\lambda g . (\lambda x . g \ (x \ x)) \ (\lambda x . g \ (x \ x))} \newcommand{\appo}[2]{#1 \ #2} \newcommand{\appt}[3]{#1 \ #2 \ #3} @@ -19,7 +20,7 @@ \begin{gather*} \fix \\ % recursive function application \quad \lambda r . \lambda n . (\ife) \\ % of fib, which takes itself and n, if expression - \quad \ \appo{(\isz)}{n} \\ % is n zero + \quad \ \appt{(\lleq)}{n}{\one} \\ % if n less than or equal to one \quad \ (\one) \\ % if so, return 1 \quad \ (\plus) \\ % if not, add \qquad \appo{r}{(\appo{(\pred)}{n})} \\ % the first recursive call, n - 1, to diff --git a/entries/pkoronkevich/tex/render.pdf b/entries/pkoronkevich/tex/render.pdf index b69f747..8ee60c7 100644 Binary files a/entries/pkoronkevich/tex/render.pdf and b/entries/pkoronkevich/tex/render.pdf differ diff --git a/entries/pkoronkevich/tex/render.png b/entries/pkoronkevich/tex/render.png index 2e172cc..a1896a2 100644 Binary files a/entries/pkoronkevich/tex/render.png and b/entries/pkoronkevich/tex/render.png differ -- cgit v1.2.3-70-g09d2