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.

The LaTeX printer writes only LaTeX tokens

Lean module Esm.Document.Math.TokLatex, formal/Esm/Document/Math/TokLatex.lean at ed59cfa2b070
Imports Esm.Document.Math.LexLatex

Every token of a printed well-formed expression is a LaTeX token (tokOK ), so the LaTeX lexer lemma applies to the printer’s output.

def TL : List Tok → Prop

Every \times is followed, within the list, by a token that is not a number: the printer writes \times between the bound pairs of a region (before a bracket) and after the \nabla of a curl (before an operand that does not start with a number).

def AllOK (ts : List Tok) : Prop

What the printer writes: LaTeX tokens, and \times before a token that is not a number.

theorem allOK_times_tok proved source
theorem allOK_times_tok {u : Tok} {r : List Tok} (hr : AllOK (u :: r)) (hu : startsNum [u] = false) :
    AllOK (.kw .times :: u :: r)

\times before a list that does not start with a number.

macro source
macro "aok" : tactic

Close a goal AllOK [fixed tokens and pieces] from the pieces in the context.

Names

JSON

theorem setToks_latex proved source
theorem setToks_latex (c : Ctx) (hc : c.sf = .latex) (s : String) : setToks c s = nameToks c s

LaTeX sets no set name upright: a set prints as a name.

Printer pieces

Reductions

Block assembly

The induction

theorem allOK_pa proved source
theorem allOK_pa (S : Sym) (e : Json) (he : isE e = true) (L : Nat) :
    AllOK ((pr ⟨.latex, S⟩ e).at .latex L)

The LaTeX printer writes LaTeX tokens, and \times only before a bracket.

theorem allOK_rowToks proved source
theorem allOK_rowToks (c : Ctx) (hc : c.sf = .latex) (P : Json → Out) (kv : String × Json)
    (hQ : ∀ a b, kv.2 = .arr [a, b] → AllOK ((P a).at .latex 4) ∧ AllOK ((P b).at .latex 4)) :
    AllOK (rowToks c P kv)

A range row’s tokens are LaTeX tokens.

theorem print_tokL proved source
theorem print_tokL (S : Sym) (e : Json) (he : isE e = true) : TokL (print .latex S e)

Every token the LaTeX printer writes for a well-formed expression is a LaTeX token or a \times the lexer lemma allows.

theorem pa_tokL proved source
theorem pa_tokL (S : Sym) (e : Json) (he : isE e = true) : TokL (pa ⟨.latex, S⟩ 1 e)

The same for an expression printed whole as an expression (pa ), an == at its top included.

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