Convert the given goal Ctx |- target into Ctx |- targetNew using an equality proof eqProof : target = targetNew.
It assumes eqProof has type target = targetNew
Equations
- One or more equations did not get rendered due to their size.
Instances For
Converts the given goal Ctx |- target into Ctx |- targetNew. It assumes the goals are definitionally equal.
We use the proof term
@id target mvarNew
to create a checkpoint.
If targetNew is equal to target, then returns mvarId unchanged.
Uses Expr.equal for the comparison so that it is possible to update binder names, etc., which are user-visible.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Replace type of the local declaration with id fvarId with one with the same user-facing name, but with type typeNew.
This method assumes eqProof is a proof that the type of fvarId is equal to typeNew.
This tactic actually adds a new declaration and (tries to) clear the old one.
If the old one cannot be cleared, then at least its user-facing name becomes inaccessible.
The new local declaration is inserted at the soonest point after fvarId at which it is
well-formed. That is, if typeNew involves declarations which occur later than fvarId in the
local context, the new local declaration will be inserted immediately after the latest-occurring
one. Otherwise, it will be inserted immediately after fvarId.
Note: replaceLocalDecl should not be used when unassigned pending mvars might be present in
typeNew, as these may later be synthesized to fvars which occur after fvarId (by e.g.
Term.withSynthesize or Term.synthesizeSyntheticMVars) .
Equations
- mvarId.replaceLocalDecl fvarId typeNew eqProof = Lean.Meta.replaceLocalDeclCore✝ mvarId fvarId typeNew eqProof
Instances For
Replaces the type of fvarId at mvarId with typeNew.
Remark: this method assumes that typeNew is definitionally equal to the current type of fvarId.
If typeNew is equal to current type of fvarId, then returns mvarId unchanged.
Uses Expr.equal for the comparison so that it is possible to update binder names, etc., which are user-visible.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Replace the target type of mvarId with typeNew.
If checkDefEq = false, this method assumes that typeNew is definitionally equal to the current target type.
If checkDefEq = true, throw an error if typeNew is not definitionally equal to the current target type.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Executes the revert/intro pattern, running the continuation k after temporarily reverting
the given local variables from the local context of the metavariable mvarId,
and then re-introducing the local variables specified by k.
mvarIdis the goal metavariable to operate on.fvarIdsis an array offvarIdsto revert in the order specified. An error is thrown if they cannot be reverted in order.clearAuxDeclsInsteadOfRevertis configuration passed toLean.MVarId.revert.kis the continuation run once the local variables have been reverted. It is providedmvarIdafter the requested variables have been reverted along with the array of reverted variables. This array always containsfvarIds, but it may contain additional variables that were reverted due to dependencies. The continuation returns a value, a new goal, and an aliasing array.
Once k has completed, one variable is introduced per entry in the aliasing array.
- If the entry is
none, the variable is just introduced. - If the entry is
some fv(wherefvis a variable fromfvarIds), the variable is introduced and then recorded as an alias offvin the info tree. This for example causes the unused variable linter as seeingfvand this newly introduced variable as being "the same".
For example, if k leaves all the reverted variables in the same order,
having it return fvars.map .some as the aliasing array causes those variables to be re-introduced and aliased
to the original local variables.
Returns the value returned by k along with the resulting goal after variable introduction.
See Lean.MVarId.changeLocalDecl for an example. The motivation is that to work on a local variable,
you need to move it into the goal, alter the goal, and then bring it back into the local context,
all while keeping track of any other local variables that depend on this one.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Like Lean.MVarId.withReverted, but reverts all local variables starting from fvarId.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Replaces the type of the free variable fvarId with typeNew.
If checkDefEq is true then an error is thrown if typeNew is not definitionally
equal to the type of fvarId. Otherwise this function assumes typeNew and the type
of fvarId are definitionally equal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Modify mvarId target type using f.
Equations
- mvarId.modifyTarget f = mvarId.withContext do mvarId.checkNotAssigned `modifyTarget let __do_lift ← mvarId.getType let __do_lift ← f __do_lift mvarId.change __do_lift false
Instances For
Clears the value of the local definition fvarId. Ensures that the resulting goal state
is still type correct. Throws an error if it is a local hypothesis without a value.
Preserves the order of the local context.
Equations
- One or more equations did not get rendered due to their size.