2. Code Panels
In-module external definition panel sample.
Lean code for Definition2.1●1 definition
Associated Lean declarations
-
def PreviewRuntimeShowcase.CodePanelDecls.previewExternalDefinition
PreviewRuntimeShowcase.CodePanelDecls.previewExternalDefinition : Nat: NatNat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.def PreviewRuntimeShowcase.CodePanelDecls.previewExternalDefinition
PreviewRuntimeShowcase.CodePanelDecls.previewExternalDefinition : Nat: NatNat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.
In-module external Lean abbrev panel sample. Status summaries stay definition-like, while the rendered declaration preserves the abbrev keyword.
Lean code for Definition2.2●1 definition
Associated Lean declarations
-
abbrev PreviewRuntimeShowcase.CodePanelDecls.previewExternalAbbrev
PreviewRuntimeShowcase.CodePanelDecls.previewExternalAbbrev : Nat: NatNat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.abbrev PreviewRuntimeShowcase.CodePanelDecls.previewExternalAbbrev
PreviewRuntimeShowcase.CodePanelDecls.previewExternalAbbrev : Nat: NatNat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.
In-module external theorem panel sample.
Lean code for Theorem2.3●1 theorem
Associated Lean declarations
-
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem
PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem : True: TrueTrue : Prop`True` is a proposition and has only an introduction rule, `True.intro : True`. In other words, `True` is simply true, and has a canonical proof, `True.intro` For more information: [Propositional Logic](https://lean-lang.org/theorem_proving_in_lean4/propositions_and_proofs.html#propositional-logic)theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem
PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem : True: TrueTrue : Prop`True` is a proposition and has only an introduction rule, `True.intro : True`. In other words, `True` is simply true, and has a canonical proof, `True.intro` For more information: [Propositional Logic](https://lean-lang.org/theorem_proving_in_lean4/propositions_and_proofs.html#propositional-logic)
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalSorry[sorry in proof]
In-module external theorem panel with a sorry-backed declaration.
Lean code for Theorem2.4●1 theorem, incomplete
Associated Lean declarations
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalSorry[sorry in proof]
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalSorry[sorry in proof]
-
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalSorry
PreviewRuntimeShowcase.CodePanelDecls.previewExternalSorry : True: TrueTrue : Prop`True` is a proposition and has only an introduction rule, `True.intro : True`. In other words, `True` is simply true, and has a canonical proof, `True.intro` For more information: [Propositional Logic](https://lean-lang.org/theorem_proving_in_lean4/propositions_and_proofs.html#propositional-logic)theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalSorry
PreviewRuntimeShowcase.CodePanelDecls.previewExternalSorry : True: TrueTrue : Prop`True` is a proposition and has only an introduction rule, `True.intro : True`. In other words, `True` is simply true, and has a canonical proof, `True.intro` For more information: [Propositional Logic](https://lean-lang.org/theorem_proving_in_lean4/propositions_and_proofs.html#propositional-logic)
-
Nat.add[complete]
Out-of-module external definition panel sample.
Lean code for Definition2.5●1 definition
Associated Lean declarations
-
Nat.add[complete]
-
Nat.add[complete]
-
def Nat.add
Nat.add : Nat → Nat → NatAddition of natural numbers, typically used via the `+` operator. This function is overridden in both the kernel and the compiler to efficiently evaluate using the arbitrary-precision arithmetic library. The definition provided here is the logical model.: NatNat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.→ NatNat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.→ NatNat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.def Nat.add
Nat.add : Nat → Nat → NatAddition of natural numbers, typically used via the `+` operator. This function is overridden in both the kernel and the compiler to efficiently evaluate using the arbitrary-precision arithmetic library. The definition provided here is the logical model.: NatNat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.→ NatNat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.→ NatNat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.Addition of natural numbers, typically used via the `+` operator. This function is overridden in both the kernel and the compiler to efficiently evaluate using the arbitrary-precision arithmetic library. The definition provided here is the logical model.
-
Nat.add_assoc[complete]
Out-of-module external theorem panel sample.
Lean code for Theorem2.6●1 theorem
Associated Lean declarations
-
Nat.add_assoc[complete]
-
Nat.add_assoc[complete]
-
theorem Nat.add_assoc
Nat.add_assoc (n m k : Nat) : n + m + k = n + (m + k)(nNatmNatkNat: NatNat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.) : nNat+HAdd.hAdd.{u, v, w} {α : Type u} {β : Type v} {γ : outParam (Type w)} [self : HAdd α β γ] : α → β → γ`a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `+` in identifiers is `add`.mNat+HAdd.hAdd.{u, v, w} {α : Type u} {β : Type v} {γ : outParam (Type w)} [self : HAdd α β γ] : α → β → γ`a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `+` in identifiers is `add`.kNat=Eq.{u_1} {α : Sort u_1} : α → α → PropThe equality relation. It has one introduction rule, `Eq.refl`. We use `a = b` as notation for `Eq a b`. A fundamental property of equality is that it is an equivalence relation. ``` variable (α : Type) (a b c d : α) variable (hab : a = b) (hcb : c = b) (hcd : c = d) example : a = d := Eq.trans (Eq.trans hab (Eq.symm hcb)) hcd ``` Equality is much more than an equivalence relation, however. It has the important property that every assertion respects the equivalence, in the sense that we can substitute equal expressions without changing the truth value. That is, given `h1 : a = b` and `h2 : p a`, we can construct a proof for `p b` using substitution: `Eq.subst h1 h2`. Example: ``` example (α : Type) (a b : α) (p : α → Prop) (h1 : a = b) (h2 : p a) : p b := Eq.subst h1 h2 example (α : Type) (a b : α) (p : α → Prop) (h1 : a = b) (h2 : p a) : p b := h1 ▸ h2 ``` The triangle in the second presentation is a macro built on top of `Eq.subst` and `Eq.symm`, and you can enter it by typing `\t`. For more information: [Equality](https://lean-lang.org/theorem_proving_in_lean4/quantifiers_and_equality.html#equality) Conventions for notations in identifiers: * The recommended spelling of `=` in identifiers is `eq`.nNat+HAdd.hAdd.{u, v, w} {α : Type u} {β : Type v} {γ : outParam (Type w)} [self : HAdd α β γ] : α → β → γ`a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `+` in identifiers is `add`.(HAdd.hAdd.{u, v, w} {α : Type u} {β : Type v} {γ : outParam (Type w)} [self : HAdd α β γ] : α → β → γ`a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `+` in identifiers is `add`.mNat+HAdd.hAdd.{u, v, w} {α : Type u} {β : Type v} {γ : outParam (Type w)} [self : HAdd α β γ] : α → β → γ`a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `+` in identifiers is `add`.kNat)HAdd.hAdd.{u, v, w} {α : Type u} {β : Type v} {γ : outParam (Type w)} [self : HAdd α β γ] : α → β → γ`a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `+` in identifiers is `add`.theorem Nat.add_assoc
Nat.add_assoc (n m k : Nat) : n + m + k = n + (m + k)(nNatmNatkNat: NatNat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.) : nNat+HAdd.hAdd.{u, v, w} {α : Type u} {β : Type v} {γ : outParam (Type w)} [self : HAdd α β γ] : α → β → γ`a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `+` in identifiers is `add`.mNat+HAdd.hAdd.{u, v, w} {α : Type u} {β : Type v} {γ : outParam (Type w)} [self : HAdd α β γ] : α → β → γ`a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `+` in identifiers is `add`.kNat=Eq.{u_1} {α : Sort u_1} : α → α → PropThe equality relation. It has one introduction rule, `Eq.refl`. We use `a = b` as notation for `Eq a b`. A fundamental property of equality is that it is an equivalence relation. ``` variable (α : Type) (a b c d : α) variable (hab : a = b) (hcb : c = b) (hcd : c = d) example : a = d := Eq.trans (Eq.trans hab (Eq.symm hcb)) hcd ``` Equality is much more than an equivalence relation, however. It has the important property that every assertion respects the equivalence, in the sense that we can substitute equal expressions without changing the truth value. That is, given `h1 : a = b` and `h2 : p a`, we can construct a proof for `p b` using substitution: `Eq.subst h1 h2`. Example: ``` example (α : Type) (a b : α) (p : α → Prop) (h1 : a = b) (h2 : p a) : p b := Eq.subst h1 h2 example (α : Type) (a b : α) (p : α → Prop) (h1 : a = b) (h2 : p a) : p b := h1 ▸ h2 ``` The triangle in the second presentation is a macro built on top of `Eq.subst` and `Eq.symm`, and you can enter it by typing `\t`. For more information: [Equality](https://lean-lang.org/theorem_proving_in_lean4/quantifiers_and_equality.html#equality) Conventions for notations in identifiers: * The recommended spelling of `=` in identifiers is `eq`.nNat+HAdd.hAdd.{u, v, w} {α : Type u} {β : Type v} {γ : outParam (Type w)} [self : HAdd α β γ] : α → β → γ`a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `+` in identifiers is `add`.(HAdd.hAdd.{u, v, w} {α : Type u} {β : Type v} {γ : outParam (Type w)} [self : HAdd α β γ] : α → β → γ`a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `+` in identifiers is `add`.mNat+HAdd.hAdd.{u, v, w} {α : Type u} {β : Type v} {γ : outParam (Type w)} [self : HAdd α β γ] : α → β → γ`a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `+` in identifiers is `add`.kNat)HAdd.hAdd.{u, v, w} {α : Type u} {β : Type v} {γ : outParam (Type w)} [self : HAdd α β γ] : α → β → γ`a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. Conventions for notations in identifiers: * The recommended spelling of `+` in identifiers is `add`.
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalMissing[missing declaration]
External declaration panel with a missing declaration.
Lean code for Definition2.7●1 declaration, 1 missing
Associated Lean declarations
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalMissing[missing declaration]
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalMissing[missing declaration]
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalMissingmissing declarationdeclaration not found (name was not present during directive/code-block registration)
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalAxiom[axiom-like (no body)]
External theorem panel with an axiom-like declaration.
Lean code for Theorem2.8●1 definition, incomplete
Associated Lean declarations
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalAxiom[axiom-like (no body)]
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalAxiom[axiom-like (no body)]
-
axiom PreviewRuntimeShowcase.CodePanelDecls.previewExternalAxiom
PreviewRuntimeShowcase.CodePanelDecls.previewExternalAxiom : True: TrueTrue : Prop`True` is a proposition and has only an introduction rule, `True.intro : True`. In other words, `True` is simply true, and has a canonical proof, `True.intro` For more information: [Propositional Logic](https://lean-lang.org/theorem_proving_in_lean4/propositions_and_proofs.html#propositional-logic)axiom PreviewRuntimeShowcase.CodePanelDecls.previewExternalAxiom
PreviewRuntimeShowcase.CodePanelDecls.previewExternalAxiom : True: TrueTrue : Prop`True` is a proposition and has only an introduction rule, `True.intro : True`. In other words, `True` is simply true, and has a canonical proof, `True.intro` For more information: [Propositional Logic](https://lean-lang.org/theorem_proving_in_lean4/propositions_and_proofs.html#propositional-logic)
-
panelInlineOnlyOk[complete]
Inline code panel sample with complete Lean code.
Lean code for Definition2.9
Associated Lean declarations
-
panelInlineOnlyOk[complete]
-
panelInlineOnlyOk[complete]
def panelInlineOnlyOk : Nat := 0
-
panelInlineOnlySorry[sorry in proof]
Inline code panel sample with a sorry-backed declaration.
Lean code for Definition2.10
Associated Lean declarations
-
panelInlineOnlySorry[sorry in proof]
-
panelInlineOnlySorry[sorry in proof]
theorem panelInlineOnlySorry : True := ⊢ True
All goals completed! 🐙
-
panelInlineOk[complete] -
panelInlineSorry[sorry in proof]
Inline code panel sample with mixed declaration health.
Lean code for Definition2.11
Associated Lean declarations
-
panelInlineOk[complete]
-
panelInlineSorry[sorry in proof]
-
panelInlineOk[complete] -
panelInlineSorry[sorry in proof]
def panelInlineOk : Nat := 0
theorem panelInlineSorry : True := ⊢ True
All goals completed! 🐙
-
panelInlineAxiom[axiom-like (no body)]
Inline code panel sample with an axiom-like declaration.
Lean code for Definition2.12
Associated Lean declarations
-
panelInlineAxiom[axiom-like (no body)]
-
panelInlineAxiom[axiom-like (no body)]
axiom panelInlineAxiom : True
- No associated Lean code or declarations.
Statement without associated Lean code.