remove stdlib duplication

This commit is contained in:
rhiannon morris 2022-11-06 13:03:54 +01:00
parent 5c3f2510fe
commit 8582862914
2 changed files with 10 additions and 11 deletions

View File

@ -9,14 +9,3 @@ Scope = SnocList
public export
Scoped : Type -> Type
Scoped a = Scope a -> Type
public export
data All : (a -> Type) -> Scoped a where
Lin : All p [<]
(:<) : All p xs -> p x -> All p (xs :< x)
%name OPE.Basics.All ps, qs
public export
mapAll : (forall x. p x -> q x) -> All p xs -> All q xs
mapAll f [<] = [<]
mapAll f (x :< y) = mapAll f x :< f y

View File

@ -5,6 +5,7 @@ import Quox.OPE.Length
import Quox.NatExtra
import Data.DPair
import Data.SnocList.Elem
import Data.SnocList.Quantifiers
%default total
@ -99,12 +100,21 @@ export
appZeroRight {len = Z} p = Refl
||| if `p` holds for all elements of the main list,
||| it holds for all elements of the sublist
public export
subAll : xs `Sub` ys -> All p ys -> All p xs
subAll End [<] = [<]
subAll (Keep q) (ps :< x) = subAll q ps :< x
subAll (Drop q) (ps :< x) = subAll q ps
||| if `p` holds for one element of the sublist,
||| it holds for one element of the main list
public export
subAny : xs `Sub` ys -> Any p xs -> Any p ys
subAny (Keep q) (Here x) = Here x
subAny (Keep q) (There x) = There (subAny q x)
subAny (Drop q) x = There (subAny q x)
public export