Project

EarthSciAST

The EarthSciML Abstract Syntax Tree format: schema, operators, coupling, and five language bindings.

Contents

This is the documentation for the older version v0.16.0. For the latest release, see v0.17.0.

Round trip, case by case: the escape form

Lean module Esm.Document.Math.Escape, formal/Esm/Document/Math/Escape.lean at ed59cfa2b070
Imports Esm.Document.Math.Cases9

Every node has it: LaTeX \esm{op}{fields}{args} with the fields as JSON tokens, Typst esm.node("op", #(fields), args). The parser puts op and args back in their sorted places among the fields (mkNode_fieldsOf).

JSON tokens

Putting op and args back

theorem addAcc_of_lvl proved source
theorem addAcc_of_lvl {c : Ctx} {kvs : List (String × Json)} (h : (pr c (.obj kvs)).lvl = 10) :
    addAcc (.obj kvs) = [.obj kvs]

A node printed at level 10 is not a + chain.

The escape node

theorem fieldsOf_wf proved source
theorem fieldsOf_wf {kvs : List (String × Json)} (hs : keysSorted kvs = true)
    (hf : ∀ kv ∈ fieldsOf kvs, jwf kv.2 = true) : (Json.obj (fieldsOf kvs)).WF

The fields of a node with sorted keys, each well formed, are a well-formed object.

This module also proves 11 lemmas without doc comments; they are in the source.