Built with doc-gen4, running Lean4. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓to navigate, Ctrl+🖱️to focus. On Mac, use Cmdinstead of Ctrl.
/-
Copyright (c) 2018 Louis Carlin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Louis Carlin, Mario Carneiro

! This file was ported from Lean 3 source module algebra.euclidean_domain.instances
! leanprover-community/mathlib commit e1bccd6e40ae78370f01659715d3c948716e3b7e
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.Algebra.EuclideanDomain.Defs
import Mathlib.Algebra.Field.Defs
import Mathlib.Algebra.GroupWithZero.Units.Lemmas
import Mathlib.Algebra.Order.Ring.Lemmas
import Mathlib.Init.Data.Int.Order
import Mathlib.Data.Int.Basic
import Mathlib.Data.Nat.Order.Basic
import Mathlib.Data.Int.Order.Basic

/-!
# Instances for Euclidean domains
* `Int.euclideanDomain`: shows that `ℤ` is a Euclidean domain.
* `Field.toEuclideanDomain`: shows that any field is a Euclidean domain.
-/

instance 
Int.euclideanDomain: EuclideanDomain
Int.euclideanDomain
:
EuclideanDomain: Type ?u.2 → Type ?u.2
EuclideanDomain
: Type
:= {
inferInstanceAs: (α : Sort ?u.6) → [i : α] → α
inferInstanceAs
(
CommRing: Type ?u.7 → Type ?u.7
CommRing
Int: Type
Int
),
inferInstanceAs: ∀ (α : Sort ?u.18) [i : α], α
inferInstanceAs
(
Nontrivial: Type ?u.19 → Prop
Nontrivial
Int: Type
Int
) with add :=
(· + ·):
(· + ·)
, mul :=
(· * ·):
(· * ·)
, one :=
1: ?m.413
1
, zero :=
0: ?m.147
0
, neg :=
Neg.neg: {α : Type ?u.495} → [self : Neg α] → αα
Neg.neg
, quotient :=
(· / ·):
(· / ·)
, quotient_zero :=
Int.ediv_zero: ∀ (a : ), a / 0 = 0
Int.ediv_zero
, remainder :=
(· % ·):
(· % ·)
, quotient_mul_add_remainder_eq :=
Int.ediv_add_emod: ∀ (a b : ), b * (a / b) + a % b = a
Int.ediv_add_emod
, r := fun
a: ?m.748
a
b: ?m.751
b
=>
a: ?m.748
a
.
natAbs:
natAbs
<
b: ?m.751
b
.
natAbs:
natAbs
, r_wellFounded := (
measure: {α : Sort ?u.765} → (α) → WellFoundedRelation α
measure
natAbs:
natAbs
).
wf: ∀ {α : Sort ?u.770} [self : WellFoundedRelation α], WellFounded WellFoundedRelation.rel
wf
remainder_lt := fun
a: ?m.782
a
b: ?m.785
b
b0: ?m.788
b0
=>
Int.ofNat_lt: ∀ {n m : }, n < m n < m
Int.ofNat_lt
.
1: ∀ {a b : Prop}, (a b) → ab
1
<|

Goals accomplished! 🐙

↑(natAbs ((fun x x_1 => x % x_1) a b)) < ↑(natAbs b)

↑(natAbs ((fun x x_1 => x % x_1) a b)) < ↑(natAbs b)

↑(natAbs ((fun x x_1 => x % x_1) a b)) < ↑(natAbs b)

↑(natAbs ((fun x x_1 => x % x_1) a b)) < ↑(natAbs b)

Goals accomplished! 🐙
mul_left_not_lt := fun
a: ?m.812
a
b: ?m.815
b
b0: ?m.818
b0
=>
not_lt_of_ge: ∀ {α : Type ?u.820} [inst : Preorder α] {a b : α}, a b¬a < b
not_lt_of_ge
<|

Goals accomplished! 🐙

Goals accomplished! 🐙
} -- Porting note: this seems very slow. -- see Note [lower instance priority] instance (priority := 100)
Field.toEuclideanDomain: {K : Type ?u.2448} → [inst : Field K] → EuclideanDomain K
Field.toEuclideanDomain
{
K: Type ?u.2448
K
:
Type _: Type (?u.2448+1)
Type _
} [
Field: Type ?u.2451 → Type ?u.2451
Field
K: Type ?u.2448
K
] :
EuclideanDomain: Type ?u.2454 → Type ?u.2454
EuclideanDomain
K: Type ?u.2448
K
:= { ‹Field K› with add :=
(· + ·): KKK
(· + ·)
, mul :=
(· * ·): KKK
(· * ·)
, one :=
1: ?m.3123
1
, zero :=
0: ?m.2705
0
, neg :=
Neg.neg: {α : Type ?u.3336} → [self : Neg α] → αα
Neg.neg
, quotient :=
(· / ·): KKK
(· / ·)
, remainder := fun
a: ?m.3635
a
b: ?m.3638
b
=>
a: ?m.3635
a
-
a: ?m.3635
a
*
b: ?m.3638
b
/
b: ?m.3638
b
, quotient_zero :=
div_zero: ∀ {G₀ : Type ?u.3589} [inst : GroupWithZero G₀] (a : G₀), a / 0 = 0
div_zero
, quotient_mul_add_remainder_eq := fun
a: ?m.3866
a
b: ?m.3869
b
=>

Goals accomplished! 🐙
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K


b * (fun x x_1 => x / x_1) a b + (fun a b => a - a * b / b) a b = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
b * (fun x x_1 => x / x_1) a b + (fun a b => a - a * b / b) a b = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: ¬b = 0


neg
b * (fun x x_1 => x / x_1) a b + (fun a b => a - a * b / b) a b = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K


b * (fun x x_1 => x / x_1) a b + (fun a b => a - a * b / b) a b = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
b * (fun x x_1 => x / x_1) a b + (fun a b => a - a * b / b) a b = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: ¬b = 0


neg
b * (fun x x_1 => x / x_1) a b + (fun a b => a - a * b / b) a b = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K


b * (fun x x_1 => x / x_1) a b + (fun a b => a - a * b / b) a b = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K


b * (fun x x_1 => x / x_1) a b + (fun a b => a - a * b / b) a b = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: ¬b = 0


neg
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
0 * (a / 0) + (a - a * 0 / 0) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
0 + (a - a * 0 / 0) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
0 + (a - 0 / 0) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
0 + (a - 0) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
a - 0 = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: b = 0


pos
a = a

Goals accomplished! 🐙
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K


b * (fun x x_1 => x / x_1) a b + (fun a b => a - a * b / b) a b = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: ¬b = 0


neg
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: ¬b = 0


neg
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: ¬b = 0


neg
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: ¬b = 0


neg
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: ¬b = 0


neg
b * (a / b) + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: ¬b = 0


neg
a + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: ¬b = 0


neg
a + (a - a * b / b) = a
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

h: ¬b = 0


neg
b * (a / b) + (a - a * b / b) = a

Goals accomplished! 🐙
r := fun
a: ?m.3878
a
b: ?m.3881
b
=>
a: ?m.3878
a
=
0: ?m.3885
0
b: ?m.3881
b
0: ?m.3904
0
, r_wellFounded :=
WellFounded.intro: ∀ {α : Sort ?u.3910} {r : ααProp}, (∀ (a : α), Acc r a) → WellFounded r
WellFounded.intro
fun
a: ?m.3922
a
=> (
Acc.intro: ∀ {α : Sort ?u.3924} {r : ααProp} (x : α), (∀ (y : α), r y xAcc r y) → Acc r x
Acc.intro
_: ?m.3925
_
) fun
b: ?m.3939
b
hb: b = 0
hb
, _⟩ => (
Acc.intro: ∀ {α : Sort ?u.3972} {r : ααProp} (x : α), (∀ (y : α), r y xAcc r y) → Acc r x
Acc.intro
_: ?m.3973
_
) fun
c: ?m.3982
c
⟨_,
hnb: b 0
hnb
⟩ =>
False.elim: ∀ {C : Sort ?u.4012}, FalseC
False.elim
<|
hnb: b 0
hnb
hb: b = 0
hb
, remainder_lt := fun
a: ?m.4148
a
b: ?m.4151
b
hnb: ?m.4154
hnb
=>

Goals accomplished! 🐙
K: Type ?u.2448

inst✝: Field K

src✝:= inst✝: Field K

a, b: K

hnb: b 0


(fun a b => a = 0 b 0) ((fun a b => a - a * b / b) a b) b

Goals accomplished! 🐙
, mul_left_not_lt := fun
a: ?m.4168
a
b: ?m.4171
b
hnb: ?m.4174
hnb
hab: a * b = 0
hab
,
hna: a 0
hna
⟩ =>
Or.casesOn: ∀ {a b : Prop} {motive : a bProp} (t : a b), (∀ (h : a), motive (_ : a b)) → (∀ (h : b), motive (_ : a b)) → motive t
Or.casesOn
(
mul_eq_zero: ∀ {M₀ : Type ?u.4299} [inst : MulZeroClass M₀] [inst_1 : NoZeroDivisors M₀] {a b : M₀}, a * b = 0 a = 0 b = 0
mul_eq_zero
.
1: ∀ {a b : Prop}, (a b) → ab
1
hab: a * b = 0
hab
)
hna: a 0
hna
hnb: ?m.4174
hnb
} #align field.to_euclidean_domain
Field.toEuclideanDomain: {K : Type u_1} → [inst : Field K] → EuclideanDomain K
Field.toEuclideanDomain