Skip to content

Commit

Permalink
feat: port NumberTheory.NumberField.Units (#5359)
Browse files Browse the repository at this point in the history
  • Loading branch information
Parcly-Taxel committed Jun 22, 2023
1 parent 29c4785 commit 81c3108
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions Mathlib.lean
Expand Up @@ -2307,6 +2307,7 @@ import Mathlib.NumberTheory.ModularForms.CongruenceSubgroups
import Mathlib.NumberTheory.Multiplicity
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.NumberTheory.NumberField.Norm
import Mathlib.NumberTheory.NumberField.Units
import Mathlib.NumberTheory.Padics.Hensel
import Mathlib.NumberTheory.Padics.PadicIntegers
import Mathlib.NumberTheory.Padics.PadicNorm
Expand Down
56 changes: 56 additions & 0 deletions Mathlib/NumberTheory/NumberField/Units.lean
@@ -0,0 +1,56 @@
/-
Copyright (c) 2023 Xavier Roblot. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Xavier Roblot
! This file was ported from Lean 3 source module number_theory.number_field.units
! leanprover-community/mathlib commit 00f91228655eecdcd3ac97a7fd8dbcb139fe990a
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.NumberTheory.NumberField.Norm

/-!
# Units of a number field
We prove results about the group `(π“ž K)Λ£` of units of the ring of integers `π“ž K` of a number
field `K`.
## Main results
* `isUnit_iff_norm`: an algebraic integer `x : π“ž K` is a unit if and only if `|norm β„š x| = 1`
## Tags
number field, units
-/


open scoped NumberField

noncomputable section

open NumberField Units

section Rat

theorem Rat.RingOfIntegers.isUnit_iff {x : π“ž β„š} : IsUnit x ↔ (x : β„š) = 1 ∨ (x : β„š) = -1 := by
simp_rw [(isUnit_map_iff (Rat.ringOfIntegersEquiv : π“ž β„š β†’+* β„€) x).symm, Int.isUnit_iff,
RingEquiv.coe_toRingHom, RingEquiv.map_eq_one_iff, RingEquiv.map_eq_neg_one_iff, ←
Subtype.coe_injective.eq_iff]; rfl
#align rat.ring_of_integers.is_unit_iff Rat.RingOfIntegers.isUnit_iff

end Rat

variable (K : Type _) [Field K]

section IsUnit

attribute [local instance] NumberField.ringOfIntegersAlgebra

variable {K}

theorem isUnit_iff_norm [NumberField K] (x : π“ž K) :
IsUnit x ↔ |(RingOfIntegers.norm β„š x : β„š)| = 1 := by
convert (RingOfIntegers.isUnit_norm β„š (F := K)).symm
rw [← abs_one, abs_eq_abs, ← Rat.RingOfIntegers.isUnit_iff]
#align is_unit_iff_norm isUnit_iff_norm

end IsUnit

0 comments on commit 81c3108

Please sign in to comment.