Skip to content

Commit

Permalink
fix: backtrack at injection failure (#6109)
Browse files Browse the repository at this point in the history
This PR fixes an issue in the `injection` tactic. This tactic may
execute multiple sub-tactics. If any of them fail, we must backtrack the
partial assignment. This issue was causing the error: "`mvarId` is
already assigned" in issue #6066. The issue is not yet resolved, as the
equation generator for the match expressions is failing in the example
provided in this issue.
  • Loading branch information
leodemoura authored Nov 18, 2024
1 parent ab162b3 commit 98b1edf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Lean/Meta/Tactic/Injection.lean
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,11 @@ where
if lhs.isRawNatLit && rhs.isRawNatLit then cont
else
try
match (← injection mvarId fvarId newNames) with
| .solved => return .solved
| .subgoal mvarId newEqs remainingNames =>
mvarId.withContext <| go d (newEqs.toList ++ fvarIds) mvarId remainingNames
commitIfNoEx do
match (← injection mvarId fvarId newNames) with
| .solved => return .solved
| .subgoal mvarId newEqs remainingNames =>
mvarId.withContext <| go d (newEqs.toList ++ fvarIds) mvarId remainingNames
catch _ => cont
else cont

Expand Down

0 comments on commit 98b1edf

Please sign in to comment.