Theorem Proving in Lean Release 3.23.0
Prop -- Type We will discuss Prop in the next chapter. We want some operations, however, to be polymorphic over type universes. For example, list α should make sense for any type α, no matter which type α also has type Type n. The function prod is similarly polymorphic: #check prod -- Type u_1 → Type u_2 → Type (max u_1 u_2) To define polymorphic constants and variables, Lean allows us to declare universe which inserts a new element at the head of a list. What type should cons have? Such a function is polymorphic: we expect the cons function for N, bool, or an arbitrary type α to behave the same way. So it0 码力 | 173 页 | 777.93 KB | 1 年前3The Hitchhiker’s Guide to Logical Verification
finite lists: inductive list (α : Type) : Type | nil : list | cons : α → list → list The type is polymorphic: It is parameterized by a type α, which we can instantiate with concrete types. For example, list variant λα : Type, list α, or the polymorphic type λα : Type, α → α of functions with the same domain and codomain. A term may depend on a type—for example, the polymorphic identity function λα : Type, λx λ-expression A type depending on a term Dependent type (in the narrow sense) A term depending on a type Polymorphic term A type depending on a type Type constructor The last three rows correspond to the three axes0 码力 | 215 页 | 1.95 MB | 1 年前3An Introduction to Lean
certain kinds of objects, so functions can depend on types. For example, the following defines a polymorphic identity function: def id (α : Type) (x : α) : α := x #check id N 3 #eval id N 3 #check id0 码力 | 48 页 | 191.92 KB | 1 年前3Programming in Lean Release 3.4.2
certain kinds of objects, so functions can depend on types. For example, the following defines a polymorphic identity function: def id (α : Type) (x : α) : α := x #check id N 3 #eval id N 3 #check id0 码力 | 51 页 | 220.07 KB | 1 年前3The Lean Reference Manual Release 3.3.0
command universe u, a definition or theorem that is declared with a variable ranging over Sort u is polymorphic over that universe variable. More generally, universe level variables can appear in any universe0 码力 | 67 页 | 266.23 KB | 1 年前3
共 5 条
- 1