0 | -- Despite the significant difference in the types, idea and function names taken from
1 | -- https://github.com/idris-lang/Idris2/blob/7972c6acbd7276a53e00e038a09607fc4edad006/libs/base/Data/List/Quantifiers.idr
26 | export
27 | Uninhabited (Any p Nil) where
28 | uninhabited (Here _) impossible
29 | uninhabited (There _) impossible
31 | export
32 | {0 p : a -> Type} -> {0 u0 : _} -> {0 u1 : _} ->
42 | export
66 | export
68 | Either (Uninhabited $ p x) (Uninhabited $ All p xs) => Uninhabited (All p $ (x::xs) @{u0} @{u1}) where
108 | ----------------------------------------------------------
109 | --- Relationships between `All`, `Any` and other stuff ---
110 | ----------------------------------------------------------
112 | --- Relations throught `Not` ---
114 | export
119 | export
124 | export
135 | --- Relations between listwise `All` and elementwise `Subset` ---
137 | -- The function below is commented out due to https://github.com/idris-lang/Idris2/issues/2910
139 | --public export
140 | --pushIn : (xs : LazyLst ne a) -> (0 _ : All p xs) -> LazyLst ne $ Subset a p
141 | --pushIn [] [] = []
142 | --pushIn (x::Delay xs) (p::ps) = Element x p :: pushIn xs ps
149 | {-
151 | export
152 | pushInOutInverse : (xs : LazyLst ne a) -> (0 prf : All p xs) -> pullOut (pushIn xs prf) = Element xs prf
153 | pushInOutInverse [] [] = Refl
154 | pushInOutInverse (x::xs) (p::ps) = rewrite pushInOutInverse xs ps in Refl
156 | export
157 | pushOutInInverse : (xs : LazyLst ne $ Subset a p) -> uncurry Quantifiers.pushIn (pullOut xs) = xs
158 | pushOutInInverse [] = Refl
159 | pushOutInInverse (Element x p :: xs) with (pushOutInInverse xs)
160 | pushOutInInverse (Element x p :: xs) | subprf with (pullOut xs)
161 | pushOutInInverse (Element x p :: xs) | subprf | Element ss ps = rewrite subprf in Refl