Library NumAnalysis.Algebra.Ring.Ring_morphism

This file is part of the Rocq Numerical Analysis library
Copyright (C) Boldo, Clément, Martin, Mayero, Mouhcine
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the COPYING file for more details.

Brief description

Support for morphisms on rings.

Description

Results needing a commutative Ring are only stated for the ring of real numbers R_Ring.
Let K1 K2 : Ring. Let f : K1 → K2.
  • f_mult_compat f states that f transports the multiplicative law mult;
  • f_one_compat f states that f transports the multiplicative identity element one;
  • morphism_r f states that f transports the ring structure.
Lemmas about predicate morphism_r have "mr" in their names, usually as prefix "mr_", sometimes as suffix "_mr".

Usage

This module may be used through the import of NumAnalysis.Algebra.Ring.Ring, NumAnalysis.Algebra.Algebra, NumAnalysis.Algebra.Algebra_wDep, NumAnalysis.LM.LM_wDep, or NumAnalysis.FEM.FEM_wDep, where it is exported.

From NumAnalysis Require Import ssr_wMC.

From Coquelicot Require Import Hierarchy.
Close Scope R_scope.

From NumAnalysis Require Import Subsets_wDep.
From NumAnalysis Require Import Hierarchy_compl Monoid Group Ring_FF_FT.

Local Open Scope Monoid_scope.
Local Open Scope Group_scope.
Local Open Scope Ring_scope.

Section Ring_Morphism_Def.

Context {K1 K2 : Ring}.

Definition f_mult_compat (f : K1 → K2) : Prop :=
  ∀ x1 y1, f (x1 × y1) = f x1 × f y1.

Definition f_one_compat (f : K1 → K2) : Prop := f 1 = 1.

Definition morphism_r f : Prop :=
  f_plus_compat f ∧ f_mult_compat f ∧ f_one_compat f.

End Ring_Morphism_Def.

Section Ring_Morphism_Facts1a.

Context {K1 K2 : Ring}.

Lemma mr_mg : ∀ {f : K1 → K2}, morphism_r f → morphism_g f.
Proof. move=>> H; apply H. Qed.

Lemma mr_mg_rev :
  ∀ {f : K1 → K2},
    f_mult_compat f → f_one_compat f → morphism_g f → morphism_r f.
Proof. easy. Qed.

Lemma mr_mult : ∀ {f : K1 → K2}, morphism_r f → f_mult_compat f.
Proof. move=>> H; apply H. Qed.

Lemma mr_one : ∀ {f : K1 → K2}, morphism_r f → f_one_compat f.
Proof. move=>> H; apply H. Qed.

Lemma mr_plus : ∀ {f : K1 → K2}, morphism_r f → f_plus_compat f.
Proof. move=>> /mr_mg; apply: mg_plus. Qed.

Lemma mr_zero : ∀ {f : K1 → K2}, morphism_r f → f_zero_compat f.
Proof. move=>> /mr_mg; apply: mg_zero. Qed.

Lemma mr_sum : ∀ {f : K1 → K2}, morphism_r f → f_sum_compat f.
Proof. move=>> /mr_mg; apply: mg_sum. Qed.

Lemma mr_opp : ∀ {f : K1 → K2}, morphism_r f → f_opp_compat f.
Proof. move=>> /mr_mg; apply mg_opp. Qed.

Lemma mr_minus : ∀ {f : K1 → K2}, morphism_r f → f_minus_compat f.
Proof. move=>> /mr_mg; apply mg_minus. Qed.


Lemma mr_ext :
  ∀ f g : K1 → K2, same_fun f g → morphism_r f → morphism_r g.
Proof. move=>> /fun_ext H; subst; easy. Qed.

End Ring_Morphism_Facts1a.

Section Ring_Morphism_Facts1b.

Context {T : Type}.
Context {K K1 K2 K3 : Ring}.

Lemma pt_eval_mr : ∀ (t : T), morphism_r (fun (f : T → K) ⇒ f t).
Proof. easy. Qed.

Lemma component_mr : ∀ {n} i, morphism_r (fun B1 : 'K1^n ⇒ B1 i).
Proof. easy. Qed.

Lemma constF_mr : ∀ n, morphism_r (@constF K n).
Proof. easy. Qed.

Lemma skipF_mr : ∀ {n} i0, morphism_r (skipF i0 : 'K^n.+1 → 'K^n).
Proof. easy. Qed.

Lemma mapF_f_mult_compat :
  ∀ {n} {f : K1 → K2},
    f_mult_compat f → f_mult_compat (mapF f : 'K1^n → 'K2^n).
Proof. move=>> Hf x1 y1; extF; rewrite mapF_correct Hf; easy. Qed.

Lemma mapF_f_one_compat :
  ∀ {n} {f : K1 → K2},
    f_one_compat f → f_one_compat (mapF f : 'K1^n → 'K2^n).
Proof. move=>> Hf; extF; rewrite mapF_correct Hf; easy. Qed.

Lemma mapF_mr :
  ∀ {n} {f : K1 → K2},
    morphism_r f → morphism_r (mapF f : 'K1^n → 'K2^n).
Proof.
move=>> [Hf1 [Hf2 Hf3]]; repeat split; [apply mapF_mg |
    apply mapF_f_mult_compat | apply mapF_f_one_compat]; easy.
Qed.

Lemma map2F_mr :
  ∀ {n} {f : K1 → K2 → K3} (u1 : 'K1^n),
    (∀ i1, morphism_r (f (u1 i1))) → morphism_r (map2F f u1).
Proof.
move=>> Hf; repeat split.
apply map2F_mg; intros; apply mr_mg; easy.
intros x1 y1; extF i1; destruct (Hf i1) as [_ [Hf2 _]].
rewrite map2F_correct Hf2; easy.
extF i1; destruct (Hf i1) as [_ [_ Hf3]].
rewrite map2F_correct Hf3; easy.
Qed.

End Ring_Morphism_Facts1b.

Section Ring_Morphism_Facts2.

Context {T : Type}.
Context {K1 K2 K3 : Ring}.

Lemma mr_bij_compat :
  ∀ {f : K1 → K2} (Hf : bijective f),
    morphism_r f → morphism_r (f_inv Hf).
Proof.
intros f Hf1 [Hf2 [Hf3 Hf4]]; repeat split; move=>>;
    apply (bij_inj Hf1); [rewrite Hf2 | rewrite Hf3 | rewrite Hf4];
    rewrite !f_inv_can_r; easy.
Qed.

Lemma comp_f_mult_compat :
  ∀ {f : K1 → K2} {g : K2 → K3},
    f_mult_compat f → f_mult_compat g → f_mult_compat (g \o f).
Proof. intros f g Hf Hg x1 y1; rewrite !comp_correct Hf; easy. Qed.

Lemma comp_f_one_compat :
  ∀ {f : K1 → K2} {g : K2 → K3},
    f_one_compat f → f_one_compat g → f_one_compat (g \o f).
Proof.
intros f g; unfold f_one_compat; rewrite comp_correct; move⇒ ->; easy.
Qed.

Lemma comp_mr :
  ∀ {f : K1 → K2} {g : K2 → K3},
    morphism_r f → morphism_r g → morphism_r (g \o f).
Proof.
intros f g [Hfa [Hfb Hfc]] [Hga [Hgb Hgc]]; repeat split;
    [apply comp_f_plus_compat | apply comp_f_mult_compat |
     apply comp_f_one_compat]; easy.
Qed.

Variable f : T → K2.

Lemma pullback_f_mult_compat : f_mult_compat (@pullback T K2 K3 f).
Proof. easy. Qed.

Lemma pullback_f_one_compat : f_one_compat (@pullback T K2 K3 f).
Proof. easy. Qed.

Lemma pullback_mr : morphism_r (@pullback T K2 K3 f).
Proof. easy. Qed.

Variable g : K1 → K2.

Lemma comp_r_f_mult_compat :
  f_mult_compat g → f_mult_compat (@comp_r K1 K2 T g).
Proof.
intros Hg; move=>>; fun_ext; unfold comp_r;
    rewrite comp_correct fct_mult_eq Hg; easy.
Qed.

Lemma comp_r_f_one_compat : f_one_compat g → f_one_compat (@comp_r K1 K2 T g).
Proof. intros; fun_ext; easy. Qed.

Lemma comp_r_mr : morphism_r g → morphism_r (@comp_r K1 K2 T g).
Proof.
intros [Hga [Hgb Hgc]]; repeat split; [apply comp_r_mg |
    apply comp_r_f_mult_compat | apply comp_r_f_one_compat]; easy.
Qed.

End Ring_Morphism_Facts2.

Section Ring_Morphism_Functional_Facts.

Context {G1 G2 G3 G4 : Ring}.

Variable phi : G1 → G2.
Variable sigma : (G1 → G3) → G4.

Lemma pushforward_mult :
  f_mult_compat sigma → f_mult_compat (pushforward phi sigma).
Proof. intros H f g; apply H. Qed.

Lemma pushforward_one :
  f_one_compat sigma → f_one_compat (pushforward phi sigma).
Proof. easy. Qed.

Lemma pushforward_mr : morphism_r sigma → morphism_r (pushforward phi sigma).
Proof.
intros [Hga [Hgb Hgc]]; repeat split; [apply: pushforward_mg |
    apply pushforward_mult | apply pushforward_one]; easy.
Qed.

End Ring_Morphism_Functional_Facts.