Documentation

Lean.PrettyPrinter.Delaborator.Builtins

If cond is true, wraps the syntax produced by d in a type ascription.

Equations
  • One or more equations did not get rendered due to their size.

Wraps the identifier (or identifier with explicit universe levels) with @ if pp.analysis.blockImplicit is set to true.

Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.

Delaborator for const expressions. This is not registered as a delaborator, as const is not an expression kind (see [delab] description and Lean.PrettyPrinter.Delaborator.getExprKind). Rather, it is called through the app delaborator.

Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.

A structure that records details of a function parameter.

  • name : Lake.Name

    Binder name for the parameter.

  • Binder info for the parameter.

  • defVal : Option Lean.Expr

    The default value for the parameter, if the parameter has a default value.

  • isAutoParam : Bool

    Whether the parameter is an autoparam (i.e., whether it uses a tactic for the default value).

Instances For
Equations

Returns true if the parameter is an explicit parameter that has neither a default value nor a tactic.

Equations

Given a function f supplied with arguments args, returns an array whose n-th element is set to the kind of the n-th argument's associated parameter. We do not assume the expression mkAppN f args is sensical, and this function captures errors (except for panics) and returns the empty array in that case.

The returned array might be longer than the number of arguments. It gives parameter kinds for the fully-applied function. Note: the defVal expressions are only guaranteed to be valid for parameters associated to the supplied arguments; after this, they might refer to temporary fvars.

This function properly handles "overapplied" functions. For example, while id takes one explicit argument, it can take more than one explicit argument when its arguments are specialized to function types, like in id id 2.

Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.

Given an application of numArgs arguments with the calculated ParamKinds, returns true if we should wrap the applied function with @ when we are in explicit mode.

Equations
  • One or more equations did not get rendered due to their size.

Delaborates a function application in explicit mode, and ensures the resulting head syntax is wrapped with @ if needed.

Equations
  • One or more equations did not get rendered due to their size.

Delaborates a function application in the standard mode, where implicit arguments are generally not included, unless pp.analysis.namedArg is set at that argument.

This delaborator is where app_unexpanders and the structure instance unexpander are applied.

Assumes numArgs ≤ paramKinds.size.

Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.

If the argument should be pretty printed then it returns the syntax for that argument. The boolean is false if an unexpander should not be used for the application due to this argument. The argumnet remainingArgs is the number of arguments in the application after this one.

Equations
  • One or more equations did not get rendered due to their size.

Runs the given unexpanders, returning the resulting syntax if any are applicable, and otherwise fails.

Equations
  • One or more equations did not get rendered due to their size.

If the expression is a candidate for app unexpanders, try applying an app unexpander using some prefix of the arguments, longest prefix first. This function makes sure that the unexpanded syntax is annotated and given TermInfo so that it is hoverable in the InfoView.

Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.

Returns true if an application should use explicit mode when delaborating.

Equations
  • One or more equations did not get rendered due to their size.

Delaborates applications. Removes up to maxArgs arguments to form the "head" of the application and delaborates the head using delabHead. Then the application is then processed in explicit mode or implicit mode depending on which should be used.

Equations
  • One or more equations did not get rendered due to their size.

Default delaborator for applications.

Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.

The withOverApp combinator allows delaborators to handle "over-application" by using the core application delaborator to handle additional arguments.

For example, suppose f : {A : Type} → Foo A → A and we want to implement a delaborator for applications f x to pretty print as F[x]. Because A is a type variable we might encounter a term of the form @f (A → B) x y, which has an additional argument y. With this combinator one can use an arity-2 delaborator to pretty print this as F[x] y.

  • arity: the expected number of arguments to f. The combinator will fail if fewer than this number of arguments are passed, and if more than this number of arguments are passed the arguments are handled using the standard application delaborator.
  • x: constructs data corresponding to the main application (f x in the example).

In the event of overapplication, the delaborator x is wrapped in Lean.PrettyPrinter.Delaborator.withAnnotateTermInfo to register TermInfo for the resulting term. The effect of this is that the term is hoverable in the Infoview.

Equations
  • One or more equations did not get rendered due to their size.

State for delabAppMatch and helpers.

Delaborate applications of "matchers" such as

List.map.match_1 : {α : Type _} →
  (motive : List α → Sort _) →
    (x : List α) → (Unit → motive List.nil) → ((a : α) → (as : List α) → motive (a :: as)) → motive x
Equations
  • One or more equations did not get rendered due to their size.

Delaborates applications of the form letFun v (fun x => b) as let_fun x := v; b.

Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.

Check for a Syntax.ident of the given name anywhere in the tree. This is usually a bad idea since it does not check for shadowing bindings, but in the delaborator we assume that bindings are never shadowed.

Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.

Core function that delaborates a natural number (an OfNat.ofNat literal).

Equations
  • One or more equations did not get rendered due to their size.

Core function that delaborates a negative integer literal (a Neg.neg applied to OfNat.ofNat).

Equations
  • One or more equations did not get rendered due to their size.

Core function that delaborates a rational literal that is the division of an integer literal by a natural number literal. The division must be homogeneous for it to count as a rational literal.

Equations
  • One or more equations did not get rendered due to their size.

Delaborates an OfNat.ofNat literal. @OfNat.ofNat _ n _ ~> n.

Equations
  • One or more equations did not get rendered due to their size.

Delaborates the negative of an OfNat.ofNat literal. -@OfNat.ofNat _ n _ ~> -n

Equations
  • One or more equations did not get rendered due to their size.

Delaborates a rational number literal. @OfNat.ofNat _ n _ / @OfNat.ofNat _ m ~> n / m and -@OfNat.ofNat _ n _ / @OfNat.ofNat _ m ~> -n / m

Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.

Delaborate a projection primitive. These do not usually occur in user code, but are pretty-printed when e.g. #printing a projection function.

Equations
  • One or more equations did not get rendered due to their size.

Delaborates an application of a projection function, for example Prod.fst p as p.fst. Collapses intermediate parent projections, so for example rather than o.toB.toA.x it produces o.x.

Does not delaborate projection functions from classes, since the instance parameter is implicit; we would rather see default than instInhabitedNat.default.

Equations
  • One or more equations did not get rendered due to their size.

If this is a projection that could delaborate using dot notation, returns the field name, the arity of the projector, and whether this is a parent projection. Otherwise it fails.

Equations
  • One or more equations did not get rendered due to their size.

Consumes projections to parent structures. For example, if the current expression is o.toB.toA, runs d with o as the current expression.

This delaborator tries to elide functions which are known coercions. For example, Int.ofNat is a coercion, so instead of printing ofNat n we just print ↑n, and when re-parsing this we can (usually) recover the specific coercion being used.

Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.

Pretty-prints a constant c as c.{<levels>} <params> : <type>.

Equations
  • One or more equations did not get rendered due to their size.