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.
39 lines
844 B
Text
39 lines
844 B
Text
universe u v
|
||
|
||
structure InjectiveFunction (α : Type u) (β : Type v) where
|
||
fn : α → β
|
||
inj : ∀ a b, fn a = fn b → a = b
|
||
|
||
def add1 : InjectiveFunction Nat Nat where
|
||
fn a := a + 1
|
||
inj a b h := by injection h
|
||
|
||
instance : CoeFun (InjectiveFunction α β) (fun _ => α → β) where
|
||
coe s := s.fn
|
||
|
||
#guard add1 10 == 11
|
||
|
||
def mapAdd1 (xs : List Nat) : List Nat :=
|
||
xs.map add1
|
||
|
||
#guard mapAdd1 [1, 2] = [2, 3]
|
||
|
||
def foo : InjectiveFunction Bool (Nat → Nat) where
|
||
fn
|
||
| true, a => a + 1
|
||
| false, a => a
|
||
inj a b h := by
|
||
cases a
|
||
cases b; rfl; injection (congrFun h 0)
|
||
cases b; injection (congrFun h 0); rfl
|
||
|
||
theorem ex1 (x : Nat) : foo true x = x + 1 :=
|
||
rfl
|
||
|
||
theorem ex2 (x : Nat) : foo false x = x :=
|
||
rfl
|
||
|
||
#guard foo true 10 == 11
|
||
#guard foo false 20 == 20
|
||
|
||
#guard [1, 2, 3].map (foo true) = [2, 3, 4]
|