The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [type-theory]

formal systems to specify properties of objects

Filter by
Sorted by
Tagged with
0
votes
1answer
36 views

How do you define and parse variables (free or bound) from user-entered strings?

I'm writing an application in which the user might enter expressions such as $\text{lim}_{i \in I} \beta(i)$ where $\beta$ is a functor. That's just an example, the expressions, which contain ...
2
votes
1answer
35 views

How is β-reduction a 2-morphism in Category theory?

According to Categorifying CCCs: Computation as a Process, computation or β-reduction process in untyped-lambda calculus is in fact a 2-morphism in category theory. Can someone please describe me ...
0
votes
0answers
14 views

Do Rank-1 (prenex) polymorphism and Predicative polymorphism mean the same?

https://en.wikipedia.org/wiki/Parametric_polymorphism says: Rank-1 (prenex) polymorphism In a prenex polymorphic system, type variables may not be instantiated with polymorphic types.[4] ...
1
vote
0answers
15 views

What are the relation and differences between reification and type passing semantics?

https://en.wikipedia.org/wiki/Type_erasure says type erasure refers to the load-time process by which explicit type annotations are removed from a program, before it is executed at run-time. ...
0
votes
0answers
15 views

What are the relations between these two descriptions of let polymorphism?

In Types and Programming Languages by Pierce, there are two descriptions of let-polymorphism. Sec23.8 Fragments of SystemF on p359 says This has led to various proposals for restricted fragments ...
0
votes
0answers
11 views

What are the difference and relation between type checking and type reconstruction?

In Types and Programming Languages by Pierce, ML-style let-polymorphism was first described by Milner (1978). A num- ber of type reconstruction algorithms have been proposed, notably the clas- ...
-1
votes
1answer
40 views

What is “Hindley-Milner (i.e., unification-based) polymorphism”?

In Types and Programming Languages by Pierce, Ch11 Simple Extensions extends the typed lambda calculus. Section 11.5 Let Bindings says: In Chapter 22 we will see another reason not to treat let as ...
2
votes
0answers
16 views

Does Hindley-Milner refer to the unification algorithm for type reconstruction, a type system, or a form of polymorphism?

What does Hindely-Milner refer to? In Types and Programming Languages by Pierce, I only find that Section 22.4 Unification mentions "Hindley" and "Milner", when introducing the unification algorithm. ...
0
votes
0answers
18 views

Is it possible to deduce type from the lambda form?

I was continuing the exploration of lambda world this summer. When I take a look at the simply typed lambda calculus, it looks like there is no use for usual chuch numerals and boolean forms anymore. ...
1
vote
1answer
45 views

Types and Programming Languages - proof for theorem about principles of induction of terms

Types and Programming Languages book introduces a theorem about principles of induction on term (p. 31, theorem 3.3.4): Suppose P is a predicate on terms. Induction on depth: If, for each ...
0
votes
1answer
23 views

What does valid method overriding mean?

In Types and Programming Languages by Pierce, from p257 to p258, about featherweight Java, The predicate override(m, D, C→C0) judges whether a method ...
1
vote
2answers
48 views

Which is a type of objects in mainstream OO languages: a class, an interface, an abstract class, a metaclass?

In Types and Programming Languages by Pierce, Section 18.6 Simple Classes in Chapter 18 Imperative Objects says: We should emphasize that these classes are values, not types. Also we can, if we ...
9
votes
1answer
1k views

Why does Coq include let-expressions in its core language

Coq includes let-expressions in its core language. We can translate let-expressions to applications like this: let x : t = v in b ~> (\(x:t). b) v I understand ...
1
vote
1answer
22 views

Does an ADT have multiple or only one representations/implementations?

Section 24.2 in Types and Programming Languages by Pierce defines ADTs in existential types: A conventional abstract data type (or ADT) consists of (1) a type name A, (2) a concrete representation ...
0
votes
1answer
19 views

Why can System F1 a.k.a. λ → have kind `*`, but no quantification `∀`?

In Types and Programming Languages by Pierce, on p461 in Section 30.4 Fragments of 30.4.1 Definition: In System F1 , the only kind is ...
-1
votes
1answer
42 views

What order logic does a system correspond to under Curry–Howard correspondence?

In Types and Programming Languages by Pierce, Section 9.4 Curry–Howard correspondence on p109 has a table Does the table mean that the simply typed lambda calculus ...
0
votes
0answers
9 views

Can two type expressions in different kinds have subtyping relation and equivalence relation?

In Higher-order bounded quantification ($F^ω_{<:}$), introduced in Ch31 in Types and Programming Langauges by Pierce, its subtyping and equivalence rules are: Does subtyping relation only exist ...
0
votes
0answers
29 views

Is `→` a type operator?

In Types and Programming Languages by Pierce, The level of types contains two sorts of expressions. First, there are proper types like Nat, Nat→Nat, Pair Nat Bool, and ∀X.X→X, which are ...
0
votes
0answers
23 views

Does λ→ have type operators?

In Types and Programming Languages by Pierce, Ch11 Simple Extensions introduces λ→ as the simply typed lambda calculus with simple extensions, and introduces <...
0
votes
0answers
21 views

Is the language “untyped arithmetic expressions” in Types and Programming Languages not Turing complete?

In Types and Programming Languages by Pierce, is it correct that the language introduced in Chapter 3 Untyped Arithmetic Expressions is not Turing complete? Because it doesn't provide recursion. the ...
0
votes
0answers
14 views

How can we directly reaching inside and looking at the state of a partially existential object?

Types and Programming Languages by Pierce says in Section 26.5 Bounded Existential Types, about partial existential objects implemented in terms of bounded existential types: We can make a similar ...
0
votes
0answers
24 views

What are the differences and relations between a type constructor and a type operator?

What are the definitions of a type constructor and a type operator? What are their differences and relations? I think a type operator is a function whose parameters are n types and return is a type. A ...
0
votes
1answer
42 views

How can an existential type be defined in terms of universal type?

In Types and Programming Languages by Pierce, how does the following achieve the definition of an existential type in terms of universal type, by polymorphic version of Church encoding of pairs? ...
0
votes
1answer
56 views

Why are ADT packages opened immediately after they are built, while existential objects opened as late as possible?

Section 24.2 in Types and Programming Languages by Pierce defines ADTs in existential types: A conventional abstract data type (or ADT) consists of (1) a type name A, (2) a concrete representation ...
0
votes
1answer
56 views

How can mainstream OO languages support strong binary operations by classes?

Section 24.2 in Types and Programming Languages by Pierce compares ADT and existential objects,in terms of how well they support strong binary operations: Other binary operations cannot be ...
0
votes
1answer
38 views

Are type abstraction values and universal types not for non functions, but only for functions?

In Types and Programming Languages by Pierce, Chapter 23 Universal Types has a summary of System F in the following figure, in particular, "type abstraction values" and their types "universal types". ...
0
votes
1answer
36 views

How does this allow list operations to be applied to lists with elements of any type?

In Types and Programming Languages by Pierce, Chapter 11 is simple extensions of the simply typed lambda calculus with any simple base types. Section 11.12 introduces Lists. How does the section ...
0
votes
1answer
25 views

What is the purpose of erasing a type application to a term-application in parametric polymorphism?

From Types and Programming Languages by Pierce 23 Polymorphism 23.7 Erasure and Evaluation Order in a full-blown programming language, which may include side- effecting features such as ...
0
votes
1answer
25 views

Does a term being normalizable mean the same as the term has a normal form?

From Types and Programming Languages by Pierce A term $t$ is in normal form if no evaluation rule applies to it— i.e., if there is no $t'$ such that $t -→ t'$. and A term $t$ is typable (or ...
0
votes
1answer
65 views

Do the following concepts belong to syntax or semantics?

I am not very sure about the difference between syntax and semantics. Does each of the following concepts belong to syntax or semantics? terms values: terms that are possible final results of ...
1
vote
1answer
16 views

Do determinacy of one-step evaluation and uniqueness of normal forms apply to all (or most) languages in TAPL?

In Types and Programming Languages by Pierce, when talking about untyped arithmetic expressions in Chapter 3, there are two theorems: $-→$ is single-step evaluation relation: 3.5.4 Theorem [...
1
vote
1answer
25 views

Does Types and Programming Languages use a recursive equation to define a recursive type or its generator?

In Types and Programming Languages by Pierce et al: The recursive equation specifying the type of lists of numbers is similar to the equation specifying the recursive factorial function on page 52: ...
0
votes
0answers
30 views

General term for upcasting and downcasting?

Is there a more precise term than simply "casting"? "Casting" often includes for example integer -> float or ...
3
votes
0answers
48 views

Calculus of constructions, type-in-type and recursion

Does adding type-in-type to the calculus of constructions lead to (general) recursion? Such that one can write the Y combinator.
0
votes
0answers
32 views

How do you derive a type $∃e(e)$ in terms of universally quantified types, without invoking Void initially?

I wrote a "proof" for this, and though it was enough to convince myself, there are a few things that bother me about it. Primarily I'm not sure about the loose way in which I'm swapping between first-...
0
votes
1answer
34 views

Could following be a counter example to Church-Rosser (Confluence) theorem?

According to the "Type Theory and Formal Proof" book, Church-Rosser theorem (confluence) is as follow: Suppose that for a given term $M$, we have $M \twoheadrightarrow_\beta N_1$ and $M\...
5
votes
1answer
135 views

What does canonicity property mean in Type Theory?

The "Computational Component" section of the Type Theory - Wikipedia (as well as a few papers about cubical type theory and 2d type theory) talk about canonicity property. Would you please explain ...
2
votes
1answer
79 views

Difference between computation in proposition proof and definitional computation?

As stated in equality at nLab, "computational equality" is about computational steps which take for example, $s(s(0))+ s(0)$ to $s(s(s(0)))$ and it acts exactly and can be considered same as ...
4
votes
2answers
61 views

Why values can not be replaced with their extensionally equal values in an intensional system?

Thomas Streicher states in Investigations into Intensional Type Theory(§Introduction p.5) that: Although in Intensional constructive set theory (Intensional Type Theory) one can do most of the ...
2
votes
1answer
58 views

Definition of extensional and propositional equality in Martin-Lof extensional type theory

Martin Hofmann states in Extensional Concepts in Intensional Type Theory (§1.1 p.[4-5]) that: A similar situation occurs in extensional Martin-Lof type theory where propositional and definitional ...
4
votes
1answer
89 views

Definitional equality of two propositions about propositional equality

Martin Hofmann states in Extensional Concepts in Intensional Type Theory (§1.1 p.3) that: It is important that definition equality is pervasive so if M and N are definitionally equal then P(M) is ...
8
votes
1answer
454 views

Representation of the concatenation at the type level

I would like to learn more about concatenative programming through the creation of a small simple language, based on the stack and following the concatenative paradigm. Unfortunately, I haven't found ...
2
votes
0answers
36 views

Real world example of contraction and weakening

Can you provide me a real world example of contraction and weakening in the type system of a popular language like Java, Kotlin, etc.? I heard that Rust has got explicit contraction but I don´t ...
0
votes
1answer
47 views

Subtyping and subkinding, are they relevant?

I'm thinking about a type system that has some special kind of some certain types that are subtypes of the universe kind type. Imagine the typing relation, where $...
5
votes
1answer
49 views

What untyped term inhabits induction on natural numbers in CoC?

Induction on Church-encoded natural numbers (which I will call indNat) can not be defined within the Calculus of Constructions. If we assumed ...
0
votes
1answer
24 views

How does this example violate Liskov substitution principle, which then causes violation of the open-closed principle?

From Agile Principles, Patterns, and Practices in C# by Robert Martin, Listing 10-1. A violation of LSP causing a violation of OCP ...
1
vote
2answers
84 views

Type theory for imperative programming languages?

The type theory that I have seen is all developed over lambda calculus, which is an inherently functional language. Nevertheless, in practice imperative languages have type systems. Are there ...
25
votes
4answers
4k views

What's the difference between a type and a kind?

I am learning the programming langauge Haskell, and I'm trying to wrap my head around what the difference between a type and a ...
2
votes
0answers
150 views

Proving that the failure of algorithm W implies that the program is not typable

How one does prove that if algorithm W failed for a given program $e$ and context $\Gamma$, then there is no substitution $S$ and type $\tau$ such that $S\Gamma \vdash e : \tau$ ? The original paper ...
2
votes
0answers
26 views

Is the expression (λx.xx)(λy.y) typeable in the following system?

We are given a simple functional language: $ e ::= x | n | e_{1}e_{2}|\lambda(x:\tau).e$ with types: $\tau ::= \text{int} | \tau_{1} \rightarrow \tau_{2}| \tau_{1} \land \tau_{2} $ Is the ...