ArticleslgStudy

science

Bottom type

Bottom type is a 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 Bottom type rather than just read about it. In short: In type theory, a theory within mathematical logic, the bottom type of a type system is the type that is a subtype of all other types. Where such a type exists, it is often represented with the up tack (⊥) symbol.

Key takeaways

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

Reference excerpt

In type theory, a theory within mathematical logic, the bottom type of a type system is the type that is a subtype of all other types. Where such a type exists, it is often represented with the up tack (⊥) symbol.

Relation with the empty type When the bottom type is uninhabited, a function whose return type is bottom cannot return any value, not even the lone value of a unit type. In such a language, the bottom type may therefore be known as the zero, never or empty type which, in the Curry–Howard correspondence, corresponds to falsity. However, when the bottom type is inhabited, it is then different from the empty type. If a type system is sound, the bottom type is uninhabited and a term of bottom type represents a logical contradiction. In such systems, typically no distinction is drawn between the bottom type and the empty type, and the terms may be used interchangeably.

Computer science applications In subtyping systems, the bottom type is a subtype of all types. It is dual to the top type, which spans all possible values in a system. If the bottom type is inhabited, its term(s) typically correspond to error conditions such as undefined behavior, infinite recursion, or unrecoverable errors. In Bounded Quantification with Bottom, Pierce says that Bot (the bottom type) has many uses:

In a language with exceptions, a natural type for the raise construct is raise ∈ exception -> Bot, and similarly for other control structures. Intuitively, Bot here is the type of computations that do not return an answer. Bot is useful in typing the "leaf nodes" of polymorphic data structures. For example, List(Bot) is a good type for nil. Bot is a natural type for the "null pointer" value (a pointer which does not point to any object) of languages like Java: in Java, the null type is the universal subtype of reference types. null is the only value of the null type; and it can be cast to any reference type.However, the null type is not a bottom type as described above, it is not a subtype of int and other primitive types. A type system including both Top and Bot seems to be a natural target for type inference, allowing the constraints on an omitted type parameter to be captured by a pair of bounds: we write S<:X<:T to mean "the value of X must lie somewhere between S and T". In such a scheme, a completely unconstrained parameter is bounded below by Bot and above by Top.

In programming languages Most commonly used languages don't have a way to denote the bottom type. There are a few notable exceptions.

In Haskell, the bottom type is called Void. In Common Lisp the type NIL, contains no values and is a subtype of every type. The type named NIL is sometimes confused with the type named NULL, which has one value, namely the symbol NIL itself. In Scala, the bottom type is denoted as scala.Nothing. Besides its use for functions that just throw exceptions or otherwise don't return normally, it is also used for covariant parameterized types. For example, Scala's scala.Listis a covariant type constructor, so List[Nothing] is a subtype of List[A] for all types A. So Scala's scala.Nil, the object for marking the end of a list of any type, belongs to the type List[Nothing]. In Rust, the bottom type is called the never type and is denoted by !. It is present in the type signature of functions guaranteed to never return, for example by calling panic!() or looping forever. It is also the type of certain control-flow keywords, such as break and return, which do not produce a value but are nonetheless usable as expressions. In C and C++, there is no bottom type, but a function which does not return is annotated with [[noreturn]]; the annotated function must return void. For any pointer type, the nullptr value can be assigned, which is of type nullptr_t (C) or std::nullptr_t (C++). In C# (as of version 3.0, null is typeless. In Ceylon, the bottom type is Nothing. It is comparable to scala.Nothing in Scala and represents the intersection of all other types as well as an empty set. In Java, null is of a special internal "null type" that is unnamed, and cannot be referenced or accessed. In the Java compiler API, it can be represented by javax.lang.model.type.NullType. In Julia, the bottom type is Union{}. In TypeScript, the bottom type is never. In JavaScript with Closure Compiler annotations, the bottom type is !Null (literally, a non-null member of the Null unit type). In PHP, the bottom type is never. In Python's optional static type annotations, the general bottom type is typing.Never (introduced in version 3.11), while typing.NoReturn (introduced in version 3.5) can be used as the return type of non-returning functions specifically (and doubled as the general bottom type prior to the introduction of Never). In Kotlin, the bottom type is kotlin.Nothing. In D, the bottom type is noreturn. In Dart, since version 2.12 with the sound null safety update, the Never type was introduced as the bottom type. Before that, the bottom type used to be Null.

See also Contradiction Fail-stop NaN Top type Undefined value Unit type Void type

References

Further reading Pierce, Benjamin C. (2002). Types and Programming Languages. MIT Press. ISBN 0-262-16209-1.

Worked examples

Example 1 — a first encounter with Bottom type

Start with the simplest possible case. Write down what Bottom type claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In 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 Bottom type 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 Bottom type 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 Bottom type

In research
Bottom type appears in 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 Bottom type 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
Bottom type is common in secondary-school and first-year university syllabi. It links to neighbouring topics Data types, Type theory, so understanding it makes those chapters shorter.
In everyday life
Look for Bottom type 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.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Bottom type” →

How to study Bottom type in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Bottom type 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 Bottom type out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Bottom type in simple terms?

In type theory, a theory within mathematical logic, the bottom type of a type system is the type that is a subtype of all other types. Where such a type exists, it is often represented with the up tack (⊥) symbol.

Why does Bottom type matter?

Because it connects several 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 Bottom type?

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 Bottom type.

Tags

  • Data types
  • Type theory

Keep exploring