lean4-htt/tests/lean/run/array_simp.lean
Kim Morrison a826de8a3d
chore: remove duplicated ForIn instances (#5892)
I'd previously added an instance from `ForIn'` to `ForIn`, but this then
caused some non-defeq duplication. It seems fine to just remove the
concrete `ForIn` instances in cases where the `ForIn'` instance exists
too. We can even remove a number of type-specific lemmas in favour of
the general ones.
2024-10-31 07:40:09 +00:00

23 lines
557 B
Text

#check_simp #[1,2,3,4,5][2] ~> 3
#check_simp #[1,2,3,4,5][2]? ~> some 3
#check_simp #[1,2,3,4,5][7]? ~> none
#check_simp #[][0]? ~> none
#check_simp #[1,2,3,4,5][2]! ~> 3
#check_simp #[1,2,3,4,5][7]! ~> (default : Nat)
#check_simp (#[] : Array Nat)[0]! ~> (default : Nat)
attribute [local simp] Id.run in
#check_simp
(Id.run do
let mut s := 0
for i in #[1,2,3,4] do
s := s + i
pure s) ~> 10
attribute [local simp] Id.run in
#check_simp
(Id.run do
let mut s := 0
for h : i in #[1,2,3,4] do
s := s + i
pure s) ~> 10