chore(tests/lean): add missing tests
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
464f991eba
commit
653141135d
9 changed files with 1515 additions and 0 deletions
15
tests/lean/run/coe6.lean
Normal file
15
tests/lean/run/coe6.lean
Normal file
|
@ -0,0 +1,15 @@
|
|||
import data.unit
|
||||
open unit
|
||||
|
||||
variable int : Type.{1}
|
||||
variable nat : Type.{1}
|
||||
variable izero : int
|
||||
variable nzero : nat
|
||||
variable isucc : int → int
|
||||
variable nsucc : nat → nat
|
||||
definition f [coercion] (a : unit) : int := izero
|
||||
definition g [coercion] (a : unit) : nat := nzero
|
||||
|
||||
set_option pp.coercion true
|
||||
check isucc star
|
||||
check nsucc star
|
16
tests/lean/run/coe8.lean
Normal file
16
tests/lean/run/coe8.lean
Normal file
|
@ -0,0 +1,16 @@
|
|||
import logic
|
||||
|
||||
variable nat : Type.{1}
|
||||
variable int : Type.{1}
|
||||
variable of_nat : nat → int
|
||||
coercion of_nat
|
||||
variable nat_add : nat → nat → nat
|
||||
variable int_add : int → int → int
|
||||
infixl `+`:65 := int_add
|
||||
infixl `+`:65 := nat_add
|
||||
|
||||
print "================"
|
||||
variable tst (n m : nat) : @eq int (of_nat n + of_nat m) (n + m)
|
||||
|
||||
check tst
|
||||
exit
|
3
tests/lean/run/ex.lean
Normal file
3
tests/lean/run/ex.lean
Normal file
|
@ -0,0 +1,3 @@
|
|||
import standard
|
||||
set_option pp.implicit true
|
||||
check ∃x, x = 0
|
10
tests/lean/run/protected.lean
Normal file
10
tests/lean/run/protected.lean
Normal file
|
@ -0,0 +1,10 @@
|
|||
import logic
|
||||
|
||||
namespace foo
|
||||
definition C [protected] := true
|
||||
definition D := true
|
||||
end foo
|
||||
|
||||
open foo
|
||||
check foo.C
|
||||
check D
|
22
tests/lean/run/t3.lean
Normal file
22
tests/lean/run/t3.lean
Normal file
|
@ -0,0 +1,22 @@
|
|||
variable int : Type.{1}
|
||||
variable nat : Type.{1}
|
||||
namespace int
|
||||
variable plus : int → int → int
|
||||
end int
|
||||
|
||||
namespace nat
|
||||
variable plus : nat → nat → nat
|
||||
end nat
|
||||
|
||||
open int nat
|
||||
|
||||
variables a b : int
|
||||
|
||||
|
||||
check plus a b
|
||||
|
||||
variable f : int → int → int
|
||||
variable g : nat → nat → int
|
||||
notation A `+`:65 B:65 := f A (g B B)
|
||||
variable n : nat
|
||||
check a + n
|
6
tests/lean/run/tac1.lean
Normal file
6
tests/lean/run/tac1.lean
Normal file
|
@ -0,0 +1,6 @@
|
|||
import tools.tactic
|
||||
open tactic
|
||||
|
||||
definition mytac := apply @and_intro; apply @refl
|
||||
|
||||
check @mytac
|
8
tests/lean/run/tt1.lean
Normal file
8
tests/lean/run/tt1.lean
Normal file
|
@ -0,0 +1,8 @@
|
|||
import data.prod data.num logic.core.quantifiers
|
||||
open prod
|
||||
|
||||
check (true, false, 10)
|
||||
|
||||
-- definition a f := f
|
||||
|
||||
check fun x, x ∧ x
|
23
tests/lean/slow/nat_bug1.lean
Normal file
23
tests/lean/slow/nat_bug1.lean
Normal file
|
@ -0,0 +1,23 @@
|
|||
----------------------------------------------------------------------------------------------------
|
||||
-- Copyright (c) 2014 Floris van Doorn. All rights reserved.
|
||||
-- Released under Apache 2.0 license as described in the file LICENSE.
|
||||
-- Author: Floris van Doorn
|
||||
----------------------------------------------------------------------------------------------------
|
||||
import logic
|
||||
open tactic num
|
||||
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
||||
notation `ℕ`:max := nat
|
||||
|
||||
abbreviation plus (x y : ℕ) : ℕ
|
||||
:= nat_rec x (λ n r, succ r) y
|
||||
|
||||
definition to_nat [coercion] [inline] (n : num) : ℕ
|
||||
:= num_rec zero (λ n, pos_num_rec (succ zero) (λ n r, plus r (plus r (succ zero))) (λ n r, plus r r) n) n
|
||||
|
||||
print "=================="
|
||||
theorem nat_rec_zero {P : ℕ → Type} (x : P 0) (f : ∀m, P m → P (succ m)) : nat_rec x f 0 = x :=
|
||||
refl _
|
1412
tests/lean/slow/nat_bug2.lean
Normal file
1412
tests/lean/slow/nat_bug2.lean
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue