Skip to content

Commit efda8e2

Browse files
authored
[ bug/refactor ] put Algebra.Consequence.Propositional.sel⇒idem in the right place (#2881)
* refactor: put lemma in the right place * fix: uncommitted edits * fix: `CHANGELOG` * fix: qualified module name
1 parent 320220b commit efda8e2

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ Additions to existing modules
133133

134134
* In `Algebra.Consequences.Setoid`:
135135
```agda
136+
sel⇒idem : Selective _∙_ → Idempotent _∙_
136137
binomial-expansion : Congruent₂ _∙_ → Associative _∙_ → _◦_ DistributesOver _∙_ →
137138
∀ w x y z → ((w ∙ x) ◦ (y ∙ z)) ≈ ((((w ◦ y) ∙ (w ◦ z)) ∙ (x ◦ y)) ∙ (x ◦ z))
138139
identity⇒central : Identity e _∙_ → Central _∙_ e

src/Algebra/Consequences/Propositional.agda

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ open import Relation.Binary.PropositionalEquality.Properties
2222
open import Relation.Unary using (Pred)
2323

2424
open import Algebra.Definitions {A = A} _≡_
25-
import Algebra.Consequences.Setoid (setoid A) as Base
25+
import Algebra.Consequences.Setoid (setoid A) as SetoidConsequences
2626

2727
------------------------------------------------------------------------
2828
-- Re-export all proofs that don't require congruence or substitutivity
2929

30-
open Base public
30+
open SetoidConsequences public
3131
hiding
3232
( comm∧assoc⇒middleFour
3333
; identity∧middleFour⇒assoc
@@ -41,7 +41,6 @@ open Base public
4141
; comm⇒sym[distribˡ]
4242
; subst∧comm⇒sym
4343
; wlog
44-
; sel⇒idem
4544
; binomial-expansion
4645
-- plus all the deprecated versions of the above
4746
; comm+assoc⇒middleFour
@@ -64,12 +63,12 @@ module _ {_∙_ _⁻¹ ε} where
6463
assoc∧id∧invʳ⇒invˡ-unique : Associative _∙_ Identity ε _∙_
6564
RightInverse ε _⁻¹ _∙_
6665
x y (x ∙ y) ≡ ε x ≡ (y ⁻¹)
67-
assoc∧id∧invʳ⇒invˡ-unique = Base.assoc∧id∧invʳ⇒invˡ-unique (cong₂ _)
66+
assoc∧id∧invʳ⇒invˡ-unique = SetoidConsequences.assoc∧id∧invʳ⇒invˡ-unique (cong₂ _)
6867

6968
assoc∧id∧invˡ⇒invʳ-unique : Associative _∙_ Identity ε _∙_
7069
LeftInverse ε _⁻¹ _∙_
7170
x y (x ∙ y) ≡ ε y ≡ (x ⁻¹)
72-
assoc∧id∧invˡ⇒invʳ-unique = Base.assoc∧id∧invˡ⇒invʳ-unique (cong₂ _)
71+
assoc∧id∧invˡ⇒invʳ-unique = SetoidConsequences.assoc∧id∧invˡ⇒invʳ-unique (cong₂ _)
7372

7473
------------------------------------------------------------------------
7574
-- Ring-like structures
@@ -80,27 +79,27 @@ module _ {_+_ _*_ -_ 0#} where
8079
RightIdentity 0# _+_ RightInverse 0# -_ _+_
8180
LeftZero 0# _*_
8281
assoc∧distribʳ∧idʳ∧invʳ⇒zeˡ =
83-
Base.assoc∧distribʳ∧idʳ∧invʳ⇒zeˡ (cong₂ _+_) (cong₂ _*_)
82+
SetoidConsequences.assoc∧distribʳ∧idʳ∧invʳ⇒zeˡ (cong₂ _+_) (cong₂ _*_)
8483

8584
assoc∧distribˡ∧idʳ∧invʳ⇒zeʳ : Associative _+_ _*_ DistributesOverˡ _+_
8685
RightIdentity 0# _+_ RightInverse 0# -_ _+_
8786
RightZero 0# _*_
8887
assoc∧distribˡ∧idʳ∧invʳ⇒zeʳ =
89-
Base.assoc∧distribˡ∧idʳ∧invʳ⇒zeʳ (cong₂ _+_) (cong₂ _*_)
88+
SetoidConsequences.assoc∧distribˡ∧idʳ∧invʳ⇒zeʳ (cong₂ _+_) (cong₂ _*_)
9089

9190
------------------------------------------------------------------------
9291
-- Bisemigroup-like structures
9392

9493
module _ {_∙_ _◦_ : Op₂ A} (∙-comm : Commutative _∙_) where
9594

9695
comm∧distrˡ⇒distrʳ : _∙_ DistributesOverˡ _◦_ _∙_ DistributesOverʳ _◦_
97-
comm∧distrˡ⇒distrʳ = Base.comm+distrˡ⇒distrʳ (cong₂ _) ∙-comm
96+
comm∧distrˡ⇒distrʳ = SetoidConsequences.comm+distrˡ⇒distrʳ (cong₂ _) ∙-comm
9897

9998
comm∧distrʳ⇒distrˡ : _∙_ DistributesOverʳ _◦_ _∙_ DistributesOverˡ _◦_
100-
comm∧distrʳ⇒distrˡ = Base.comm∧distrʳ⇒distrˡ (cong₂ _) ∙-comm
99+
comm∧distrʳ⇒distrˡ = SetoidConsequences.comm∧distrʳ⇒distrˡ (cong₂ _) ∙-comm
101100

102101
comm⇒sym[distribˡ] : x Symmetric (λ y z (x ◦ (y ∙ z)) ≡ ((x ◦ y) ∙ (x ◦ z)))
103-
comm⇒sym[distribˡ] = Base.comm⇒sym[distribˡ] (cong₂ _◦_) ∙-comm
102+
comm⇒sym[distribˡ] = SetoidConsequences.comm⇒sym[distribˡ] (cong₂ _◦_) ∙-comm
104103

105104
module _ {_∙_ _◦_ : Op₂ A}
106105
(∙-assoc : Associative _∙_)
@@ -109,15 +108,7 @@ module _ {_∙_ _◦_ : Op₂ A}
109108

110109
binomial-expansion : w x y z
111110
((w ∙ x) ◦ (y ∙ z)) ≡ ((((w ◦ y) ∙ (w ◦ z)) ∙ (x ◦ y)) ∙ (x ◦ z))
112-
binomial-expansion = Base.binomial-expansion {_∙_} {_◦_} (cong₂ _) ∙-assoc distrib
113-
114-
------------------------------------------------------------------------
115-
-- Selectivity
116-
117-
module _ {_∙_ : Op₂ A} where
118-
119-
sel⇒idem : Selective _∙_ Idempotent _∙_
120-
sel⇒idem = Base.sel⇒idem _≡_
111+
binomial-expansion = SetoidConsequences.binomial-expansion {_∙_} {_◦_} (cong₂ _) ∙-assoc distrib
121112

122113
------------------------------------------------------------------------
123114
-- Middle-Four Exchange
@@ -126,17 +117,17 @@ module _ {_∙_ : Op₂ A} where
126117

127118
comm∧assoc⇒middleFour : Commutative _∙_ Associative _∙_
128119
_∙_ MiddleFourExchange _∙_
129-
comm∧assoc⇒middleFour = Base.comm∧assoc⇒middleFour (cong₂ _∙_)
120+
comm∧assoc⇒middleFour = SetoidConsequences.comm∧assoc⇒middleFour (cong₂ _∙_)
130121

131122
identity∧middleFour⇒assoc : {e : A} Identity e _∙_
132123
_∙_ MiddleFourExchange _∙_
133124
Associative _∙_
134-
identity∧middleFour⇒assoc = Base.identity∧middleFour⇒assoc (cong₂ _∙_)
125+
identity∧middleFour⇒assoc = SetoidConsequences.identity∧middleFour⇒assoc (cong₂ _∙_)
135126

136127
identity∧middleFour⇒comm : {_+_ : Op₂ A} {e : A} Identity e _+_
137128
_∙_ MiddleFourExchange _+_
138129
Commutative _∙_
139-
identity∧middleFour⇒comm = Base.identity∧middleFour⇒comm (cong₂ _∙_)
130+
identity∧middleFour⇒comm = SetoidConsequences.identity∧middleFour⇒comm (cong₂ _∙_)
140131

141132
------------------------------------------------------------------------
142133
-- Without Loss of Generality
@@ -145,13 +136,13 @@ module _ {p} {P : Pred A p} where
145136

146137
subst∧comm⇒sym : {f} (f-comm : Commutative f)
147138
Symmetric (λ a b P (f a b))
148-
subst∧comm⇒sym = Base.subst∧comm⇒sym {P = P} subst
139+
subst∧comm⇒sym = SetoidConsequences.subst∧comm⇒sym {P = P} subst
149140

150141
wlog : {f} (f-comm : Commutative f)
151142
{r} {_R_ : Rel _ r} Total _R_
152143
( a b a R b P (f a b))
153144
a b P (f a b)
154-
wlog = Base.wlog {P = P} subst
145+
wlog = SetoidConsequences.wlog {P = P} subst
155146

156147

157148
------------------------------------------------------------------------

src/Algebra/Consequences/Setoid.agda

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,22 @@ open import Relation.Binary.Reasoning.Setoid S
3333
-- Export base lemmas that don't require the setoid
3434

3535
open Base public
36-
hiding (module Congruence)
36+
hiding (module Congruence; sel⇒idem)
3737

3838
-- Export congruence lemmas using reflexivity
3939

4040
module Congruence {_∙_ : Op₂ A} (cong : Congruent₂ _∙_) where
4141

4242
open Base.Congruence _≈_ cong refl public
4343

44+
------------------------------------------------------------------------
45+
-- Selectivity
46+
47+
module _ {_∙_ : Op₂ A} where
48+
49+
sel⇒idem : Selective _∙_ Idempotent _∙_
50+
sel⇒idem = Base.sel⇒idem _≈_
51+
4452
------------------------------------------------------------------------
4553
-- MiddleFourExchange
4654

0 commit comments

Comments
 (0)