Skip to content

Commit 81467b8

Browse files
committed
chore: rename grind intro functions that will be deleted
1 parent f77442b commit 81467b8

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

src/Lean/Meta/Tactic/Grind/Intro.lean

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,19 @@ private def isCheapInductive (type : Expr) : CoreM Bool := do
184184
let .inductInfo info ← getConstInfo declName | return false
185185
return info.numCtors <= 1
186186

187-
private def applyCases? (goal : Goal) (fvarId : FVarId) : GrindM (Option (List Goal)) := goal.mvarId.withContext do
187+
private def applyInjection? (goal : Goal) (fvarId : FVarId) : MetaM (Option Goal) := do
188+
if let some mvarId ← injection? goal.mvarId fvarId then
189+
return some { goal with mvarId }
190+
else
191+
return none
192+
193+
private def exfalsoIfNotProp (goal : Goal) : MetaM Goal := goal.mvarId.withContext do
194+
if (← isProp (← goal.mvarId.getType)) then
195+
return goal
196+
else
197+
return { goal with mvarId := (← goal.mvarId.exfalso) }
198+
199+
private def applyCasesOld? (goal : Goal) (fvarId : FVarId) : GrindM (Option (List Goal)) := goal.mvarId.withContext do
188200
/-
189201
Remark: we used to use `whnfD`. This was a mistake, we don't want to unfold user-defined abstractions.
190202
Example: `a ∣ b` is defined as `∃ x, b = a * x`
@@ -201,20 +213,8 @@ private def applyCases? (goal : Goal) (fvarId : FVarId) : GrindM (Option (List G
201213
else
202214
return none
203215

204-
private def applyInjection? (goal : Goal) (fvarId : FVarId) : MetaM (Option Goal) := do
205-
if let some mvarId ← injection? goal.mvarId fvarId then
206-
return some { goal with mvarId }
207-
else
208-
return none
209-
210-
private def exfalsoIfNotProp (goal : Goal) : MetaM Goal := goal.mvarId.withContext do
211-
if (← isProp (← goal.mvarId.getType)) then
212-
return goal
213-
else
214-
return { goal with mvarId := (← goal.mvarId.exfalso) }
215-
216216
/-- Introduce new hypotheses (and apply `by_contra`) until goal is of the form `... ⊢ False` -/
217-
partial def intros (generation : Nat) : GrindTactic' := fun goal => do
217+
partial def introsOld (generation : Nat) : GrindTactic' := fun goal => do
218218
let rec go (goal : Goal) : StateRefT (Array Goal) GrindM Unit := do
219219
if goal.inconsistent then
220220
return ()
@@ -226,7 +226,7 @@ partial def intros (generation : Nat) : GrindTactic' := fun goal => do
226226
else
227227
modify fun s => s.push goal
228228
| .newHyp fvarId goal =>
229-
if let some goals ← applyCases? goal fvarId then
229+
if let some goals ← applyCasesOld? goal fvarId then
230230
goals.forM go
231231
else if let some goal ← applyInjection? goal fvarId then
232232
go goal
@@ -235,19 +235,19 @@ partial def intros (generation : Nat) : GrindTactic' := fun goal => do
235235
| .newDepHyp goal =>
236236
go goal
237237
| .newLocal fvarId goal =>
238-
if let some goals ← applyCases? goal fvarId then
238+
if let some goals ← applyCasesOld? goal fvarId then
239239
goals.forM go
240240
else
241241
go goal
242242
let (_, goals) ← (go goal).run #[]
243243
return goals.toList
244244

245245
/-- Asserts a new fact `prop` with proof `proof` to the given `goal`. -/
246-
def assertAt (proof : Expr) (prop : Expr) (generation : Nat) : GrindTactic' := fun goal => do
246+
def assertAtOld (proof : Expr) (prop : Expr) (generation : Nat) : GrindTactic' := fun goal => do
247247
if isEagerCasesCandidate goal prop then
248248
let mvarId ← goal.mvarId.assert (← mkFreshUserName `h) prop proof
249249
let goal := { goal with mvarId }
250-
intros generation goal
250+
introsOld generation goal
251251
else
252252
let goal ← GoalM.run' goal do
253253
let r ← preprocess prop
@@ -257,16 +257,16 @@ def assertAt (proof : Expr) (prop : Expr) (generation : Nat) : GrindTactic' := f
257257
if goal.inconsistent then return [] else return [goal]
258258

259259
/-- Asserts next fact in the `goal` fact queue. -/
260-
def assertNext : GrindTactic := fun goal => do
260+
def assertNextOld : GrindTactic := fun goal => do
261261
let some (fact, newRawFacts) := goal.newRawFacts.dequeue?
262262
| return none
263-
assertAt fact.proof fact.prop fact.generation { goal with newRawFacts }
263+
assertAtOld fact.proof fact.prop fact.generation { goal with newRawFacts }
264264

265265
/-- Asserts all facts in the `goal` fact queue. -/
266-
partial def assertAll : GrindTactic := fun goal =>
266+
partial def assertAllOld : GrindTactic := fun goal =>
267267
if goal.newRawFacts.isEmpty then
268268
return none
269269
else
270-
assertNext.iterate goal
270+
assertNextOld.iterate goal
271271

272272
end Lean.Meta.Grind

src/Lean/Meta/Tactic/Grind/Lookahead.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Lean.Meta.Tactic.Grind.EMatch
1313
namespace Lean.Meta.Grind
1414

1515
private partial def solve (generation : Nat) (goal : Goal) : GrindM Bool := do
16-
cont (← intros generation goal)
16+
cont (← introsOld generation goal)
1717
where
1818
cont (goals : List Goal) : GrindM Bool := do
1919
match goals with
@@ -24,7 +24,7 @@ where
2424
loop (goal : Goal) : GrindM Bool := withIncRecDepth do
2525
if goal.inconsistent then
2626
return true
27-
else if let some goals ← assertAll goal then
27+
else if let some goals ← assertAllOld goal then
2828
cont goals
2929
else if let some goals ← Arith.checkOld goal then
3030
cont goals

src/Lean/Meta/Tactic/Grind/Main.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private def initCore (mvarId : MVarId) (params : Params) : GrindM (List Goal) :=
100100
let mvarId ← mvarId.unfoldReducible
101101
let mvarId ← mvarId.betaReduce
102102
appendTagSuffix mvarId `grind
103-
let goals ← intros (← mkGoal mvarId params) (generation := 0)
103+
let goals ← introsOld (← mkGoal mvarId params) (generation := 0)
104104
goals.forM (·.checkInvariants (expensive := true))
105105
return goals.filter fun goal => !goal.inconsistent
106106

src/Lean/Meta/Tactic/Grind/Solve.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def applyTac (x : GrindTactic) (goal : Goal) : M Bool := do
5252
return true
5353
stepGuard go goal
5454

55-
def tryAssertAll : Goal → M Bool := applyTac assertAll
55+
def tryAssertAll : Goal → M Bool := applyTac assertAllOld
5656

5757
def tryEmatch : Goal → M Bool := applyTac ematchOld
5858

src/Lean/Meta/Tactic/Grind/Split.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ private def mkCasesMajor (c : Expr) : GoalM Expr := do
236236
private def introNewHyp (goals : List Goal) (acc : List Goal) (generation : Nat) : GrindM (List Goal) := do
237237
match goals with
238238
| [] => return acc.reverse
239-
| goal::goals => introNewHyp goals ((← intros generation goal) ++ acc) generation
239+
| goal::goals => introNewHyp goals ((← introsOld generation goal) ++ acc) generation
240240

241241
private def casesWithTrace (major : Expr) : GoalM (List MVarId) := do
242242
if (← getConfig).trace then

0 commit comments

Comments
 (0)