Datasets:

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
proof-pile / formal /lean /liquid /rescale /normed_group.lean
Zhangir Azerbayev
squashed?
4365a98
raw
history blame
7.22 kB
import rescale.basic
import locally_constant.Vhat
import category_theory.preadditive.additive_functor
import facts.nnreal
noncomputable theory
open_locale big_operators classical nnreal
namespace rescale
variables {N : ℝβ‰₯0} {V : Type*}
instance [has_norm V] : has_norm (rescale N V) :=
{ norm := Ξ» v, βˆ₯of.symm vβˆ₯/N }
lemma norm_def [has_norm V] (v : rescale N V) : βˆ₯vβˆ₯ = βˆ₯of.symm vβˆ₯/N := rfl
instance [hN : fact (0 < N)] [seminormed_add_comm_group V] : seminormed_add_comm_group (rescale N V) :=
seminormed_add_comm_group.of_core (rescale N V)
{ norm_zero := show βˆ₯(0 : V)βˆ₯/N = 0, by rw [norm_zero, zero_div],
triangle := Ξ» v w,
begin
simp only [norm_def, ← add_div],
exact div_le_div_of_le hN.out.le (norm_add_le _ _), -- defeq abuse
end,
norm_neg := Ξ» v, by { simp only [norm_def], congr' 1, exact norm_neg _ /- defeq abuse -/ } }
instance [hN : fact (0 < N)] [normed_add_comm_group V] : normed_add_comm_group (rescale N V) :=
normed_add_comm_group.of_core (rescale N V)
{ norm_eq_zero_iff := Ξ» v,
begin
have aux : (N:ℝ) β‰  0 := ne_of_gt hN.out,
simp only [norm_def, div_eq_zero_iff, aux, or_false],
exact norm_eq_zero -- defeq abuse
end,
triangle := Ξ» v w,
begin
simp only [norm_def, ← add_div],
exact div_le_div_of_le hN.out.le (norm_add_le _ _), -- defeq abuse
end,
norm_neg := Ξ» v, by { simp only [norm_def], congr' 1, exact norm_neg _ /- defeq abuse -/ } }
lemma nnnorm_def [hN : fact (0 < N)] [seminormed_add_comm_group V] (v : rescale N V) :
βˆ₯vβˆ₯β‚Š = βˆ₯of.symm vβˆ₯β‚Š / N := rfl
end rescale
namespace SemiNormedGroup
variables (r r₁ rβ‚‚ : ℝβ‰₯0) [fact (0 < r₁)] [fact (0 < rβ‚‚)]
@[simps]
def rescale (r : ℝβ‰₯0) [hr : fact (0 < r)] : SemiNormedGroup β₯€ SemiNormedGroup :=
{ obj := Ξ» V, of $ rescale r V,
map := Ξ» V₁ Vβ‚‚ f,
{ to_fun := Ξ» v, @rescale.of r Vβ‚‚ $ f ((@rescale.of r V₁).symm v),
map_add' := f.map_add', -- defeq abuse
bound' :=
begin
obtain ⟨C, C_pos, hC⟩ := f.bound,
use C,
intro v,
have := hC ((@rescale.of r V₁).symm v),
rw [← div_le_div_right (show 0 < (r:ℝ), from hr.1), mul_div_assoc] at this,
exact this,
end },
map_id' := Ξ» V, rfl, -- defeq abuse
map_comp' := Ξ» V₁ Vβ‚‚ V₃ f g, rfl /- defeq abuse -/ }
instance rescale.additive [fact (0 < r)] : (rescale r).additive :=
{ map_add' := Ξ» V W f g, rfl /- defeq abuse -/ }
lemma norm_rescale_map_le [fact (0 < r)] {V₁ Vβ‚‚ : SemiNormedGroup}
{f : V₁ ⟢ Vβ‚‚} {C : ℝ} (hf : βˆ₯fβˆ₯ ≀ C) :
βˆ₯(rescale r).map fβˆ₯ ≀ C :=
begin
refine normed_add_group_hom.op_norm_le_bound _ (le_trans (norm_nonneg _) hf) (Ξ» v, _),
dsimp,
erw [rescale.norm_def, rescale.norm_def, equiv.symm_apply_apply, ← mul_div_assoc],
refine div_le_div (mul_nonneg (le_trans (norm_nonneg _) hf) (norm_nonneg _))
(normed_add_group_hom.le_of_op_norm_le _ hf _) _ le_rfl,
rw nnreal.coe_pos, exact β€Ήfact (0 < r)β€Ί.out
end
lemma rescale_map_isometry [fact (0 < r)]
{V₁ Vβ‚‚ : SemiNormedGroup} {f : V₁ ⟢ Vβ‚‚} (hf : isometry f) :
isometry ((rescale r).map f) :=
begin
rw add_monoid_hom_class.isometry_iff_norm at hf ⊒,
intro v,
erw [rescale.norm_def, rescale.norm_def, hf ((@rescale.of r _).symm v)],
end
lemma rescale_exact [fact (0 < r)] {V₁ Vβ‚‚ V₃ : SemiNormedGroup} (f : V₁ ⟢ Vβ‚‚) (g : Vβ‚‚ ⟢ V₃)
(hfg : f.range = g.ker) :
((rescale r).map f).range = ((rescale r).map g).ker :=
begin
ext x,
calc x ∈ ((rescale r).map f).range ↔ x ∈ f.range : iff.rfl
... ↔ x ∈ g.ker : by rw hfg
... ↔ x ∈ ((rescale r).map g).ker : iff.rfl,
end
lemma rescale_exists_norm_le [fact (0 < r)] {V₁ Vβ‚‚ : SemiNormedGroup} (f : V₁ ⟢ Vβ‚‚) (C : ℝβ‰₯0)
(hf : βˆ€ y, βˆƒ x, f x = y ∧ βˆ₯xβˆ₯ ≀ C * βˆ₯yβˆ₯) :
βˆ€ y, βˆƒ x, (rescale r).map f x = y ∧ βˆ₯xβˆ₯ ≀ C * βˆ₯yβˆ₯ :=
begin
intro y,
obtain ⟨x, h1, h2⟩ := hf ((@rescale.of r _).symm y),
refine ⟨@rescale.of r _ x, h1, _⟩,
erw [rescale.norm_def, rescale.norm_def],
simp only [div_eq_mul_inv, ← mul_assoc, equiv.symm_apply_apply, ← coe_nnnorm],
norm_cast, exact mul_le_mul' h2 le_rfl,
end
lemma nnnorm_to_rescale {V : SemiNormedGroup} (v : V) : βˆ₯(@rescale.of r V) vβˆ₯ ≀ r⁻¹ * βˆ₯vβˆ₯ :=
by { rw ← div_eq_inv_mul, refl }
def to_rescale [fact (0 < r)] : 𝟭 _ ⟢ rescale r :=
{ app := Ξ» V,
add_monoid_hom.mk_normed_add_group_hom'
(add_monoid_hom.mk' (@rescale.of r V) $ λ _ _, rfl) r⁻¹ (λ v, nnnorm_to_rescale _ v),
naturality' := Ξ» V W f, rfl /- defeq abuse -/ }
def of_rescale [hr : fact (0 < r)] : rescale r ⟢ 𝟭 _ :=
{ app := Ξ» V,
add_monoid_hom.mk_normed_add_group_hom' (add_monoid_hom.mk' (@rescale.of r V) .symm $ Ξ» _ _, rfl) r
begin
intro v,
erw [rescale.nnnorm_def, mul_div_cancel' _ hr.1.ne'],
exact le_rfl
end,
naturality' := Ξ» V W f, rfl /- defeq abuse -/ }
@[simps]
def iso_rescale [fact (0 < r)] : 𝟭 _ β‰… (rescale r) :=
{ hom := to_rescale r,
inv := of_rescale r, }
open _root_.category_theory
lemma iso_rescale_isometry [fact (0 < r)] (h : r = 1) (V : SemiNormedGroup) :
isometry ((iso_rescale r).app V).hom :=
begin
unfreezingI { cases h },
dsimp only [nat_iso.app_hom, iso_rescale_hom],
apply add_monoid_hom_class.isometry_of_norm,
intro v,
erw [rescale.norm_def],
simp only [div_one, subtype.coe_mk],
refl
end
lemma norm_to_rescale_le [fact (0 < r)] (V : SemiNormedGroup) : βˆ₯(to_rescale r).app Vβˆ₯ ≀ r⁻¹ :=
normed_add_group_hom.mk_normed_add_group_hom_norm_le _
(inv_nonneg.2 (nnreal.zero_le_coe)) (Ξ» v, nnnorm_to_rescale _ v)
lemma nnnorm_rescale_rescale_symm {V : SemiNormedGroup} (v : (rescale r₁).obj V) :
βˆ₯(@rescale.of rβ‚‚ V) ((@rescale.of r₁ V).symm v)βˆ₯β‚Š ≀ r₁ / rβ‚‚ * βˆ₯vβˆ₯β‚Š :=
begin
apply le_of_eq,
show _ = r₁ / rβ‚‚ * (βˆ₯(@rescale.of r₁ V).symm vβˆ₯β‚Š / r₁),
simp only [add_monoid_hom.mk'_apply, div_eq_inv_mul, rescale.nnnorm_def],
rw [mul_assoc, mul_inv_cancel_leftβ‚€ (show r₁ β‰  0, from ne_of_gt $ fact.out _)],
refl
end
def scale : rescale r₁ ⟢ rescale rβ‚‚ :=
{ app := Ξ» V,
add_monoid_hom.mk_normed_add_group_hom'
(add_monoid_hom.mk' (Ξ» v, (@rescale.of rβ‚‚ V) $ (@rescale.of r₁ V).symm v) $
Ξ» _ _, rfl) (r₁ / rβ‚‚) (Ξ» v, nnnorm_rescale_rescale_symm r₁ rβ‚‚ v),
naturality' := Ξ» V W f, rfl /- defeq abuse -/ }
lemma norm_scale_le (V : SemiNormedGroup) : βˆ₯(scale r₁ rβ‚‚).app Vβˆ₯ ≀ (r₁ / rβ‚‚) :=
normed_add_group_hom.mk_normed_add_group_hom_norm_le _ (div_nonneg (nnreal.coe_nonneg _)
(nnreal.coe_nonneg _)) (Ξ» v, nnnorm_rescale_rescale_symm r₁ rβ‚‚ v)
lemma scale_comm {V₁ Vβ‚‚ W₁ Wβ‚‚ : SemiNormedGroup}
(f₁ : V₁ ⟢ W₁) (fβ‚‚ : Vβ‚‚ ⟢ Wβ‚‚) (Ο† : V₁ ⟢ Vβ‚‚) (ψ : W₁ ⟢ Wβ‚‚) (h : f₁ ≫ ψ = Ο† ≫ fβ‚‚) :
(rescale r₁).map f₁ ≫ ((rescale r₁).map ψ ≫ (scale r₁ rβ‚‚).app Wβ‚‚) =
((rescale r₁).map Ο† ≫ (scale r₁ rβ‚‚).app Vβ‚‚) ≫ (rescale rβ‚‚).map fβ‚‚ :=
by rw [← category.assoc, ← category_theory.functor.map_comp, nat_trans.naturality,
nat_trans.naturality, category.assoc, ← category_theory.functor.map_comp, h]
end SemiNormedGroup