@[instance]
Equations
- zsqrtd.decidable_eq = id (λ (_v : ℤ√d), _v.cases_on (λ (re im : ℤ) (w : ℤ√d), w.cases_on (λ (w_re w_im : ℤ), decidable.by_cases (λ (a : re = w_re), eq.rec (decidable.by_cases (λ (a : im = w_im), eq.rec (decidable.is_true _) a) (λ (a : ¬im = w_im), decidable.is_false _)) a) (λ (a : ¬re = w_re), decidable.is_false _))))
Convert an integer to a ℤ√d
Equations
- zsqrtd.of_int n = {re := n, im := 0}
@[instance]
Equations
- zsqrtd.has_zero = {zero := zsqrtd.zero d}
@[instance]
Equations
- zsqrtd.inhabited = {default := 0}
@[instance]
Equations
- zsqrtd.has_one = {one := zsqrtd.one d}
The representative of √d
in the ring
Equations
- zsqrtd.sqrtd = {re := 0, im := 1}
@[instance]
Equations
- zsqrtd.has_add = {add := zsqrtd.add d}
@[instance]
Equations
- zsqrtd.has_neg = {neg := zsqrtd.neg d}
@[instance]
Equations
- zsqrtd.has_mul = {mul := zsqrtd.mul d}
@[instance]
Equations
- zsqrtd.comm_ring = {add := has_add.add zsqrtd.has_add, add_assoc := _, zero := 0, zero_add := _, add_zero := _, neg := has_neg.neg zsqrtd.has_neg, add_left_neg := _, add_comm := _, mul := has_mul.mul zsqrtd.has_mul, mul_assoc := _, one := 1, one_mul := _, mul_one := _, left_distrib := _, right_distrib := _, mul_comm := _}
@[instance]
Equations
@[instance]
Equations
@[instance]
Equations
@[instance]
Equations
@[instance]
Equations
@[instance]
Equations
@[instance]
@[instance]
Equations
@[instance]
Equations
@[instance]
Equations
@[instance]
Equations
@[instance]
Equations
@[instance]
Equations
theorem
zsqrtd.sq_le_of_le
{c d x y z w : ℕ} :
z ≤ x → y ≤ w → zsqrtd.sq_le x c y d → zsqrtd.sq_le z c w d
theorem
zsqrtd.sq_le_add_mixed
{c d x y z w : ℕ} :
zsqrtd.sq_le x c y d → zsqrtd.sq_le z c w d → c * (x * z) ≤ d * (y * w)
theorem
zsqrtd.sq_le_add
{c d x y z w : ℕ} :
zsqrtd.sq_le x c y d → zsqrtd.sq_le z c w d → zsqrtd.sq_le (x + z) c (y + w) d
theorem
zsqrtd.sq_le_cancel
{c d x y z w : ℕ} :
zsqrtd.sq_le y d x c → zsqrtd.sq_le (x + z) c (y + w) d → zsqrtd.sq_le z c w d
theorem
zsqrtd.sq_le_smul
{c d x y : ℕ}
(n : ℕ) :
zsqrtd.sq_le x c y d → zsqrtd.sq_le (n * x) c (n * y) d
theorem
zsqrtd.sq_le_mul
{d x y z w : ℕ} :
(zsqrtd.sq_le x 1 y d → zsqrtd.sq_le z 1 w d → zsqrtd.sq_le (x * w + y * z) d (x * z + d * y * w) 1) ∧ (zsqrtd.sq_le x 1 y d → zsqrtd.sq_le w d z 1 → zsqrtd.sq_le (x * z + d * y * w) 1 (x * w + y * z) d) ∧ (zsqrtd.sq_le y d x 1 → zsqrtd.sq_le z 1 w d → zsqrtd.sq_le (x * z + d * y * w) 1 (x * w + y * z) d) ∧ (zsqrtd.sq_le y d x 1 → zsqrtd.sq_le w d z 1 → zsqrtd.sq_le (x * w + y * z) d (x * z + d * y * w) 1)
"Generalized" nonneg
. nonnegg c d x y
means a √c + b √d ≥ 0
;
we are interested in the case c = 1
but this is more symmetric
Equations
- zsqrtd.nonnegg c d -[1+ a] -[1+ b] = false
- zsqrtd.nonnegg c d -[1+ a] ↑b = zsqrtd.sq_le (a + 1) d b c
- zsqrtd.nonnegg c d ↑a -[1+ b] = zsqrtd.sq_le (b + 1) c a d
- zsqrtd.nonnegg c d ↑a ↑b = true
theorem
zsqrtd.nonnegg_cases_right
{c d a : ℕ}
{b : ℤ} :
(∀ (x : ℕ), b = -↑x → zsqrtd.sq_le x c a d) → zsqrtd.nonnegg c d ↑a b
theorem
zsqrtd.nonnegg_cases_left
{c d b : ℕ}
{a : ℤ} :
(∀ (x : ℕ), a = -↑x → zsqrtd.sq_le x d b c) → zsqrtd.nonnegg c d a ↑b
@[instance]
Equations
@[instance]
Equations
- zsqrtd.decidable_nonnegg c d a b = a.cases_on (λ (a : ℕ), b.cases_on (λ (b : ℕ), _.mpr (_.mpr (_.mpr decidable.true))) (λ (b : ℕ), _.mpr (_.mpr ((c * (b + 1) * (b + 1)).decidable_le (d * a * a))))) (λ (a : ℕ), b.cases_on (λ (b : ℕ), _.mpr (_.mpr ((d * (a + 1) * (a + 1)).decidable_le (c * b * b)))) (λ (b : ℕ), _.mpr decidable.false))
@[instance]
Equations
- {re := a, im := b}.decidable_nonneg = zsqrtd.decidable_nonnegg d 1 a b
@[instance]
Equations
- a.decidable_le b = (b - a).decidable_nonneg
@[instance]
Equations
- zsqrtd.decidable_linear_order = {le := preorder.le zsqrtd.preorder, lt := preorder.lt zsqrtd.preorder, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_total := _, decidable_le := zsqrtd.decidable_le d, decidable_eq := decidable_eq_of_decidable_le zsqrtd.decidable_le, decidable_lt := decidable_lt_of_decidable_le zsqrtd.decidable_le}
@[instance]
Equations
- zsqrtd.integral_domain = {add := comm_ring.add zsqrtd.comm_ring, add_assoc := _, zero := comm_ring.zero zsqrtd.comm_ring, zero_add := _, add_zero := _, neg := comm_ring.neg zsqrtd.comm_ring, add_left_neg := _, add_comm := _, mul := comm_ring.mul zsqrtd.comm_ring, mul_assoc := _, one := comm_ring.one zsqrtd.comm_ring, one_mul := _, mul_one := _, left_distrib := _, right_distrib := _, mul_comm := _, exists_pair_ne := _, eq_zero_or_eq_zero_of_mul_eq_zero := _}
@[instance]
Equations
- zsqrtd.decidable_linear_ordered_comm_ring = {add := comm_ring.add zsqrtd.comm_ring, add_assoc := _, zero := comm_ring.zero zsqrtd.comm_ring, zero_add := _, add_zero := _, neg := comm_ring.neg zsqrtd.comm_ring, add_left_neg := _, add_comm := _, mul := comm_ring.mul zsqrtd.comm_ring, mul_assoc := _, one := comm_ring.one zsqrtd.comm_ring, one_mul := _, mul_one := _, left_distrib := _, right_distrib := _, le := decidable_linear_order.le zsqrtd.decidable_linear_order, lt := decidable_linear_order.lt zsqrtd.decidable_linear_order, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, add_le_add_left := _, exists_pair_ne := _, mul_pos := _, le_total := _, zero_lt_one := _, mul_comm := _, decidable_le := decidable_linear_order.decidable_le zsqrtd.decidable_linear_order, decidable_eq := decidable_linear_order.decidable_eq zsqrtd.decidable_linear_order, decidable_lt := decidable_linear_order.decidable_lt zsqrtd.decidable_linear_order}
@[instance]
@[instance]
@[instance]