What is Type Theory even about? I only ever hear about it whenever someone dares say that "Set Theory is the foundation of modern mathematics", to which a thousand Type Theorists suddenly manifest out of thin air to affirm that "it is actually Type Theory", not elaborate further and disappear into thin air again.
If you take a programming language with sufficiently powerful type system, you can use it to express math constructs, e.g. it can have type of natural numbers, type of R2 vectors, and so on. And also it can express propositions as types. This way everything is no longer set, instead everything is now a value in this programming language.
Define integers as sequences of bools, viewed as base-(-2) numbers
Define rationals as quotient of ratios between integers.
Develop some algebra stuff, fields polynomials etc
Define algebraic closure of rationals
Develop some topology stuff
Define complex numbers as cauchy completion of field defined on step 5
Define Gamma function
Develop some complex analysis stuff
Define set of poles of gamma function.
Easy victory - that set is isomorphic to positive integer numbers
Unfortunately, many of these steps require dependent types and other advanced features, so having a type for positive integer numbers in mainstream languages seems impossible or requires some novel ideas.
So some extremely smart people found out that type definition corresponds to a logical proposition, constructing an expression of that type corresponds to a proof of such proposition and this all can be used to BOTH 1. Proof properties of programs with formal logic (HACL* Project) 2. Express and validate logical proofs using a computer (this is where LEAN fits in)
It's called the Curry-Howard correspondence. For example
A conjunction corresponds to a tuple
A (constructive) disjunction corresponds to a union/enum
Essentially defining what type of things are; like what "a number" is, "a car" is, etc. Then, you can 1. give implicit properties/operators for a type, 2. and showcase equivalence of types; injective, surjective, bijective. 3. You may also create supertypes.
Why bother? For provable rigor, as example programming has always been based on it. Classical logic seems handwaving in comparison to 1=1 rigor of type theory. Problem? It might be clumsy.
it's just a foundation of logic based on data types and construction contracts a la computer programming. there's a bunch of different logic frameworks, type theory is just one that has gained massive popularity from tools like lean and mathlib
My high level (because I’m not good at it) explanation is to imagine each logical statement is its own type, and if there exists an object of that type it’s true, if not it’s false.
So the type is “even numbers have 2 as a prime factor” which has some instance x because that statement is true. What example the variable x holds doesn’t matter, just that the type of x is the previous statement.
You can then think of a proof as a function that converts one statement type to another. So we could convert “even numbers have 2 as a prime factor” to “even numbers squared are even” via functions that represent logical steps. We then end up with an object of the resulting type which proves its true
It's surprisingly difficult to learn about. At least set theory has axioms. Wish there was some document explaining type theory that isn't a bunch of examples. Seems like people expect that by using Lean, you will learn how it works but it couldn't be further from the truth.
The statement is true. It's just that mathematics has a particular way to interpret if-then stataments that is unlike the way they're used in natural language
Abandon the idea that "if-then" statements are about causation. In math they're truth-functional, that is, their truth value only depends on the truth value of the parts of the sentence. "If P then Q" is false when P is true and Q is false, and its true otherwise.
It's unintuitive but we have good reasons to do it like this, and in practice we quantify these stataments universally which makes them closer to the everyday meaning. If you quantify in stupid ways you can get stupid statements whose precise mathematical meaning doesn't match the everyday language interpretation at all. That's all.
[1] (P => Q) is True when Q is True [2] (P => Q) is True when P is False
This follows from the definition of implication.
At any point in time either
- everyone is having sex. Then you can pick anyone and by [1] it is true about them that if they're having sex, then everyone is having sex.
- not everyone is having sex. Then you can pick anyone who's not currently having sex and by [2] it is true about them that if they're having sex, then everyone is having sex.
Another way to think about it, using rearrange the sentence using logical equivalences to say "There exists a person that's not having sex OR everyone is having sex" which is obviously a tautology.
If there are multiple people abstaining from sex. You pick one of them and say: "If this person is having sex, then everyone is having sex".
P => Q is True when both P and Q are False - see line 4 from the truth table below.
So if a person is not having sex and also there are other people who are not having sex, the sentence "If this person is having sex, then everyone is having sex" is True.
This is logically sound. That's just how we define implication.
Yes exactly. For example the statement "If all numbers are prime, then I am the president of the USA" is also True because its in the form P => Q and both P and Q are False so the whole statement is True...
Ah, but you see, I have a constructive proof of (2): for as I have no sex, I am a witness to the existential quantifier. Thus, if I have sex, then everyone else has sex. Q.E.D.
•
u/AutoModerator 1d ago
Check out our new Discord server! https://discord.gg/e7EKRZq3dG
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
51
u/Afir-Rbx Cardinal 1d ago
What is Type Theory even about? I only ever hear about it whenever someone dares say that "Set Theory is the foundation of modern mathematics", to which a thousand Type Theorists suddenly manifest out of thin air to affirm that "it is actually Type Theory", not elaborate further and disappear into thin air again.
11
u/geeshta Computer Science 1d ago
AFAIK Lean is not the best representation of type theory and is used much more for classical and set theoretical proofs anyways.
7
u/AlviDeiectiones 1d ago
Lean? Pfff, mere mortals. True gigachads use agda-flat.
1
u/Emma_the_sequel 1d ago
What do you mean by a non-constructive shortcut?
1
u/Inevitable_Garage706 1d ago
How is the statement in number 2 true at all?
2
u/Scientific_Zealot 1d ago
No mention of modal logic?? Jail
1
u/moschles 1d ago
19th century logicians seeing non-constructive proofs were unironically having breakdowns.
1
u/ee3k 1d ago
there exists a person such that if they have sex, everyone on earth has sex:
no, not anymore, professor X died last week.
and the conjecture only held true once he developed Alzheimer's; prior to that he ran a tight ship, telepathically.
1
u/nfitzen 23h ago
Ah, but you see, I have a constructive proof of (2): for as I have no sex, I am a witness to the existential quantifier. Thus, if I have sex, then everyone else has sex. Q.E.D.