File: Mathlib/NumberTheory/Padics/RingHoms.lean

full_name: PadicInt.modPart
code: /-- `modPart p r` is an integer that satisfies
`‖(r - modPart p r : ℚ_[p])‖ < 1` when `‖(r : ℚ_[p])‖ ≤ 1`,
see `PadicInt.norm_sub_modPart`.
It is the unique non-negative integer that is `< p` with this property.

(Note that this definition assumes `r : ℚ`.
See `PadicInt.zmodRepr` for a version that takes values in `ℕ`
and works for arbitrary `x : ℤ_[p]`.) -/
def modPart : ℤ 
goal: ℤ

full_name: PadicInt.modPart_lt_p
code: theorem modPart_lt_p : modPart p r < p 
goal: PadicInt.modPart p r < ↑p

full_name: PadicInt.modPart_nonneg
code: theorem modPart_nonneg : 0 ≤ modPart p r 
goal: 0 ≤ PadicInt.modPart p r

full_name: PadicInt.isUnit_den
code: theorem isUnit_den (r : ℚ) (h : ‖(r : ℚ_[p])‖ ≤ 1) : IsUnit (r.den : ℤ_[p]) 
goal: IsUnit ↑r.den

full_name: PadicInt.norm_sub_modPart_aux
code: theorem norm_sub_modPart_aux (r : ℚ) (h : ‖(r : ℚ_[p])‖ ≤ 1) :
    ↑p ∣ r.num - r.num * r.den.gcdA p % p * ↑r.den 
goal: ↑p ∣ r.num - r.num * r.den.gcdA p % ↑p * ↑r.den

full_name: PadicInt.norm_sub_modPart
code: theorem norm_sub_modPart (h : ‖(r : ℚ_[p])‖ ≤ 1) : ‖(⟨r, h⟩ - modPart p r : ℤ_[p])‖ < 1 
goal: ‖⟨↑r, h⟩ - ↑(PadicInt.modPart p r)‖ < 1

full_name: PadicInt.exists_mem_range_of_norm_rat_le_one
code: theorem exists_mem_range_of_norm_rat_le_one (h : ‖(r : ℚ_[p])‖ ≤ 1) :
    ∃ n : ℤ, 0 ≤ n ∧ n < p ∧ ‖(⟨r, h⟩ - n : ℤ_[p])‖ < 1 
goal: ∃ n, 0 ≤ n ∧ n < ↑p ∧ ‖⟨↑r, h⟩ - ↑n‖ < 1

full_name: PadicInt.zmod_congr_of_sub_mem_span_aux
code: theorem zmod_congr_of_sub_mem_span_aux (n : ℕ) (x : ℤ_[p]) (a b : ℤ)
    (ha : x - a ∈ (Ideal.span {(p : ℤ_[p]) ^ n}))
    (hb : x - b ∈ (Ideal.span {(p : ℤ_[p]) ^ n})) : (a : ZMod (p ^ n)) = b 
goal: ↑a = ↑b

full_name: PadicInt.zmod_congr_of_sub_mem_span
code: theorem zmod_congr_of_sub_mem_span (n : ℕ) (x : ℤ_[p]) (a b : ℕ)
    (ha : x - a ∈ (Ideal.span {(p : ℤ_[p]) ^ n}))
    (hb : x - b ∈ (Ideal.span {(p : ℤ_[p]) ^ n})) : (a : ZMod (p ^ n)) = b 
goal: ↑a = ↑b

full_name: PadicInt.zmod_congr_of_sub_mem_max_ideal
code: theorem zmod_congr_of_sub_mem_max_ideal (x : ℤ_[p]) (m n : ℕ) (hm : x - m ∈ maximalIdeal ℤ_[p])
    (hn : x - n ∈ maximalIdeal ℤ_[p]) : (m : ZMod p) = n 
goal: ↑m = ↑n

full_name: PadicInt.exists_mem_range
code: theorem exists_mem_range : ∃ n : ℕ, n < p ∧ x - n ∈ maximalIdeal ℤ_[p] 
goal: ∃ n < p, x - ↑n ∈ LocalRing.maximalIdeal ℤ_[p]

full_name: PadicInt.zmodRepr
code: /-- `zmod_repr x` is the unique natural number smaller than `p`
satisfying `‖(x - zmod_repr x : ℤ_[p])‖ < 1`.
-/
def zmodRepr : ℕ 
goal: ℕ

full_name: PadicInt.zmodRepr_spec
code: theorem zmodRepr_spec : zmodRepr x < p ∧ x - zmodRepr x ∈ maximalIdeal ℤ_[p] 
goal: x.zmodRepr < p ∧ x - ↑x.zmodRepr ∈ LocalRing.maximalIdeal ℤ_[p]

full_name: PadicInt.zmodRepr_lt_p
code: theorem zmodRepr_lt_p : zmodRepr x < p 
goal: x.zmodRepr < p

full_name: PadicInt.sub_zmodRepr_mem
code: theorem sub_zmodRepr_mem : x - zmodRepr x ∈ maximalIdeal ℤ_[p] 
goal: x - ↑x.zmodRepr ∈ LocalRing.maximalIdeal ℤ_[p]

full_name: PadicInt.toZModHom
code: /-- `toZModHom` is an auxiliary constructor for creating ring homs from `ℤ_[p]` to `ZMod v`.
-/
def toZModHom (v : ℕ) (f : ℤ_[p] → ℕ) (f_spec : ∀ x, x - f x ∈ (Ideal.span {↑v} : Ideal ℤ_[p]))
    (f_congr :
      ∀ (x : ℤ_[p]) (a b : ℕ),
        x - a ∈ (Ideal.span {↑v} : Ideal ℤ_[p]) →
          x - b ∈ (Ideal.span {↑v} : Ideal ℤ_[p]) → (a : ZMod v) = b) :
    ℤ_[p] →+* ZMod v 
goal: ℤ_[p] →+* ZMod v

full_name: PadicInt.toZMod
code: /-- `toZMod` is a ring hom from `ℤ_[p]` to `ZMod p`,
with the equality `toZMod x = (zmodRepr x : ZMod p)`.
-/
def toZMod : ℤ_[p] →+* ZMod p 
goal: ℤ_[p] →+* ZMod p

full_name: PadicInt.toZMod_spec
code: /-- `z - (toZMod z : ℤ_[p])` is contained in the maximal ideal of `ℤ_[p]`, for every `z : ℤ_[p]`.

The coercion from `ZMod p` to `ℤ_[p]` is `ZMod.cast`,
which coerces `ZMod p` into arbitrary rings.
This is unfortunate, but a consequence of the fact that we allow `ZMod p`
to coerce to rings of arbitrary characteristic, instead of only rings of characteristic `p`.
This coercion is only a ring homomorphism if it coerces into a ring whose characteristic divides
`p`. While this is not the case here we can still make use of the coercion.
-/
theorem toZMod_spec : x - (ZMod.cast (toZMod x) : ℤ_[p]) ∈ maximalIdeal ℤ_[p] 
goal: x - (PadicInt.toZMod x).cast ∈ LocalRing.maximalIdeal ℤ_[p]

full_name: PadicInt.ker_toZMod
code: theorem ker_toZMod : RingHom.ker (toZMod : ℤ_[p] →+* ZMod p) = maximalIdeal ℤ_[p] 
goal: RingHom.ker PadicInt.toZMod = LocalRing.maximalIdeal ℤ_[p]

full_name: PadicInt.appr
code: /-- `appr n x` gives a value `v : ℕ` such that `x` and `↑v : ℤ_p` are congruent mod `p^n`.
See `appr_spec`. -/
-- Porting note: removing irreducible solves a lot of problems
noncomputable def appr : ℤ_[p] → ℕ → ℕ
  
goal: ℤ_[p] → ℕ → ℕ

full_name: PadicInt.appr_lt
code: theorem appr_lt (x : ℤ_[p]) (n : ℕ) : x.appr n < p ^ n 
goal: x.appr n < p ^ n

full_name: PadicInt.appr_mono
code: theorem appr_mono (x : ℤ_[p]) : Monotone x.appr 
goal: Monotone x.appr

full_name: PadicInt.dvd_appr_sub_appr
code: theorem dvd_appr_sub_appr (x : ℤ_[p]) (m n : ℕ) (h : m ≤ n) : p ^ m ∣ x.appr n - x.appr m 
goal: p ^ m ∣ x.appr n - x.appr m

full_name: PadicInt.appr_spec
code: theorem appr_spec (n : ℕ) : ∀ x : ℤ_[p], x - appr x n ∈ Ideal.span {(p : ℤ_[p]) ^ n} 
goal: x - ↑(x.appr n) ∈ Ideal.span {↑p ^ n}

full_name: PadicInt.toZModPow
code: /-- A ring hom from `ℤ_[p]` to `ZMod (p^n)`, with underlying function `PadicInt.appr n`. -/
def toZModPow (n : ℕ) : ℤ_[p] →+* ZMod (p ^ n) 
goal: ℤ_[p] →+* ZMod (p ^ n)

full_name: PadicInt.ker_toZModPow
code: theorem ker_toZModPow (n : ℕ) :
    RingHom.ker (toZModPow n : ℤ_[p] →+* ZMod (p ^ n)) = Ideal.span {(p : ℤ_[p]) ^ n} 
goal: RingHom.ker (PadicInt.toZModPow n) = Ideal.span {↑p ^ n}

full_name: PadicInt.zmod_cast_comp_toZModPow
code: theorem zmod_cast_comp_toZModPow (m n : ℕ) (h : m ≤ n) :
    (ZMod.castHom (pow_dvd_pow p h) (ZMod (p ^ m))).comp (@toZModPow p _ n) = @toZModPow p _ m 
goal: (ZMod.castHom ⋯ (ZMod (p ^ m))).comp (PadicInt.toZModPow n) = PadicInt.toZModPow m

full_name: PadicInt.cast_toZModPow
code: @[simp]
theorem cast_toZModPow (m n : ℕ) (h : m ≤ n) (x : ℤ_[p]) :
    ZMod.cast (toZModPow n x) = toZModPow m x 
goal: ((PadicInt.toZModPow n) x).cast = (PadicInt.toZModPow m) x

full_name: PadicInt.denseRange_natCast
code: theorem denseRange_natCast : DenseRange (Nat.cast : ℕ → ℤ_[p]) 
goal: DenseRange Nat.cast

full_name: PadicInt.denseRange_intCast
code: theorem denseRange_intCast : DenseRange (Int.cast : ℤ → ℤ_[p]) 
goal: DenseRange Int.cast

full_name: PadicInt.nthHom
code: /-- Given a family of ring homs `f : Π n : ℕ, R →+* ZMod (p ^ n)`,
`nthHom f r` is an integer-valued sequence
whose `n`th value is the unique integer `k` such that `0 ≤ k < p ^ n`
and `f n r = (k : ZMod (p ^ n))`.
-/
def nthHom (r : R) : ℕ → ℤ 
goal: ℕ → ℤ

full_name: PadicInt.nthHom_zero
code: @[simp]
theorem nthHom_zero : nthHom f 0 = 0 
goal: PadicInt.nthHom f 0 = 0

full_name: PadicInt.pow_dvd_nthHom_sub
code: theorem pow_dvd_nthHom_sub (r : R) (i j : ℕ) (h : i ≤ j) :
    (p : ℤ) ^ i ∣ nthHom f r j - nthHom f r i 
goal: ↑p ^ i ∣ PadicInt.nthHom f r j - PadicInt.nthHom f r i

full_name: PadicInt.isCauSeq_nthHom
code: theorem isCauSeq_nthHom (r : R) : IsCauSeq (padicNorm p) fun n => nthHom f r n 
goal: IsCauSeq (padicNorm p) fun n => ↑(PadicInt.nthHom f r n)

full_name: PadicInt.nthHomSeq
code: /-- `nthHomSeq f_compat r` bundles `PadicInt.nthHom f r`
as a Cauchy sequence of rationals with respect to the `p`-adic norm.
The `n`th value of the sequence is `((f n r).val : ℚ)`.
-/
def nthHomSeq (r : R) : PadicSeq p 
goal: PadicSeq p

full_name: PadicInt.nthHomSeq_one
code: theorem nthHomSeq_one : nthHomSeq f_compat 1 ≈ 1 
goal: PadicInt.nthHomSeq f_compat 1 ≈ 1

full_name: PadicInt.nthHomSeq_add
code: theorem nthHomSeq_add (r s : R) :
    nthHomSeq f_compat (r + s) ≈ nthHomSeq f_compat r + nthHomSeq f_compat s 
goal: PadicInt.nthHomSeq f_compat (r + s) ≈ PadicInt.nthHomSeq f_compat r + PadicInt.nthHomSeq f_compat s

full_name: PadicInt.nthHomSeq_mul
code: theorem nthHomSeq_mul (r s : R) :
    nthHomSeq f_compat (r * s) ≈ nthHomSeq f_compat r * nthHomSeq f_compat s 
goal: PadicInt.nthHomSeq f_compat (r * s) ≈ PadicInt.nthHomSeq f_compat r * PadicInt.nthHomSeq f_compat s

full_name: PadicInt.limNthHom
code: /--
`limNthHom f_compat r` is the limit of a sequence `f` of compatible ring homs `R →+* ZMod (p^k)`.
This is itself a ring hom: see `PadicInt.lift`.
-/
def limNthHom (r : R) : ℤ_[p] 
goal: ℤ_[p]

full_name: PadicInt.limNthHom_spec
code: theorem limNthHom_spec (r : R) :
    ∀ ε : ℝ, 0 < ε → ∃ N : ℕ, ∀ n ≥ N, ‖limNthHom f_compat r - nthHom f r n‖ < ε 
goal: 0 < ε → ∃ N, ∀ n ≥ N, ‖PadicInt.limNthHom f_compat r - ↑(PadicInt.nthHom f r n)‖ < ε

full_name: PadicInt.limNthHom_zero
code: theorem limNthHom_zero : limNthHom f_compat 0 = 0 
goal: PadicInt.limNthHom f_compat 0 = 0

full_name: PadicInt.limNthHom_one
code: theorem limNthHom_one : limNthHom f_compat 1 = 1 
goal: PadicInt.limNthHom f_compat 1 = 1

full_name: PadicInt.limNthHom_add
code: theorem limNthHom_add (r s : R) :
    limNthHom f_compat (r + s) = limNthHom f_compat r + limNthHom f_compat s 
goal: PadicInt.limNthHom f_compat (r + s) = PadicInt.limNthHom f_compat r + PadicInt.limNthHom f_compat s

full_name: PadicInt.limNthHom_mul
code: theorem limNthHom_mul (r s : R) :
    limNthHom f_compat (r * s) = limNthHom f_compat r * limNthHom f_compat s 
goal: PadicInt.limNthHom f_compat (r * s) = PadicInt.limNthHom f_compat r * PadicInt.limNthHom f_compat s

full_name: PadicInt.lift
code: /-- `lift f_compat` is the limit of a sequence `f` of compatible ring homs `R →+* ZMod (p^k)`,
with the equality `lift f_compat r = PadicInt.limNthHom f_compat r`.
-/
def lift : R →+* ℤ_[p] 
goal: R →+* ℤ_[p]

full_name: PadicInt.lift_sub_val_mem_span
code: theorem lift_sub_val_mem_span (r : R) (n : ℕ) :
    lift f_compat r - (f n r).val ∈ (Ideal.span {(p : ℤ_[p]) ^ n}) 
goal: (PadicInt.lift f_compat) r - ↑((f n) r).val ∈ Ideal.span {↑p ^ n}

full_name: PadicInt.lift_spec
code: /-- One part of the universal property of `ℤ_[p]` as a projective limit.
See also `PadicInt.lift_unique`.
-/
theorem lift_spec (n : ℕ) : (toZModPow n).comp (lift f_compat) = f n 
goal: (PadicInt.toZModPow n).comp (PadicInt.lift f_compat) = f n

full_name: PadicInt.lift_unique
code: /-- One part of the universal property of `ℤ_[p]` as a projective limit.
See also `PadicInt.lift_spec`.
-/
theorem lift_unique (g : R →+* ℤ_[p]) (hg : ∀ n, (toZModPow n).comp g = f n) :
    lift f_compat = g 
goal: PadicInt.lift f_compat = g

full_name: PadicInt.lift_self
code: @[simp]
theorem lift_self (z : ℤ_[p]) : @lift p _ ℤ_[p] _ toZModPow zmod_cast_comp_toZModPow z = z 
goal: (PadicInt.lift ⋯) z = z

full_name: PadicInt.ext_of_toZModPow
code: theorem ext_of_toZModPow {x y : ℤ_[p]} : (∀ n, toZModPow n x = toZModPow n y) ↔ x = y 
goal: (∀ (n : ℕ), (PadicInt.toZModPow n) x = (PadicInt.toZModPow n) y) ↔ x = y

full_name: PadicInt.toZModPow_eq_iff_ext
code: theorem toZModPow_eq_iff_ext {R : Type*} [NonAssocSemiring R] {g g' : R →+* ℤ_[p]} :
    (∀ n, (toZModPow n).comp g = (toZModPow n).comp g') ↔ g = g' 
goal: (∀ (n : ℕ), (PadicInt.toZModPow n).comp g = (PadicInt.toZModPow n).comp g') ↔ g = g'