chore(tests/lean): add untracked tests
This commit is contained in:
parent
9b9adf8831
commit
efb14d906b
5 changed files with 81 additions and 0 deletions
7
tests/lean/run/abs.lean
Normal file
7
tests/lean/run/abs.lean
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import data.int
|
||||||
|
open int
|
||||||
|
|
||||||
|
variable abs : int → int
|
||||||
|
notation `|`:40 A:40 `|` := abs A
|
||||||
|
variables a b c : int
|
||||||
|
check |a + |b| + c|
|
25
tests/lean/run/class_bug2.lean
Normal file
25
tests/lean/run/class_bug2.lean
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import logic
|
||||||
|
|
||||||
|
inductive category (ob : Type) (mor : ob → ob → Type) : Type :=
|
||||||
|
mk : Π (comp : Π⦃A B C : ob⦄, mor B C → mor A B → mor A C)
|
||||||
|
(id : Π {A : ob}, mor A A),
|
||||||
|
(Π {A B C D : ob} {f : mor A B} {g : mor B C} {h : mor C D},
|
||||||
|
comp h (comp g f) = comp (comp h g) f) →
|
||||||
|
(Π {A B : ob} {f : mor A B}, comp f id = f) →
|
||||||
|
(Π {A B : ob} {f : mor A B}, comp id f = f) →
|
||||||
|
category ob mor
|
||||||
|
class category
|
||||||
|
|
||||||
|
namespace category
|
||||||
|
section sec_cat
|
||||||
|
parameter A : Type
|
||||||
|
inductive foo :=
|
||||||
|
mk : A → foo
|
||||||
|
|
||||||
|
class foo
|
||||||
|
parameters {ob : Type} {mor : ob → ob → Type} {Cat : category ob mor}
|
||||||
|
abbreviation compose := rec (λ comp id assoc idr idl, comp) Cat
|
||||||
|
abbreviation id := rec (λ comp id assoc idr idl, id) Cat
|
||||||
|
infixr `∘`:60 := compose
|
||||||
|
end sec_cat
|
||||||
|
end category
|
1
tests/lean/run/comment.lean
Normal file
1
tests/lean/run/comment.lean
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/- tests -/
|
22
tests/lean/run/ctx.lean
Normal file
22
tests/lean/run/ctx.lean
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import data.nat logic.classes.inhabited
|
||||||
|
open nat inhabited
|
||||||
|
|
||||||
|
variable N : Type.{1}
|
||||||
|
variable a : N
|
||||||
|
|
||||||
|
section s1
|
||||||
|
set_option pp.implicit true
|
||||||
|
|
||||||
|
definition f (a b : nat) := a
|
||||||
|
|
||||||
|
theorem nat_inhabited [instance] : inhabited nat :=
|
||||||
|
inhabited.mk zero
|
||||||
|
|
||||||
|
definition to_N [coercion] (n : nat) : N := a
|
||||||
|
|
||||||
|
infixl `$$`:65 := f
|
||||||
|
end s1
|
||||||
|
|
||||||
|
theorem tst : inhabited nat
|
||||||
|
variables n m : nat
|
||||||
|
check n = a
|
26
tests/lean/run/lift.lean
Normal file
26
tests/lean/run/lift.lean
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import data.nat
|
||||||
|
open nat
|
||||||
|
|
||||||
|
inductive lift .{l} (A : Type.{l}) : Type.{l+1} :=
|
||||||
|
up : A → lift A
|
||||||
|
|
||||||
|
namespace lift
|
||||||
|
definition down {A : Type} (a : lift A) : A :=
|
||||||
|
rec (λ a, a) a
|
||||||
|
|
||||||
|
theorem down_up {A : Type} (a : A) : down (up a) = a :=
|
||||||
|
rfl
|
||||||
|
|
||||||
|
theorem induction_on [protected] {A : Type} {P : lift A → Prop} (a : lift A) (H : ∀ (a : A), P (up a)) : P a :=
|
||||||
|
rec H a
|
||||||
|
|
||||||
|
theorem up_down {A : Type} (a' : lift A) : up (down a') = a' :=
|
||||||
|
induction_on a' (λ a, rfl)
|
||||||
|
|
||||||
|
end lift
|
||||||
|
|
||||||
|
set_option pp.universes true
|
||||||
|
check nat
|
||||||
|
check lift nat
|
||||||
|
open lift
|
||||||
|
definition one1 : lift nat := up 1
|
Loading…
Reference in a new issue