ShotDs.Util.Formatter (shot_ds v1.0.0)

Copy Markdown View Source

Contains functionality for formatting terms, variable names etc.

Summary

Functions

Pretty-prints the given HOL object taking the ETS cache into accout for recursively traversing term DAGs. This is implemented for singular types, declarations, terms (via ID or struct), substitutions and TPTP proof problems. Returns a tuple {:ok, result} or {:error, reason}.

Pretty-prints the given HOL object taking the ETS cache into accout for recursively traversing term DAGs. This is implemented for singular types, declarations, terms (via ID or struct), substitutions and TPTP proof problems. Raises on errors (for terms, substitutions and problems).

Pretty-prints a TPTP proof problem. Returns a tuple {:ok, result} or {:error, reason}.

Pretty-prints a TPTP proof problem, raising on errors.

Pretty-prints a substitution. Returns a tuple {:ok, result} or {:error, reason}.

Pretty-prints a substitution, raising on errors.

Recursively traverses the term DAG to build a pretty-printed string representation with minimal bracketing. Type annotations may be enabled.

Recursively traverses the term DAG to build a pretty-printed string representation with minimal bracketing, raising on errors. Type annotations may be enabled.

Shortens Erlang references by hashing it and converting it to base 36 for display purposes.

Functions

format(hol_object, hide_types \\ true)

Pretty-prints the given HOL object taking the ETS cache into accout for recursively traversing term DAGs. This is implemented for singular types, declarations, terms (via ID or struct), substitutions and TPTP proof problems. Returns a tuple {:ok, result} or {:error, reason}.

format!(hol_object, hide_types \\ true)

Pretty-prints the given HOL object taking the ETS cache into accout for recursively traversing term DAGs. This is implemented for singular types, declarations, terms (via ID or struct), substitutions and TPTP proof problems. Raises on errors (for terms, substitutions and problems).

format_problem(p, hide_types \\ true)

@spec format_problem(ShotDs.Data.Problem.t(), boolean()) ::
  {:ok, String.t()} | {:error, term()}

Pretty-prints a TPTP proof problem. Returns a tuple {:ok, result} or {:error, reason}.

format_problem!(problem, hide_types \\ true)

@spec format_problem!(ShotDs.Data.Problem.t(), boolean()) :: String.t()

Pretty-prints a TPTP proof problem, raising on errors.

format_substitution(substitution, hide_types \\ true)

@spec format_substitution(ShotDs.Data.Substitution.t(), boolean()) ::
  {:ok, String.t()} | ShotDs.Stt.TermFactory.lookup_error_t()

Pretty-prints a substitution. Returns a tuple {:ok, result} or {:error, reason}.

format_substitution!(substitution, hide_types \\ true)

@spec format_substitution!(ShotDs.Data.Substitution.t(), boolean()) :: String.t()

Pretty-prints a substitution, raising on errors.

format_term(term_or_id, hide_types \\ true)

Recursively traverses the term DAG to build a pretty-printed string representation with minimal bracketing. Type annotations may be enabled.

Returns a tuple {:ok, result} or {:error, reason}.

format_term!(term_or_id, hide_types \\ true)

@spec format_term!(ShotDs.Data.Term.term_id() | ShotDs.Data.Term.t(), boolean()) ::
  String.t()

Recursively traverses the term DAG to build a pretty-printed string representation with minimal bracketing, raising on errors. Type annotations may be enabled.

short_ref(ref)

@spec short_ref(reference()) :: String.t()

Shortens Erlang references by hashing it and converting it to base 36 for display purposes.

Example:

iex> make_ref() |> short_ref
"1PO9GZ"