Outputs beyond text

Proof trees, countermodels, intermediate forms, tables, a typeset page.

Framework decisions behind it: D37, D47, D56.

A package declares what its outputs show: lines of text, but also trees, graphs, tables, drawings and code. The page draws each kind the same way, in the page's colours. Press Run, then look at the tabs.

A proof as a tree

Peirce's law is provable in classical logic. The Proof tab is the derivation, drawn as a tree.

((a -> b) -> a) -> a

A countermodel as a graph

The same law is not provable intuitionistically. The Countermodel tab shows a Kripke model as a graph and a table.

% fragment: intuitionistic ((a -> b) -> a) -> a

A proof state

Rocq checks the file in the page. Put the cursor in the proof and open Goals to see what is left to prove at that point.

Lemma and_swap : forall P Q : Prop, P /\ Q -> Q /\ P. Proof. intros P Q [p q]. split. - exact q. - exact p. Qed.

Intermediate forms

Gleam compiles in the page, so the JavaScript and the Erlang it produces are outputs, kept current as you type.

import gleam/io pub type Shape { Circle(radius: Int) Square(side: Int) } pub fn area(shape: Shape) -> Int { case shape { Circle(r) -> 3 * r * r Square(s) -> s * s } } pub fn main() { io.debug(area(Square(4))) }

A table, and a schema as a tree

SQLite runs the script; every query is a table, and the Schema tab lists what the script made.

CREATE TABLE authors (id INTEGER PRIMARY KEY, name TEXT NOT NULL); CREATE TABLE books ( id INTEGER PRIMARY KEY, title TEXT NOT NULL, author_id INTEGER REFERENCES authors (id), year INTEGER ); INSERT INTO authors (name) VALUES ('Ursula K. Le Guin'), ('Stanisław Lem'); INSERT INTO books (title, author_id, year) VALUES ('The Dispossessed', 1, 1974), ('Solaris', 2, 1961), ('The Left Hand of Darkness', 1, 1969); SELECT authors.name, books.title, books.year FROM authors JOIN books ON books.author_id = authors.id ORDER BY books.year;

A typeset page

Typst compiles to pages, drawn as SVG, and re-compiles while you type.

#set page(width: 12cm, height: auto, margin: 1cm) = The sum of the odd numbers The first n odd numbers add up to a square: $ sum_(k=1)^n (2k - 1) = n^2 $