@@ -5,28 +5,8 @@ module Prelude.Pairs
55
66||| Dependent pair where the first field is erased.
77data Exists : {a : Type} -> (P : a -> Type) -> Type where
8− witness : .{x : a} -> (pf : P x) -> Exists P
8+ witness : .{P : a -> Type} -> .{x : a} -> (pf : P x) -> Exists P
99
1010||| Dependent pair where the second field is erased.
1111data Subset : (a : Type) -> (P : a -> Type) -> Type where
12− element : (x : a) -> .(pf : P x) -> Subset a P
13−
14−||| Class of dependent pair constructors.
15−class DependentPair f where
16− ||| Project the first field from a dependent pair.
17− getWitness : f a P -> a
18−
19− ||| Project the second field from a dependent pair.
20− getProof : (x : f a P) -> P (getWitness x)
21−
22−instance DependentPair Pair where
23− getWitness (pair x pf) = x
24− getProof (pair x pf) = pf
25−
26−instance DependentPair Exists where
27− getWitness (witness x pf) = x
28− getProof (witness x pf) = pf
29−
30−instance DependentPair Subset where
31− getWitness (element x pf) = x
32− getProof (element x pf) = pf
12+ element : .{P : a -> Type} -> (x : a) -> .(pf : P x) -> Subset a P