Skip to content

Commit

Permalink
chore: use double-backtick
Browse files Browse the repository at this point in the history
  • Loading branch information
gebner committed Nov 1, 2022
1 parent a04dac6 commit 4a78c37
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Mathport/Binary/Number.lean
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ These functions mimic the ones in lean3/src/library/num.cpp
-/
import Lean
import Mathport.Binary.Basic
import Mathlib.Init.ZeroOne

namespace Mathport.Binary

open Lean

partial def isConcreteNat? (e : Expr) : Option Nat := do
if e.isConstOf `Nat.zero then
if e.isConstOf ``Nat.zero then
some 0
else if e.isAppOfArity `Nat.succ 1 then
else if e.isAppOfArity ``Nat.succ 1 then
let n ← isConcreteNat? e.appArg!
some (n+1)
else
Expand All @@ -31,13 +32,13 @@ structure NumInfo where
deriving Inhabited

partial def isNumber? (e : Expr) : Option NumInfo := do
if e.isAppOfArity `Zero.zero 2 then pure {
if e.isAppOfArity ``Zero.zero 2 then pure {
number := 0,
level := e.getAppFn.constLevels!.head!,
type := e.getArg! 0
hasZero? := e.getArg! 1
}
else if e.isAppOfArity `One.one 2 then pure {
else if e.isAppOfArity ``One.one 2 then pure {
number := 1,
level := e.getAppFn.constLevels!.head!,
type := e.getArg! 0,
Expand Down Expand Up @@ -67,7 +68,7 @@ def translateNumbers (e : Expr) : MetaM Expr := Meta.transform e (pre := core) w
| some { number := n, level, type, .. } =>
-- TODO: we will want to avoid wrapping "normal" Nat numbers
-- (current workaround is for the OfNat instances to `no_index` the numbers)
let inst := mkAppN (mkConst `OfNat.mk [level]) #[type, mkRawNatLit n, e]
TransformStep.done $ mkAppN (mkConst `OfNat.ofNat [level]) #[type, mkRawNatLit n, inst]
let inst := mkAppN (mkConst ``OfNat.mk [level]) #[type, mkRawNatLit n, e]
TransformStep.done $ mkAppN (mkConst ``OfNat.ofNat [level]) #[type, mkRawNatLit n, inst]

end Mathport.Binary

0 comments on commit 4a78c37

Please sign in to comment.