fix(tests/lean): adjust tests since module 'logic' depends on nat

We need that because of the definitional package
This commit is contained in:
Leonardo de Moura 2014-11-22 17:34:05 -08:00
parent 616f2d9b82
commit 919007612a
21 changed files with 48 additions and 25 deletions

View file

@ -1,5 +1,6 @@
import logic import logic
namespace experiment
definition Type1 := Type.{1} definition Type1 := Type.{1}
context context
@ -49,7 +50,7 @@ namespace nat
:= algebra.add_struct.mk add := algebra.add_struct.mk add
definition to_nat (n : num) : nat 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 num.rec nat.zero (λ n, pos_num.rec (succ zero) (λ n r, r + r) (λ n r, r + r + succ zero) n) n
end nat end nat
@ -111,3 +112,4 @@ section
check a*b*c*a*b*c*a*b*a*b*c*a check a*b*c*a*b*c*a*b*a*b*c*a
check a*b check a*b
end end
end experiment

View file

@ -1,5 +1,5 @@
import logic import logic
namespace experiment
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,
succ : nat → nat succ : nat → nat
@ -90,3 +90,4 @@ reducible [off] add
check dvd a (a + (succ b)) check dvd a (a + (succ b))
end nat end nat
end experiment

View file

@ -1,5 +1,5 @@
import logic import logic
namespace experiment
namespace algebra namespace algebra
inductive mul_struct [class] (A : Type) : Type := inductive mul_struct [class] (A : Type) : Type :=
mk : (A → A → A) → mul_struct A mk : (A → A → A) → mul_struct A
@ -33,7 +33,7 @@ end
section section
open [notation] algebra open [notation] algebra
open nat 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 variables a b c : nat
check a * b * c check a * b * c
definition tst2 : nat := a * b * c definition tst2 : nat := a * b * c
@ -41,10 +41,10 @@ end
section section
open nat 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 variables a b c : nat
check #algebra a*b*c check a*b*c
definition tst3 : nat := #algebra a*b*c definition tst3 : nat := #nat a*b*c
end end
section section
@ -54,6 +54,7 @@ section
:= algebra.mul_struct.mk add := algebra.mul_struct.mk add
variables a b c : nat variables a b c : nat
check #algebra a*b*c -- << is open add instead of mul check #experiment.algebra a*b*c -- << is open add instead of mul
definition tst4 : nat := #algebra a*b*c definition tst4 : nat := #experiment.algebra a*b*c
end end
end experiment

View file

@ -1,5 +1,5 @@
import logic import logic
namespace experiment
constant nat : Type.{1} constant nat : Type.{1}
constant int : Type.{1} constant int : Type.{1}
constant of_nat : nat → int constant of_nat : nat → int
@ -9,3 +9,4 @@ theorem tst (n : nat) : n = n :=
have H : true, from trivial, have H : true, from trivial,
calc n = n : eq.refl _ calc n = n : eq.refl _
... = n : eq.refl _ ... = n : eq.refl _
end experiment

View file

@ -1,5 +1,5 @@
import logic import logic
namespace experiment
constant nat : Type.{1} constant nat : Type.{1}
constant int : Type.{1} constant int : Type.{1}
constant of_nat : nat → int constant of_nat : nat → int

View file

@ -1,7 +1,7 @@
import logic import logic
open decidable open decidable
open eq open eq
namespace experiment
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,
succ : nat → 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 _ (take m IH, or.intro_right _
(show succ m = succ (pred (succ m)), from congr_arg succ (symm (pred_succ m)))) (show succ m = succ (pred (succ m)), from congr_arg succ (symm (pred_succ m))))
end nat end nat
end experiment

View file

@ -1,6 +1,6 @@
import logic import logic
open eq.ops open eq.ops
namespace experiment
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,
succ : nat → 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 := add_one m ▸ add_one n ▸ add_le_right H 1
end nat end nat
end experiment

View file

@ -1,6 +1,6 @@
import logic import logic
open eq.ops open eq.ops
namespace experiment
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,
succ : nat → 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) := add_le_right_inv (add_one m⁻¹ ▸ add_one n⁻¹ ▸ H)
end nat end nat
end experiment

View file

@ -1,6 +1,6 @@
import logic import logic
open eq.ops open eq.ops
namespace experiment
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,
succ : nat → nat succ : nat → nat
@ -15,3 +15,4 @@ open eq
theorem small2 (n m l : nat) : n * succ l + m = n * l + n + m theorem small2 (n m l : nat) : n * succ l + m = n * l + n + m
:= subst (mul_succ_right _ _) (eq.refl (n * succ l + m)) := subst (mul_succ_right _ _) (eq.refl (n * succ l + m))
end nat end nat
end experiment

View file

@ -1,6 +1,6 @@
import logic import logic
open eq.ops eq open eq.ops eq
namespace foo
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,
succ : nat → 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 * l + m) : {symm (mul_succ_right _ _)}
... = n * succ l + m * succ l : {symm (mul_succ_right _ _)}) ... = n * succ l + m * succ l : {symm (mul_succ_right _ _)})
end nat end nat
end foo

View file

@ -1,6 +1,6 @@
import logic import logic
open eq.ops open eq.ops
namespace experiment
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,
succ : nat → nat succ : nat → nat
@ -19,3 +19,4 @@ print "==========================="
theorem tst (n : nat) (H : P (n * zero)) : P zero theorem tst (n : nat) (H : P (n * zero)) : P zero
:= eq.subst (mul_zero_right _) H := eq.subst (mul_zero_right _) H
end nat end nat
exit

View file

@ -1,5 +1,5 @@
import logic import logic
namespace experiment
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,
succ : nat → nat succ : nat → nat
@ -14,3 +14,4 @@ print "==========================="
theorem bug (a b c d : nat) : a + b + c + d = a + c + b + d 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)) := subst (add_right_comm _ _ _) (eq.refl (a + b + c + d))
end nat end nat
end experiment

View file

@ -1,5 +1,5 @@
import logic import logic
namespace experiment
constant nat : Type.{1} constant nat : Type.{1}
constant int : Type.{1} constant int : Type.{1}
@ -24,3 +24,4 @@ definition c2 := i + j
theorem T2 : c2 = int_add i j := theorem T2 : c2 = int_add i j :=
eq.refl _ eq.refl _
exit

View file

@ -1,5 +1,5 @@
import logic import logic
namespace experiment
namespace nat namespace nat
constant nat : Type.{1} constant nat : Type.{1}
constant add : nat → nat → nat constant add : nat → nat → nat
@ -29,3 +29,4 @@ open nat
open eq open eq
theorem add_lt_left {a b : int} (H : a < b) (c : int) : c + a < c + b := 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) subst (symm (add_assoc c a one)) (add_le_left H c)
end experiment

View file

@ -1,5 +1,5 @@
import logic import logic
namespace experiment
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,
succ : nat → nat succ : nat → nat
@ -35,3 +35,4 @@ theorem T2 : ∃ a, (is_zero a) = true
:= by apply exists_intro; apply eq.refl := by apply exists_intro; apply eq.refl
end nat end nat
end experiment

View file

@ -1,5 +1,5 @@
import logic import logic
namespace experiment
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,
succ : nat → nat succ : nat → nat
@ -46,3 +46,4 @@ end
test_unify(env, t(m), tt, 1) test_unify(env, t(m), tt, 1)
test_unify(env, t(m), ff, 1) test_unify(env, t(m), ff, 1)
*) *)
end experiment

View file

@ -1,5 +1,5 @@
import logic import logic
namespace experiment
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,
succ : nat → nat succ : nat → nat
@ -48,3 +48,4 @@ end
test_unify(env, f(t(m)), f(tt), 1) test_unify(env, f(t(m)), f(tt), 1)
*) *)
exit

View file

@ -1,8 +1,9 @@
import logic import logic
namespace experiment
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,
succ : nat → nat succ : nat → nat
definition is_zero (n : nat) definition is_zero (n : nat)
:= nat.rec true (λ n r, false) n := nat.rec true (λ n r, false) n
end experiment

View file

@ -6,6 +6,7 @@
import logic import logic
open tactic open tactic
namespace foo
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,
succ : nat → 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 := theorem nat_rec_zero {P : → Type} (x : P 0) (f : ∀m, P m → P (succ m)) : nat.rec x f 0 = x :=
eq.refl _ eq.refl _
end nat end nat
end foo

View file

@ -6,7 +6,7 @@
import logic algebra.binary import logic algebra.binary
open tactic binary eq.ops eq open tactic binary eq.ops eq
open decidable open decidable
namespace experiment
definition refl := @eq.refl definition refl := @eq.refl
definition and_intro := @and.intro definition and_intro := @and.intro
definition or_intro_left := @or.intro_left 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 ... = dist l m : dist_add_left k l m
end nat end nat
end experiment

View file

@ -7,6 +7,7 @@ import logic algebra.binary
open tactic binary eq.ops eq open tactic binary eq.ops eq
open decidable open decidable
namespace experiment
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,
succ : nat → 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 nat
end experiment