Latest / CyberSecurity Summary / Lambda-Calculus and Combinators: An Introduction
Transcript
- 0:00Speaker 1: Every time you open an app on your phone or,
- 0:02Speaker 1: you know, run a Python script or honestly just watch
- 0:05Speaker 1: a digital clock tick over to the next minute, you're
- 0:08Speaker 1: interacting with a ghost from the 1920s.
- 0:10Speaker 2: Yeah, which is kind of wild to think about.
- 0:13Speaker 1: Right, because there's this natural assumption that computing is this
- 0:17Speaker 1: perfectly modern silicon-based invention, like just sprang into existence alongside
- 0:23Speaker 1: microchips and glowing screens.
- 0:25Speaker 2: It feels tangible, right? I mean, we associate computation with Hardware, electricity,
- 0:31Speaker 2: physical servers humming in a data center somewhere.
- 0:34Speaker 1: Exactly.
- 0:34Speaker 2: But the actual logic governing literally all of that was
- 0:38Speaker 2: finalized decades before the first transistor was even built.
- 0:41Speaker 1: Which is just mind-blowing. So for today's deep dive, we
- 0:45Speaker 1: are pulling from a notoriously dense, heavily mathematical textbook on
- 0:49Speaker 1: lambda calculus and combinators.
- 0:51Speaker 2: It is very dense.
- 0:52Speaker 1: Oh, totally. But if you're prepping for an advanced computer
- 0:55Speaker 1: science theory class, or if you've just you know, ever
- 0:58Speaker 1: fiercely wondered how the digital universe actually thinks on a
- 1:00Speaker 1: fundamental level, you are in the right place. Our mission
- 1:04Speaker 1: today is to demystify this abstract DNA of modern computing.
- 1:08Speaker 1: We are going to explore this wild mathematical rebellion, a
- 1:13Speaker 1: moment in time when a few rogue logicians decided to
- 1:16Speaker 1: rebuild the entire foundation of mathematics using operations instead of sets. Okay,
- 1:21Speaker 1: let's unpack this. Where does this shift actually start?
- 1:24Speaker 2: Well, it gained serious momentum in the 1930s with an
- 1:27Speaker 2: American logician named Alonzo Church.
- 1:29Speaker 1: Okay.
- 1:29Speaker 2: He invented something called lambda notation, which is the bedrock
- 1:34Speaker 2: of lambda calculus. But to grasp why this was a rebellion,
- 1:38Speaker 2: you really have to look at how classical math operates.
- 1:40Speaker 1: Right, because classical math is everywhere.
- 1:42Speaker 2: Exactly. And classical math relies on sets. It is heavily declarative. So, like,
- 1:46Speaker 2: if you have a function where y equals x squared...
- 1:49Speaker 2: Classical math views that as a static set of ordered pairs.
- 1:52Speaker 1: Just a list of facts.
- 1:53Speaker 2: Right. We'll put two, output four, input three, output nine.
- 1:55Speaker 2: It's essentially an infinite lookup table that just exists out
- 1:58Speaker 2: there in the abstract universe.
- 2:00Speaker 1: So it's just stating what a relationship is. If classical
- 2:03Speaker 1: math is like a restaurant menu listing what a dish is,
- 2:07Speaker 1: lambda calculus is the actual step-by-step recipe the chef executes
- 2:11Speaker 1: in the kitchen.
- 2:12Speaker 2: Oh, that is a perfect analogy, actually. Yes. Classical math
- 2:16Speaker 2: is descriptive, but Church and his contemporaries They wanted a
- 2:20Speaker 2: system based on operations. They wanted a system that described
- 2:24Speaker 2: what things actively do. Right.
- 2:26Speaker 1: The cooking part.
- 2:27Speaker 2: Exactly. In lambda calculus, a function isn't a static lookup table.
- 2:32Speaker 2: It is a process. It's an active set of instructions
- 2:35Speaker 2: that mechanically modifies an input.
- 2:37Speaker 1: Okay. I see. So it's kind of like the difference
- 2:38Speaker 1: between declarative and imperative programming. Like writing HTML where you
- 2:43Speaker 1: just say, you know, make this text bold versus writing
- 2:46Speaker 1: C + + where where you explicitly tell a machine,
- 2:49Speaker 1: take this variable, multiply it, store it.
- 2:51Speaker 2: The programming analogy is spot on, though I'd push it
- 2:53Speaker 2: even further, honestly.
- 2:55Speaker 1: Oh, really?
- 2:55Speaker 2: Yeah, because lambda calculus completely isolates the concept of the
- 2:59Speaker 2: function itself. You don't even need to name the function.
- 3:01Speaker 1: Wait, really? No names?
- 3:02Speaker 2: Nope. It just becomes an anonymous, raw, mechanical process. And
- 3:06Speaker 2: because it's an active process, you can manipulate exactly how
- 3:11Speaker 2: inputs are fed into the machine.
- 3:13Speaker 1: How does that work, practically?
- 3:15Speaker 2: Let's talk about functions that need multiple inputs. Like say
- 3:18Speaker 2: you want to calculate the area of a rectangle, you
- 3:20Speaker 2: need length and width, right?
- 3:22Speaker 1: Right, two variables.
- 3:23Speaker 2: In classical math, you feed both variables into the function
- 3:27Speaker 2: at the exact same time. But lambda calculus prefers to
- 3:30Speaker 2: handle one thing at a time. So they use this
- 3:33Speaker 2: mechanical workaround called currying.
- 3:35Speaker 1: Currying, okay. How does that fundamentally change the operation?
- 3:38Speaker 2: So instead of taking two inputs simultaneously, Currying transforms a
- 3:43Speaker 2: multivariable function into a chain of single variable functions.
- 3:46Speaker 1: Like a sequence.
- 3:47Speaker 2: Exactly. If we have our area function, instead of asking
- 3:50Speaker 2: for length and width together, the function first asks only
- 3:54Speaker 2: for the length. Let's say the length is 5. When
- 3:56Speaker 2: you feed that 5 into the function, it doesn't give
- 3:58Speaker 2: you the area. It spits out a brand new custom-built
- 4:02Speaker 2: function that we could call multiply by 5. Ah, okay.
- 4:06Speaker 1: So it processes the first variable and generates a new machine.
- 4:10Speaker 1: And then I take my second variable, the width, and
- 4:12Speaker 1: drop it into this newly created multiply by five machine.
- 4:16Speaker 2: You've got it. It breaks complex logic into a sequential pipeline. Now,
- 4:20Speaker 2: it's called currying after the logician Haskell Curry, who popularized it.
- 4:24Speaker 1: Right, Haskell Curry.
- 4:25Speaker 2: But our source text includes a great piece of historical
- 4:28Speaker 2: trivia here. Curry didn't actually invent this mechanic.
- 4:31Speaker 1: He didn't.
- 4:32Speaker 2: No, it was first conceptualized by a Russian mathematician named
- 4:35Speaker 2: Moses Schoenfinkel in 1924. And to his credit.
- 4:39Speaker 2: Curry actively credited Schoenfinkel in his work.
- 4:43Speaker 1: Then why on earth aren't we calling it Schoensinkling?
- 4:45Speaker 2: The historical consensus, which the textbook very dryly notes, by
- 4:49Speaker 2: the way, is that mathematicians simply preferred pronouncing currying.
- 4:52Speaker 1: You're kidding.
- 4:53Speaker 2: No, I mean, Schoenfinkel, a function just doesn't roll off
- 4:57Speaker 2: the tongue quite as well.
- 4:58Speaker 1: I mean, that is incredibly unfair to Schoenfinkel, but I
- 5:01Speaker 1: guess I get the phonetic preference.
- 5:03Speaker 2: Yeah, history can be brutal that way.
- 5:04Speaker 1: Right. So we have this system of anonymous functions and
- 5:08Speaker 1: sequential pipelines. But, you know, a recipe is totally useless
- 5:13Speaker 1: unless you actually cook it. How does this system execute
- 5:16Speaker 1: its instructions? What is the actual mechanism here?
- 5:20Speaker 2: The core engine of computation here is a mechanical process
- 5:23Speaker 2: called beta reduction.
- 5:24Speaker 1: Beta reduction.
- 5:25Speaker 2: It's the formal act of simplification. So when you apply
- 5:29Speaker 2: a function to an argument, beta reduction is the literal
- 5:32Speaker 2: physical step of scanning through the function's internal blueprint and
- 5:36Speaker 2: substituting the argument wherever the corresponding variable appears.
- 5:39Speaker 1: So if my function says add x to x and
- 5:41Speaker 1: my input is 4, beta reduction is just the act
- 5:44Speaker 1: of erasing the x's and writing in the 4's.
- 5:47Speaker 2: That is the physical mechanism, exactly. And you keep performing
- 5:50Speaker 2: these beta reductions, these substitutions, layer by layer, function by function.
- 5:54Speaker 1: Just chipping away at it.
- 5:55Speaker 2: Right. And the ultimate goal of this simplification process is
- 5:58Speaker 2: to reach what the text calls a normal form.
- 6:01Speaker 1: Meaning a state where no more reductions are possible?
- 6:04Speaker 2: Correct. A normal form is a final irreducible state. All
- 6:09Speaker 2: the operations have been carried out. All the substitutions are done.
- 6:12Speaker 2: And you are just left with the final answer.
- 6:15Speaker 1: The program finished running.
- 6:16Speaker 2: Exactly. In modern terms.
- 6:18Speaker 1: Wait, does everything actually simplify down neatly to a normal form? Like,
- 6:22Speaker 1: if I just blindly follow the mechanical rules of beta reduction,
- 6:26Speaker 1: will I always hit a wall where the computation finishes?
- 6:28Speaker 2: No. And honestly, that realization was a massive theoretical breakthrough.
- 6:33Speaker 2: Not every term has a normal form. The textbook highlights
- 6:37Speaker 2: the most famous counterexample known as the omega term.
- 6:40Speaker 1: Okay, walk me through the omega term. How does it
- 6:42Speaker 1: break the system?
- 6:43Speaker 2: Well, the omega term consists of a specific function applied
- 6:46Speaker 2: to itself. The function's rule is very simple. It says,
- 6:49Speaker 2: take whatever input you're given and apply that input to itself.
- 6:52Speaker 1: Okay, so if I give it function A, it outputs
- 6:54Speaker 1: function A applied to function A.
- 6:56Speaker 2: Right, but in the omega term, the input you give
- 6:59Speaker 2: it is that exact same function.
- 7:01Speaker 1: Oh, okay, I see the trap.
- 7:03Speaker 2: Yeah, let's run the beta reduction. The function looks at
- 7:06Speaker 2: its input, which is itself, and follows its one rule,
- 7:10Speaker 2: duplicate the input and apply them to each other. Uh-huh.
- 7:13Speaker 2: When it executes that rule, the output it generates is
- 7:15Speaker 2: the exact same arrangement it started with.
- 7:17Speaker 1: It just swallowed itself and spat out an identical clone
- 7:20Speaker 1: of the problem?
- 7:21Speaker 2: And if you run beta reduction on that new clone,
- 7:23Speaker 2: it does it again.
- 7:24Speaker 1: And again?
- 7:25Speaker 2: And again. Forever. It yields itself endlessly. It represents a pure,
- 7:30Speaker 2: infinite loop. It will never, under any circumstances, reach a
- 7:34Speaker 2: normal form.
- 7:35Speaker 1: So it's the mathematical equivalent of a software crash. The
- 7:38Speaker 1: logic is perfectly sound. The rules are being followed. But
- 7:42Speaker 1: the structure of the instructions creates a bottomless pit.
- 7:45Speaker 2: Which naturally led logicians to worry about the stability of
- 7:48Speaker 2: the entire system. I mean, if computation can fall into
- 7:51Speaker 2: infinite loops, how reliable is it when it actually does work?
- 7:54Speaker 1: Right.
- 7:54Speaker 2: What's fascinating here is how they solved this. This brings
- 7:58Speaker 2: us to a crucial proof in the text called the
- 8:00Speaker 2: Church-Rosser theorem. This establishes a property called confluence.
- 8:04Speaker 1: Confluence, like rivers merging into a single stream.
- 8:08Speaker 2: That geographical metaphor works perfectly here. Imagine you have a
- 8:12Speaker 2: massive complex equation. It has dozens of nested functions.
- 8:16Speaker 1: Okay.
- 8:17Speaker 2: And there are multiple places where you could choose to
- 8:19Speaker 2: start your beta reductions. You could reduce the innermost functions first,
- 8:23Speaker 2: or maybe start from the outside.
- 8:24Speaker 1: Like deciding whether to solve the left side of an
- 8:27Speaker 1: algebra equation before the right side.
- 8:29Speaker 2: Yes. The underlying anxiety was, well, if I evaluate this
- 8:33Speaker 2: code in a different order, will I get a different
- 8:35Speaker 2: final answer?
- 8:36Speaker 1: Well, that would be a disaster. Right.
- 8:38Speaker 2: But the Church-Rosser theorem proves that you will not. It
- 8:41Speaker 2: guarantees that if a term does have a normal form,
- 8:44Speaker 2: the sequence of reductions does not matter. The pads might
- 8:48Speaker 2: diverge widely during the calculation, but they will invariably flow
- 8:51Speaker 2: back together. All pads that terminate will uniquely end up
- 8:54Speaker 2: in the exact same final state.
- 8:56Speaker 1: That is massive. Because if computation wasn't confluent, parallel processing
- 9:01Speaker 1: wouldn't work at all. Your computer would give you a
- 9:04Speaker 1: different answer to the same math problem, depending on which
- 9:07Speaker 1: CPU core happened to finish its chunk of the calculation first.
- 9:11Speaker 2: Exactly. Confluence provides the mathematical guarantee that computation is deterministic.
- 9:16Speaker 2: It secures the entire foundation.
- 9:18Speaker 1: Okay, so we have this solid foundation. We have the
- 9:20Speaker 1: engine of beta reduction substituting inputs for variables. But as
- 9:25Speaker 1: I'm picturing this operating at scale, dealing with all these
- 9:28Speaker 1: variables sounds incredibly messy.
- 9:30Speaker 2: Oh, it is.
- 9:31Speaker 1: Like the textbook mentioned something called alpha conversion or variable clashes.
- 9:35Speaker 1: If I have a massive chain of functions... and an
- 9:37Speaker 1: outer function uses the variable x, and some deeply nested
- 9:41Speaker 1: inner function also happens to use x, a flying substitution
- 9:45Speaker 1: is gonna cause total chaos, right?
- 9:47Speaker 2: Oh, absolutely.
- 9:47Speaker 1: The math is just gonna trip over its own naming conventions.
- 9:51Speaker 2: It is a bureaucratic nightmare. You constantly have to scan
- 9:53Speaker 2: ahead and rename variables, changing an x to a z
- 9:57Speaker 2: or a y just to ensure that substituting a value
- 10:00Speaker 2: into the outer function doesn't accidentally overwrite the logic of
- 10:03Speaker 2: the inner function.
- 10:04Speaker 1: So if tracking and renaming variables is this much of
- 10:07Speaker 1: a liability, is there a cleaner way to compute, like
- 10:11Speaker 1: without them? Yes.
- 10:12Speaker 2: And that exact frustration led to one of the most elegant,
- 10:16Speaker 2: minimalist concepts in the entire textbook. It's called combinatory logic,
- 10:21Speaker 2: or CL.
- 10:21Speaker 1: Combinatory logic.
- 10:23Speaker 2: It was pioneered by our tragic figure, Moses Schoenfinkel, and
- 10:27Speaker 2: later heavily developed by Haskell Curry. CL achieves the exact
- 10:31Speaker 2: same computational power as lambda calculus. It can compute anything
- 10:35Speaker 2: a Turing machine can compute. Okay. But it completely eliminates variables.
- 10:38Speaker 2: There are no Xs, no Ys, no bound variables to
- 10:41Speaker 2: rename or track whatsoever.
- 10:43Speaker 1: Okay, doing advanced mathematics without variables sounds like trying to
- 10:46Speaker 1: write a novel without using verbs. How do you pass
- 10:49Speaker 1: data around if you don't have placeholders for it?
- 10:51Speaker 2: By relying entirely on pure routing mechanisms. Instead of variables,
- 10:55Speaker 2: this entire universe of computation is built out of just
- 10:58Speaker 2: three foundational operators called combinators.
- 11:01Speaker 1: Just three?
- 11:01Speaker 2: Just three. They are represented by the letters S, K,
- 11:04Speaker 2: and I.
- 11:05Speaker 1: I am extremely skeptical you can build all of software
- 11:08Speaker 1: out of three letters. Walk me through the mechanics of S, K,
- 11:11Speaker 1: and I.
- 11:12Speaker 2: Okay, let's start with the simplest one, the I combinator.
- 11:15Speaker 2: I stands for identity. Its mechanical rule is trivial. Whatever
- 11:19Speaker 2: argument you hand to it, it hands it right back,
- 11:22Speaker 2: completely unchanged.
- 11:23Speaker 1: So apply i to x, you get x.
- 11:26Speaker 2: Exactly.
- 11:27Speaker 1: Okay, that seems almost useless on its own, but I
- 11:29Speaker 1: assume that x is like a buffer or a placeholder
- 11:32Speaker 1: in complex chains. What about k?
- 11:35Speaker 2: K forms constant functions. It requires two arguments. When you
- 11:39Speaker 2: apply k to a first argument and then a second argument,
- 11:42Speaker 2: it strictly returns the first argument and permanently deletes the second.
- 11:46Speaker 1: So it's a mechanic of erasure.
- 11:48Speaker 2: Erasure and selection.
- 11:49Speaker 1: Okay, so if I feed K an apple and an orange,
- 11:52Speaker 1: it just hands me back the apple and throws the
- 11:54Speaker 1: orange into the void.
- 11:55Speaker 2: Exactly. It allows the system to ignore irrelevant data and
- 11:58Speaker 2: force a specific output. Now, the heavy lifter is the
- 12:01Speaker 2: S combinator.
- 12:02Speaker 1: What does S do?
- 12:03Speaker 2: S is a composition operator that handles distribution. It takes
- 12:07Speaker 2: three arguments. Let's call them X, Y, and Z.
- 12:09Speaker 1: Okay, I've been tracking.
- 12:10Speaker 2: When S receives all three, it takes the third argument
- 12:13Speaker 2: Z and duplicates it. It feeds one copy of Z
- 12:16Speaker 2: into X and the other copy of Z into Y.
- 12:18Speaker 2: Then it takes the result of that Y calculation and
- 12:21Speaker 2: feeds it into the X calculation. It essentially creates a
- 12:24Speaker 2: crisscrossing network of data flow.
- 12:27Speaker 1: Oh, wow. I think I see it. It's like building
- 12:29Speaker 1: a highly complex functioning Lego city.
- 12:32Speaker 2: Yes.
- 12:33Speaker 1: But instead of static plastic bricks, S, K, and I
- 12:36Speaker 1: are these active junctions. You don't need infinite variable names
- 12:40Speaker 1: to tell the data where to go. You just arrange
- 12:42Speaker 1: an F block. a K block, and an I block
- 12:45Speaker 1: in a massive specific physical sequence.
- 12:47Speaker 2: Right.
- 12:48Speaker 1: And the blocks themselves automatically route, duplicate, and delete the
- 12:51Speaker 1: data as it flows through the pipes.
- 12:53Speaker 2: That active Lego analogy is very close. You are building
- 12:57Speaker 2: complex logic gates out of the most primitive structural routing
- 13:00Speaker 2: elements imaginable. You're hardwiring the logic directly into the architecture
- 13:04Speaker 2: of the formula.
- 13:05Speaker 1: It's incredibly beautiful, honestly.
- 13:06Speaker 2: It is mathematically beautiful, yeah. But the history behind its
- 13:10Speaker 2: creation is quite sobering. The textbook actually notes the tragic
- 13:14Speaker 2: arc of Moses Schoenfinkel's life.
- 13:16Speaker 1: Felt right. You mentioned he was a tragic figure.
- 13:18Speaker 2: He was. He first conceptualized this variable-free architecture back in 1920.
- 13:24Speaker 2: It was a stroke of absolute genius that literally laid
- 13:27Speaker 2: the groundwork for functional programming.
- 13:30Speaker 1: But he didn't get to see it flourish, did he?
- 13:32Speaker 2: No, unfortunately. Schoenfinkel presented his initial paper, but he suffered
- 13:36Speaker 2: from severe mental illness. He never fully developed his theories
- 13:39Speaker 2: or published extensively after that initial breakthrough.
- 13:42Speaker 1: That's awful.
- 13:43Speaker 2: He withdrew entirely from the mathematical community, returned to the
- 13:46Speaker 2: Soviet Union, and tragically died in poverty in a Moscow
- 13:50Speaker 2: hospital in 1942. The heavy lifting to formalize and save
- 13:54Speaker 2: his ideas was all done later by Curry.
- 13:57Speaker 1: Man, that completely reframes how you look at these pristine
- 14:01Speaker 1: abstract equations. We treat math as this cold universal truth.
- 14:06Speaker 1: but it's dragged into existence by flawed, fragile human beings who,
- 14:11Speaker 1: you know, often don't survive the process.
- 14:13Speaker 2: It's a stark reminder of the human cost behind foundational science.
- 14:17Speaker 2: But Schoenfinkel's legacy is monumental. Those three simple routing blocks,
- 14:21Speaker 2: SK and I, prove that immense complexity could emerge from strict,
- 14:24Speaker 2: mindless simplicity.
- 14:25Speaker 1: Okay, let me challenge that complexity for a second, though.
- 14:28Speaker 1: I understand the SK, and I can route data. I
- 14:31Speaker 1: can see how you could build basic logic gates. But
- 14:34Speaker 1: real software requires iteration.
- 14:37Speaker 2: Right.
- 14:37Speaker 1: It requires loops. It requires code that can run itself
- 14:40Speaker 1: over and over until a condition is met. Now, we
- 14:44Speaker 1: just established that the omega term causes an infinite loop,
- 14:47Speaker 1: but that's a crash.
- 14:48Speaker 2: Yes, an uncontrolled one.
- 14:50Speaker 1: So how do you build a controlled loop out of
- 14:52Speaker 1: tiny sk and i blocks that don't even have variables
- 14:56Speaker 1: to track their state?
- 14:58Speaker 2: Well, to answer that, we have to explore the fixed
- 15:00Speaker 2: point theorem. In these accommodator systems, every operator has a
- 15:04Speaker 2: fixed point. And to exploit this, logicians discovered specialized tools
- 15:08Speaker 2: called fixed-point combinators.
- 15:10Speaker 1: Okay.
- 15:10Speaker 2: The most famous one was formulated by Alan Turing in 1937,
- 15:14Speaker 2: and it's universally known as the Y-combinator.
- 15:16Speaker 1: Wait, my brain is breaking a bit here. I know
- 15:18Speaker 1: what recursion is, right? A function calling itself. But in
- 15:21Speaker 1: a normal language, with variables, you pass the current state
- 15:24Speaker 1: back into the function. If we have no variables and
- 15:27Speaker 1: the Y-combinator just forces a function to self-apply... wouldn't it
- 15:31Speaker 1: just instantly evaluate into an infinite stack overflow? Like how
- 15:35Speaker 1: does it actually hold onto data without crashing?
- 15:38Speaker 2: It's a fantastic question and it really gets to the
- 15:41Speaker 2: heart of something called lazy evaluation.
- 15:43Speaker 1: Lazy evaluation.
- 15:44Speaker 2: Yeah. The Y Combinator doesn't evaluate infinitely all at once.
- 15:48Speaker 2: The mechanic of the Y Combinator is that it takes
- 15:50Speaker 2: your target function and it passes the target function back
- 15:54Speaker 2: into itself as an argument.
- 15:55Speaker 1: Okay.
- 15:56Speaker 2: But crucially, it only expands one layer at a time
- 15:59Speaker 2: precisely when the next step of calculation is required.
- 16:03Speaker 1: Oh, so it's not an infinite explosion. It's an infinite blueprint.
- 16:06Speaker 1: It says, whenever you resolve this current step and need
- 16:08Speaker 1: the next one, here is the mechanism to generate it.
- 16:11Speaker 2: Exactly. It creates controlled recursive lube out of thin air.
- 16:14Speaker 2: It allows you to run continuous state updating processes using
- 16:18Speaker 2: nothing but blind routing combinators.
- 16:21Speaker 1: Wow. Actually, you know, the textbook outlines some bizarre side
- 16:24Speaker 1: effects of this fixed point property. Because you can bend
- 16:28Speaker 1: functions into these looping shapes, some combinators start exhibiting what
- 16:32Speaker 1: almost looks like a personality.
- 16:33Speaker 2: Yeah, they really do.
- 16:34Speaker 1: The text describes one that acts as a garbage disposer,
- 16:38Speaker 1: which basically swallows every single argument presented to it in
- 16:42Speaker 1: sequence forever without ever outputting a single change. Right. And
- 16:46Speaker 1: another acts as a bureaucrat, internally permuting and shuffling its
- 16:50Speaker 1: arguments around in circles with zero actual effect on the outcome.
- 16:54Speaker 2: They are essentially mathematical black holes and treadmills.
- 16:57Speaker 1: It's hilarious. Like, Turing essentially proved that at the bedrock
- 17:01Speaker 1: of mathematics, it is possible to perfectly simulate endless circular
- 17:06Speaker 1: corporate bureaucracy. Just a function endlessly handing paperwork to itself
- 17:11Speaker 1: without ever producing a final report.
- 17:13Speaker 2: The bureaucrat function is a perfect way to visualize it.
- 17:15Speaker 2: But beyond the humor, these behaviors highlight a serious problem.
- 17:19Speaker 1: What's that?
- 17:20Speaker 2: Well, if functions can be twisted into these bizarre forms...
- 17:22Speaker 2: How do you mathematically prove what a function actually is?
- 17:26Speaker 2: This brings us to Bohm's theorem.
- 17:28Speaker 1: Okay, what does Bohm contribute?
- 17:30Speaker 2: Bohm's theorem deals with distinct normal forms. It proves that
- 17:35Speaker 2: if you have two pieces of code that have reached
- 17:38Speaker 2: their final irreducible state and their syntax is genuinely different,
- 17:43Speaker 2: you can always distinguish them purely by their behavior.
- 17:46Speaker 1: Meaning you don't have to look at the underlying code
- 17:48Speaker 1: to prove they are different.
- 17:50Speaker 2: Right. If they're different, Bum proved there is always a
- 17:53Speaker 2: specific sequence of inputs, a mathematical probe, essentially, that you
- 17:58Speaker 2: can feed into both of them that will force them
- 18:00Speaker 2: to reveal their difference.
- 18:01Speaker 1: Like a diet of inputs.
- 18:02Speaker 2: Exactly. You can force one to output the equivalent of
- 18:05Speaker 2: exactly X and the other to output exactly Y.
- 18:08Speaker 1: Here's where it gets really interesting. We have controlled recursion
- 18:12Speaker 1: with the Y combinator. We have routing with SK and I.
- 18:15Speaker 1: We have behavioral proofs with Bum. But we haven't mentioned
- 18:19Speaker 1: a single number.
- 18:20Speaker 2: No, we haven't.
- 18:21Speaker 1: If this system is supposed to be the foundation of
- 18:23Speaker 1: all computation, how on earth do you do real math
- 18:27Speaker 1: without numbers?
- 18:28Speaker 2: Alonzo Church solved this by inventing what we now call
- 18:32Speaker 2: church numerals. In this universe, numbers aren't digits. They aren't
- 18:36Speaker 2: concepts of quantity. Numbers are actions.
- 18:39Speaker 1: I'm going to need you to unpack numbers or actions.
- 18:42Speaker 2: Let's look at the church numeral for two.
- 18:43Speaker 1: Okay.
- 18:44Speaker 2: Two is not a symbol. Two is defined purely as
- 18:47Speaker 2: a function that takes an action and applies it to
- 18:49Speaker 2: an argument exactly twice. The number three is a function
- 18:52Speaker 2: that takes an action and applies it three times. You
- 18:55Speaker 2: define the concept of number by the mechanical act of repetition.
- 18:59Speaker 1: Okay, so two is just the structural blueprint of doing
- 19:02Speaker 1: something twice. But how do you perform arithmetic? Like, how
- 19:06Speaker 1: do you add church numeral two and church numeral three?
- 19:08Speaker 2: Through function composition. Addition in the system means taking the
- 19:12Speaker 2: function that says do this twice and embedding it inside
- 19:15Speaker 2: the function that says do this three times.
- 19:17Speaker 1: Oh, wow.
- 19:17Speaker 2: You route the output of one into the input of
- 19:19Speaker 2: the other. The resulting combined structure now behaves as a
- 19:22Speaker 2: function that applies an action five times. And that new
- 19:25Speaker 2: behavior literally is the number five.
- 19:27Speaker 1: That is staggering. You've abstracted arithmetic into pure verb tense.
- 19:32Speaker 1: And I assume that once you have addition, you can
- 19:34Speaker 1: build multiplication by stacking additions and exponents by stacking multiplications.
- 19:39Speaker 2: You can. The textbook mathematically proves that with church numerals,
- 19:43Speaker 2: this variable-free SKI combinator system can represent all primitive and
- 19:49Speaker 2: partial recurrents. functions.
- 19:50Speaker 1: Incredible.
- 19:51Speaker 2: It has the exact same theoretical power as a Turing machine.
- 19:55Speaker 2: It can compute literally anything that is computable in the universe.
- 19:58Speaker 1: So if this system can compute anything, what is the limit?
- 20:01Speaker 1: What can't it do? Because right now it sounds like
- 20:04Speaker 1: an omnipotent logical engine.
- 20:06Speaker 2: It isn't omnipotent. And that's where we hit the most
- 20:08Speaker 2: profound wall in computer science. The textbook details the Scott-Curry
- 20:12Speaker 2: undecidability theorem.
- 20:14Speaker 1: Undecidability. Yeah.
- 20:15Speaker 2: This builds directly on Church's 1936 work on the enscheidings
- 20:20Speaker 2: problem or the decision problem. Right.
- 20:22Speaker 1: The quest to find a master algorithm that can look
- 20:25Speaker 1: at any mathematical statement and definitively output whether it's true
- 20:29Speaker 1: or false.
- 20:30Speaker 2: Yes. And Church, alongside Turing, proved that such a master
- 20:33Speaker 2: algorithm is impossible. The Scott-Curry theorem proves this specifically within
- 20:38Speaker 2: combinatory logic. It states that there is fundamentally no recursive way,
- 20:42Speaker 2: no algorithm you could ever write, to definitively decide if
- 20:46Speaker 2: an arbitrary piece of code will eventually reach a normal form.
- 20:49Speaker 1: Because to check if the code finishes, the master program
- 20:53Speaker 1: essentially has to run the code. And if the code
- 20:56Speaker 1: happens to be an omega term, an infinite loop, the
- 20:59Speaker 1: master program checking it gets sucked into the infinite loop too.
- 21:02Speaker 2: Precisely. You cannot mathematically verify if a program will finish
- 21:05Speaker 2: without running it, and running it risks infinite non-termination. Furthermore,
- 21:11Speaker 2: the theorem proves you cannot definitively decide if two arbitrary
- 21:14Speaker 2: programs are mathematically equivalent before running them.
- 21:17Speaker 1: So the system is powerful enough to compute anything, but
- 21:20Speaker 1: too complex to analyze itself perfectly. Yes.
- 21:24Speaker 2: And honestly, this isn't just abstract philosophy. This mathematical wall
- 21:28Speaker 2: is exactly why your computer sometimes freezes indefinitely.
- 21:31Speaker 1: So if you've ever stared at a spinning beach ball
- 21:33Speaker 1: of death on your screen or watched an app hang
- 21:37Speaker 1: and wondered why the operating system can't just figure out
- 21:39Speaker 1: that the program is stuck and kill it, this is why.
- 21:42Speaker 2: Exactly.
- 21:43Speaker 1: It's not bad hardware. The freezing computer is a physical
- 21:47Speaker 1: manifestation of the Scott Curry undecidability theorem. There is fundamentally
- 21:52Speaker 1: no equation in the universe that that can look at
- 21:54Speaker 1: arbitrary software and definitively predict if it's just processing a
- 21:58Speaker 1: really heavy calculation or if it's trapped in an infinite
- 22:01Speaker 1: combinator loop forever.
- 22:03Speaker 2: The limits of logic are hardwired into every device we use.
- 22:07Speaker 2: By building a mathematical system capable of infinite complexity and self-reference,
- 22:11Speaker 2: We permanently sacrificed the ability to perfectly predict its behavior.
- 22:15Speaker 1: What a profound journey. I mean, we started by looking
- 22:17Speaker 1: at a 1920s rebellion that wanted to view math as
- 22:20Speaker 1: dynamic recipes instead of static menus. We watched Moses Schoenfinkel
- 22:24Speaker 1: strip away all the variables, leaving us with a pure
- 22:27Speaker 1: logic engine built entirely out of SK & I Lego
- 22:31Speaker 1: routing blocks. We discovered how the Y Combinator bends those
- 22:35Speaker 1: blocks into endless recursive loops and how church numerals turn
- 22:39Speaker 1: pure action into mathematics. And finally, we hit the hard,
- 22:43Speaker 1: unpassable limit of logic and undecidability.
- 22:47Speaker 2: It highlights the beautiful tension in computer science. The very
- 22:50Speaker 2: mechanisms that give the system its infinite power self-application in
- 22:53Speaker 2: recursive loops are the exact same mechanisms that make it
- 22:56Speaker 2: impossible to perfectly control or predict.
- 22:59Speaker 1: I want to leave you with a final thought to
- 23:00Speaker 1: mull over. Classical math was terrified of paradoxes. It strictly
- 23:04Speaker 1: banned self-application. A function was never allowed to eat itself.
- 23:08Speaker 1: But lambda calculus and combinators looked at self-application. I made
- 23:12Speaker 1: it the engine of the entire system. That infinite feedback
- 23:15Speaker 1: loop is what makes computation powerful enough to do anything.
- 23:19Speaker 1: So if everything in advanced computing boils down to abstract operations,
- 23:23Speaker 1: endlessly feeding their own outputs back into themselves to generate complexity.
- 23:29Speaker 1: Could human consciousness, our own deep self-awareness, just be a
- 23:32Speaker 1: biological fixed point combinator running in the wetware of our brains?
- 23:36Speaker 2: Oh, wow.
- 23:36Speaker 1: Maybe we aren't just static sets of memories. Maybe we
- 23:39Speaker 1: are the operations. infinitely looking at itself in the mirror.
- 23:41Speaker 1: Just something to think about the next time your screen freezes.