This PR sets up the new integrated test/bench suite. It then migrates all benchmarks and some related tests to the new suite. There's also some documentation and some linting. For now, a lot of the old tests are left alone so this PR doesn't become even larger than it already is. Eventually, all tests should be migrated to the new suite though so there isn't a confusing mix of two systems.
64 lines
1.4 KiB
Text
64 lines
1.4 KiB
Text
/-!
|
|
Test support for `if-then-else` terms in the simplifier.
|
|
The condition should be simplified before trying to apply congruence.
|
|
We are currently accomplished that using pre-simp theorems.
|
|
TODO: replace them with simprocs.
|
|
In the following example, the term `g (a + <num>)` takes an
|
|
exponential amount of time to be simplified without the pre-simp theorems.
|
|
-/
|
|
|
|
def myid (x : Nat) := 0 + x
|
|
|
|
@[simp] theorem myid_eq : myid x = x := by simp [myid]
|
|
|
|
namespace Ex1
|
|
def f (x : Nat) (y z : Nat) : Nat :=
|
|
if myid x = 0 then y else z
|
|
|
|
def g (x : Nat) : Nat :=
|
|
match x with
|
|
| 0 => 1
|
|
| a+1 => f x (g a + 1) (g a)
|
|
|
|
theorem ex (h : a = 1) : g (a+32) = a := by
|
|
simp [g, f, h]
|
|
end Ex1
|
|
|
|
namespace Ex2
|
|
def f (x : Nat) (y z : Nat) : Nat :=
|
|
if myid x > 0 then z else y
|
|
|
|
def g (x : Nat) : Nat :=
|
|
match x with
|
|
| 0 => 1
|
|
| a+1 => f x (g a + 1) (g a)
|
|
|
|
theorem ex (h : a = 1) : g (a+32) = a := by
|
|
simp [g, f, h]
|
|
end Ex2
|
|
|
|
namespace Ex3
|
|
def f (x : Nat) (y z : Nat) : Nat :=
|
|
if _ : myid x = 0 then y else z
|
|
|
|
def g (x : Nat) : Nat :=
|
|
match x with
|
|
| 0 => 1
|
|
| a+1 => f x (g a + 1) (g a)
|
|
|
|
theorem ex (h : a = 1) : g (a+32) = a := by
|
|
simp [g, f, h]
|
|
end Ex3
|
|
|
|
namespace Ex4
|
|
def f (x : Nat) (y z : Nat) : Nat :=
|
|
if _ : myid x > 0 then z else y
|
|
|
|
def g (x : Nat) : Nat :=
|
|
match x with
|
|
| 0 => 1
|
|
| a+1 => f x (g a + 1) (g a)
|
|
|
|
theorem ex (h : a = 1) : g (a+32) = a := by
|
|
simp [g, f, h]
|
|
end Ex4
|