From 0c476e92e1807928ffb30864126076ef4c6a0821 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Tue, 13 Feb 2024 20:00:02 -0700 Subject: add all the stuff --- src/scenes/substitution.tsx | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/scenes/substitution.tsx (limited to 'src/scenes/substitution.tsx') diff --git a/src/scenes/substitution.tsx b/src/scenes/substitution.tsx new file mode 100644 index 0000000..1e7e48c --- /dev/null +++ b/src/scenes/substitution.tsx @@ -0,0 +1,45 @@ +import { Layout, Txt, makeScene2D } from "@motion-canvas/2d"; +import { + Direction, + beginSlide, + createRef, + slideTransition, +} from "@motion-canvas/core"; +import { theme } from "../theme"; + +const substitution = [ + "β-reduce [ (λ x . x) y ] => y\n\n", + "Formal definition:", + "1. x[x := N] = N", + "2. y[x := N] = y if y != x", + "3. (M N)[x := P] = (M[x := P]) (N[x := P])", + "4. (λ x . M)[x := N] = λ x . M", + "5. (λ y . M)[x := N] = λ y . (M[x := N]) if y != x and y is not _free_ in N", + " +=> A variable is _free_ in a lambda term if it is not bound by a λ abstraction.", +]; + +export default makeScene2D(function* (view) { + const rules = createRef(); + + view.add( + + + The Lambda Calculus - Substitution Rules + + + + ); + + yield* slideTransition(Direction.Right); + yield* beginSlide("The Lambda Calculus - Substitutions"); + + for (const rule of substitution) { + yield* rules().text(rules().text() + "\n\n" + rule, 1); + yield* beginSlide("substitution - " + rule); + } +}); -- cgit v1.2.3-70-g09d2