Debian Codegraph @

src/Data/List/Fresh/Relation/Unary/All/Properties.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Properties of All predicate transformer for fresh lists
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --safe #-}
8
9 module Data.List.Fresh.Relation.Unary.All.Properties where
10
11 open import Data.List.Fresh using (List#; []; cons; _∷#_; _#_)
12 open import Data.List.Fresh.Relation.Unary.All using (All; []; _∷_; append)
13 open import Data.Nat.Base using (ℕ; zero; suc)
14 open import Data.Product.Base using (_,_)
15 open import Function.Base using (_∘′_)
16 open import Level using (Level; _⊔_; Lift)
17 open import Relation.Unary as U using (Pred)
18 open import Relation.Binary.Core using (Rel)
19 open import Relation.Binary.PropositionalEquality.Core using (_≡_; refl; cong)
20
21
22
23 private
24 variable
25 a p r : Level
26 A : Set a
27
28 module _ {R : Rel A r} where
29
30 fromAll : ∀ {x} {xs : List# A R} → All (R x) xs → x # xs
31 fromAll [] = _
32 fromAll (p ∷ ps) = p , fromAll ps
33
34 toAll : ∀ {x} {xs : List# A R} → x # xs → All (R x) xs
35 toAll {xs = []} _ = []
36 toAll {xs = a ∷# as} (p , ps) = p ∷ toAll ps
37
38 module _ {R : Rel A r} {P : Pred A p} where
39
40 append⁺ : {xs ys : List# A R} {ps : All (_# ys) xs} →
41 All P xs → All P ys → All P (append xs ys ps)
42 append⁺ [] pys = pys
43 append⁺ (px ∷ pxs) pys = px ∷ append⁺ pxs pys