Debian Codegraph @

src/Algebra/Construct/Initial.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Instances of algebraic structures where the carrier is ⊥.
5 -- In mathematics, this is usually called 0.
6 --
7 -- From monoids up, these are zero-objects – i.e, the terminal
8 -- object is *also* the initial object in the relevant category.
9 ------------------------------------------------------------------------
10
11 {-# OPTIONS --cubical-compatible --safe #-}
12
13 open import Level using (Level)
14
15 module Algebra.Construct.Initial {c ℓ : Level} where
16
17 open import Algebra.Bundles
18 using (Magma; Semigroup; Band)
19 open import Algebra.Bundles.Raw
20 using (RawMagma)
21 open import Algebra.Core using (Op₂)
22 open import Algebra.Definitions using (Congruent₂; Associative; Idempotent)
23 open import Algebra.Structures using (IsMagma; IsSemigroup; IsBand)
24 open import Data.Empty.Polymorphic using (⊥)
25 open import Relation.Binary.Core using (Rel)
26 open import Relation.Binary.Structures using (IsEquivalence)
27 open import Relation.Binary.Definitions
28 using (Reflexive; Symmetric; Transitive)
29
30
31 ------------------------------------------------------------------------
32 -- Re-export those algebras which are also terminal
33
34 open import Algebra.Construct.Terminal {c} {ℓ} public
35 hiding (rawMagma; magma; semigroup; band)
36
37 ------------------------------------------------------------------------
38 -- Gather all the functionality in one place
39
40 module ℤero where
41
42 infixl 7 _∙_
43 infix 4 _≈_
44
45 Carrier : Set c
46 Carrier = ⊥
47
48 _≈_ : Rel Carrier ℓ
49 _≈_ ()
50
51 _∙_ : Op₂ Carrier
52 _∙_ ()
53
54 refl : Reflexive _≈_
55 refl {x = ()}
56
57 sym : Symmetric _≈_
58 sym {x = ()}
59
60 trans : Transitive _≈_
61 trans {i = ()}
62
63 ∙-cong : Congruent₂ _≈_ _∙_
64 ∙-cong {x = ()}
65
66 assoc : Associative _≈_ _∙_
67 assoc ()
68
69 idem : Idempotent _≈_ _∙_
70 idem ()
71
72 open ℤero
73
74 ------------------------------------------------------------------------
75 -- Raw bundles
76
77 rawMagma : RawMagma c ℓ
78 rawMagma = record { ℤero }
79
80 ------------------------------------------------------------------------
81 -- Structures
82
83 isEquivalence : IsEquivalence _≈_
84 isEquivalence = record { refl = refl; sym = sym; trans = λ where {i = ()} }
85
86 isMagma : IsMagma _≈_ _∙_
87 isMagma = record { isEquivalence = isEquivalence ; ∙-cong = λ where {x = ()} }
88
89 isSemigroup : IsSemigroup _≈_ _∙_
90 isSemigroup = record { isMagma = isMagma ; assoc = assoc }
91
92 isBand : IsBand _≈_ _∙_
93 isBand = record { isSemigroup = isSemigroup ; idem = idem }
94
95 ------------------------------------------------------------------------
96 -- Bundles
97
98 magma : Magma c ℓ
99 magma = record { isMagma = isMagma }
100
101 semigroup : Semigroup c ℓ
102 semigroup = record { isSemigroup = isSemigroup }
103
104 band : Band c ℓ
105 band = record { isBand = isBand }
106