fix(tests,doc): adjust tests to changes in the standard library

This commit is contained in:
Leonardo de Moura 2015-12-05 23:52:16 -08:00
parent 80725cc416
commit b36ce49f2b
21 changed files with 47 additions and 53 deletions

View file

@ -20,19 +20,17 @@ multiplication are put in a namespace that begins with the name of the
operation: operation:
#+BEGIN_SRC lean #+BEGIN_SRC lean
import standard algebra.ordered_ring import standard algebra.ordered_ring
open nat algebra
check and.comm check and.comm
check mul.comm check mul.comm
check and.assoc check and.assoc
check mul.assoc check mul.assoc
check @algebra.mul.left_cancel -- multiplication is left cancelative check @mul.left_cancel -- multiplication is left cancelative
#+END_SRC #+END_SRC
In particular, this includes =intro= and =elim= operations for logical In particular, this includes =intro= and =elim= operations for logical
connectives, and properties of relations: connectives, and properties of relations:
#+BEGIN_SRC lean #+BEGIN_SRC lean
import standard algebra.ordered_ring import standard algebra.ordered_ring
open nat algebra
check and.intro check and.intro
check and.elim check and.elim
@ -49,8 +47,7 @@ For the most part, however, we rely on descriptive names. Often the
name of theorem simply describes the conclusion: name of theorem simply describes the conclusion:
#+BEGIN_SRC lean #+BEGIN_SRC lean
import standard algebra.ordered_ring import standard algebra.ordered_ring
open nat algebra open nat
check succ_ne_zero check succ_ne_zero
check mul_zero check mul_zero
check mul_one check mul_one
@ -61,7 +58,6 @@ If only a prefix of the description is enough to convey the meaning,
the name may be made even shorter: the name may be made even shorter:
#+BEGIN_SRC lean #+BEGIN_SRC lean
import standard algebra.ordered_ring import standard algebra.ordered_ring
open nat algebra
check @neg_neg check @neg_neg
check nat.pred_succ check nat.pred_succ
@ -75,8 +71,7 @@ intended reference, it is necessary to describe some of the
hypotheses. The word "of" is used to separate these hypotheses: hypotheses. The word "of" is used to separate these hypotheses:
#+BEGIN_SRC lean #+BEGIN_SRC lean
import standard algebra.ordered_ring import standard algebra.ordered_ring
open nat algebra open nat
check lt_of_succ_le check lt_of_succ_le
check lt_of_not_ge check lt_of_not_ge
check lt_of_le_of_ne check lt_of_le_of_ne
@ -87,8 +82,7 @@ with. For example, we use =pos=, =neg=, =nonpos=, =nonneg= rather than
=zero_lt=, =lt_zero=, =le_zero=, and =zero_le=. =zero_lt=, =lt_zero=, =le_zero=, and =zero_le=.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import standard algebra.ordered_ring import standard algebra.ordered_ring
open nat algebra open nat
check mul_pos check mul_pos
check mul_nonpos_of_nonneg_of_nonpos check mul_nonpos_of_nonneg_of_nonpos
check add_lt_of_lt_of_nonpos check add_lt_of_lt_of_nonpos
@ -105,7 +99,6 @@ Sometimes the word "left" or "right" is helpful to describe variants
of a theorem. of a theorem.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import standard algebra.ordered_ring import standard algebra.ordered_ring
open nat algebra
check add_le_add_left check add_le_add_left
check add_le_add_right check add_le_add_right

View file

@ -52,7 +52,7 @@ section
theorem lt.irrefl (a : A) : ¬ a < a := !strict_order.lt_irrefl theorem lt.irrefl (a : A) : ¬ a < a := !strict_order.lt_irrefl
theorem not_lt_self (a : A) : ¬ a < a := !lt.irrefl -- alternate syntax theorem not_lt_self (a : A) : ¬ a < a := !lt.irrefl -- alternate syntax
theorem lt_self_iff_false [simp] (a : A) : a < a ↔ false := theorem lt_self_iff_false (a : A) : a < a ↔ false :=
iff_false_intro (lt.irrefl a) iff_false_intro (lt.irrefl a)
theorem lt.trans [trans] {a b c : A} : a < b → b < c → a < c := !strict_order.lt_trans theorem lt.trans [trans] {a b c : A} : a < b → b < c → a < c := !strict_order.lt_trans
@ -333,10 +333,10 @@ section
(assume H : a ≤ b, by rewrite [↑max, if_pos H]; apply H₂) (assume H : a ≤ b, by rewrite [↑max, if_pos H]; apply H₂)
(assume H : ¬ a ≤ b, by rewrite [↑max, if_neg H]; apply H₁) (assume H : ¬ a ≤ b, by rewrite [↑max, if_neg H]; apply H₁)
theorem le_max_left_iff_true [simp] (a b : A) : a ≤ max a b ↔ true := theorem le_max_left_iff_true (a b : A) : a ≤ max a b ↔ true :=
iff_true_intro (le_max_left a b) iff_true_intro (le_max_left a b)
theorem le_max_right_iff_true [simp] (a b : A) : b ≤ max a b ↔ true := theorem le_max_right_iff_true (a b : A) : b ≤ max a b ↔ true :=
iff_true_intro (le_max_right a b) iff_true_intro (le_max_right a b)
/- these are also proved for lattices, but with inf and sup in place of min and max -/ /- these are also proved for lattices, but with inf and sup in place of min and max -/

View file

@ -1,7 +1,7 @@
import data.int import data.int
open int open int
protected theorem has_decidable_eq [instance] : decidable_eq := protected theorem has_decidable_eq [instance] : decidable_eq :=
take (a b : ), _ take (a b : ), _
constant n : nat constant n : nat

View file

@ -44,7 +44,7 @@ b
a + c + b = a + (c + b) a + c + b = a + (c + b)
-- ACK -- ACK
-- IDENTIFIER|7|33 -- IDENTIFIER|7|33
algebra.add.assoc add.assoc
-- ACK -- ACK
-- TYPE|7|43 -- TYPE|7|43
a + c + b = a + (c + b) → a + (c + b) = a + c + b a + c + b = a + (c + b) → a + (c + b) = a + c + b

View file

@ -1,7 +1,8 @@
import data.int import data.int
open int open int
namespace foo
constant abs : int → int constant abs : int → int
notation `|` A `|` := abs A notation `|` A `|` := abs A
constants a b c : int constants a b c : int
check |a + |b| + c| check |a + |b| + c|
end foo

View file

@ -1,4 +1,4 @@
import data.finset import data.finset data.set
open set finset open set finset
structure finite_set [class] {T : Type} (xs : set T) := structure finite_set [class] {T : Type} (xs : set T) :=

View file

@ -1,6 +1,6 @@
import algebra.ring data.nat import algebra.ring data.nat
open algebra
namespace foo
variables {A : Type} variables {A : Type}
section section
@ -36,3 +36,4 @@ set_option blast.ematch true
theorem inv_mul_cancel_left (a b : A) : a⁻¹ * (a * b) = b := theorem inv_mul_cancel_left (a b : A) : a⁻¹ * (a * b) = b :=
by blast by blast
end end
end foo

View file

@ -16,7 +16,7 @@ attribute mul.assoc [forward]
attribute mul.left_inv [forward] attribute mul.left_inv [forward]
attribute one_mul [forward] attribute one_mul [forward]
theorem inv_eq_of_mul_eq_one {a b : A} (H : a * b = 1) : a⁻¹ = b := theorem inv_eq_of_mul_eq_one {a b : A} (H : a * b = 1) : a⁻¹ = b :=
-- This is the kind of theorem that can be easily proved using superposition, -- This is the kind of theorem that can be easily proved using superposition,
-- but cannot to be proved using E-matching. -- but cannot to be proved using E-matching.
-- To prove it using E-matching, we must provide the following auxiliary assertion. -- To prove it using E-matching, we must provide the following auxiliary assertion.

View file

@ -4,7 +4,7 @@ open algebra
variables {A : Type} variables {A : Type}
variables [s : group A] variables [s : group A]
include s include s
namespace foo
set_option blast.ematch true set_option blast.ematch true
set_option blast.subst false set_option blast.subst false
set_option blast.simp false set_option blast.simp false
@ -47,3 +47,4 @@ theorem eq_of_mul_inv_eq_one₂ {a b : A} (H : a * b⁻¹ = 1) : a = b :=
calc calc
a = a * b⁻¹ * b : by blast a = a * b⁻¹ * b : by blast
... = b : by blast ... = b : by blast
end foo

View file

@ -1,7 +1,7 @@
import data.nat import data.nat
open nat open nat
namespace foo
definition lt.trans {a b c : nat} (H₁ : a < b) (H₂ : b < c) : a < c := definition lt.trans {a b c : nat} (H₁ : a < b) (H₂ : b < c) : a < c :=
have aux : a < b → a < c, from have aux : a < b → a < c, from
le.rec_on H₂ le.rec_on H₂
@ -18,3 +18,4 @@ definition lt_of_succ_lt {a b : nat} (H : succ a < b) : a < b :=
le.rec_on H le.rec_on H
(by constructor; constructor) (by constructor; constructor)
(λ b h ih, by constructor; exact ih) (λ b h ih, by constructor; exact ih)
end foo

View file

@ -1,5 +1,5 @@
import data.finset data.finset.card data.finset.equiv import data.finset data.finset.card data.finset.equiv
open nat nat.finset decidable open nat decidable
namespace finset namespace finset
variable {A : Type} variable {A : Type}

View file

@ -2,6 +2,6 @@ import data.list algebra.group
print inductive nat print inductive nat
print inductive algebra.group print inductive group
print inductive list print inductive list

View file

@ -1,9 +1,8 @@
import algebra.group import algebra.group
open algebra
variable {A : Type} variable {A : Type}
variable [s : group A] variable [s : group A]
include s include s
theorem mul.right_inv (a : A) : a * a⁻¹ = 1 := theorem mul.right_inv (a : A) : a * a⁻¹ = 1 :=
by rewrite [-{a}inv_inv at {1}, mul.left_inv] by rewrite [-{a}inv_inv at {1}, mul.left_inv]

View file

@ -1,6 +1,6 @@
import data.nat.basic import data.nat.basic
open nat open nat
namespace foo
definition associative {A : Type} (op : A → A → A) := ∀a b c, op (op a b) c = op a (op b c) definition associative {A : Type} (op : A → A → A) := ∀a b c, op (op a b) c = op a (op b c)
structure semigroup [class] (A : Type) := structure semigroup [class] (A : Type) :=
@ -19,3 +19,4 @@ definition s := semigroup2.mk nat nat.mul nat.mul_assoc
example (a b c : nat) : (a * b) * c = a * (b * c) := example (a b c : nat) : (a * b) * c = a * (b * c) :=
semigroup2.mul_assoc nat s a b c semigroup2.mul_assoc nat s a b c
end foo

View file

@ -3,7 +3,7 @@ open algebra
set_option simplify.max_steps 1000 set_option simplify.max_steps 1000
universe l universe l
constants (T : Type.{l}) (s : algebra.comm_ring T) constants (T : Type.{l}) (s : comm_ring T)
constants (x1 x2 x3 x4 : T) (f g : T → T) constants (x1 x2 x3 x4 : T) (f g : T → T)
attribute s [instance] attribute s [instance]

View file

@ -1,9 +1,8 @@
-- Basic fusion -- Basic fusion
import algebra.ring import algebra.ring
open algebra
universe l universe l
constants (T : Type.{l}) (s : algebra.comm_ring T) constants (T : Type.{l}) (s : comm_ring T)
constants (x1 x2 x3 x4 : T) (f g : T → T) constants (x1 x2 x3 x4 : T) (f g : T → T)
attribute s [instance] attribute s [instance]
set_option simplify.max_steps 50000 set_option simplify.max_steps 50000

View file

@ -3,7 +3,7 @@ import algebra.ring
open algebra open algebra
universe l universe l
constants (T : Type.{l}) (s : algebra.comm_ring T) constants (T : Type.{l}) (s : comm_ring T)
constants (x1 x2 x3 x4 : T) (f g : T → T) constants (x1 x2 x3 x4 : T) (f g : T → T)
attribute s [instance] attribute s [instance]

View file

@ -1,24 +1,23 @@
(refl): x1 (refl): x1
(refl): @add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) x1 x1 (refl): @add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) x1 x1
(refl): @add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) (refl): @add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) (@add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) x1 x1)
(@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) x1 x1)
x1 x1
(refl): @add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) (refl): @add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s))
(@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) (@add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s))
(@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) x1 x1) (@add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) x1 x1)
x1) x1)
x1 x1
(refl): @add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) (refl): @add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s))
(@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) (@add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s))
(@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) x1 x1) (@add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) x1 x1)
(@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) x1 x1)) (@add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) x1 x1))
x1 x1
@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) x1 @add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) x1
(@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) x1 x1) (@add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) x1 x1)
@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) x1 @add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) x1
(@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) x1 (@add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) x1
(@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) x1 x1)) (@add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) x1 x1))
@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) x1 @add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) x1
(@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) x1 (@add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) x1
(@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) x1 (@add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) x1
(@add.{l} T (@has_add.mk.{l} T (@algebra.comm_ring.add.{l} T s)) x1 x1))) (@add.{l} T (@has_add.mk.{l} T (@comm_ring.add.{l} T s)) x1 x1)))

View file

@ -3,7 +3,7 @@ import algebra.ring
open algebra open algebra
universe l universe l
constants (T : Type.{l}) (s : algebra.comm_ring T) constants (T : Type.{l}) (s : comm_ring T)
constants (x1 x2 x3 x4 : T) (f g : T → T) constants (x1 x2 x3 x4 : T) (f g : T → T)
attribute s [instance] attribute s [instance]
set_option simplify.max_steps 50000 set_option simplify.max_steps 50000

View file

@ -3,7 +3,7 @@ import algebra.ring
open algebra open algebra
universe l universe l
constants (T : Type.{l}) (s : algebra.comm_ring T) constants (T : Type.{l}) (s : comm_ring T)
constants (x1 x2 x3 x4 : T) (f g : T → T) constants (x1 x2 x3 x4 : T) (f g : T → T)
attribute s [instance] attribute s [instance]
set_option simplify.max_steps 50000 set_option simplify.max_steps 50000

View file

@ -1,5 +1,4 @@
import algebra.ring import algebra.ring
open algebra
set_option simplify.max_steps 5000000 set_option simplify.max_steps 5000000
-- TODO(dhs): we need to create the simplifier.numeral namespace incrementally. -- TODO(dhs): we need to create the simplifier.numeral namespace incrementally.