Renders HOL objects as LaTeX.
Types are printed as subscripts. Logical constants of the signature
(⊤, ⊥, ¬, ∧, ∨, ⊃, ≡, =, ∀, ∃) are rendered as their
standard LaTeX symbols without any type annotation. Bound variables are
reconstructed with fresh names drawn from a type-specific pool, avoiding
capture with free variables and outer binders. Duplicates are disambiguated
with running superscripts (subscripts are reserved for the type annotation).
Examples
iex> import ShotDs.Hol.Dsl
iex> import ShotDs.Hol.Definitions
iex> alias ShotDs.Util.LatexFormatter
iex> t = forall(x_i(), &(x_i() &&& &1))
...> # etc.
Summary
Types
HOL objects understood by the formatter.
Functions
Renders the given HOL object as a LaTeX string. Returns {:ok, result} or
{:error, reason}.
Renders the given HOL object as a LaTeX string. Raises on error.
Types
@type formattable() :: ShotDs.Data.Type.t() | ShotDs.Data.Declaration.t() | ShotDs.Data.Term.t() | ShotDs.Data.Term.term_id() | ShotDs.Data.Substitution.t() | ShotDs.Data.Problem.t()
HOL objects understood by the formatter.
@type opts() :: [ hide_types: boolean(), merge_binder: boolean(), reconstruct_names: boolean(), math_mode: :raw | :inline | :display ]
Options accepted by format/2 and format!/2.
:hide_types— omit type subscripts on non-logical symbols (defaultfalse).:merge_binder— collapse∀(λx. body)into∀ x.\, body(defaulttrue; ignored when:reconstruct_namesisfalse).:reconstruct_names— pick fresh names for bound variables (defaulttrue). Whenfalse, binders are rendered as\lambda_{τ}and bound references as\mathtt{k}_{τ}, preserving the raw de Bruijn structure.:math_mode— one of:raw(default),:inline($…$) or:display($$…$$).
Functions
@spec format(formattable(), opts()) :: {:ok, String.t()} | ShotDs.Stt.TermFactory.lookup_error_t() | {:error, :unknown_argument}
Renders the given HOL object as a LaTeX string. Returns {:ok, result} or
{:error, reason}.
@spec format!(formattable(), opts()) :: String.t()
Renders the given HOL object as a LaTeX string. Raises on error.