58
votes
Accepted
What exactly is the semantic difference between set and type?
To understand the difference between sets and types, ones has to go back to pre-mathematical ideas of "collection" and "construction", and see how sets and types mathematize these.
...
40
votes
Accepted
Why is C's void type not analogous to the empty/bottom type?
In C, void is used for multiple unrelated things. Depending on what it's used for, its meaning may be a unit type, an empty type, or something else.
When ...
38
votes
What's the difference between a type and a kind?
Here, "values", "types", and "kinds" have formal meanings, so considering their common English usage or analogies to classifying automobiles will only get you so far.
My answer pertains to the formal ...
32
votes
Accepted
Why must a function with polymorphic type `forall t: Type, t->t` be the identity function?
The first thing to note is that this isn't necessarily true. For example, depending on the language a function with that type, besides being the identity function, could: 1) loop forever, 2) mutate ...
27
votes
Accepted
Strict positivity
First a terminological explanation: negative and positive positions come from logic. They are about an assymetry in logical connectives: in $A \Rightarrow B$ the $A$ behaves differently from $B$. A ...
26
votes
Accepted
Why does Coq include let-expressions in its core language
It is a common misconception that we can translate let-expresions to applications. The difference between let x : t := b in v ...
25
votes
What is a brief but complete explanation of a pure/dependent type system?
Let's have a go. I'll not bother about Girard's paradox, because it distracts from the central ideas. I will need to introduce some presentational machinery about judgments and derivations and such.
...
21
votes
What's the difference between a type and a kind?
If you know about the difference between sets and classes in set theory, then it may help to think about the matter as
$$\mathrm{type} : \mathrm{kind} = \mathrm{set} : \mathrm{class}.$$
If not, you ...
19
votes
Accepted
What does the leading turnstile operator mean?
On the left of the turnstile, you can find the local context, a finite list of assumptions on the types of the variables at hand.
$$
x_1:T_1, \ldots, x_n:T_n \vdash e:T
$$
Above, $n$ can be zero, ...
18
votes
Accepted
What is induction-induction?
Supplemental 2016-10-03: I mixed up induction-induction and induction-recursion (not the first time I did that!). My apologies for the mess. I updated the answer to cover both.
I find the ...
18
votes
Accepted
Is there a non-trivial type which is equal to its own derivative?
Consider the finite multisets $\mathbf{Bag}\:X$. Its elements are given by $\{x_1,\ldots,x_n\}$ quotiented by permutations, so that $\{x_1,\ldots,x_n\}=\{x_{\pi 1},\ldots,x_{\pi n}\}$ for any $\pi\in\...
18
votes
Accepted
Why product type is a dependent SUM?
Let's do products first.
The usual cartesian product $A \times B$ is also called a binary product because we are making a product of two sets. We could make a ternary product $A \times B \times C$. ...
17
votes
Accepted
Is there a difference between type safety and type soundness?
Type safety and type soundness are synonyms in most theoretical work. Type soundness is often formulated with respect to an operational semantics as (type) preservation and progress. Preservation ...
17
votes
Accepted
What is the use case for multi-type-parameter generics?
Some use cases for multiple type arguments include
maps/dictionaries Map<K,V>, where you have one key parameter and one value parameter
product types ...
17
votes
Is there any use case for the bottom type as a function parameter type?
One of the defining properties of the $\bot$ or empty type is that there exists a function $\bot \to A$ for every type $A$. In fact, there exists a unique such function. It is therefore, fairly ...
15
votes
Accepted
Reference request: Category theory as it applies to type systems
Category theory is not necessary to understand programming languages, it's not even necessary to do advanced research on programming languages. Most programming language people don't know (much) ...
15
votes
Why must a function with polymorphic type `forall t: Type, t->t` be the identity function?
The proof of the claim is quite complex, but if that's what you really want, you can check out Reynolds' original paper on the topic.
The key idea is that it holds for parametrically polymorphic ...
15
votes
What exactly is the semantic difference between set and type?
In practice, claiming that $x$ being of type $T$ usually is used to describe syntax, while claiming that $x$ is in set $S$ is usually used to indicate a semantic property. I will give some examples to ...
15
votes
What do the ∀ and ∃ symbols mean in the Axiom of Choice?
$\forall$ reads as "for all", and $\exists$ reads as "there exists".
So, in english we have
$$\text{"if }\underbrace{\text{for all $x$}}_{\forall x^\sigma}\text{ }\underbrace{\text{exists a $y$}}_{\...
14
votes
Accepted
Question on the "Tutorial implementation of dependently typed lambda calculus"
$\mathsf{id}$ and $\mathsf{const}$ are not variables of the calculus, but syntactic sugar for $\lambda x \rightarrow x$ and $\lambda x \rightarrow \lambda y \rightarrow x$ respectively. This is stated ...
13
votes
Accepted
Proving a sorting operation in type system
Yes, it is possible to express a precise type for a sorting routine, such that any function having that type must indeed sort the input list.
While there might be a more advanced and elegant solution,...
13
votes
Accepted
"Minimal" intuitionistic type theory?
To elaborate on gallais' clarifications, a type theory with impredicative Prop, and dependent types, can be seen as some subsystem of the calculus of constructions, typically close to Church's type ...
13
votes
Accepted
Relation between type-checking decidability, typability decidability and strong normalization
I'll give a more focused and technical answer to Martin's. If we're interested in dependent type theories, then neither direction is obvious, but both are generally assumed to hold. However the ...
13
votes
Accepted
What fragment of Martin-Löf dependent type theory can be expressed using generic types in Java?
There are a lot of misconceptions here. To begin, MLTT doesn't have subtypes, so Java is not going to simply be a fragment of it. It does not require dependent types to make either of the types you ...
13
votes
Accepted
What does canonicity property mean in Type Theory?
There are potentially multiple ways of presenting canonicity (and I think complications depending on the theory). However, I think the simplest way to think about it is from the perspective of a ...
13
votes
Accepted
What do the ∀ and ∃ symbols mean in the Axiom of Choice?
The symbols are quantifiers. They bind a new variable name to the symbolic logic statements. ∃ reads as there exists. ∀ reads for all so the first part of the statement would be read as:
forall x (...
12
votes
What is the Curry-Howard analogue for linear logics?
Linear logic corresponds to a type system for a process calculus (a variant of the internal π-calculus), where:
proofs correspond to processes;
propositions correspond to session types (communication ...
12
votes
Dependent types vs refinement types
A refinement type is a type together with a decidable predicate:
$$ \{x:T ~|~ p(x)\} $$
where $x$ is a variable name, $T$ is a type, and $p(x)$ is a decidable predicate over $x$.
A dependent pair ...
12
votes
Accepted
Universal/existential quantification?
It helps to remember that $\forall$ (or $\Pi$ as you sometimes see) is a type. It's generalizing $\to$. So while it makes perfect sense to say $(\lambda x : A. M)\ N$, it doesn't make sense to say $(\...
12
votes
"Minimal" intuitionistic type theory?
The problem with Church encodings is that you cannot obtain induction principles for your types meaning that they are pretty much useless when it comes to proving statements about them.
In terms of ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
type-theory × 530programming-languages × 118
dependent-types × 87
lambda-calculus × 70
type-checking × 63
type-inference × 50
types-and-programming-languages × 46
functional-programming × 45
logic × 39
category-theory × 28
reference-request × 26
terminology × 22
curry-howard × 21
inductive-datatypes × 20
polymorphisms × 20
homotopy-type-theory × 19
proof-assistants × 18
haskell × 17
typing × 17
coq × 16
compilers × 14
abstract-data-types × 12
notation × 11
computability × 10
induction × 10