fix(tests/lean): adjust tests since module 'logic' depends on nat
We need that because of the definitional package
This commit is contained in:
parent
616f2d9b82
commit
919007612a
21 changed files with 48 additions and 25 deletions
|
@ -1,5 +1,6 @@
|
|||
import logic
|
||||
|
||||
namespace experiment
|
||||
definition Type1 := Type.{1}
|
||||
|
||||
context
|
||||
|
@ -49,7 +50,7 @@ namespace nat
|
|||
:= algebra.add_struct.mk add
|
||||
|
||||
definition to_nat (n : num) : nat
|
||||
:= #algebra
|
||||
:= #experiment.algebra
|
||||
num.rec nat.zero (λ n, pos_num.rec (succ zero) (λ n r, r + r) (λ n r, r + r + succ zero) n) n
|
||||
end nat
|
||||
|
||||
|
@ -111,3 +112,4 @@ section
|
|||
check a*b*c*a*b*c*a*b*a*b*c*a
|
||||
check a*b
|
||||
end
|
||||
end experiment
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logic
|
||||
|
||||
namespace experiment
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
@ -90,3 +90,4 @@ reducible [off] add
|
|||
check dvd a (a + (succ b))
|
||||
|
||||
end nat
|
||||
end experiment
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logic
|
||||
|
||||
namespace experiment
|
||||
namespace algebra
|
||||
inductive mul_struct [class] (A : Type) : Type :=
|
||||
mk : (A → A → A) → mul_struct A
|
||||
|
@ -33,7 +33,7 @@ end
|
|||
section
|
||||
open [notation] algebra
|
||||
open nat
|
||||
-- check mul_struct nat << This is an error, we are open only the notation from algebra
|
||||
-- check mul_struct nat << This is an error, we opened only the notation from algebra
|
||||
variables a b c : nat
|
||||
check a * b * c
|
||||
definition tst2 : nat := a * b * c
|
||||
|
@ -41,10 +41,10 @@ end
|
|||
|
||||
section
|
||||
open nat
|
||||
-- check mul_struct nat << This is an error, we are open only the notation from algebra
|
||||
-- check mul_struct nat << This is an error, we opened only the notation from algebra
|
||||
variables a b c : nat
|
||||
check #algebra a*b*c
|
||||
definition tst3 : nat := #algebra a*b*c
|
||||
check a*b*c
|
||||
definition tst3 : nat := #nat a*b*c
|
||||
end
|
||||
|
||||
section
|
||||
|
@ -54,6 +54,7 @@ section
|
|||
:= algebra.mul_struct.mk add
|
||||
|
||||
variables a b c : nat
|
||||
check #algebra a*b*c -- << is open add instead of mul
|
||||
definition tst4 : nat := #algebra a*b*c
|
||||
check #experiment.algebra a*b*c -- << is open add instead of mul
|
||||
definition tst4 : nat := #experiment.algebra a*b*c
|
||||
end
|
||||
end experiment
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logic
|
||||
|
||||
namespace experiment
|
||||
constant nat : Type.{1}
|
||||
constant int : Type.{1}
|
||||
constant of_nat : nat → int
|
||||
|
@ -9,3 +9,4 @@ theorem tst (n : nat) : n = n :=
|
|||
have H : true, from trivial,
|
||||
calc n = n : eq.refl _
|
||||
... = n : eq.refl _
|
||||
end experiment
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logic
|
||||
|
||||
namespace experiment
|
||||
constant nat : Type.{1}
|
||||
constant int : Type.{1}
|
||||
constant of_nat : nat → int
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import logic
|
||||
open decidable
|
||||
open eq
|
||||
|
||||
namespace experiment
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
@ -24,3 +24,4 @@ theorem zero_or_succ2 (n : nat) : n = zero ∨ n = succ (pred n)
|
|||
(take m IH, or.intro_right _
|
||||
(show succ m = succ (pred (succ m)), from congr_arg succ (symm (pred_succ m))))
|
||||
end nat
|
||||
end experiment
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import logic
|
||||
open eq.ops
|
||||
|
||||
namespace experiment
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
@ -23,3 +23,4 @@ theorem succ_le {n m : nat} (H : n ≤ m) : succ n ≤ succ m
|
|||
:= add_one m ▸ add_one n ▸ add_le_right H 1
|
||||
|
||||
end nat
|
||||
end experiment
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import logic
|
||||
open eq.ops
|
||||
|
||||
namespace experiment
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
@ -23,3 +23,4 @@ theorem succ_le_cancel {n m : nat} (H : succ n ≤ succ m) : n ≤ m
|
|||
:= add_le_right_inv (add_one m⁻¹ ▸ add_one n⁻¹ ▸ H)
|
||||
|
||||
end nat
|
||||
end experiment
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import logic
|
||||
open eq.ops
|
||||
|
||||
namespace experiment
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
@ -15,3 +15,4 @@ open eq
|
|||
theorem small2 (n m l : nat) : n * succ l + m = n * l + n + m
|
||||
:= subst (mul_succ_right _ _) (eq.refl (n * succ l + m))
|
||||
end nat
|
||||
end experiment
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import logic
|
||||
open eq.ops eq
|
||||
|
||||
namespace foo
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
@ -33,3 +33,4 @@ theorem mul_add_distr_left (n m k : nat) : (n + m) * k = n * k + m * k
|
|||
... = n * succ l + (m * l + m) : {symm (mul_succ_right _ _)}
|
||||
... = n * succ l + m * succ l : {symm (mul_succ_right _ _)})
|
||||
end nat
|
||||
end foo
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import logic
|
||||
open eq.ops
|
||||
|
||||
namespace experiment
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
@ -19,3 +19,4 @@ print "==========================="
|
|||
theorem tst (n : nat) (H : P (n * zero)) : P zero
|
||||
:= eq.subst (mul_zero_right _) H
|
||||
end nat
|
||||
exit
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logic
|
||||
|
||||
namespace experiment
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
@ -14,3 +14,4 @@ print "==========================="
|
|||
theorem bug (a b c d : nat) : a + b + c + d = a + c + b + d
|
||||
:= subst (add_right_comm _ _ _) (eq.refl (a + b + c + d))
|
||||
end nat
|
||||
end experiment
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logic
|
||||
|
||||
namespace experiment
|
||||
constant nat : Type.{1}
|
||||
constant int : Type.{1}
|
||||
|
||||
|
@ -24,3 +24,4 @@ definition c2 := i + j
|
|||
|
||||
theorem T2 : c2 = int_add i j :=
|
||||
eq.refl _
|
||||
exit
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logic
|
||||
|
||||
namespace experiment
|
||||
namespace nat
|
||||
constant nat : Type.{1}
|
||||
constant add : nat → nat → nat
|
||||
|
@ -29,3 +29,4 @@ open nat
|
|||
open eq
|
||||
theorem add_lt_left {a b : int} (H : a < b) (c : int) : c + a < c + b :=
|
||||
subst (symm (add_assoc c a one)) (add_le_left H c)
|
||||
end experiment
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logic
|
||||
|
||||
namespace experiment
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
@ -35,3 +35,4 @@ theorem T2 : ∃ a, (is_zero a) = true
|
|||
:= by apply exists_intro; apply eq.refl
|
||||
|
||||
end nat
|
||||
end experiment
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logic
|
||||
|
||||
namespace experiment
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
@ -46,3 +46,4 @@ end
|
|||
test_unify(env, t(m), tt, 1)
|
||||
test_unify(env, t(m), ff, 1)
|
||||
*)
|
||||
end experiment
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logic
|
||||
|
||||
namespace experiment
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
@ -48,3 +48,4 @@ end
|
|||
|
||||
test_unify(env, f(t(m)), f(tt), 1)
|
||||
*)
|
||||
exit
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import logic
|
||||
|
||||
namespace experiment
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
||||
definition is_zero (n : nat)
|
||||
:= nat.rec true (λ n r, false) n
|
||||
end experiment
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
import logic
|
||||
open tactic
|
||||
|
||||
namespace foo
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
@ -23,3 +24,4 @@ print "=================="
|
|||
theorem nat_rec_zero {P : ℕ → Type} (x : P 0) (f : ∀m, P m → P (succ m)) : nat.rec x f 0 = x :=
|
||||
eq.refl _
|
||||
end nat
|
||||
end foo
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import logic algebra.binary
|
||||
open tactic binary eq.ops eq
|
||||
open decidable
|
||||
|
||||
namespace experiment
|
||||
definition refl := @eq.refl
|
||||
definition and_intro := @and.intro
|
||||
definition or_intro_left := @or.intro_left
|
||||
|
@ -1410,3 +1410,4 @@ theorem dist_eq_intro {n m k l : ℕ} (H : n + m = k + l) : dist n k = dist l m
|
|||
... = dist l m : dist_add_left k l m
|
||||
|
||||
end nat
|
||||
end experiment
|
||||
|
|
|
@ -7,6 +7,7 @@ import logic algebra.binary
|
|||
open tactic binary eq.ops eq
|
||||
open decidable
|
||||
|
||||
namespace experiment
|
||||
inductive nat : Type :=
|
||||
zero : nat,
|
||||
succ : nat → nat
|
||||
|
@ -1415,3 +1416,4 @@ theorem dist_eq_intro {n m k l : ℕ} (H : n + m = k + l) : dist n k = dist l m
|
|||
|
||||
|
||||
end nat
|
||||
end experiment
|
||||
|
|
Loading…
Reference in a new issue