Debian Codegraph @

src/Algebra/Consequences/Base.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Lemmas relating algebraic definitions (such as associativity and
5 -- commutativity) that don't require the equality relation to be a setoid.
6 ------------------------------------------------------------------------
7
8 {-# OPTIONS --cubical-compatible --safe #-}
9
10 module Algebra.Consequences.Base
11 {a} {A : Set a} where
12
13 open import Algebra.Core using (Op₁; Op₂)
14 import Algebra.Definitions as Definitions
15 using (Congruent₂; LeftCongruent; RightCongruent
16 ; Selective; Idempotent; SelfInverse; Involutive)
17 open import Data.Sum.Base using (_⊎_; reduce)
18 open import Relation.Binary.Consequences
19 using (mono₂⇒monoˡ; mono₂⇒monoʳ)
20 open import Relation.Binary.Core using (Rel)
21 open import Relation.Binary.Definitions using (Reflexive)
22
23 module Congruence {ℓ} {_∙_ : Op₂ A} (_≈_ : Rel A ℓ) (open Definitions _≈_)
24 (cong : Congruent₂ _∙_) (refl : Reflexive _≈_)
25 where
26
27 ∙-congˡ : LeftCongruent _∙_
28 ∙-congˡ {x} = mono₂⇒monoˡ _ _≈_ _≈_ (refl {x = x}) cong x
29
30 ∙-congʳ : RightCongruent _∙_
31 ∙-congʳ {x} = mono₂⇒monoʳ _≈_ _ _≈_ (refl {x = x}) cong x
32
33 module _ {ℓ} {_∙_ : Op₂ A} (_≈_ : Rel A ℓ) (open Definitions _≈_) where
34
35 sel⇒idem : Selective _∙_ → Idempotent _∙_
36 sel⇒idem sel x = reduce (sel x x)
37
38 module _ {ℓ} {f : Op₁ A} (_≈_ : Rel A ℓ) (open Definitions _≈_) where
39
40 reflexive∧selfInverse⇒involutive : Reflexive _≈_ →
41 SelfInverse f →
42 Involutive f
43 reflexive∧selfInverse⇒involutive refl inv _ = inv refl
44
45 ------------------------------------------------------------------------
46 -- DEPRECATED NAMES
47 ------------------------------------------------------------------------
48 -- Please use the new names as continuing support for the old names is
49 -- not guaranteed.
50
51 -- Version 2.0
52
53 reflexive+selfInverse⇒involutive = reflexive∧selfInverse⇒involutive
54 {-# WARNING_ON_USAGE reflexive+selfInverse⇒involutive
55 "Warning: reflexive+selfInverse⇒involutive was deprecated in v2.0.
56 Please use reflexive∧selfInverse⇒involutive instead."
57 #-}