Debian Codegraph @

src/Algebra/Module/Consequences.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Relations between properties of scaling and other operations
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --safe #-}
8
9 module Algebra.Module.Consequences where
10
11 open import Algebra.Core using (Op₂)
12 import Algebra.Definitions as Defs
13 open import Algebra.Module.Core using (Opₗ; Opᵣ)
14 open import Algebra.Module.Definitions
15 open import Function.Base using (flip)
16 open import Level using (Level)
17 open import Relation.Binary.Core using (Rel)
18 open import Relation.Binary.Bundles using (Setoid)
19 import Relation.Binary.Reasoning.Setoid as ≈-Reasoning
20
21 private
22 variable
23 a b c ℓ ℓa : Level
24 A : Set a
25 B : Set b
26
27 module _ (_≈ᴬ_ : Rel {a} A ℓa) (S : Setoid c ℓ) where
28
29 open Setoid S
30 open ≈-Reasoning S
31 open Defs _≈ᴬ_
32
33 private
34 module L = LeftDefs A _≈_
35 module R = RightDefs A _≈_
36 module B = BiDefs A A _≈_
37
38 module _ {_*_ : Op₂ A} {_*ₗ_ : Opₗ A Carrier} where
39
40 private
41 _*ᵣ_ = flip _*ₗ_
42
43 *ₗ-assoc∧comm⇒*ᵣ-assoc :
44 L.RightCongruent _≈ᴬ_ _*ₗ_ →
45 L.Associative _*_ _*ₗ_ → Commutative _*_ → R.Associative _*_ _*ᵣ_
46 *ₗ-assoc∧comm⇒*ᵣ-assoc *ₗ-congʳ *ₗ-assoc *-comm m x y = begin
47 (m *ᵣ x) *ᵣ y ≈⟨ refl ⟩
48 y *ₗ (x *ₗ m) ≈⟨ *ₗ-assoc _ _ _ ⟨
49 (y * x) *ₗ m ≈⟨ *ₗ-congʳ (*-comm y x) ⟩
50 (x * y) *ₗ m ≈⟨ refl ⟩
51 m *ᵣ (x * y) ∎
52
53 *ₗ-assoc∧comm⇒*ₗ-*ᵣ-assoc :
54 L.RightCongruent _≈ᴬ_ _*ₗ_ →
55 L.Associative _*_ _*ₗ_ → Commutative _*_ → B.Associative _*ₗ_ _*ᵣ_
56 *ₗ-assoc∧comm⇒*ₗ-*ᵣ-assoc *ₗ-congʳ *ₗ-assoc *-comm x m y = begin
57 ((x *ₗ m) *ᵣ y) ≈⟨ refl ⟩
58 (y *ₗ (x *ₗ m)) ≈⟨ *ₗ-assoc _ _ _ ⟨
59 ((y * x) *ₗ m) ≈⟨ *ₗ-congʳ (*-comm y x) ⟩
60 ((x * y) *ₗ m) ≈⟨ *ₗ-assoc _ _ _ ⟩
61 (x *ₗ (y *ₗ m)) ≈⟨ refl ⟩
62 (x *ₗ (m *ᵣ y)) ∎
63
64 module _ {_*_ : Op₂ A} {_*ᵣ_ : Opᵣ A Carrier} where
65
66 private
67 _*ₗ_ = flip _*ᵣ_
68
69 *ᵣ-assoc∧comm⇒*ₗ-assoc :
70 R.LeftCongruent _≈ᴬ_ _*ᵣ_ →
71 R.Associative _*_ _*ᵣ_ → Commutative _*_ → L.Associative _*_ _*ₗ_
72 *ᵣ-assoc∧comm⇒*ₗ-assoc *ᵣ-congˡ *ᵣ-assoc *-comm x y m = begin
73 ((x * y) *ₗ m) ≈⟨ refl ⟩
74 (m *ᵣ (x * y)) ≈⟨ *ᵣ-congˡ (*-comm x y) ⟩
75 (m *ᵣ (y * x)) ≈⟨ *ᵣ-assoc _ _ _ ⟨
76 ((m *ᵣ y) *ᵣ x) ≈⟨ refl ⟩
77 (x *ₗ (y *ₗ m)) ∎
78
79 *ᵣ-assoc∧comm⇒*ₗ-*ᵣ-assoc :
80 R.LeftCongruent _≈ᴬ_ _*ᵣ_ →
81 R.Associative _*_ _*ᵣ_ → Commutative _*_ → B.Associative _*ₗ_ _*ᵣ_
82 *ᵣ-assoc∧comm⇒*ₗ-*ᵣ-assoc *ᵣ-congˡ *ᵣ-assoc *-comm x m y = begin
83 ((x *ₗ m) *ᵣ y) ≈⟨ refl ⟩
84 ((m *ᵣ x) *ᵣ y) ≈⟨ *ᵣ-assoc _ _ _ ⟩
85 (m *ᵣ (x * y)) ≈⟨ *ᵣ-congˡ (*-comm x y) ⟩
86 (m *ᵣ (y * x)) ≈⟨ *ᵣ-assoc _ _ _ ⟨
87 ((m *ᵣ y) *ᵣ x) ≈⟨ refl ⟩
88 (x *ₗ (m *ᵣ y)) ∎
89
90
91 ------------------------------------------------------------------------
92 -- DEPRECATED NAMES
93 ------------------------------------------------------------------------
94 -- Please use the new names as continuing support for the old names is
95 -- not guaranteed.
96
97 -- Version 2.3
98
99 *ₗ-assoc+comm⇒*ᵣ-assoc = *ₗ-assoc∧comm⇒*ᵣ-assoc
100 {-# WARNING_ON_USAGE *ₗ-assoc+comm⇒*ᵣ-assoc
101 "Warning: *ₗ-assoc+comm⇒*ᵣ-assoc was deprecated in v2.3.
102 Please use *ₗ-assoc∧comm⇒*ᵣ-assoc instead."
103 #-}
104
105 *ₗ-assoc+comm⇒*ₗ-*ᵣ-assoc = *ₗ-assoc∧comm⇒*ₗ-*ᵣ-assoc
106 {-# WARNING_ON_USAGE *ₗ-assoc+comm⇒*ₗ-*ᵣ-assoc
107 "Warning: *ₗ-assoc+comm⇒*ₗ-*ᵣ-assoc was deprecated in v2.3.
108 Please use *ₗ-assoc∧comm⇒*ₗ-*ᵣ-assoc instead."
109 #-}
110
111 *ᵣ-assoc+comm⇒*ₗ-assoc = *ᵣ-assoc∧comm⇒*ₗ-assoc
112 {-# WARNING_ON_USAGE *ᵣ-assoc+comm⇒*ₗ-assoc
113 "Warning: *ᵣ-assoc+comm⇒*ₗ-assoc was deprecated in v2.3.
114 Please use *ᵣ-assoc∧comm⇒*ₗ-assoc instead."
115 #-}
116
117 *ᵣ-assoc+comm⇒*ₗ-*ᵣ-assoc = *ᵣ-assoc∧comm⇒*ₗ-*ᵣ-assoc
118 {-# WARNING_ON_USAGE *ᵣ-assoc+comm⇒*ₗ-*ᵣ-assoc
119 "Warning: *ᵣ-assoc+comm⇒*ₗ-*ᵣ-assoc was deprecated in v2.3.
120 Please use *ᵣ-assoc∧comm⇒*ₗ-*ᵣ-assoc instead."
121 #-}