lean4-htt/tests/lean/run/array_simp.lean
Markus Himmel 5a34ffb9b0
chore: upstream Nat material from mathlib (#7971)
This PR upstreams much of the material from `Mathlib/Data/Nat/Init.lean`
and `Mathlib/Data/Nat/Basic.lean`.
2025-04-16 06:55:32 +00:00

28 lines
717 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

attribute [-simp] Nat.default_eq_zero -- undo changes to simp set after this test was written
#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)
variable {xs : Array α} in
#check_simp xs.size = 0 ~> xs = #[]
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