Skip to content

Commit

Permalink
refactor: IndPredBelow: use apply_assumption (#4841)
Browse files Browse the repository at this point in the history
when transforming the `match` statements in `IndPredBelow`, given a
local variable `x : T`, we need to search for `hx : T.below x`.
Previously this was done using the custom `backwardsChaining` method,
although my hypothesis is that we don’t need to chain anything here, and
can use `apply_assumption`.
  • Loading branch information
nomeata authored Jul 28, 2024
1 parent 671ce7a commit f830fc9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Lean/Meta/IndPredBelow.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Authors: Dany Fabian
prelude
import Lean.Meta.Constructions.CasesOn
import Lean.Meta.Match.Match
import Lean.Meta.Tactic.SolveByElim

namespace Lean.Meta.IndPredBelow
open Match
Expand Down Expand Up @@ -569,7 +570,7 @@ def findBelowIdx (xs : Array Expr) (motive : Expr) : MetaM $ Option (Expr × Nat
let below ← mkFreshExprSyntheticOpaqueMVar belowTy
try
trace[Meta.IndPredBelow.match] "{←Meta.ppGoal below.mvarId!}"
if (← backwardsChaining below.mvarId! 10) then
if (← below.mvarId!.applyRules { backtracking := false, maxDepth := 1 } []).isEmpty then
trace[Meta.IndPredBelow.match] "Found below term in the local context: {below}"
if (← xs.anyM (isDefEq below)) then pure none else pure (below, idx.val)
else
Expand Down

0 comments on commit f830fc9

Please sign in to comment.