CoChat

An Extensible User Interface for Lean 4

Open access
Nawrocki, Wojciech, Ayers, Edward W., Ebner, Gabriel · 2023 · Schloss Dagstuhl – Leibniz-Zentrum für Informatik

The DOI matches its DataCite record; 40 of the 40 references it cites were found in a registry or an index; none of the 16 sources its claims cite is checked for support yet.

Abstract

Contemporary proof assistants rely on complex automation and process libraries with millions of lines of code. At these scales, understanding the emergent interactions between components can be a serious challenge. One way of managing complexity, long established in informal practice, is through varying external representations. For instance, algebraic notation facilitates term-based reasoning whereas geometric diagrams invoke spatial intuition. Objects viewed one way become much simpler than when viewed differently. In contrast, modern general-purpose ITP systems usually only support limited, textual representations. Treating this as a problem of human-computer interaction, we aim to demonstrate that presentations - UI elements that store references to the objects they are displaying - are a fruitful way of thinking about ITP interface design. They allow us to make headway on two fronts - introspection of prover internals and support for diagrammatic reasoning. To this end we have built an extensible user interface for the Lean 4 prover with an associated ProofWidgets 4 library of presentation-based UI components. We demonstrate the system with several examples including type information popups, structured traces, contextual suggestions, a display for algebraic reasoning, and visualizations of red-black trees. Our interface is already part of the core Lean distribution.

Overview

CoChat Summary

TL;DR

The paper presents an extensible user interface for Lean 4 and the ProofWidgets 4 library, centered on “presentations”: UI elements that retain references to the objects they display. It reports that the UI is part of core Lean and deployed to hundreds of active users, with examples including expression popups, structured traces, contextual suggestions, commutative diagrams, and red-black tree visualizations.

Key findings

  • The system combines arbitrary HTML5/web displays, referential presentations, user-extensibility with reusable components, live interactive displays, on-demand lazy computation, and general-purpose design; the authors state it appears to be the first to support all of these cohesively.
  • The UI is part of the core Lean distribution and has been deployed widely to hundreds of active users, with integration in the VS Code extension `vscode-lean4` and the Lean 4 Web online editor.
  • Demonstrated examples include type information popups, structured traces (e.g., typeclass search), contextual suggestions, algebraic reasoning via commutative diagrams using Penrose, and red-black tree visualizations; the red-black tree visualization using `react-d3-tree` took less than an hour to prototype.
  • Implementation uses LSP/JSON-RPC with user-extensible server RPC methods, remote references (`WithRpcRef`), and dynamic code delivery; traces can have thousands of nodes and environments can weigh several gigabytes, motivating lazy and remote handling.

Methods

  • Design and implementation paper: describes the architecture of the Lean 4 UI, ProofWidgets 4 library, language server/infoview/editor components, and supporting metaprogramming features.
  • No empirical user study or quantitative evaluation is reported; evidence is provided through worked examples and system deployment.
  • Data availability lists software repositories for `vscode-lean4` and ProofWidgets 4.

Limitations

  • The paper states that compared to the previous version, the system has lost the ability to program UI event handlers directly in Lean rather than JavaScript, and hopes to regain this when a JavaScript or WebAssembly backend is developed for Lean.
  • The paper states that remote-reference memory management is cooperative and may fail if client-side errors occur; a client that does not release server-side memory could cause leaks, though keepalive messages mitigate disconnection- and hang-related leaks.
  • The paper states that details are highly likely to change as the library evolves; evident from the text, no empirical evaluation or user study is reported, so usefulness claims rest on examples and deployment rather than measured outcomes.

Model-written summary. Check it against the paper before relying on it.

Integrity signals

Registry

DataCite · 10.4230/lipics.itp.2023.24

Cites

40 of 40 references verified0 citation errors · 0 not checkable

Statistics

Nothing to recompute.

Figures

Figure 1 The Lean infoview embedded in vscode-lean4 . Two tactic-mode goals (Tactic state) at the text cursor are shown (1). Differences in the goals' types and local contexts with respect to the previous state are highlighted (2). A second location containing a term goal (Expected type) is pinned (3).
Figure 1 The Lean infoview embedded in vscode-lean4 . Two tactic-mode goals (Tactic state) at the text cursor are shown (1). Differences in the goals' types and local contexts with respect to the previous state are highlighted (2). A second location containing a term goal (Expected type) is pinned (3).CC-BY · From the PDF
Figure 2 The numeral notation 0 : Nat is resolved via typeclass search. A structured trace (1) of the search is explored. A presentation of a pretty-printed typeclass instance is clicked on to display its type (2). Subexpressions within an expression can be selected following its tree structure.
Figure 2 The numeral notation 0 : Nat is resolved via typeclass search. A structured trace (1) of the search is explored. A presentation of a pretty-printed typeclass instance is clicked on to display its type (2). Subexpressions within an expression can be selected following its tree structure.CC-BY · From the PDF
Figure 3 A JSX-like syntax for writing HTML trees inline is used to write down a term of type Html in the editor. The #check command is used to inspect it in the infoview (1). The type Html has an associated pretty-printer which emits the same custom syntax. The pretty-printer sub-output <b>Lean!</b> is a presentation of the subterm Html.element "b" #[] #["Lean!"] which can be inspected by hovering over it with the mouse (2).
Figure 3 A JSX-like syntax for writing HTML trees inline is used to write down a term of type Html in the editor. The #check command is used to inspect it in the infoview (1). The type Html has an associated pretty-printer which emits the same custom syntax. The pretty-printer sub-output <b>Lean!</b> is a presentation of the subterm Html.element "b" #[] #["Lean!"] which can be inspected by hovering over it with the mouse (2).CC-BY · From the PDF
Image 4
CC-BY · From the PDF
Figure 5 The Rubiks component loads the three.js library in order to create a 3D visualization of a Rubik's cube. An HTML tree <Rubiks seq={eg} /> containing an instance of this component is passed to the #html command. This command can be used to render HTML trees in the infoview with a user widget (HTML Display). The sequence of rotations eg is determined by the Lean script.
Figure 5 The Rubiks component loads the three.js library in order to create a 3D visualization of a Rubik's cube. An HTML tree <Rubiks seq={eg} /> containing an instance of this component is passed to the #html command. This command can be used to render HTML trees in the infoview with a user widget (HTML Display). The sequence of rotations eg is determined by the Lean script.CC-BY · From the PDF
Figure 6 Abalancing function for red-black trees is implemented in balance . Two terms appearing in the course of a proof about it are selected in the goal and illustrated as trees.
Figure 6 Abalancing function for red-black trees is implemented in balance . Two terms appearing in the course of a proof about it are selected in the goal and illustrated as trees.CC-BY · From the PDF
Figure 7 A subset of hypotheses relevant to the proof is selected. The set relationships are visualized in one Venn diagram.
Figure 7 A subset of hypotheses relevant to the proof is selected. The set relationships are visualized in one Venn diagram.CC-BY · From the PDF
Image 8
CC-BY · From the PDF
Figure 9 In order to determine which user widgets to show in the infoview, a sequence of messages is exchanged every time the text cursor moves. First, the editor informs the infoview about the new cursor position (here line 4 , column 5 ). Then, the infoview queries the language server for the user widgets that should be shown at that position. Finally, the server replies with a list of user widgets. Its contents are then displayed in the infoview. The editor acts as a proxy for infoview-server communication, indicated by dashed lines.
Figure 9 In order to determine which user widgets to show in the infoview, a sequence of messages is exchanged every time the text cursor moves. First, the editor informs the infoview about the new cursor position (here line 4 , column 5 ). Then, the infoview queries the language server for the user widgets that should be shown at that position. Finally, the server replies with a list of user widgets. Its contents are then displayed in the infoview. The editor acts as a proxy for infoview-server communication, indicated by dashed lines.CC-BY · From the PDF

Verification

Claims the paper makes

0 Valid · 14 Not valid · 13 Not checked · 100 Own results and interpretations

25 more claims

Create a free account to see all 127 claims and every source verdict.

See all claims — free account
  • Probably not a substantial claim. 88
  • It may state two separate claims as one. 23
  • The quote only partly states this claim. 1

Create a free account to see these claims.

Self-check

Percentages, sums and reported differences re-computed from the paper’s own numbers.

Each contradiction between two passages listed here was confirmed by an independent check.

4 of 4

Citations

Cites

Show all 40 references

Research works printed but not linked: 4

  1. Krzysztof Bar, Aleks Kissinger, and Jamie Vicary. Globular: an online proof assistant for higher-dimensional rewriting. In Leibniz International Proceedings in Informatics, volume 52, pages 34:1-34:11, 2016. ncatlab.org/nlab/show/Globular.
  2. Jon Barwise and John Etchemendy. Hyperproof: Logical reasoning with diagrams. In Working Notes of the AAAI Spring Symposium on Reasoning with Diagrammatic Representations, 1992. URL: https://www.aaai.org/Papers/Symposia/Spring/1992/SS-92-02/SS92-02-016.pdf.
  3. Eugene Charles Ciccarelli. Presentation based user interfaces. PhD thesis, Massachusetts Institute of Technology, Cambridge, MA, USA, 1984. URL: https://hdl.handle.net/1721. 1/15346.
  4. R.A. Dean. Elements of Abstract Algebra. Wiley international edition. Wiley, 1966. URL: https://books.google.com/books?id=kmulxmBgkxoC.

Cited by

See all 33

Metadata

Authors
Nawrocki, W., Ayers, E. W., & Ebner, G.
Affiliations
  • Carnegie Mellon University (US)
  • Microsoft (United States) (US)
Venue
Schloss Dagstuhl – Leibniz-Zentrum für Informatik
Publisher
Schloss Dagstuhl – Leibniz-Zentrum für Informatik
Published
2023
OpenAlex
W6929086236
Cited by
33
References
39
Citations by year
2026: 9 · 2025: 8 · 2024: 11 · 2023: 5
FWCI
5.76
Type
journal article
Language
en
Open access
Locations
  • DROPS (Schloss Dagstuhl – Leibniz Center for Informatics) (publishedVersion, cc-by)
  • Leibniz international proceedings in informatics (cc-by)
Topics
  • Physical Sciences › Computer Science › Software › Logic, programming, and type systems
  • Physical Sciences › Computer Science › Computational Theory and Mathematics › Mathematics, Computing, and Information Processing
  • Physical Sciences › Computer Science › Human-Computer Interaction › Usability and User Interface Design
Keywords
Lean 4, proof assistants, user interface design, presentations, diagrammatic reasoning, interactive theorem proving, algebraic notation, contextual suggestion

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

A language model drew the claims from the paper on 2026-11-22, under version 3 of the claim definition (model deepseek-v4.1-flash, prompt extract-v3).

A second model labelled each claim on 2026-11-22 (model jev-1.13-20260917, definition revision gold-guideline-v0.2).

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review

How to cite

Cite CoChat for the checks on this page, and the paper for its own findings.

This page
CoChat. (2026). Citation check: An Extensible User Interface for Lean 4. https://app.cochat.ai/papers/10.4230/lipics.itp.2023.24
The paper
Nawrocki, W., Ayers, E. W., & Ebner, G. (2023). An Extensible User Interface for Lean 4. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. https://doi.org/10.4230/lipics.itp.2023.24

Data sources

Bibliographic data: Semantic Scholar, OpenAlex, Crossref.

Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).

Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.