logoalt Hacker News

rramadass • yesterday at 12:42 PM • 0 replies • view on HN

The main issue is on how you define a "Type". There are two different logics here;

1) Classical Logic/Set Theory (this is the one you are talking about). Here Type = Set of values defined by membership rules (extensional/intensional).

2) Intuitionistic Constructive Logic/Type Theory (this is what is preferred for proof assistants). Here Type = Set of constructive (often inductive) proofs where the proof itself is the value.

As an example, think of defining the Type "Even_t"; under (1) it can be a predicate "x % 2 == 0", while under (2) it is defined inductively as "0 is Even_t; if construct(n) is Even_t so is construct(n+2)".

Notice that in the latter case a Type maps nicely into the idea of "a computation" and the fact that the very act of generation of one of its inhabitants constitutes "the proof" that the value has that property!

Whereas in Set theory Types are just subsets. But because you can mix anything into a set, an untyped term can be nonsense and will only get caught when you try to use it. Type Theory disallows it by construction.

This leads to the "Curry-Howard Correspondence" so you get a mapping between logic and type theory concepts - https://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspon...

This idea of "Typing" can further be extended (with additions of Dependent Types etc.) giving a complex matrix of powerful Type Theories represented by what is known as "Lambda Cube" (https://en.wikipedia.org/wiki/Lambda_cube) and their implementations in proof assistants eg. Calculus of Constructions (CoC), Calculus of Inductive Constructions (CIC) etc.

Finally, note that not all proof assistants use constructive logic, several use straight ZFC/HOL. Amongst those that use constructive logic it is usually only the kernel (containing the Type System) which models it while the rest of the system still uses classical logic.

PS: See also the previous discussion Why is dependent type theory more suitable than set theory for proof assistants? - https://news.ycombinator.com/item?id=25167468