Documentation

Lean.Meta.SynthInstance

Equations
Equations
Equations
  • maxResultSize : Nat
  • maxHeartbeats : Nat
Equations
  • Lean.Meta.SynthInstance.instInhabitedSynthM = { default := fun x x => default }

Return globals and locals instances that may unify with type

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.

Create a new generator node for mvar and add waiter as its waiter. key must be mkTableKey mctx mvarType.

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.

Create a key for the goal associated with the given metavariable. That is, we create a key for the type of the metavariable.

We must instantiate assigned metavariables before we invoke mkTableKey.

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

getSubgoals lctx localInsts xs inst creates the subgoals for the instance inst. The subgoals are in the context of the free variables xs, and (lctx, localInsts) is the local context and instances before we added the free variables to it.

This extra complication is required because 1- We want all metavariables created by synthInstance to share the same local context. 2- We want to ensure that applications such as mvar xs are higher order patterns.

The method getGoals create a new metavariable for each parameter of inst. For example, suppose the type of inst is forall (x_1 : A_1) ... (x_n : A_n), B x_1 ... x_n. Then, we create the metavariables ?m_i : forall xs, A_i, and return the subset of these metavariables that are instance implicit arguments, and the expressions: - inst (?m_1 xs) ... (?m_n xs) (aka instVal) - B (?m_1 xs) ... (?m_n xs)

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.

Try to synthesize metavariable mvar using the instance inst. Remark: mctx contains mvar. If it succeeds, the result is a new updated metavariable context and a new list of subgoals. A subgoal is created for each instance implicit parameter of inst.

Equations

Assign a precomputed answer to mvar. If it succeeds, the result is a new updated metavariable context and a new list of subgoals.

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

Move waiters that are waiting for the given answer to the resume stack.

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

Create a new answer after cNode resolved all subgoals. That is, cNode.subgoals == []. And then, store it in the tabled entries map, and wakeup waiters.

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

Process the next subgoal in the given consumer node.

Equations
  • One or more equations did not get rendered due to their size.
@[inline]
Equations
  • One or more equations did not get rendered due to their size.

Try the next instance in the node on the top of the generator stack.

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

Given (cNode, answer) on the top of the resume stack, continue execution by using answer to solve the next subgoal.

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.

Return LOption.some r if succeeded, LOption.none if it failed, and LOption.undef if instance cannot be synthesized right now because type contains metavariables.

Equations
  • One or more equations did not get rendered due to their size.
def Lean.Meta.synthInstance (type : Lean.Expr) (maxResultSize? : optParam (Option Nat) none) :
Equations
  • One or more equations did not get rendered due to their size.