Debian Codegraph @

src/Data/List/Relation/Binary/Suffix/Propositional/Properties.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Properties of the propositional suffix relation
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --safe #-}
8
9 module Data.List.Relation.Binary.Suffix.Propositional.Properties {a} {A : Set a} where
10
11 open import Data.List.Base using (List; []; _∷_)
12 open import Data.List.Properties using (++-monoid)
13
14 open import Data.List.Relation.Binary.Suffix.Heterogeneous
15 using (Suffix; here; there; fromView; _++_)
16 open import Data.List.Relation.Binary.Prefix.Homogeneous.Properties
17 import Data.List.Relation.Binary.Pointwise as Pointwise
18
19 open import Algebra.Properties.Monoid.Divisibility (++-monoid A)
20
21 open import Relation.Binary.PropositionalEquality using (_≡_; refl)
22 open import Relation.Binary using (_⇒_)
23
24 ------------------------------------------------------------------------
25 -- The inductive definition of the propositional Suffix relation is
26 -- equivalent to the notion of right divisibility induced by the
27 -- (List A, _++_, []) monoid
28
29 Suffix-as-∣ʳ : Suffix _≡_ ⇒ _∣ʳ_
30 Suffix-as-∣ʳ (here equal) = ∣ʳ-reflexive (Pointwise.Pointwise-≡⇒≡ equal)
31 Suffix-as-∣ʳ (there suff) = x∣ʳy⇒x∣ʳzy (_ ∷ []) (Suffix-as-∣ʳ suff)
32
33 ∣ʳ-as-Suffix : _∣ʳ_ ⇒ Suffix _≡_
34 ∣ʳ-as-Suffix (rest , refl) = fromView (rest ++ Pointwise.refl refl)