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.
36 lines
910 B
Text
36 lines
910 B
Text
inductive LazyList (α : Type u)
|
||
| nil : LazyList α
|
||
| cons (hd : α) (tl : LazyList α) : LazyList α
|
||
| delayed (t : Thunk (LazyList α)) : LazyList α
|
||
|
||
namespace LazyList
|
||
|
||
def force : LazyList α → Option (α × LazyList α)
|
||
| delayed as => force as.get
|
||
| nil => none
|
||
| cons a as => some (a,as)
|
||
|
||
end LazyList
|
||
|
||
def deq (Q : LazyList τ) : Option (τ × LazyList τ) :=
|
||
match h:Q.force with
|
||
| some (x, F') => some (x, F')
|
||
| none => none
|
||
|
||
theorem deq_correct_1 (Q : LazyList τ)
|
||
: deq Q = none ↔ Q.force = none
|
||
:= by
|
||
unfold deq
|
||
cases h' : Q.force <;> simp
|
||
|
||
theorem deq_correct_2 (Q : LazyList τ)
|
||
: deq Q = none ↔ Q.force = none
|
||
:= by
|
||
cases h' : Q.force with
|
||
| none => unfold deq; rw [h']
|
||
| some => unfold deq; rw [h']
|
||
|
||
theorem deq_correct_3 (Q : LazyList τ)
|
||
: deq Q = none ↔ Q.force = none
|
||
:= by
|
||
cases h' : Q.force <;> unfold deq <;> rw [h'] <;> simp
|