LeanMachineLearning

elabKernelDiagramCmd🔗

Definition

Display the kernel diagram for a given term.

Example usage:

/- Kernel diagram for an equality theorem. -/
#kernel_diagram ProbabilityTheory.Kernel.deterministic_comp_copy
🔗def
elabKernelDiagramCmd : Lean.Elab.Command.CommandElab
elabKernelDiagramCmd : Lean.Elab.Command.CommandElab

Code

@[command_elab kernelDiagram, inherit_doc kernelDiagram] def elabKernelDiagramCmd : CommandElab := fun | stx@`(#kernel_diagram $t:term) => do let html runTermElabM fun _ => do let e try mkConstWithFreshMVarLevels ( realizeGlobalConstNoOverloadWithInfo t) catch _ => Term.levelMVarToParam ( instantiateMVars ( Term.elabTerm t none)) match KernelDiagram.kernelEqMReduce? e with | some html => return html | none => throwError "could not find an equality of kernels: {e}." liftCoreM <| Widget.savePanelWidgetInfo (hash HtmlDisplay.javascript) (return json% { html: $( Server.RpcEncodable.rpcEncode html) }) stx | stx => throwError "Unexpected syntax {stx}."

Actions: Source · Open Issue

Meaning last changed in v4.34.0-rc2-1-g439785b (2026-08-23).

Self-contained, with its dependencies inlined and proofs replaced by sorry: download the raw file · open it in the Lean web editor.

Dependency graph

Audit surface: 21 project declarations, 335 external constants

✓ Proved: no sorry anywhere in its closure

This is the tool's own reading of one build's recorded axioms, and it is not robust against an author who wants it to pass. Checking meant to be relied on should go through Comparator, which replays the proof through the kernel from an export against an explicit list of permitted axioms.