| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Properties of linear maps. |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
import Algebra.Module.Properties as ModuleProperties |
| 10 |
import Algebra.Module.Morphism.Structures as MorphismStructures |
| 11 |
|
| 12 |
open import Algebra using (CommutativeRing) |
| 13 |
open import Algebra.Module using (Module) |
| 14 |
open import Level using (Level) |
| 15 |
|
| 16 |
module Algebra.Module.Morphism.ModuleHomomorphism |
| 17 |
{r ℓr m ℓm : Level} |
| 18 |
{ring : CommutativeRing r ℓr} |
| 19 |
(modA modB : Module ring m ℓm) |
| 20 |
(open Module modA using () renaming (Carrierᴹ to A; rawModule to rawModA)) |
| 21 |
(open Module modB using () renaming (Carrierᴹ to B; rawModule to rawModB)) |
| 22 |
{f : A → B} |
| 23 |
(open MorphismStructures.ModuleMorphisms rawModA rawModB) |
| 24 |
(isModuleHomomorphism : IsModuleHomomorphism f) |
| 25 |
where |
| 26 |
|
| 27 |
open import Axiom.DoubleNegationElimination using (DoubleNegationElimination) |
| 28 |
open import Data.Product.Base using (∃₂; _×_; _,_) |
| 29 |
open import Relation.Binary.Reasoning.MultiSetoid |
| 30 |
open import Relation.Nullary using (¬_) |
| 31 |
open import Relation.Nullary.Negation using (contraposition) |
| 32 |
|
| 33 |
module A = Module modA |
| 34 |
module B = Module modB |
| 35 |
module PA = ModuleProperties modA |
| 36 |
module PB = ModuleProperties modB |
| 37 |
open CommutativeRing ring renaming (Carrier to S) |
| 38 |
|
| 39 |
open IsModuleHomomorphism isModuleHomomorphism |
| 40 |
|
| 41 |
-- Some of the lemmas below only hold for continously scalable, |
| 42 |
-- non-trivial functions, i.e., f x = f (s y) and f ≠ const 0. |
| 43 |
-- This is a handy abbreviation for that rather verbose term. |
| 44 |
NonTrivial : A → Set (r Level.⊔ m Level.⊔ ℓm) |
| 45 |
NonTrivial x = ∃₂ λ s y → (s A.*ₗ x A.≈ᴹ y) × (f y B.≉ᴹ B.0ᴹ) |
| 46 |
|
| 47 |
x≈0⇒fx≈0 : ∀ {x} → x A.≈ᴹ A.0ᴹ → f x B.≈ᴹ B.0ᴹ |
| 48 |
x≈0⇒fx≈0 {x} x≈0 = begin⟨ B.≈ᴹ-setoid ⟩ |
| 49 |
f x ≈⟨ ⟦⟧-cong x≈0 ⟩ |
| 50 |
f A.0ᴹ ≈⟨ 0ᴹ-homo ⟩ |
| 51 |
B.0ᴹ ∎ |
| 52 |
|
| 53 |
fx≉0⇒x≉0 : ∀ {x} → f x B.≉ᴹ B.0ᴹ → x A.≉ᴹ A.0ᴹ |
| 54 |
fx≉0⇒x≉0 = contraposition x≈0⇒fx≈0 |
| 55 |
|
| 56 |
-- Zero is a unique output of non-trivial (i.e. - ≉ `const 0`) linear map. |
| 57 |
x≉0⇒f[x]≉0 : ∀ {x} → NonTrivial x → x A.≉ᴹ A.0ᴹ → f x B.≉ᴹ B.0ᴹ |
| 58 |
x≉0⇒f[x]≉0 {x} (s , y , s·x≈y , fy≉0) x≉0 = |
| 59 |
PB.x*y≉0⇒y≉0 ( λ s·fx≈0 → fy≉0 ( begin⟨ B.≈ᴹ-setoid ⟩ |
| 60 |
f y ≈⟨ ⟦⟧-cong (A.≈ᴹ-sym s·x≈y) ⟩ |
| 61 |
f (s A.*ₗ x) ≈⟨ *ₗ-homo s x ⟩ |
| 62 |
s B.*ₗ f x ≈⟨ s·fx≈0 ⟩ |
| 63 |
B.0ᴹ ∎ ) |
| 64 |
) |
| 65 |
|
| 66 |
-- f is odd (i.e. - f (-x) ≈ - (f x)). |
| 67 |
fx+f[-x]≈0 : (x : A) → f x B.+ᴹ f (A.-ᴹ x) B.≈ᴹ B.0ᴹ |
| 68 |
fx+f[-x]≈0 x = begin⟨ B.≈ᴹ-setoid ⟩ |
| 69 |
f x B.+ᴹ f (A.-ᴹ x) ≈⟨ B.≈ᴹ-sym (+ᴹ-homo x (A.-ᴹ x)) ⟩ |
| 70 |
f (x A.+ᴹ (A.-ᴹ x)) ≈⟨ ⟦⟧-cong (A.-ᴹ‿inverseʳ x) ⟩ |
| 71 |
f A.0ᴹ ≈⟨ 0ᴹ-homo ⟩ |
| 72 |
B.0ᴹ ∎ |
| 73 |
|
| 74 |
f[-x]≈-fx : (x : A) → f (A.-ᴹ x) B.≈ᴹ B.-ᴹ f x |
| 75 |
f[-x]≈-fx x = B.uniqueʳ‿-ᴹ (f x) (f (A.-ᴹ x)) (fx+f[-x]≈0 x) |
| 76 |
|
| 77 |
-- A non-trivial linear function is injective. |
| 78 |
fx≈fy⇒fx-fy≈0 : ∀ {x y} → f x B.≈ᴹ f y → f x B.+ᴹ (B.-ᴹ f y) B.≈ᴹ B.0ᴹ |
| 79 |
fx≈fy⇒fx-fy≈0 {x} {y} fx≈fy = begin⟨ B.≈ᴹ-setoid ⟩ |
| 80 |
f x B.+ᴹ (B.-ᴹ f y) ≈⟨ B.+ᴹ-congˡ (B.-ᴹ‿cong (B.≈ᴹ-sym fx≈fy)) ⟩ |
| 81 |
f x B.+ᴹ (B.-ᴹ f x) ≈⟨ B.-ᴹ‿inverseʳ (f x) ⟩ |
| 82 |
B.0ᴹ ∎ |
| 83 |
|
| 84 |
fx≈fy⇒f[x-y]≈0 : ∀ {x y} → f x B.≈ᴹ f y → f (x A.+ᴹ (A.-ᴹ y)) B.≈ᴹ B.0ᴹ |
| 85 |
fx≈fy⇒f[x-y]≈0 {x} {y} fx≈fy = begin⟨ B.≈ᴹ-setoid ⟩ |
| 86 |
f (x A.+ᴹ (A.-ᴹ y)) ≈⟨ +ᴹ-homo x (A.-ᴹ y) ⟩ |
| 87 |
f x B.+ᴹ f (A.-ᴹ y) ≈⟨ B.+ᴹ-congˡ (f[-x]≈-fx y) ⟩ |
| 88 |
f x B.+ᴹ (B.-ᴹ f y) ≈⟨ fx≈fy⇒fx-fy≈0 fx≈fy ⟩ |
| 89 |
B.0ᴹ ∎ |
| 90 |
|
| 91 |
module _ {dne : DoubleNegationElimination _} where |
| 92 |
|
| 93 |
fx≈0⇒x≈0 : ∀ {x} → NonTrivial x → f x B.≈ᴹ B.0ᴹ → x A.≈ᴹ A.0ᴹ |
| 94 |
fx≈0⇒x≈0 {x} (s , y , s·x≈y , fy≉0) fx≈0 = |
| 95 |
dne ¬x≉0 |
| 96 |
where |
| 97 |
¬x≉0 : ¬ (x A.≉ᴹ A.0ᴹ) |
| 98 |
¬x≉0 = λ x≉0 → x≉0⇒f[x]≉0 (s , y , s·x≈y , fy≉0) x≉0 fx≈0 |
| 99 |
|
| 100 |
inj-lm : ∀ {x y} → |
| 101 |
(∃₂ λ s z → ((s A.*ₗ (x A.+ᴹ A.-ᴹ y) A.≈ᴹ z) × (f z B.≉ᴹ B.0ᴹ))) → |
| 102 |
f x B.≈ᴹ f y → x A.≈ᴹ y |
| 103 |
inj-lm {x} {y} (s , z , s·[x-y]≈z , fz≉0) fx≈fy = |
| 104 |
begin⟨ A.≈ᴹ-setoid ⟩ |
| 105 |
x ≈⟨ x≈--y ⟩ |
| 106 |
A.-ᴹ (A.-ᴹ y) ≈⟨ PA.-ᴹ-involutive y ⟩ |
| 107 |
y ∎ |
| 108 |
where |
| 109 |
x-y≈0 : x A.+ᴹ (A.-ᴹ y) A.≈ᴹ A.0ᴹ |
| 110 |
x-y≈0 = fx≈0⇒x≈0 (s , z , s·[x-y]≈z , fz≉0) (fx≈fy⇒f[x-y]≈0 fx≈fy) |
| 111 |
x≈--y : x A.≈ᴹ A.-ᴹ (A.-ᴹ y) |
| 112 |
x≈--y = A.uniqueʳ‿-ᴹ (A.-ᴹ y) x |
| 113 |
( begin⟨ A.≈ᴹ-setoid ⟩ |
| 114 |
A.-ᴹ y A.+ᴹ x ≈⟨ A.+ᴹ-comm (A.-ᴹ y) x ⟩ |
| 115 |
x A.+ᴹ A.-ᴹ y ≈⟨ x-y≈0 ⟩ |
| 116 |
A.0ᴹ ∎ |
| 117 |
) |