Skip to content

Commit be62e95

Browse files
committed
refactored from agda#2350
1 parent c5255d0 commit be62e95

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ New modules
8989
Algebra.Module.Bundles.Raw
9090
```
9191

92+
* Properties of `List` modulo `Setoid` equality (currently only the ([],++) monoid):
93+
```
94+
Data.List.Relation.Binary.Equality.Setoid.Properties
95+
```
96+
9297
* Prime factorisation of natural numbers.
9398
```
9499
Data.Nat.Primality.Factorisation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
------------------------------------------------------------------------
2+
-- The Agda standard library
3+
--
4+
-- Properties of List modulo ≋
5+
------------------------------------------------------------------------
6+
7+
{-# OPTIONS --cubical-compatible --safe #-}
8+
9+
open import Relation.Binary.Bundles using (Setoid)
10+
11+
module Data.List.Relation.Binary.Equality.Setoid.Properties
12+
{c ℓ} (S : Setoid c ℓ)
13+
where
14+
15+
open import Algebra.Bundles using (Monoid)
16+
open import Algebra.Structures using (IsMonoid)
17+
open import Data.List.Base using (List; []; _++_)
18+
import Data.List.Properties as List
19+
import Data.List.Relation.Binary.Equality.Setoid as ≋
20+
open import Data.Product.Base using (_,_)
21+
open import Function.Base using (_∘_)
22+
open import Level using (_⊔_)
23+
24+
open S using (_≋_; ≋-refl; ≋-reflexive; ≋-isEquivalence; ++⁺)
25+
26+
------------------------------------------------------------------------
27+
-- The []-++-Monoid
28+
29+
-- Structure
30+
31+
isMonoid : IsMonoid _≋_ _++_ []
32+
isMonoid = record
33+
{ isSemigroup = record
34+
{ isMagma = record
35+
{ isEquivalence = ≋-isEquivalence
36+
; ∙-cong = ++⁺
37+
}
38+
; assoc = λ xs ys zs ≋-reflexive (List.++-assoc xs ys zs)
39+
}
40+
; identity = (λ _ ≋-refl) , ≋-reflexive ∘ List.++-identityʳ
41+
}
42+
43+
-- Bundle
44+
45+
monoid : Monoid c (c ⊔ ℓ)
46+
monoid = record { isMonoid = isMonoid }

0 commit comments

Comments
 (0)