test: shadowing in do blocks
This commit is contained in:
parent
60edde82b0
commit
7a0cbdbe04
1 changed files with 14 additions and 0 deletions
|
|
@ -30,3 +30,17 @@ rfl
|
|||
|
||||
theorem ex2 : (g [] $.run' 0) = 1 :=
|
||||
rfl
|
||||
|
||||
def h (x : Nat) (y : Nat) : Nat := do
|
||||
if x > 0 then
|
||||
let y := x + 1 -- this is a new `y` that shadows the one above
|
||||
x := y
|
||||
else
|
||||
y := y + 1
|
||||
return x + y
|
||||
|
||||
theorem ex3 (y : Nat) : h 0 y = 0 + (y + 1) :=
|
||||
rfl
|
||||
|
||||
theorem ex4 (y : Nat) : h 1 y = (1 + 1) + y :=
|
||||
rfl
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue