Math Behind Software
summary
Explains the concrete claim that vacuous truth is why empty collections make predicates like allMatch returns true, not a bug; demonstrates this with Java Stream.allMatch plus Scala forAll, JavaScript Array.every, Kotlin/Python all, and an IntelliJ compiler simplification screenshot that replaces a predicate with literal true; frames the logic as "for all x in set, if P(x) then Q(x)" and shows the empty-set case evaluates true, clarifying surprising counterintuitive examples and practical implications.
AI-written summary · about
chapters (5)
- 0:00Start
- 3:01Why calling allMatch on empty Stream always return true?
- 3:59Is a concept from logic used to describe all statements that are evaluated as true because their base condition (Antecedent) cannot be fulfilled
- 7:55How exactly do Stream and allMatch fit into this?
- 11:24Vacuous truth - recap: ⚫ is a concept from the mathematics field of logic • represents logical statements with a false base condition ⚫ is the reason why all Match and their counterparts will return true for empty sequences • can sometimes occur in real life
related talks
39mNothing is Something
01h 06mDesigning Applications with Functional Programming Constructs
24mProving False in Object Oriented Verification Programs by Exploiting Non-Termination
47mSimplifying Scala Collections
38mPattern Matching in Java: Better Code, Better APIs
01h 05mVerifying Infinitely Many Programs at Once
44mNothing is Something
44mUnconditional Code
