refactor(library/algebra/field.lean): rename has_decidable_eq and declare instance

This commit is contained in:
Jeremy Avigad 2015-04-18 13:48:27 -04:00 committed by Leonardo de Moura
parent dfaeb475cc
commit 6359132b67
2 changed files with 44 additions and 46 deletions

View file

@ -310,9 +310,11 @@ section field
end field
structure discrete_field [class] (A : Type) extends field A :=
(decidable_equality : ∀x y : A, decidable (x = y))
(has_decidable_eq : decidable_eq A)
(inv_zero : inv zero = zero)
attribute discrete_field.has_decidable_eq [instance]
section discrete_field
variable [s : discrete_field A]
include s
@ -322,10 +324,6 @@ section discrete_field
-- but with fewer hypotheses since 0⁻¹ = 0 and equality is decidable.
-- they are named with '. Is there a better convention?
-- name clash with order
definition decidable_eq' [instance] (a b : A) : decidable (a = b) :=
@discrete_field.decidable_equality A s a b
theorem discrete_field.eq_zero_or_eq_zero_of_mul_eq_zero
(x y : A) (H : x * y = 0) : x = 0 y = 0 :=
decidable.by_cases

View file

@ -281,7 +281,7 @@ section discrete_linear_ordered_field
definition discrete_linear_ordered_field.to_discrete_field [instance] [reducible] [coercion]
[s : discrete_linear_ordered_field A] : discrete_field A :=
⦃ discrete_field, s, decidable_equality := dec_eq_of_dec_lt⦄
⦃ discrete_field, s, has_decidable_eq := dec_eq_of_dec_lt⦄
theorem pos_of_div_pos (H : 0 < 1 / a) : 0 < a :=
have H1 : 0 < 1 / (1 / a), from div_pos_of_pos H,