2. Code Panels
In-module external definition panel sample.
Lean code for Definition2.1●1 definition
Associated Lean declarations
-
defdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
def PreviewRuntimeShowcase.CodePanelDecls.previewExternalDefinition : Nat
def PreviewRuntimeShowcase.CodePanelDecls.previewExternalDefinition : Nat
Namespace-opened external definition panel sample.
Lean code for Definition2.2●1 definition
Associated Lean declarations
-
previewExternalDefinition[complete]
-
previewExternalDefinition[complete]
-
defdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
def PreviewRuntimeShowcase.CodePanelDecls.previewExternalDefinition : Nat
def PreviewRuntimeShowcase.CodePanelDecls.previewExternalDefinition : Nat
In-module external Lean abbrev panel sample. Status summaries stay definition-like, while the rendered declaration preserves the abbrev keyword.
Lean code for Definition2.3●1 definition
Associated Lean declarations
-
abbrevdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
abbrev PreviewRuntimeShowcase.CodePanelDecls.previewExternalAbbrev : Nat
abbrev PreviewRuntimeShowcase.CodePanelDecls.previewExternalAbbrev : Nat
In-module external unsafe definition panel sample.
Lean code for Definition2.4●1 definition
Associated Lean declarations
-
defdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
unsafe def PreviewRuntimeShowcase.CodePanelDecls.previewExternalUnsafeDefinition : Nat
unsafe def PreviewRuntimeShowcase.CodePanelDecls.previewExternalUnsafeDefinition : Nat
External definition panel sample with multiple documented Lean definitions.
Lean code for Definition2.5●2 definitions
Associated Lean declarations
-
defdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
def PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedDefinition : Nat
def PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedDefinition : Nat
The first documented preview definition used to test multi-declaration docstring rendering in external code panels.
-
defdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
def PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedFunction (n : Nat) : Nat
def PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedFunction (n : Nat) : Nat
Adds a small preview offset to `n`. The second paragraph keeps paragraph spacing visible when several documented definitions appear in the same code panel.
In-module external theorem panel sample.
Lean code for Theorem2.6●1 theorem
Associated Lean declarations
-
theoremdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem : True
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem : True
External theorem panel sample with a declaration docstring.
Lean code for Theorem2.7●1 theorem
Associated Lean declarations
-
theoremdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
theorem PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedTheorem : True
theorem PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedTheorem : True
A documented preview theorem whose statement is intentionally small.
In-module external theorem panel sample with multiple complete declarations.
Lean code for Theorem2.8●2 theorems
Associated Lean declarations
-
theoremdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem : True
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem : True
-
theoremdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheoremTwo : True
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheoremTwo : True
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalSorry[sorry in proof]
In-module external theorem panel with a sorry-backed declaration.
Lean code for Theorem2.9●1 theorem, incomplete
Associated Lean declarations
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalSorry[sorry in proof]
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalSorry[sorry in proof]
-
theoremdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancontains sorry
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalSorry : True
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalSorry : True
In-module external theorem panel sample with mixed declaration health.
Lean code for Theorem2.10●2 theorems, 1 incomplete
Associated Lean declarations
-
theoremdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem : True
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem : True
-
theoremdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancontains sorry
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalSorry : True
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalSorry : True
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem[complete] -
PreviewRuntimeShowcase.CodePanelDecls.previewExternalMissing[missing declaration]
External theorem panel sample with multiple references and one missing declaration.
Lean code for Theorem2.11●2 declarations, 1 missing
Associated Lean declarations
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem[complete]
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalMissing[missing declaration]
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem[complete] -
PreviewRuntimeShowcase.CodePanelDecls.previewExternalMissing[missing declaration]
-
theoremdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem : True
theorem PreviewRuntimeShowcase.CodePanelDecls.previewExternalTheorem : True
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalMissingmissing declarationdeclaration not found (name was not present during directive/code-block registration)
Out-of-module external definition panel sample.
Lean code for Definition2.12●1 definition
Associated Lean declarations
-
Nat.add[complete]
-
Nat.add[complete]
-
defdefined in Init/Prelude.leancomplete
def Nat.add : Nat → Nat → Nat
def Nat.add : Nat → Nat → Nat
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.
Out-of-module external theorem panel sample.
Lean code for Theorem2.13●1 theorem
Associated Lean declarations
-
Nat.add_assoc[complete]
-
Nat.add_assoc[complete]
-
theoremdefined in Init/Data/Nat/Basic.leancomplete
theorem Nat.add_assoc (n m k : Nat) : n + m + k = n + (m + k)
theorem Nat.add_assoc (n m k : Nat) : n + m + k = n + (m + k)
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalMissing[missing declaration]
External declaration panel with a missing declaration.
Lean code for Definition2.14●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.15●1 definition, incomplete
Associated Lean declarations
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalAxiom[axiom-like (no body)]
-
PreviewRuntimeShowcase.CodePanelDecls.previewExternalAxiom[axiom-like (no body)]
-
axiomdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leanaxiom-like
axiom PreviewRuntimeShowcase.CodePanelDecls.previewExternalAxiom : True
axiom PreviewRuntimeShowcase.CodePanelDecls.previewExternalAxiom : True
External inductive panel sample with documented constructors.
Lean code for Definition2.16●1 definition
Associated Lean declarations
-
inductivedefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
inductive PreviewRuntimeShowcase.CodePanelDecls.PreviewStage : Type
inductive PreviewRuntimeShowcase.CodePanelDecls.PreviewStage : Type
A small inductive type used to exercise rendered constructor lists.
Constructors
PreviewRuntimeShowcase.CodePanelDecls.PreviewStage.initial : PreviewStage
The initial stage of the preview workflow.
PreviewRuntimeShowcase.CodePanelDecls.PreviewStage.step (n : Nat) : PreviewStage
A numbered follow-up stage.
External class panel sample with documented methods.
Lean code for Definition2.17●1 definition
Associated Lean declarations
-
classdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
class PreviewRuntimeShowcase.CodePanelDecls.PreviewFold (α : Type) : Type
class PreviewRuntimeShowcase.CodePanelDecls.PreviewFold (α : Type) : Type
A compact class used to exercise rendered method documentation.
Methods
neutral : α
The neutral preview value.
combine : α → α → α
Combine two preview values.
External structure panel sample with a field-heavy package shape.
Lean code for Definition2.18●1 definition
Associated Lean declarations
-
structuredefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
structure PreviewRuntimeShowcase.CodePanelDecls.PreviewFreyPackage : Type
structure PreviewRuntimeShowcase.CodePanelDecls.PreviewFreyPackage : Type
A preview Frey package is a compact stand-in for a structure whose constructor duplicates a field-heavy mathematical record.
Fields
a : Nat
The first value in the package.
b : Nat
The second value in the package.
c : Nat
The target value in the package.
p : Nat
The prime-like exponent under discussion.
hp5 : 5 ≤ self.p
The lower-bound hypothesis on `p`.
hFLT : self.a ^ self.p + self.b ^ self.p = self.c ^ self.p
The Fermat-like equation carried by the package.
External theorem panel sample with a Markdown-like docstring.
Lean code for Theorem2.19●1 theorem
Associated Lean declarations
-
theoremdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
theorem PreviewRuntimeShowcase.CodePanelDecls.PreviewFreyPackage.ofCounterexample {a b c p : Nat} (hp5 : 5 ≤ p) (H : a ^ p + b ^ p = c ^ p) : Nonempty PreviewFreyPackage
theorem PreviewRuntimeShowcase.CodePanelDecls.PreviewFreyPackage.ofCounterexample {a b c p : Nat} (hp5 : 5 ≤ p) (H : a ^ p + b ^ p = c ^ p) : Nonempty PreviewFreyPackage
Given a counterexample `a^p + b^p = c^p` with `p >= 5`, there exists a preview Frey package.
-
PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedDefinition[complete] -
PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedTheorem[complete] -
PreviewRuntimeShowcase.CodePanelDecls.PreviewStage[complete] -
PreviewRuntimeShowcase.CodePanelDecls.PreviewFold[complete] -
PreviewRuntimeShowcase.CodePanelDecls.PreviewFreyPackage[complete]
External declaration panel sample mixing definitions, theorems, inductives, classes, and structures.
Lean code for Definition2.20●5 declarations
Associated Lean declarations
-
PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedDefinition[complete]
-
PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedTheorem[complete]
-
PreviewRuntimeShowcase.CodePanelDecls.PreviewStage[complete]
-
PreviewRuntimeShowcase.CodePanelDecls.PreviewFold[complete]
-
PreviewRuntimeShowcase.CodePanelDecls.PreviewFreyPackage[complete]
-
PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedDefinition[complete] -
PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedTheorem[complete] -
PreviewRuntimeShowcase.CodePanelDecls.PreviewStage[complete] -
PreviewRuntimeShowcase.CodePanelDecls.PreviewFold[complete] -
PreviewRuntimeShowcase.CodePanelDecls.PreviewFreyPackage[complete]
-
defdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
def PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedDefinition : Nat
def PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedDefinition : Nat
The first documented preview definition used to test multi-declaration docstring rendering in external code panels.
-
theoremdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
theorem PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedTheorem : True
theorem PreviewRuntimeShowcase.CodePanelDecls.previewDocstringedTheorem : True
A documented preview theorem whose statement is intentionally small.
-
inductivedefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
inductive PreviewRuntimeShowcase.CodePanelDecls.PreviewStage : Type
inductive PreviewRuntimeShowcase.CodePanelDecls.PreviewStage : Type
A small inductive type used to exercise rendered constructor lists.
Constructors
PreviewRuntimeShowcase.CodePanelDecls.PreviewStage.initial : PreviewStage
The initial stage of the preview workflow.
PreviewRuntimeShowcase.CodePanelDecls.PreviewStage.step (n : Nat) : PreviewStage
A numbered follow-up stage.
-
classdefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
class PreviewRuntimeShowcase.CodePanelDecls.PreviewFold (α : Type) : Type
class PreviewRuntimeShowcase.CodePanelDecls.PreviewFold (α : Type) : Type
A compact class used to exercise rendered method documentation.
Methods
neutral : α
The neutral preview value.
combine : α → α → α
Combine two preview values.
-
structuredefined in PreviewRuntimeShowcase/Chapters/CodePanels.leancomplete
structure PreviewRuntimeShowcase.CodePanelDecls.PreviewFreyPackage : Type
structure PreviewRuntimeShowcase.CodePanelDecls.PreviewFreyPackage : Type
A preview Frey package is a compact stand-in for a structure whose constructor duplicates a field-heavy mathematical record.
Fields
a : Nat
The first value in the package.
b : Nat
The second value in the package.
c : Nat
The target value in the package.
p : Nat
The prime-like exponent under discussion.
hp5 : 5 ≤ self.p
The lower-bound hypothesis on `p`.
hFLT : self.a ^ self.p + self.b ^ self.p = self.c ^ self.p
The Fermat-like equation carried by the package.
Inline code panel sample with complete Lean code.
Lean code for Definition2.21
Associated Lean declarations
-
panelInlineOnlyOk[complete]
-
panelInlineOnlyOk[complete]
def panelInlineOnlyOk : Nat := 0
Inline code panel sample with a sorry-backed declaration.
Lean code for Definition2.22
Associated Lean declarations
-
panelInlineOnlySorry[sorry in proof]
-
panelInlineOnlySorry[sorry in proof]
theorem panelInlineOnlySorry : True := ⊢ True
All goals completed! 🐙
-
panelInlineMultiTheoremOkLeft[complete] -
panelInlineMultiTheoremOkRight[complete]
Inline code panel sample with multiple complete Lean theorems.
Lean code for Theorem2.23
Associated Lean declarations
-
panelInlineMultiTheoremOkLeft[complete]
-
panelInlineMultiTheoremOkRight[complete]
-
panelInlineMultiTheoremOkLeft[complete] -
panelInlineMultiTheoremOkRight[complete]
theorem panelInlineMultiTheoremOkLeft : True := ⊢ True
All goals completed! 🐙
theorem panelInlineMultiTheoremOkRight : True := ⊢ True
All goals completed! 🐙
-
panelInlineMultiTheoremWarningOk[complete] -
panelInlineMultiTheoremWarningSorry[sorry in proof]
Inline code panel sample with multiple Lean theorems and mixed declaration health.
Lean code for Theorem2.24
Associated Lean declarations
-
panelInlineMultiTheoremWarningOk[complete]
-
panelInlineMultiTheoremWarningSorry[sorry in proof]
-
panelInlineMultiTheoremWarningOk[complete] -
panelInlineMultiTheoremWarningSorry[sorry in proof]
theorem panelInlineMultiTheoremWarningOk : True := ⊢ True
All goals completed! 🐙
theorem panelInlineMultiTheoremWarningSorry : True := ⊢ True
All goals completed! 🐙
-
panelInlineOk[complete] -
panelInlineSorry[sorry in proof]
Inline code panel sample with mixed declaration health.
Lean code for Definition2.25
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! 🐙
Inline code panel sample with an axiom-like declaration.
Lean code for Definition2.26
Associated Lean declarations
-
panelInlineAxiom[axiom-like (no body)]
-
panelInlineAxiom[axiom-like (no body)]
axiom panelInlineAxiom : True
-
PanelInlineDocstringedStructure[complete] -
PanelInlineDocstringedStructure.left[complete] -
PanelInlineDocstringedStructure.right[complete] -
PanelInlineDocstringedStructure.ordered[complete]
Inline Lean structure sample with declaration and field docstrings.
Lean code for Definition2.27
Associated Lean declarations
-
PanelInlineDocstringedStructure[complete]
-
PanelInlineDocstringedStructure.left[complete]
-
PanelInlineDocstringedStructure.right[complete]
-
PanelInlineDocstringedStructure.ordered[complete]
-
PanelInlineDocstringedStructure[complete] -
PanelInlineDocstringedStructure.left[complete] -
PanelInlineDocstringedStructure.right[complete] -
PanelInlineDocstringedStructure.ordered[complete]
/--
Inline package docstring used to compare literate Lean
against the external declaration renderer.
* The field `left` is shown as inline code.
* **Bold text** checks richer Markdown.
-/
structure PanelInlineDocstringedStructure where
/-- The left inline field. -/
left : Nat
/-- The right inline field. -/
right : Nat
/--
A proof-like field that keeps dependent-looking field
layout visible.
-/
ordered : left <= right
-
PanelInlineDocstringedStage[complete] -
PanelInlineDocstringedStage.followup[complete] -
PanelInlineDocstringedStage.initial[complete]
Inline Lean inductive sample with declaration and constructor docstrings.
Lean code for Definition2.28
Associated Lean declarations
-
PanelInlineDocstringedStage[complete]
-
PanelInlineDocstringedStage.followup[complete]
-
PanelInlineDocstringedStage.initial[complete]
-
PanelInlineDocstringedStage[complete] -
PanelInlineDocstringedStage.followup[complete] -
PanelInlineDocstringedStage.initial[complete]
/--
Inline workflow stage docstring used to compare
constructor documentation.
-/
inductive PanelInlineDocstringedStage where
/-- The initial inline stage. -/
| initial
/-- A follow-up inline stage carrying a counter. -/
| followup (_ : Nat)
-
PanelInlineMixedConfig[complete] -
PanelInlineMixedConfig.enabled[complete] -
PanelInlineMixedState[complete] -
PanelInlineMixedState.ready[complete] -
PanelInlineMixedState.running[complete] -
PanelInlineMixedFold[complete] -
PanelInlineMixedFold.empty[complete] -
PanelInlineMixedFold.merge[complete]
Inline Lean panel sample mixing documented structures, inductives, and classes.
Lean code for Definition2.29
Associated Lean declarations
-
PanelInlineMixedConfig[complete]
-
PanelInlineMixedConfig.enabled[complete]
-
PanelInlineMixedState[complete]
-
PanelInlineMixedState.ready[complete]
-
PanelInlineMixedState.running[complete]
-
PanelInlineMixedFold[complete]
-
PanelInlineMixedFold.empty[complete]
-
PanelInlineMixedFold.merge[complete]
-
PanelInlineMixedConfig[complete] -
PanelInlineMixedConfig.enabled[complete] -
PanelInlineMixedState[complete] -
PanelInlineMixedState.ready[complete] -
PanelInlineMixedState.running[complete] -
PanelInlineMixedFold[complete] -
PanelInlineMixedFold.empty[complete] -
PanelInlineMixedFold.merge[complete]
/-- Inline mixed configuration docstring. -/
structure PanelInlineMixedConfig where
/-- Whether the preview branch is enabled. -/
enabled : Bool
/-- Inline mixed state docstring. -/
inductive PanelInlineMixedState where
/-- The ready state. -/
| ready
/-- The running state with a step count. -/
| running (_ : Nat)
/-- Inline mixed fold class docstring. -/
class PanelInlineMixedFold (α : Type) where
/-- The empty inline value. -/
empty : α
/-- Merge two inline values. -/
merge : α -> α -> α
- No associated Lean code or declarations.
Statement without associated Lean code.