LeanMachineLearning

applyLocTactic🔗

Definition

Apply a given transformation to all goals and/or hypotheses specified by a Location.

🔗def
applyLocTactic (loc : Lean.Elab.Tactic.Location) (transform : Lean.Expr Lean.MetaM (Lean.Expr × Lean.Expr)) : Lean.Elab.Tactic.TacticM Unit
applyLocTactic (loc : Lean.Elab.Tactic.Location) (transform : Lean.Expr Lean.MetaM (Lean.Expr × Lean.Expr)) : Lean.Elab.Tactic.TacticM Unit

Code

def applyLocTactic (loc : Location) (transform : Expr MetaM (Expr × Expr)) : TacticM Unit := do match loc with | Location.targets hyps target => for hyp in hyps do let hFVarId getFVarId hyp let newGoal replaceEquality ( getMainGoal) (some hFVarId) transform replaceMainGoal [newGoal] if target then let newGoal replaceEquality ( getMainGoal) none transform replaceMainGoal [newGoal] | Location.wildcard => let goal getMainGoal goal.withContext do let lctx getLCtx let mut currentGoal := goal for decl in lctx do if decl.isImplementationDetail then continue try currentGoal replaceEquality currentGoal (some decl.fvarId) transform replaceMainGoal [currentGoal] catch _ => continue try currentGoal replaceEquality currentGoal none transform replaceMainGoal [currentGoal] catch _ => pure ()

Actions: Source · Open Issue

Meaning last changed in v4.34.0-rc2-1-g439785b (2026-08-23).

Self-contained, with its dependencies inlined and proofs replaced by sorry: download the raw file · open it in the Lean web editor.

Dependency graph

Audit surface: 1 project declarations, 102 external constants

✓ Proved: no sorry anywhere in its closure

This is the tool's own reading of one build's recorded axioms, and it is not robust against an author who wants it to pass. Checking meant to be relied on should go through Comparator, which replays the proof through the kernel from an export against an explicit list of permitted axioms.