Move files in examples directory to tests directory. They are not real examples
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
a5adddaf14
commit
51640ecff8
40 changed files with 385 additions and 57 deletions
|
@ -1,24 +0,0 @@
|
||||||
(* Define a "fake" type to simulate the natural numbers. This is just a test. *)
|
|
||||||
Variable Natural : Type
|
|
||||||
Variable lt : Natural -> Natural -> Bool
|
|
||||||
Variable zero : Natural
|
|
||||||
Variable one : Natural
|
|
||||||
Variable two : Natural
|
|
||||||
Variable three : Natural
|
|
||||||
Infix 50 < : lt
|
|
||||||
Axiom two_lt_three : two < three
|
|
||||||
Definition vector (A : Type) (n : Natural) : Type := Pi (i : Natural) (H : i < n), A
|
|
||||||
Definition const (A : Type) (n : Natural) (d : A) : vector A n := fun (i : Natural) (H : i < n), d
|
|
||||||
Definition update (A : Type) (n : Natural) (v : vector A n) (i : Natural) (d : A) : vector A n := fun (j : Natural) (H : j < n), if A (j = i) d (v j H)
|
|
||||||
Definition select (A : Type) (n : Natural) (v : vector A n) (i : Natural) (H : i < n) : A := v i H
|
|
||||||
Definition map (A B C : Type) (n : Natural) (f : A -> B -> C) (v1 : vector A n) (v2 : vector B n) : vector C n := fun (i : Natural) (H : i < n), f (v1 i H) (v2 i H)
|
|
||||||
Show Environment
|
|
||||||
Check select Bool three (update Bool three (const Bool three false) two true) two two_lt_three
|
|
||||||
Eval select Bool three (update Bool three (const Bool three false) two true) two two_lt_three
|
|
||||||
Check select
|
|
||||||
Echo "\nmap type ---> "
|
|
||||||
Check map
|
|
||||||
Echo "\nmap normal form --> "
|
|
||||||
Eval map
|
|
||||||
Echo "\nupdate normal form --> "
|
|
||||||
Eval update
|
|
|
@ -1,6 +0,0 @@
|
||||||
Check fun x : Bool, x
|
|
||||||
Show fun x y : Bool, x
|
|
||||||
Show fun (A : Type) (x y : A), x = y
|
|
||||||
Check fun (A : Type) (x y : A), x = y
|
|
||||||
Check Pi (A B : Type), Type
|
|
||||||
Show Pi (A B : Type), A = B
|
|
|
@ -19,8 +19,8 @@ public:
|
||||||
virtual expr get_type() const { return Type(); }
|
virtual expr get_type() const { return Type(); }
|
||||||
virtual bool normalize(unsigned num_args, expr const * args, expr & r) const { return false; }
|
virtual bool normalize(unsigned num_args, expr const * args, expr & r) const { return false; }
|
||||||
virtual bool operator==(value const & other) const { return other.kind() == kind(); }
|
virtual bool operator==(value const & other) const { return other.kind() == kind(); }
|
||||||
virtual void display(std::ostream & out) const { out << "int"; }
|
virtual void display(std::ostream & out) const { out << "Int"; }
|
||||||
virtual format pp() const { return format("int"); }
|
virtual format pp() const { return format("Int"); }
|
||||||
virtual unsigned hash() const { return 41; }
|
virtual unsigned hash() const { return 41; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,23 +2,6 @@ configure_file("${LEAN_SOURCE_DIR}/shell/version.h.in" "${LEAN_BINARY_DIR}/versi
|
||||||
include_directories("${LEAN_BINARY_DIR}")
|
include_directories("${LEAN_BINARY_DIR}")
|
||||||
add_executable(lean lean.cpp)
|
add_executable(lean lean.cpp)
|
||||||
target_link_libraries(lean ${EXTRA_LIBS})
|
target_link_libraries(lean ${EXTRA_LIBS})
|
||||||
add_test(lean1 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex1.lean")
|
|
||||||
add_test(lean2 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex2.lean")
|
|
||||||
add_test(lean3 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex3.lean")
|
|
||||||
add_test(lean4 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex4.lean")
|
|
||||||
add_test(lean5 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex5.lean")
|
|
||||||
add_test(lean6 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex6.lean")
|
|
||||||
add_test(lean7 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex7.lean")
|
|
||||||
add_test(lean8 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex8.lean")
|
|
||||||
add_test(lean9 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex9.lean")
|
|
||||||
add_test(lean10 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex10.lean")
|
|
||||||
add_test(lean11 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex11.lean")
|
|
||||||
add_test(lean12 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex12.lean")
|
|
||||||
add_test(lean13 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex13.lean")
|
|
||||||
add_test(lean14 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex14.lean")
|
|
||||||
add_test(lean15 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex15.lean")
|
|
||||||
add_test(lean16 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex16.lean")
|
|
||||||
add_test(lean17 ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../examples/ex17.lean")
|
|
||||||
add_test(NAME leantests
|
add_test(NAME leantests
|
||||||
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lean"
|
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lean"
|
||||||
COMMAND "./test.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean")
|
COMMAND "./test.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean")
|
||||||
|
|
7
tests/lean/deep.lean.expected.out
Normal file
7
tests/lean/deep.lean.expected.out
Normal file
File diff suppressed because one or more lines are too long
26
tests/lean/tst1.lean
Normal file
26
tests/lean/tst1.lean
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
(* Define a "fake" type to simulate the natural numbers. This is just a test. *)
|
||||||
|
Variable N : Type
|
||||||
|
Variable lt : N -> N -> Bool
|
||||||
|
Variable zero : N
|
||||||
|
Variable one : N
|
||||||
|
Variable two : N
|
||||||
|
Variable three : N
|
||||||
|
Infix 50 < : lt
|
||||||
|
Axiom two_lt_three : two < three
|
||||||
|
Definition vector (A : Type) (n : N) : Type := Pi (i : N) (H : i < n), A
|
||||||
|
Definition const {A : Type} (n : N) (d : A) : vector A n := fun (i : N) (H : i < n), d
|
||||||
|
Definition update {A : Type} {n : N} (v : vector A n) (i : N) (d : A) : vector A n := fun (j : N) (H : j < n), if A (j = i) d (v j H)
|
||||||
|
Definition select {A : Type} {n : N} (v : vector A n) (i : N) (H : i < n) : A := v i H
|
||||||
|
Definition map {A B C : Type} {n : N} (f : A -> B -> C) (v1 : vector A n) (v2 : vector B n) : vector C n := fun (i : N) (H : i < n), f (v1 i H) (v2 i H)
|
||||||
|
Show Environment 10
|
||||||
|
Check select (update (const three false) two true) two two_lt_three
|
||||||
|
Eval select (update (const three false) two true) two two_lt_three
|
||||||
|
Check update (const three false) two true
|
||||||
|
Echo "\n--------"
|
||||||
|
Check select::explicit
|
||||||
|
Echo "\nmap type ---> "
|
||||||
|
Check map::explicit
|
||||||
|
Echo "\nmap normal form --> "
|
||||||
|
Eval map::explicit
|
||||||
|
Echo "\nupdate normal form --> "
|
||||||
|
Eval update::explicit
|
47
tests/lean/tst1.lean.expected.out
Normal file
47
tests/lean/tst1.lean.expected.out
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
Assumed: N
|
||||||
|
Assumed: lt
|
||||||
|
Assumed: zero
|
||||||
|
Assumed: one
|
||||||
|
Assumed: two
|
||||||
|
Assumed: three
|
||||||
|
Assumed: two_lt_three
|
||||||
|
Defined: vector
|
||||||
|
Defined: const
|
||||||
|
Defined: update
|
||||||
|
Defined: select
|
||||||
|
Defined: map
|
||||||
|
[34mAxiom[0m two_lt_three : two < three
|
||||||
|
[34mDefinition[0m vector (A : [36mType[0m) (n : N) : [36mType[0m [33m:=[0m [33mΠ[0m (i : N) (H : i < n), A
|
||||||
|
[34mDefinition[0m const {A : [36mType[0m} (n : N) (d : A) : vector A n [33m:=[0m [33mλ[0m (i : N) (H : i < n), d
|
||||||
|
[34mDefinition[0m const::explicit (A : [36mType[0m) (n : N) (d : A) : vector A n [33m:=[0m const n d
|
||||||
|
[34mDefinition[0m update {A : [36mType[0m} {n : N} (v : vector A n) (i : N) (d : A) : vector A n [33m:=[0m
|
||||||
|
[33mλ[0m (j : N) (H : j < n), if A (j = i) d (v j H)
|
||||||
|
[34mDefinition[0m update::explicit (A : [36mType[0m) (n : N) (v : vector A n) (i : N) (d : A) : vector A n [33m:=[0m update v i d
|
||||||
|
[34mDefinition[0m select {A : [36mType[0m} {n : N} (v : vector A n) (i : N) (H : i < n) : A [33m:=[0m v i H
|
||||||
|
[34mDefinition[0m select::explicit (A : [36mType[0m) (n : N) (v : vector A n) (i : N) (H : i < n) : A [33m:=[0m select v i H
|
||||||
|
[34mDefinition[0m map {A B C : [36mType[0m} {n : N} (f : A [33m→[0m B [33m→[0m C) (v1 : vector A n) (v2 : vector B n) : vector C n [33m:=[0m
|
||||||
|
[33mλ[0m (i : N) (H : i < n), f (v1 i H) (v2 i H)
|
||||||
|
[34mDefinition[0m map::explicit (A B C : [36mType[0m) (n : N) (f : A [33m→[0m B [33m→[0m C) (v1 : vector A n) (v2 : vector B n) : vector C n [33m:=[0m
|
||||||
|
map f v1 v2
|
||||||
|
Bool
|
||||||
|
⊤
|
||||||
|
vector Bool three
|
||||||
|
|
||||||
|
--------
|
||||||
|
[33mΠ[0m (A : [36mType[0m) (n : N) (v : vector A n) (i : N) (H : i < n), A
|
||||||
|
|
||||||
|
map type --->
|
||||||
|
[33mΠ[0m (A B C : [36mType[0m) (n : N) (f : A [33m→[0m B [33m→[0m C) (v1 : vector A n) (v2 : vector B n), vector C n
|
||||||
|
|
||||||
|
map normal form -->
|
||||||
|
[33mλ[0m (A B C : [36mType[0m)
|
||||||
|
(n : N)
|
||||||
|
(f : A [33m→[0m B [33m→[0m C)
|
||||||
|
(v1 : [33mΠ[0m (i : N) (H : i < n), A)
|
||||||
|
(v2 : [33mΠ[0m (i : N) (H : i < n), B)
|
||||||
|
(i : N)
|
||||||
|
(H : i < n),
|
||||||
|
f (v1 i H) (v2 i H)
|
||||||
|
|
||||||
|
update normal form -->
|
||||||
|
[33mλ[0m (A : [36mType[0m) (n : N) (v : [33mΠ[0m (i : N) (H : i < n), A) (i : N) (d : A) (j : N) (H : j < n), ite A (j = i) d (v j H)
|
22
tests/lean/tst10.lean.expected.out
Normal file
22
tests/lean/tst10.lean.expected.out
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
Assumed: a
|
||||||
|
Assumed: b
|
||||||
|
a ∧ b
|
||||||
|
a ∧ b ∧ a
|
||||||
|
a ∧ b
|
||||||
|
a ∧ b
|
||||||
|
a ∧ b
|
||||||
|
a ∧ b
|
||||||
|
a ∨ b
|
||||||
|
a ∨ b
|
||||||
|
a ∨ b
|
||||||
|
a ∨ b
|
||||||
|
a ∨ a ∨ b
|
||||||
|
a ⇒ b ⇒ a
|
||||||
|
Bool
|
||||||
|
ite Bool a a ⊤
|
||||||
|
a
|
||||||
|
Assumed: H1
|
||||||
|
Assumed: H2
|
||||||
|
[33mΠ[0m (a b : Bool) (H1 : a ⇒ b) (H2 : a), b
|
||||||
|
MP H2 H1
|
||||||
|
b
|
10
tests/lean/tst11.lean.expected.out
Normal file
10
tests/lean/tst11.lean.expected.out
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
Defined: xor
|
||||||
|
⊤ ⊕ ⊥
|
||||||
|
⊥
|
||||||
|
⊤
|
||||||
|
Assumed: a
|
||||||
|
a ⊕ a ⊕ a
|
||||||
|
[33mΠ[0m (A : [36mType[0m u) (a b : A) (P : A [33m→[0m Bool) (H1 : P a) (H2 : a = b), P b
|
||||||
|
Proved: EM2
|
||||||
|
[33mΠ[0m a : Bool, a ∨ ¬ a
|
||||||
|
a ∨ ¬ a
|
7
tests/lean/tst12.lean.expected.out
Normal file
7
tests/lean/tst12.lean.expected.out
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[33mλ[0m x y : Bool, x ∧ y
|
||||||
|
[33mlet[0m x [33m:=[0m ⊤,
|
||||||
|
y [33m:=[0m ⊤,
|
||||||
|
z [33m:=[0m x ∧ y,
|
||||||
|
f [33m:=[0m [33mλ[0m arg1 arg2 : Bool, arg1 ∧ arg2 ⇔ arg2 ∧ arg1 ⇔ arg1 ∨ arg2 ∨ arg2
|
||||||
|
[33min[0m (f x y) ∨ z
|
||||||
|
⊤
|
2
tests/lean/tst13.lean.expected.out
Normal file
2
tests/lean/tst13.lean.expected.out
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[33mλ[0m x x : Bool, x
|
||||||
|
[33mlet[0m x [33m:=[0m ⊤, y [33m:=[0m ⊤, z [33m:=[0m x ∧ y, f [33m:=[0m [33mλ[0m x y : Bool, x ∧ y ⇔ y ∧ x ⇔ x ∨ y ∨ y [33min[0m (f x y) ∨ z
|
5
tests/lean/tst14.lean.expected.out
Normal file
5
tests/lean/tst14.lean.expected.out
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Int [33m→[0m Int [33m→[0m Int
|
||||||
|
Assumed: f
|
||||||
|
f 0
|
||||||
|
Int [33m→[0m Int
|
||||||
|
Int
|
20
tests/lean/tst15.lean.expected.out
Normal file
20
tests/lean/tst15.lean.expected.out
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
Assumed: x
|
||||||
|
[36mType[0m u+3 ⊔ m+2 ⊔ 3
|
||||||
|
Assumed: f
|
||||||
|
[36mType[0m u+10 [33m→[0m [36mType[0m
|
||||||
|
[36mType[0m
|
||||||
|
[36mType[0m 5
|
||||||
|
[36mType[0m u+3 ⊔ m+2 ⊔ 3
|
||||||
|
[36mType[0m u+1 ⊔ m+1
|
||||||
|
[36mType[0m u+3
|
||||||
|
[36mType[0m u+4
|
||||||
|
[36mType[0m u+1 ⊔ m+1
|
||||||
|
[36mType[0m u+1 ⊔ m+1 ⊔ 4
|
||||||
|
[36mType[0m u+1 ⊔ m ⊔ 3
|
||||||
|
[36mType[0m u+2 ⊔ m+1 ⊔ 4
|
||||||
|
[36mType[0m u [33m→[0m [36mType[0m 5
|
||||||
|
[36mType[0m u+1 ⊔ 6
|
||||||
|
[36mType[0m m+1 ⊔ 4 ⊔ u+6
|
||||||
|
[36mType[0m m ⊔ 3 [33m→[0m [36mType[0m u [33m→[0m [36mType[0m 5
|
||||||
|
[36mType[0m m+1 ⊔ 6 ⊔ u+1
|
||||||
|
[36mType[0m u
|
15
tests/lean/tst16.lean.expected.out
Normal file
15
tests/lean/tst16.lean.expected.out
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
Assumed: f
|
||||||
|
[33m∀[0m a b : [36mType[0m, (f a) = (f b)
|
||||||
|
Assumed: g
|
||||||
|
[33m∀[0m (a b : [36mType[0m) (c : Bool), g c ((f a) = (f b))
|
||||||
|
[33m∃[0m (a b : [36mType[0m) (c : Bool), g c ((f a) = (f b))
|
||||||
|
[33m∀[0m (a b : [36mType[0m) (c : Bool), (g c (f a)) = (f b) ⇒ (f a)
|
||||||
|
Bool
|
||||||
|
[33m∀[0m (a b : [36mType[0m) (c : Bool), g c ((f a) = (f b))
|
||||||
|
[33m∀[0m a b : [36mType[0m, (f a) = (f b)
|
||||||
|
[33m∃[0m a b : [36mType[0m, (f a) = (f b) ∧ (f a)
|
||||||
|
[33m∃[0m a b : [36mType[0m, (f a) = (f b) ∨ (f b)
|
||||||
|
Assumed: a
|
||||||
|
(f a) ∨ (f a)
|
||||||
|
(f a) = a ∨ (f a)
|
||||||
|
(f a) = a ∧ (f a)
|
8
tests/lean/tst17.lean.expected.out
Normal file
8
tests/lean/tst17.lean.expected.out
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
Assumed: f
|
||||||
|
Assumed: g
|
||||||
|
[33m∀[0m a b : [36mType[0m, [33m∃[0m c : [36mType[0m, (g a b) = (f c)
|
||||||
|
Bool
|
||||||
|
([33mλ[0m a : [36mType[0m,
|
||||||
|
([33mλ[0m b : [36mType[0m, ite Bool (([33mλ[0m x : [36mType[0m, ite Bool ((g a b) = (f x)) ⊥ ⊤) = ([33mλ[0m x : [36mType[0m, ⊤)) ⊥ ⊤) =
|
||||||
|
([33mλ[0m x : [36mType[0m, ⊤)) =
|
||||||
|
([33mλ[0m x : [36mType[0m, ⊤)
|
|
@ -5,8 +5,7 @@ Show a/\b
|
||||||
Set lean::pp::notation false
|
Set lean::pp::notation false
|
||||||
Show Options
|
Show Options
|
||||||
Show a/\b
|
Show a/\b
|
||||||
Show Environment 5
|
Show Environment 2
|
||||||
Set lean::pp::notation true
|
Set lean::pp::notation true
|
||||||
Show Options
|
Show Options
|
||||||
Show a/\b
|
Show a/\b
|
||||||
|
|
12
tests/lean/tst2.lean.expected.out
Normal file
12
tests/lean/tst2.lean.expected.out
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
⟨⟩
|
||||||
|
Assumed: a
|
||||||
|
Assumed: b
|
||||||
|
a ∧ b
|
||||||
|
Set option: lean::pp::notation
|
||||||
|
⟨lean::pp::notation ↦ false⟩
|
||||||
|
and a b
|
||||||
|
[34mVariable[0m a : Bool
|
||||||
|
[34mVariable[0m b : Bool
|
||||||
|
Set option: lean::pp::notation
|
||||||
|
⟨lean::pp::notation ↦ true⟩
|
||||||
|
a ∧ b
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
Set lean::parser::verbose false.
|
Set lean::parser::verbose false.
|
||||||
Notation 10 if _ then _ : implies.
|
Notation 10 if _ then _ : implies.
|
||||||
Show Environment 1.
|
Show Environment 1.
|
25
tests/lean/tst3.lean.expected.out
Normal file
25
tests/lean/tst3.lean.expected.out
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
[34mNotation[0m 10 if _ then _ : implies
|
||||||
|
if ⊤ then ⊥
|
||||||
|
if ⊤ then (if a then ⊥)
|
||||||
|
implies true (implies a false)
|
||||||
|
[34mNotation[0m 100 _ |- _ ; _ : f
|
||||||
|
f c d e
|
||||||
|
c |- d ; e
|
||||||
|
(a !) !
|
||||||
|
fact (fact a)
|
||||||
|
[ c ; d ]
|
||||||
|
[ c ; ([ d ; e ]) ]
|
||||||
|
g c (g d e)
|
||||||
|
[34mNotation[0m 40 _ << _ end : h
|
||||||
|
d << e end
|
||||||
|
[ c ; d << e end ]
|
||||||
|
g c (h d e)
|
||||||
|
c ** d ++ e ** c
|
||||||
|
p1 ∨ p2 ∧ p3
|
||||||
|
r (s c d) (s e c)
|
||||||
|
or p1 (and p2 p3)
|
||||||
|
c = d ∨ d = c
|
||||||
|
¬ p1 ∨ p2
|
||||||
|
p1 ∧ p3 ∨ p2 ∧ p3
|
||||||
|
or (not p1) p2
|
||||||
|
or (and p1 p3) (and p2 p3)
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
Variable f {A : Type} (a b : A) : A
|
Variable f {A : Type} (a b : A) : A
|
||||||
Variable N : Type
|
Variable N : Type
|
||||||
Variable n1 : N
|
Variable n1 : N
|
||||||
|
@ -20,5 +19,3 @@ Axiom H1 : a = b && b = c
|
||||||
Theorem Pr : (g a) = (g c) :=
|
Theorem Pr : (g a) = (g c) :=
|
||||||
Congr (Refl g) (Trans (Conjunct1 H1) (Conjunct2 H1))
|
Congr (Refl g) (Trans (Conjunct1 H1) (Conjunct2 H1))
|
||||||
Show Environment 2
|
Show Environment 2
|
||||||
|
|
||||||
|
|
28
tests/lean/tst4.lean.expected.out
Normal file
28
tests/lean/tst4.lean.expected.out
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
Assumed: f
|
||||||
|
Assumed: N
|
||||||
|
Assumed: n1
|
||||||
|
Assumed: n2
|
||||||
|
Set option: lean::pp::implicit
|
||||||
|
f::explicit N n1 n2
|
||||||
|
f::explicit ((N [33m→[0m N) [33m→[0m N [33m→[0m N) ([33mλ[0m x : N [33m→[0m N, x) ([33mλ[0m y : N [33m→[0m N, y)
|
||||||
|
Assumed: EqNice
|
||||||
|
EqNice::explicit N n1 n2
|
||||||
|
N
|
||||||
|
[33mΠ[0m (A : [36mType[0m u) (B : A [33m→[0m [36mType[0m u) (f g : [33mΠ[0m x : A, B x) (a b : A) (H1 : f = g) (H2 : a = b), (f a) = (g b)
|
||||||
|
f::explicit N n1 n2
|
||||||
|
Assumed: a
|
||||||
|
Assumed: b
|
||||||
|
Assumed: c
|
||||||
|
Assumed: g
|
||||||
|
Assumed: H1
|
||||||
|
Proved: Pr
|
||||||
|
[34mAxiom[0m H1 : a = b ∧ b = c
|
||||||
|
[34mTheorem[0m Pr : (g a) = (g c) [33m:=[0m
|
||||||
|
[33mlet[0m κ::1 [33m:=[0m Trans::explicit
|
||||||
|
N
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c
|
||||||
|
(Conjunct1::explicit (a = b) (b = c) H1)
|
||||||
|
(Conjunct2::explicit (a = b) (b = c) H1)
|
||||||
|
[33min[0m Congr::explicit N ([33mλ[0m x : N, N) g g a c (Refl::explicit (N [33m→[0m N) g) κ::1
|
9
tests/lean/tst5.lean.expected.out
Normal file
9
tests/lean/tst5.lean.expected.out
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
Assumed: N
|
||||||
|
Assumed: a
|
||||||
|
Assumed: b
|
||||||
|
a ≃ b
|
||||||
|
Bool
|
||||||
|
Set option: lean::pp::implicit
|
||||||
|
heq::explicit N a b
|
||||||
|
heq::explicit [36mType[0m 2 [36mType[0m 1 [36mType[0m 1
|
||||||
|
heq::explicit Bool ⊤ ⊥
|
106
tests/lean/tst6.lean.expected.out
Normal file
106
tests/lean/tst6.lean.expected.out
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
Assumed: N
|
||||||
|
Assumed: h
|
||||||
|
Proved: CongrH
|
||||||
|
Set option: lean::pp::implicit
|
||||||
|
[34mTheorem[0m CongrH {a1 a2 b1 b2 : N} (H1 : a1 = b1) (H2 : a2 = b2) : (h a1 a2) = (h b1 b2) [33m:=[0m
|
||||||
|
Congr::explicit
|
||||||
|
N
|
||||||
|
([33mλ[0m x : N, N)
|
||||||
|
(h a1)
|
||||||
|
(h b1)
|
||||||
|
a2
|
||||||
|
b2
|
||||||
|
(Congr::explicit N ([33mλ[0m x : N, N [33m→[0m N) h h a1 b1 (Refl::explicit (N [33m→[0m N [33m→[0m N) h) H1)
|
||||||
|
H2
|
||||||
|
[34mTheorem[0m CongrH::explicit (a1 a2 b1 b2 : N) (H1 : a1 = b1) (H2 : a2 = b2) : (h a1 a2) = (h b1 b2) [33m:=[0m
|
||||||
|
CongrH::explicit a1 a2 b1 b2 H1 H2
|
||||||
|
Set option: lean::pp::implicit
|
||||||
|
[34mTheorem[0m CongrH {a1 a2 b1 b2 : N} (H1 : a1 = b1) (H2 : a2 = b2) : (h a1 a2) = (h b1 b2) [33m:=[0m Congr (Congr (Refl h) H1) H2
|
||||||
|
[34mTheorem[0m CongrH::explicit (a1 a2 b1 b2 : N) (H1 : a1 = b1) (H2 : a2 = b2) : (h a1 a2) = (h b1 b2) [33m:=[0m CongrH H1 H2
|
||||||
|
Proved: Example1
|
||||||
|
Set option: lean::pp::implicit
|
||||||
|
[34mTheorem[0m Example1 (a b c d : N) (H : a = b ∧ b = c ∨ a = d ∧ d = c) : (h a b) = (h c b) [33m:=[0m
|
||||||
|
DisjCases::explicit
|
||||||
|
(a = b ∧ b = c)
|
||||||
|
(a = d ∧ d = c)
|
||||||
|
((h a b) = (h c b))
|
||||||
|
H
|
||||||
|
([33mλ[0m H1 : a = b ∧ b = c,
|
||||||
|
CongrH::explicit
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c
|
||||||
|
b
|
||||||
|
(Trans::explicit
|
||||||
|
N
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c
|
||||||
|
(Conjunct1::explicit (a = b) (b = c) H1)
|
||||||
|
(Conjunct2::explicit (a = b) (b = c) H1))
|
||||||
|
(Refl::explicit N b))
|
||||||
|
([33mλ[0m H1 : a = d ∧ d = c,
|
||||||
|
CongrH::explicit
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c
|
||||||
|
b
|
||||||
|
(Trans::explicit
|
||||||
|
N
|
||||||
|
a
|
||||||
|
d
|
||||||
|
c
|
||||||
|
(Conjunct1::explicit (a = d) (d = c) H1)
|
||||||
|
(Conjunct2::explicit (a = d) (d = c) H1))
|
||||||
|
(Refl::explicit N b))
|
||||||
|
Proved: Example2
|
||||||
|
Set option: lean::pp::implicit
|
||||||
|
[34mTheorem[0m Example2 (a b c d : N) (H : a = b ∧ b = c ∨ a = d ∧ d = c) : (h a b) = (h c b) [33m:=[0m
|
||||||
|
DisjCases::explicit
|
||||||
|
(a = b ∧ b = c)
|
||||||
|
(a = d ∧ d = c)
|
||||||
|
((h a b) = (h c b))
|
||||||
|
H
|
||||||
|
([33mλ[0m H1 : a = b ∧ b = c,
|
||||||
|
CongrH::explicit
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c
|
||||||
|
b
|
||||||
|
(Trans::explicit
|
||||||
|
N
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c
|
||||||
|
(Conjunct1::explicit (a = b) (b = c) H1)
|
||||||
|
(Conjunct2::explicit (a = b) (b = c) H1))
|
||||||
|
(Refl::explicit N b))
|
||||||
|
([33mλ[0m H1 : a = d ∧ d = c,
|
||||||
|
CongrH::explicit
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c
|
||||||
|
b
|
||||||
|
(Trans::explicit
|
||||||
|
N
|
||||||
|
a
|
||||||
|
d
|
||||||
|
c
|
||||||
|
(Conjunct1::explicit (a = d) (d = c) H1)
|
||||||
|
(Conjunct2::explicit (a = d) (d = c) H1))
|
||||||
|
(Refl::explicit N b))
|
||||||
|
Proved: Example3
|
||||||
|
Set option: lean::pp::implicit
|
||||||
|
[34mTheorem[0m Example3 (a b c d e : N) (H : a = b ∧ b = e ∧ b = c ∨ a = d ∧ d = c) : (h a b) = (h c b) [33m:=[0m
|
||||||
|
DisjCases
|
||||||
|
H
|
||||||
|
([33mλ[0m H1 : a = b ∧ b = e ∧ b = c, CongrH (Trans (Conjunct1 H1) (Conjunct2 (Conjunct2 H1))) (Refl b))
|
||||||
|
([33mλ[0m H1 : a = d ∧ d = c, CongrH (Trans (Conjunct1 H1) (Conjunct2 H1)) (Refl b))
|
||||||
|
Proved: Example4
|
||||||
|
Set option: lean::pp::implicit
|
||||||
|
[34mTheorem[0m Example4 (a b c d e : N) (H : a = b ∧ b = e ∧ b = c ∨ a = d ∧ d = c) : (h a c) = (h c a) [33m:=[0m
|
||||||
|
DisjCases
|
||||||
|
H
|
||||||
|
([33mλ[0m H1 : a = b ∧ b = e ∧ b = c,
|
||||||
|
[33mlet[0m AeqC [33m:=[0m Trans (Conjunct1 H1) (Conjunct2 (Conjunct2 H1)) [33min[0m CongrH AeqC (Symm AeqC))
|
||||||
|
([33mλ[0m H1 : a = d ∧ d = c, [33mlet[0m AeqC [33m:=[0m Trans (Conjunct1 H1) (Conjunct2 H1) [33min[0m CongrH AeqC (Symm AeqC))
|
|
@ -1,7 +1,7 @@
|
||||||
Variable f : Pi (A : Type), A -> Bool
|
Variable f : Pi (A : Type), A -> Bool
|
||||||
Show fun (A B : Type) (a : _), f B a
|
Show fun (A B : Type) (a : _), f B a
|
||||||
(* The following one should produce an error *)
|
(* The following one should produce an error *)
|
||||||
(* Show fun (A : Type) (a : _) (B : Type), f B a *)
|
Show fun (A : Type) (a : _) (B : Type), f B a
|
||||||
|
|
||||||
Variable myeq : Pi (A : Type u), A -> A -> Bool
|
Variable myeq : Pi (A : Type u), A -> A -> Bool
|
||||||
Show myeq _ (fun (A : Type) (a : _), a) (fun (B : Type) (b : B), b)
|
Show myeq _ (fun (A : Type) (a : _), a) (fun (B : Type) (b : B), b)
|
14
tests/lean/tst7.lean.expected.out
Normal file
14
tests/lean/tst7.lean.expected.out
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Assumed: f
|
||||||
|
[33mλ[0m (A B : [36mType[0m) (a : B), f B a
|
||||||
|
Error (line: 4, pos: 40) application type mismatch during term elaboration at term
|
||||||
|
f B a
|
||||||
|
Elaborator state
|
||||||
|
?M0 := [31m[unassigned][0m
|
||||||
|
?M1 := [31m[unassigned][0m
|
||||||
|
#0 ≈ [33mlift[0m:0:0 ?M0
|
||||||
|
Assumed: myeq
|
||||||
|
myeq ([33mΠ[0m (A : [36mType[0m) (a : A), A) ([33mλ[0m (A : [36mType[0m) (a : A), a) ([33mλ[0m (B : [36mType[0m) (b : B), b)
|
||||||
|
Bool
|
||||||
|
Assumed: R
|
||||||
|
Assumed: h
|
||||||
|
Bool [33m→[0m ([33mΠ[0m (f1 g1 : [33mΠ[0m A : [36mType[0m, R A) (G : [33mΠ[0m A : [36mType[0m, myeq (R A) (f1 A) (g1 A)), Bool)
|
3
tests/lean/tst8.lean.expected.out
Normal file
3
tests/lean/tst8.lean.expected.out
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[33mΠ[0m (A : [36mType[0m) (a : A), A
|
||||||
|
Assumed: g
|
||||||
|
Defined: f
|
5
tests/lean/tst9.lean
Normal file
5
tests/lean/tst9.lean
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Variable f : Pi A : Type, A -> A -> A
|
||||||
|
Variable N : Type
|
||||||
|
Variable g : N -> N -> Bool
|
||||||
|
Variable a : N
|
||||||
|
Check g true (f _ a a)
|
10
tests/lean/tst9.lean.expected.out
Normal file
10
tests/lean/tst9.lean.expected.out
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
Assumed: f
|
||||||
|
Assumed: N
|
||||||
|
Assumed: g
|
||||||
|
Assumed: a
|
||||||
|
Error (line: 5, pos: 6) type mismatch at application argument 1 of
|
||||||
|
g ⊤ (f N a a)
|
||||||
|
expected type
|
||||||
|
N
|
||||||
|
given type
|
||||||
|
Bool
|
Loading…
Reference in a new issue