The Lean Reference Manual
Release 3.3.0Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.5 Constructors, Projections, and Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.6 Structured Proofs type α or report an error if it fails. Lean supports anonymous constructor notation, anonymous projections, and various forms of match syntax, including destructuring λ and let. These, as well as notation 2 → a^n + b^n ̸= c^n def unbounded (f : N → N) : Prop := ∀ M, ∃ n, f n ≥ M 3.5 Constructors, Projections, and Matching Lean’s foundation, the Calculus of Inductive Constructions, supports the declaration0 码力 | 67 页 | 266.23 KB | 1 年前3
An Introduction to Leanthe ascii equivalents (| and |). Similarly, one can use the notation .1, .2, and so on for the projections. def purple : color := ⟨150, 0, 150, "purple"⟩ #eval purple.1 #eval purple.2 #eval purple.3 #eval DEFINING OBJECTS IN LEAN 23 Alternatively, one can use the notation . to extract the relevant projections: #eval purple.red #eval purple.green #eval purple.blue #eval purple.name When the type of the example (a b : Prop) : a ∧ b → b ∧ a := λ h, and.intro (and.right h) (and.left h) We can use projections and anonymous constructors to express the proof even more con- cisely, though somewhat cryptically:0 码力 | 48 页 | 191.92 KB | 1 年前3
Theorem Proving in Lean
Release 3.23.0Lean, (m, n) denotes the ordered pair of m and n, and if p is a pair, p.1 and p.2 denote the two projections. 6 Chapter 2. Dependent Type Theory Theorem Proving in Lean, Release 3.23.0 2.2 Types as Objects a b, and we have to specify the output, in terms of a and b. We can use this to define the two projections for prod. Remember that the standard library defines notation α × β for prod α β and (a, b) for “structure”. In Lean, the keyword structure can be used to define such an inductive type as well as its projections, at the same time. structure prod (α β : Type*) := mk :: (fst : α) (snd : β) This example simultaneously0 码力 | 173 页 | 777.93 KB | 1 年前3
Programming in Lean
Release 3.4.2the ascii equivalents (| and |). Similarly, one can use the notation .1, .2, and so on for the projections. def purple : color := ⟨150, 0, 150, "purple"⟩ #eval purple.1 #eval purple.2 (continues on next #eval purple.3 #eval purple.4 Alternatively, one can use the notation . to extract the relevant projections: #eval purple.red #eval purple.green #eval purple.blue #eval purple.name When the type of the0 码力 | 51 页 | 220.07 KB | 1 年前3
共 4 条
- 1













