ArticleslgStudy

computer science

Intersection type discipline

Intersection type discipline is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Intersection type discipline rather than just read about it. In short: In mathematical logic, the intersection type discipline is a branch of type theory encompassing type systems that use the intersection type constructor ( ∩ ) {\displaystyle (\cap )} to assign multiple types to a single term. In particular, if a term M {\displaystyle M} can be assigned both the type φ 1 {\displaystyle \varphi _{1}} and the type φ 2 {\displaystyle \varphi _{2}} , then M {\displaystyle M} can be assign…

Key takeaways

  • Intersection type discipline belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Intersection type discipline to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Intersection type discipline from memory before moving on to harder problems.

Reference excerpt

In mathematical logic, the intersection type discipline is a branch of type theory encompassing type systems that use the intersection type constructor ( ∩ ) {\displaystyle (\cap )} to assign multiple types to a single term. In particular, if a term M {\displaystyle M} can be assigned both the type φ 1 {\displaystyle \varphi _{1}} and the type φ 2 {\displaystyle \varphi _{2}} , then M {\displaystyle M} can be assigned the intersection type φ 1 ∩ φ 2 {\displaystyle \varphi _{1}\cap \varphi _{2}} (and vice versa). Therefore, the intersection type constructor can be used to express finite heterogeneous ad hoc polymorphism (as opposed to parametric polymorphism). For example, the λ-term λ x . ( x x ) {\displaystyle \lambda x.\!(x\;x)} can be assigned the type ( ( α → β ) ∩ α ) → β {\displaystyle ((\alpha \to \beta )\cap \alpha )\to \beta } in most intersection type systems, assuming for the term variable x {\displaystyle x} both the function type α → β {\displaystyle \alpha \to \beta } and the corresponding argument type α {\displaystyle \alpha } . Prominent intersection type systems include the Coppo–Dezani type assignment system, the Barendregt-Coppo–Dezani type assignment system, and the essential intersection type assignment system. Most strikingly, intersection type systems are closely related to (and often exactly characterize) normalization properties of λ-terms under β-reduction. In programming languages, such as TypeScript and Scala, intersection types are used to express ad hoc polymorphism.

History The intersection type discipline was pioneered by Mario Coppo, Mariangiola Dezani-Ciancaglini, Patrick Sallé, and Garrel Pottinger. The underlying motivation was to study semantic properties (such as normalization) of the λ-calculus by means of type theory. While the initial work by Coppo and Dezani established a type theoretic characterization of strong normalization for the λI-calculus, Pottinger extended this characterization to the λK-calculus. In addition, Sallé contributed the notion of the universal type ω {\displaystyle \omega } that can be assigned to any λ-term, thereby corresponding to the empty intersection. Using the universal type ω {\displaystyle \omega } allowed for a fine-grained analysis of head normalization, normalization, and strong normalization. In collaboration with Henk Barendregt, a filter λ-model for an intersection type system was given, tying intersection types ever more closely to λ-calculus semantics. Due to the correspondence with normalization, typability in infinite intersection type systems is undecidable. However restricting intersection types to finite rank makes their typeability decidable for any finite rank, which is in contrast with system F, where (quantifier) restrictions to finite ranks above 3 still have undecidable typeability. On the other hand, if recursive types are added to a system with rank-2 or higher intersection types, typability becomes undecidable, in general. Complementarily, undecidability of the dual problem of type inhabitation in prominent intersection type systems was proven by Paweł Urzyczyn. Later, this result was refined showing exponential space completeness of rank 2 intersection type inhabitation and undecidability of rank 3 intersection type inhabitation. Remarkably, principal type inhabitation is decidable in polynomial time. To deal with the difficulties in applying the Curry-Howard correspondence to intersection types, Kamareddine and Wells have replaced the intersection constructor in the deduction system with finite-set declarations (FSD) for the domain of each variable in a lambda abstraction, turning them into Π types. And they extended the lambda cube to what they call the f-cube, which has with FSD-encoded intersection types at all vertices. Urzyczyn’s term U, which is untypable in the λ-cube, is typable in the f-cube.

Coppo–Dezani type assignment system The Coppo–Dezani type assignment system ( ⊢ CD ) {\displaystyle (\vdash _{\text{CD}})} extends the simply typed λ-calculus by allowing multiple types to be assumed for a term variable.

Term language The term language of ( ⊢ CD ) {\displaystyle (\vdash _{\text{CD}})} is given by λ-terms (or, lambda expressions):

M , N ::= x ∣ ( λ x . M ) ∣ ( M N ) where x ranges over term variables {\displaystyle {\begin{aligned}M,N&::=x\mid (\lambda x.\!M)\mid (M\;N)&&{\text{ where }}x{\text{ ranges over term variables}}\\\end{aligned}}}

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Intersection type discipline

Start with the simplest possible case. Write down what Intersection type discipline claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Intersection type discipline before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Intersection type discipline ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Intersection type discipline

In research
Intersection type discipline appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Intersection type discipline in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Intersection type discipline is common in secondary-school and first-year university syllabi. It links to neighbouring topics Lambda calculus, Polymorphism (computer science), Theory of computation, so understanding it makes those chapters shorter.
In everyday life
Look for Intersection type discipline outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Intersection type discipline in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Intersection type discipline means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Intersection type discipline out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Intersection type discipline in simple terms?

In mathematical logic, the intersection type discipline is a branch of type theory encompassing type systems that use the intersection type constructor ( ∩ ) {\displaystyle (\cap )} to assign multiple types to a single term. In particular, if a term M {\displaystyle M} can be assigned both the type…

Why does Intersection type discipline matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Intersection type discipline?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Intersection type discipline.

Tags

  • Lambda calculus
  • Polymorphism (computer science)
  • Theory of computation
  • Type systems
  • Type theory

Keep exploring