29
votes
Accepted
if (λ x . x x) has a type, then is the type system inconsistent?
Certainly, assigning a type to $\lambda x. x\ x$ is not enough for inconsistency: in system $F$, we can derive
$$ \lambda x.x\ x:(\forall X.X)\rightarrow (\forall X.X)$$
in a pretty straightforward ...
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 ...
19
votes
Accepted
Difference between Dependent type , refinement type and Hoare Logic
There is recent work by Paul-André Melliès and Noam Zeilberger that explores this. In particular the papers Functors are Type Refinement Systems and An Isbell Duality Theorem for Type Refinement ...
18
votes
What is different between Set and Type in Coq?
Coq has 4 "big" types:
Prop is meant for propositions. It is impredicative, meaning that you can instantiate polymorphic functions with polymorphic types....
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
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
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 ...
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
"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 ...
11
votes
Accepted
Where are C++ templates inside of the lambda cube?
But is that exactly where they are located in the lambda cube?
The lambda cube is not a giant spectrum on which all programming languages can be classified. It is precisely eight languages, which ...
9
votes
Accepted
Examples of Dependent Types
I think it helps to keep in mind the propositions as types mantra. Every type can be read either as a propostion or a set. This gives us two readings (let's just consider types dependent on natural ...
8
votes
Can properties such as memory usage of a function be expressed in a dependently typed language?
Yes, it can. While conceptually it's not that difficult, it hasn't been studied all that much. One aspect of the field is cost semantics such as the research done by Guy Blelloch.
In the vein of ...
8
votes
Accepted
About the Identity function in Agda
Your code does not work. I would suggest that you forget about the universe levels for the time being (the $\ell$ thing) and focus on simpler things first. Here is working code:
...
8
votes
Accepted
Relation between Hoare Type Theory and pointers
A pointer to a variable creates an alias. When the alias is modified, the corresponding variable is modified as well. Therefore, the rule for an assignment in Hoare's logic is not just update the ...
8
votes
Accepted
Reducing products in HoTT to church/scott encodings
The standard reference I often give is Induction is not derivable in second order dependent type theory by Herman Geuvers, which says that there is no type
$$N : \mathrm{Type}$$
with functions
$$Z:N\...
8
votes
Reducing products in HoTT to church/scott encodings
To get your idea working you need something extra, as was pointed out in @cody's answer. Sam Speight worked under the supervision of Steve Awodey to see what can be achieved in HoTT using an ...
8
votes
Accepted
What are the rules for positive recursive types in dependent type theory?
Why are recursive types seldomly seen in dependent type theory?
The point of inductive types is precisely that you get normalization. Unrestricted recursive types simply lead to non-normalizing terms....
8
votes
Accepted
How to derive dependently typed eliminators?
The canonical reference for this is Peter Dybjer, Inductive Families, which gives a pretty comprehensive treatment of inductive families based on eliminators.
8
votes
Accepted
Show how lack of universe levels would create contradiction in homotopy type theory (in Agda)
The problem is not specific to homotopy type theory. In type theory in general, if there is a type of all types, then every type is inhabited. This was shown first by Girard who encoded the Burali-...
7
votes
Why are recursive types needed as primitives for proofs in dependent type systems?
I'm not an expert, but I'll share what I understood so far with an example.
Let's consider the boolean type in CoC, using its standard encoding:
$$
\begin{array}{l}
\mathbb{B} = \Pi_{\tau:*} \tau \to ...
7
votes
Accepted
Difference between "sort" and "universe"
Sort is (typically, though see Pure Type Systems) a meta-level concept and universes are an internalization of a particular case of a sort. The second chapter of Bart Jacobs' thesis covers a fairly ...
7
votes
Accepted
Generating constraints to solve dependently-typed metavariables?
There's a nice idiom, which is explained more in chapter 22 of Types and Programming Languages (it's used for polymorphism rather than dependent types, but the idea is the same). The idiom is as ...
7
votes
Accepted
Indexing a dependent type on a value?
The best answer I can give is that you are confused about the meaning of words. I tried to explain this already in another answer to you, so let me be more explicit this time.
To say
type $A$ ...
7
votes
What are the strongest known type systems for which inference is decidable?
[EDIT: Voilà a few words on each]
There are several ways of extending HM type inference. My answer is based on many, more or less successful, attempts at implementing some of them.
The first one I ...
7
votes
Proving a sorting operation in type system
Twan van Laarhoven has a nice fully worked out example in Agda of the "Correctness and runtime of mergesort, insertion sort and selection sort".
The comments are also interesting: in them, Bob Atkey'...
7
votes
Accepted
Dependent Type Theory Implementation of a Graph
So, there are two different things you are talking about.
The definition of a graph
The encoding of a graph
A Graph is always defined as a set of vertices and edges. This tells us what vertices are ...
7
votes
Accepted
Dependent type system with different computation model
Yes, realizability theory allows you to model dependent type theory based on a variety of computational models, such as: Turing machines (with or without oracles), various $\lambda$-calculi, ...
7
votes
When is cumulative type universes useful?
Without cummulative universes, if you have $A : \mathsf{Type}_3$ then you do not have $A : \mathsf{Type}_7$. Instead, we also have to introduce lifting functions $\iota_{i,j} : \mathsf{Type}_i \to \...
7
votes
What is the runtime/time complexity of Coq’s (Dependent) Type Inference?
There are actually two questions here.
Is the Coq type system decidable?
Long answer short, we hope so, as in it would be a bug if it were not.
It is not a universal requirement for a type theory to ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
dependent-types × 117type-theory × 87
lambda-calculus × 14
programming-languages × 13
functional-programming × 13
homotopy-type-theory × 12
inductive-datatypes × 11
type-checking × 10
coq × 9
reference-request × 8
type-inference × 7
agda × 7
proof-assistants × 6
equality × 5
calculus-of-constructions × 5
category-theory × 4
computability × 3
terminology × 3
logic × 3
undecidability × 3
curry-howard × 3
semantics × 2
induction × 2
hoare-logic × 2
automated-theorem-proving × 2