Skip to content

Commit f5e90b2

Browse files
committed
nonDep -> nondep
1 parent 64186ad commit f5e90b2

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

src/Lean/Expr.lean

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -396,16 +396,16 @@ inductive Expr where
396396
Expr.letE `x (.const `Nat []) (.lit (.natVal 2)) (.app (.const `Nat.succ []) (.bvar 0)) true
397397
```
398398
399-
If the `nonDep` flag is `true`, then the elaborator treats this as a *non-dependent `let`* (known as a *`have` expression*).
399+
If the `nondep` flag is `true`, then the elaborator treats this as a *non-dependent `let`* (known as a *`have` expression*).
400400
Given an environment, a metavariable context, and a local context,
401401
we say a let-expression `let x : t := v; e` is non-dependent when it is equivalent
402402
to `(fun x : t => e) v`. In contrast, the dependent let-expression
403403
`let n : Nat := 2; fun (a : Array Nat n) (b : Array Nat 2) => a = b` is type correct,
404404
but `(fun (n : Nat) (a : Array Nat n) (b : Array Nat 2) => a = b) 2` is not.
405405
406-
The kernel does not verify `nonDep` when type checking. This is an elaborator feature.
406+
The kernel does not verify `nondep` when type checking. This is an elaborator feature.
407407
-/
408-
| letE (declName : Name) (type : Expr) (value : Expr) (body : Expr) (nonDep : Bool)
408+
| letE (declName : Name) (type : Expr) (value : Expr) (body : Expr) (nondep : Bool)
409409

410410
/--
411411
Natural number and string literal values.
@@ -670,9 +670,9 @@ def mkSimpleThunkType (type : Expr) : Expr :=
670670
def mkSimpleThunk (type : Expr) : Expr :=
671671
mkLambda `_ BinderInfo.default (mkConst `Unit) type
672672

673-
/-- Returns `let x : t := v; b`, a dependent `let` expression. If `nonDep := true`, then returns a `have`. -/
674-
@[inline] def mkLet (x : Name) (t : Expr) (v : Expr) (b : Expr) (nonDep : Bool := false) : Expr :=
675-
.letE x t v b nonDep
673+
/-- Returns `let x : t := v; b`, a `let` expression. If `nondep := true`, then returns a `have`. -/
674+
@[inline] def mkLet (x : Name) (t : Expr) (v : Expr) (b : Expr) (nondep : Bool := false) : Expr :=
675+
.letE x t v b nondep
676676

677677
/-- Returns `have x : t := v; b`, a non-dependent `let` expression. -/
678678
@[inline] def mkHave (x : Name) (t : Expr) (v : Expr) (b : Expr) : Expr :=
@@ -724,7 +724,7 @@ def mkStrLit (s : String) : Expr :=
724724
@[export lean_expr_mk_app] def mkAppEx : Expr → Expr → Expr := mkApp
725725
@[export lean_expr_mk_lambda] def mkLambdaEx (n : Name) (d b : Expr) (bi : BinderInfo) : Expr := mkLambda n bi d b
726726
@[export lean_expr_mk_forall] def mkForallEx (n : Name) (d b : Expr) (bi : BinderInfo) : Expr := mkForall n bi d b
727-
@[export lean_expr_mk_let] def mkLetEx (n : Name) (t v b : Expr) (nonDep : Bool) : Expr := mkLet n t v b nonDep
727+
@[export lean_expr_mk_let] def mkLetEx (n : Name) (t v b : Expr) (nondep : Bool) : Expr := mkLet n t v b nondep
728728
@[export lean_expr_mk_lit] def mkLitEx : Literal → Expr := mkLit
729729
@[export lean_expr_mk_mdata] def mkMDataEx : MData → Expr → Expr := mkMData
730730
@[export lean_expr_mk_proj] def mkProjEx : Name → Nat → Expr → Expr := mkProj
@@ -875,7 +875,7 @@ def isLet : Expr → Bool
875875

876876
/-- Return `true` if the given expression is a non-dependent let-expression (a have-expression). -/
877877
def isHave : Expr → Bool
878-
| letE (nonDep := nonDep) .. => nonDep
878+
| letE (nondep := nondep) .. => nondep
879879
| _ => false
880880

881881
@[export lean_expr_is_have] def isHaveEx : Expr → Bool := isHave
@@ -1020,8 +1020,8 @@ def letBody! : Expr → Expr
10201020
| letE _ _ _ b .. => b
10211021
| _ => panic! "let expression expected"
10221022

1023-
def letNonDep! : Expr → Bool
1024-
| letE _ _ _ _ nonDep => nonDep
1023+
def letNondep! : Expr → Bool
1024+
| letE _ _ _ _ nondep => nondep
10251025
| _ => panic! "let expression expected"
10261026

10271027
def consumeMData : Expr → Expr
@@ -1854,26 +1854,26 @@ def updateLambda! (e : Expr) (newBinfo : BinderInfo) (newDomain : Expr) (newBody
18541854
| lam n d b bi => updateLambda! (lam n d b bi) bi newDomain newBody
18551855
| _ => panic! "lambda expected"
18561856

1857-
@[inline] private unsafe def updateLet!Impl (e : Expr) (newType : Expr) (newVal : Expr) (newBody : Expr) (newNonDep : Bool) : Expr :=
1857+
@[inline] private unsafe def updateLet!Impl (e : Expr) (newType : Expr) (newVal : Expr) (newBody : Expr) (newNondep : Bool) : Expr :=
18581858
match e with
1859-
| letE n t v b nonDep =>
1860-
if ptrEq t newType && ptrEq v newVal && ptrEq b newBody && nonDep == newNonDep then
1859+
| letE n t v b nondep =>
1860+
if ptrEq t newType && ptrEq v newVal && ptrEq b newBody && nondep == newNondep then
18611861
e
18621862
else
1863-
letE n newType newVal newBody newNonDep
1863+
letE n newType newVal newBody newNondep
18641864
| _ => panic! "let expression expected"
18651865

18661866
@[implemented_by updateLet!Impl]
1867-
def updateLet! (e : Expr) (newType : Expr) (newVal : Expr) (newBody : Expr) (newNonDep : Bool) : Expr :=
1867+
def updateLet! (e : Expr) (newType : Expr) (newVal : Expr) (newBody : Expr) (newNondep : Bool) : Expr :=
18681868
match e with
1869-
| letE n _ _ _ _ => letE n newType newVal newBody newNonDep
1869+
| letE n _ _ _ _ => letE n newType newVal newBody newNondep
18701870
| _ => panic! "let expression expected"
18711871

1872-
/-- Like `Expr.updateLet!` but preserves the `nonDep` flag. -/
1872+
/-- Like `Expr.updateLet!` but preserves the `nondep` flag. -/
18731873
@[inline]
18741874
def updateLetE! (e : Expr) (newType : Expr) (newVal : Expr) (newBody : Expr) : Expr :=
18751875
match e with
1876-
| letE n t v b nonDep => updateLet! (letE n t v b nonDep) newType newVal newBody nonDep
1876+
| letE n t v b nondep => updateLet! (letE n t v b nondep) newType newVal newBody nondep
18771877
| _ => panic! "let expression expected"
18781878

18791879
def updateFn : Expr → Expr → Expr

src/Lean/PrettyPrinter/Delaborator/Builtins.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,19 +1028,19 @@ def delabForall : Delab := do
10281028

10291029
@[builtin_delab letE]
10301030
def delabLetE : Delab := do
1031-
let Expr.letE n t v b nonDep ← getExpr | unreachable!
1031+
let Expr.letE n t v b nondep ← getExpr | unreachable!
10321032
let n ← getUnusedName n b
10331033
let stxV ← descend v 1 delab
10341034
let (stxN, stxB) ← withLetDecl n t v fun fvar => do
10351035
let b := b.instantiate1 fvar
10361036
return (← mkAnnotatedIdent n fvar, ← descend b 2 delab)
10371037
if ← getPPOption getPPLetVarTypes <||> getPPOption getPPAnalysisLetVarType then
10381038
let stxT ← descend t 0 delab
1039-
if nonDep then
1039+
if nondep then
10401040
`(have $stxN : $stxT := $stxV; $stxB)
10411041
else
10421042
`(let $stxN : $stxT := $stxV; $stxB)
1043-
else if nonDep then
1043+
else if nondep then
10441044
`(have $stxN := $stxV; $stxB)
10451045
else
10461046
`(let $stxN := $stxV; $stxB)
@@ -1301,14 +1301,14 @@ partial def delabDoElems : DelabM (List Syntax) := do
13011301
prependAndRec `(doElem|let _ ← $ma:term)
13021302
| _ => failure
13031303
else if e.isLet then
1304-
let Expr.letE n t v b nonDep ← getExpr | unreachable!
1304+
let Expr.letE n t v b nondep ← getExpr | unreachable!
13051305
let n ← getUnusedName n b
13061306
let stxT ← descend t 0 delab
13071307
let stxV ← descend v 1 delab
13081308
withLetDecl n t v fun fvar =>
13091309
let b := b.instantiate1 fvar
13101310
descend b 2 $
1311-
if nonDep then
1311+
if nondep then
13121312
prependAndRec `(doElem|have $(mkIdent n) : $stxT := $stxV)
13131313
else
13141314
prependAndRec `(doElem|let $(mkIdent n) : $stxT := $stxV)

tests/lean/run/letNonDep.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import Lean
22
/-!
3-
# Tests of `Expr.letE (nonDep := true) ..`
3+
# Tests of `Expr.letE (nondep := true) ..`
44
5-
This file exercises the Lean/C++ interface to make sure that the `nonDep` field
5+
This file exercises the Lean/C++ interface to make sure that the `nondep` field
66
is successfully part of the data model.
77
-/
88

@@ -67,14 +67,14 @@ n : Nat
6767

6868
/-!
6969
Testing `Expr.replace`, which is implemented in C++.
70-
The `nonDep` flag was previously cleared.
70+
The `nondep` flag was previously cleared.
7171
-/
7272
/-- info: Lean.Expr.letE `n (Lean.Expr.bvar 1) (Lean.Expr.bvar 1) (Lean.Expr.bvar 1) true -/
7373
#guard_msgs in #eval Expr.replace (fun e => if let .bvar i := e then some (.bvar (i + 1)) else none) (mkHave `n (.bvar 0) (.bvar 0) (.bvar 0))
7474

7575
/-!
7676
Testing `instantiateMvars`, which is implemented in C++.
77-
The `nonDep` flag was previously cleared.
77+
The `nondep` flag was previously cleared.
7878
-/
7979
/--
8080
info: Lean.Expr.letE `n (Lean.Expr.const `Nat []) (Lean.Expr.const `Nat.zero []) (Lean.Expr.const `Unit []) true

0 commit comments

Comments
 (0)