fix(library/algebra/ring.lean): allow degenerate semirings and rings, but not degenerate ordered_semirings and ordered_rings. Closes #478.

This commit is contained in:
Jeremy Avigad 2015-03-25 17:08:36 -04:00 committed by Leonardo de Moura
parent 0c3fd7427e
commit 765f6f21f8
7 changed files with 25 additions and 25 deletions

View file

@ -17,7 +17,7 @@ namespace algebra
variable {A : Type} variable {A : Type}
structure division_ring [class] (A : Type) extends ring A, has_inv A := structure division_ring [class] (A : Type) extends ring A, has_inv A, zero_ne_one_class A :=
(mul_inv_cancel : ∀{a}, a ≠ zero → mul a (inv a) = one) (mul_inv_cancel : ∀{a}, a ≠ zero → mul a (inv a) = one)
(inv_mul_cancel : ∀{a}, a ≠ zero → mul (inv a) a = one) (inv_mul_cancel : ∀{a}, a ≠ zero → mul (inv a) a = one)

View file

@ -22,7 +22,7 @@ absurd H (lt.irrefl a)
structure ordered_semiring [class] (A : Type) structure ordered_semiring [class] (A : Type)
extends has_mul A, has_zero A, has_lt A, -- TODO: remove hack for improving performance extends has_mul A, has_zero A, has_lt A, -- TODO: remove hack for improving performance
semiring A, ordered_cancel_comm_monoid A := semiring A, ordered_cancel_comm_monoid A, zero_ne_one_class A :=
(mul_le_mul_of_nonneg_left: ∀a b c, le a b → le zero c → le (mul c a) (mul c b)) (mul_le_mul_of_nonneg_left: ∀a b c, le a b → le zero c → le (mul c a) (mul c b))
(mul_le_mul_of_nonneg_right: ∀a b c, le a b → le zero c → le (mul a c) (mul b c)) (mul_le_mul_of_nonneg_right: ∀a b c, le a b → le zero c → le (mul a c) (mul b c))
(mul_lt_mul_of_pos_left: ∀a b c, lt a b → lt zero c → lt (mul c a) (mul c b)) (mul_lt_mul_of_pos_left: ∀a b c, lt a b → lt zero c → lt (mul c a) (mul c b))
@ -147,7 +147,7 @@ section
not_lt_of_le H3 H) not_lt_of_le H3 H)
end end
structure ordered_ring [class] (A : Type) extends ring A, ordered_comm_group A := structure ordered_ring [class] (A : Type) extends ring A, ordered_comm_group A, zero_ne_one_class A :=
(mul_nonneg : ∀a b, le zero a → le zero b → le zero (mul a b)) (mul_nonneg : ∀a b, le zero a → le zero b → le zero (mul a b))
(mul_pos : ∀a b, lt zero a → lt zero b → lt zero (mul a b)) (mul_pos : ∀a b, lt zero a → lt zero b → lt zero (mul a b))

View file

@ -44,7 +44,7 @@ theorem zero_ne_one [s: zero_ne_one_class A] : 0 ≠ 1 := @zero_ne_one_class.zer
/- semiring -/ /- semiring -/
structure semiring [class] (A : Type) extends add_comm_monoid A, monoid A, distrib A, structure semiring [class] (A : Type) extends add_comm_monoid A, monoid A, distrib A,
mul_zero_class A, zero_ne_one_class A mul_zero_class A
section semiring section semiring
variables [s : semiring A] (a b c : A) variables [s : semiring A] (a b c : A)
@ -148,7 +148,7 @@ end comm_semiring
/- ring -/ /- ring -/
structure ring [class] (A : Type) extends add_comm_group A, monoid A, distrib A, zero_ne_one_class A structure ring [class] (A : Type) extends add_comm_group A, monoid A, distrib A
theorem ring.mul_zero [s : ring A] (a : A) : a * 0 = 0 := theorem ring.mul_zero [s : ring A] (a : A) : a * 0 = 0 :=
have H : a * 0 + 0 = a * 0 + a * 0, from calc have H : a * 0 + 0 = a * 0 + a * 0, from calc

View file

@ -629,7 +629,6 @@ section
mul_one := mul_one, mul_one := mul_one,
left_distrib := mul.left_distrib, left_distrib := mul.left_distrib,
right_distrib := mul.right_distrib, right_distrib := mul.right_distrib,
zero_ne_one := zero_ne_one,
mul_comm := mul.comm, mul_comm := mul.comm,
eq_zero_or_eq_zero_of_mul_eq_zero := @eq_zero_or_eq_zero_of_mul_eq_zero⦄ eq_zero_or_eq_zero_of_mul_eq_zero := @eq_zero_or_eq_zero_of_mul_eq_zero⦄
end end

View file

@ -233,7 +233,8 @@ section
mul_nonneg := @mul_nonneg, mul_nonneg := @mul_nonneg,
mul_pos := @mul_pos, mul_pos := @mul_pos,
le_iff_lt_or_eq := le_iff_lt_or_eq, le_iff_lt_or_eq := le_iff_lt_or_eq,
le_total := le.total⦄ le_total := le.total,
zero_ne_one := zero_ne_one⦄
protected definition decidable_linear_ordered_comm_ring [instance] [reducible] : protected definition decidable_linear_ordered_comm_ring [instance] [reducible] :
algebra.decidable_linear_ordered_comm_ring int := algebra.decidable_linear_ordered_comm_ring int :=

View file

@ -307,7 +307,6 @@ section
right_distrib := mul.right_distrib, right_distrib := mul.right_distrib,
zero_mul := zero_mul, zero_mul := zero_mul,
mul_zero := mul_zero, mul_zero := mul_zero,
zero_ne_one := ne.symm (succ_ne_zero zero),
mul_comm := mul.comm⦄ mul_comm := mul.comm⦄
end end

View file

@ -161,6 +161,7 @@ section
lt_iff_le_ne := lt_iff_le_and_ne, lt_iff_le_ne := lt_iff_le_and_ne,
add_le_add_left := @add_le_add_left, add_le_add_left := @add_le_add_left,
le_of_add_le_add_left := @le_of_add_le_add_left, le_of_add_le_add_left := @le_of_add_le_add_left,
zero_ne_one := ne.symm (succ_ne_zero zero),
mul_le_mul_of_nonneg_left := (take a b c H1 H2, mul_le_mul_left H1 c), mul_le_mul_of_nonneg_left := (take a b c H1 H2, mul_le_mul_left H1 c),
mul_le_mul_of_nonneg_right := (take a b c H1 H2, mul_le_mul_right H1 c), mul_le_mul_of_nonneg_right := (take a b c H1 H2, mul_le_mul_right H1 c),
mul_lt_mul_of_pos_left := @mul_lt_mul_of_pos_left, mul_lt_mul_of_pos_left := @mul_lt_mul_of_pos_left,