Skip to content

Commit 6fc18f2

Browse files
committed
fix(DiscrTree): remove special handling of numerals
Fixes leanprover#2867
1 parent e61d082 commit 6fc18f2

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

src/Lean/Meta/DiscrTree.lean

-31
Original file line numberDiff line numberDiff line change
@@ -198,31 +198,6 @@ private partial def isNumeral (e : Expr) : Bool :=
198198
else if fName == ``Nat.zero && e.getAppNumArgs == 0 then true
199199
else false
200200

201-
private partial def toNatLit? (e : Expr) : Option Literal :=
202-
if isNumeral e then
203-
if let some n := loop e then
204-
some (.natVal n)
205-
else
206-
none
207-
else
208-
none
209-
where
210-
loop (e : Expr) : OptionT Id Nat := do
211-
let f := e.getAppFn
212-
match f with
213-
| .lit (.natVal n) => return n
214-
| .const fName .. =>
215-
if fName == ``Nat.succ && e.getAppNumArgs == 1 then
216-
let r ← loop e.appArg!
217-
return r+1
218-
else if fName == ``OfNat.ofNat && e.getAppNumArgs == 3 then
219-
loop (e.getArg! 1)
220-
else if fName == ``Nat.zero && e.getAppNumArgs == 0 then
221-
return 0
222-
else
223-
failure
224-
| _ => failure
225-
226201
private def isNatType (e : Expr) : MetaM Bool :=
227202
return (← whnf e).isConstOf ``Nat
228203

@@ -350,8 +325,6 @@ private def pushArgs (root : Bool) (todo : Array Expr) (e : Expr) (config : Whnf
350325
return (.lit v, todo)
351326
| .const c _ =>
352327
unless root do
353-
if let some v := toNatLit? e then
354-
return (.lit v, todo)
355328
if (← shouldAddAsStar c e) then
356329
return (.star, todo)
357330
let nargs := e.getAppNumArgs
@@ -468,10 +441,6 @@ def insertIfSpecific [BEq α] (d : DiscrTree α) (e : Expr) (v : α) (config : W
468441

469442
private def getKeyArgs (e : Expr) (isMatch root : Bool) (config : WhnfCoreConfig) : MetaM (Key × Array Expr) := do
470443
let e ← reduceDT e root config
471-
unless root do
472-
-- See pushArgs
473-
if let some v := toNatLit? e then
474-
return (.lit v, #[])
475444
match e.getAppFn with
476445
| .lit v => return (.lit v, #[])
477446
| .const c _ =>

0 commit comments

Comments
 (0)