Your SlideShare is downloading.
×

- 1. Math behind software
- 2. How are math & software related?
- 3. How are math & software related? Binary System
- 4. How are math & software related? Binary System Algorithms
- 5. How are math & software related? Binary System Algorithms CAP theorem
- 6. How are math & software related? Binary System Algorithms CAP theorem Monads
- 7. Why calling allMatch on empty Stream always return true?
- 8. Why calling allMatch on empty Stream always return true? ...And what does it have to do with math?
- 9. Vacuous truth
- 10. Vacuous truth
- 11. Vacuous truth Is a concept from logic used to describe all statements that are evaluated as true because their base condition (Antecedent) cannot be fulfilled
- 12. Vacuous truth Is a concept from logic used to describe all statements that are evaluated as true because their base condition (Antecedent) cannot be fulfilled Or in a more mathematical syntax
- 13. S: P ⇒Q
- 14. S: P ⇒Q Then, if P is false, S is logically true and considered vacuously true.
- 15. S: P ⇒Q Then, if P is false, S is logically true and considered vacuously true. It can also be defined with quantificator - for all ∀:
- 16. S: P ⇒Q Then, if P is false, S is logically true and considered vacuously true. It can also be defined with quantificator - for all ∀: ∀x ∈B : P(x) ⇒Q(x)
- 17. S: P ⇒Q Then, if P is false, S is logically true and considered vacuously true. It can also be defined with quantificator - for all ∀: ∀x ∈B : P(x) ⇒Q(x) Then, if P(x) is false for all x, our statement is also considered vacuously true.
- 18. Example If there are any developers in the room next door, then they all work with Haskell.
- 19. Example If there are any developers in the room next door, then they all work with Haskell. the base condition is: If there are any developers in the room next door
- 20. Example If there are any developers in the room next door, then they all work with Haskell. the base condition is: If there are any developers in the room next door if the room's empty, the statement is evaluated as vacuously true
- 21. Haskell devs & mixed syntax
- 22. Haskell devs & mixed syntax P(x) is our explicit base condition - there are any developers in the room
- 23. Haskell devs & mixed syntax P(x) is our explicit base condition - there are any developers in the room Q(x) is our 'then' clause - they all work in Haskell
- 24. Haskell devs & mixed syntax P(x) is our explicit base condition - there are any developers in the room Q(x) is our 'then' clause - they all work in Haskell B is our set - all the people in the room
- 25. Haskell devs & mixed syntax P(x) is our explicit base condition - there are any developers in the room Q(x) is our 'then' clause - they all work in Haskell B is our set - all the people in the room We can write the example in this form: For all people from the room, if a person is a developer, then they work with Haskell.
- 26. How exactly do Stream and allMatch fit into this?
- 27. How exactly do Stream and allMatch fit into this? ∀x ∈B : P(x) ⇒Q(x)
- 28. Similar behavior in other languages
- 29. Similar behavior in other languages In Scala: forall, present in many collections
- 30. Similar behavior in other languages In Scala: forall, present in many collections In JavaScript: every from array prototype
- 31. Similar behavior in other languages In Scala: forall, present in many collections In JavaScript: every from array prototype In Python & Kotlin: all - which tests if all elements of an array are true, will also return true for empty arrays
- 32. When hell freezes... Vacuous truth IRL when hell freezes when pigs fly when shrimps learn to whistle when the sun starts rising in the west ...or any other absurdity based on an obviously false or impossible condition
- 33. Vacuous truth - recap: is a concept from the mathematics field of logic represents logical statements with a false base condition is the reason why allMatch and their counterparts will return true for empty sequences can sometimes occur in real life
- 34. Thank you! Bartek Żyliński @PaskSoftware softwaremill.com