leanprover-community / mathlib3

Lean 3's obsolete mathematical components library: please use mathlib4
https://leanprover-community.github.io/lean3
Apache License 2.0
1.67k stars 298 forks source link

The ring of integers of a number field `K` is free of dimension `[K : β„š]` / develop the theory of lattices #18150

Closed riccardobrasca closed 1 year ago

riccardobrasca commented 1 year ago

We are absolutely ready to prove this. For example the fact that π“ž K is free over β„€ is very easy

instance {K : Type*} [field K] [number_field K] : module.free β„€ (π“ž K) :=
begin
  have basis : Ξ£ n, basis (fin n) β„€ (π“ž K) := module.free_of_finite_type_torsion_free',
  obtain ⟨n, b⟩ := basis,
  exact module.free.of_basis b
end

But the correct thing to do is to develop the theory of lattices, proving that a β„€-basis gives also a β„š-basis. Note that we have basis.localization, but this is the wrong statement, since it take a β„€-basis of M and produces a β„š-basis of M (in practice it only applies in trivial cases).

A sketch would be something like (of course one should not use tactic mode for the whole definition)

def foo {I K : Type*} [field K] [number_field K] (b : basis I β„€ (π“ž K)) : basis I β„š K :=
begin
  let b' : I β†’ K := Ξ» i, b i,
  have hb'li : linear_independent β„š b',
  { rw [← linear_independent.iff_fraction_ring β„€ β„š, linear_independent_iff'],
    intros s f H i hi,
    refine linear_independent_iff'.1 b.linear_independent s f ((π“ž K).coe_eq_zero.1 _) i hi,
    convert H,
    simp only [zsmul_eq_mul, add_submonoid_class.coe_finset_sum, mul_mem_class.coe_mul,
      subring_class.coe_int_cast],
    apply_instance },
  refine basis.mk hb'li (Ξ» x hx, _),
  obtain ⟨n, hn⟩ := (is_separable.is_integral β„š x).exists_multiple_integral_of_is_localization
      (non_zero_divisors β„€) x,
      sorry
end

See this comment for a nice application.

Vierkantor commented 1 year ago

I have the following result on my ideal-span-norm branch:

noncomputable def basis.localization_localization {R S : Type*} [comm_ring R] [comm_ring S]
  [algebra R S] {ΞΉ : Type*} [fintype ΞΉ] (b : basis ΞΉ R S)
  (M : submonoid R) (Rβ‚˜ Sβ‚˜ : Type*)
  [comm_ring Rβ‚˜] [algebra R Rβ‚˜] [comm_ring Sβ‚˜] [algebra S Sβ‚˜]
  [algebra Rβ‚˜ Sβ‚˜] [algebra R Sβ‚˜] [is_scalar_tower R Rβ‚˜ Sβ‚˜] [is_scalar_tower R S Sβ‚˜]
  [is_localization M Rβ‚˜] [is_localization (M.map (algebra_map R S)) Sβ‚˜]
  (hM : submonoid.map (algebra_map R S) M ≀ S ⁰) :
  basis ΞΉ Rβ‚˜ Sβ‚˜ :=

That is what we're looking for, right?

riccardobrasca commented 1 year ago

I have the following result on my ideal-span-norm branch:

noncomputable def basis.localization_localization {R S : Type*} [comm_ring R] [comm_ring S]
  [algebra R S] {ΞΉ : Type*} [fintype ΞΉ] (b : basis ΞΉ R S)
  (M : submonoid R) (Rβ‚˜ Sβ‚˜ : Type*)
  [comm_ring Rβ‚˜] [algebra R Rβ‚˜] [comm_ring Sβ‚˜] [algebra S Sβ‚˜]
  [algebra Rβ‚˜ Sβ‚˜] [algebra R Sβ‚˜] [is_scalar_tower R Rβ‚˜ Sβ‚˜] [is_scalar_tower R S Sβ‚˜]
  [is_localization M Rβ‚˜] [is_localization (M.map (algebra_map R S)) Sβ‚˜]
  (hM : submonoid.map (algebra_map R S) M ≀ S ⁰) :
  basis ΞΉ Rβ‚˜ Sβ‚˜ :=

That is what we're looking for, right?

Yes! This should replace basis.localization, whose assumptions essentially never apply (we take a β„€-basis of a β„š-vector space).

Vierkantor commented 1 year ago

I PR'd the result above in #18261.