[ base ] Prove anyToFin preserves the property witnessed by Any

This commit is contained in:
0xd34df00d 2023-10-08 15:11:30 -05:00 committed by G. Allais
parent 8d5caaa137
commit 32b639ca3c

View File

@ -67,6 +67,14 @@ namespace Any
anyToFin (Here _) = FZ anyToFin (Here _) = FZ
anyToFin (There later) = FS (anyToFin later) anyToFin (There later) = FS (anyToFin later)
||| `anyToFin`'s return type satisfies the predicate
export
anyToFinCorrect : {0 xs : Vect n a} ->
(witness : Any p xs) ->
p (anyToFin witness `index` xs)
anyToFinCorrect (Here prf) = prf
anyToFinCorrect (There later) = anyToFinCorrect later
namespace All namespace All
||| A proof that all elements of a vector satisfy a property. It is a list of ||| A proof that all elements of a vector satisfy a property. It is a list of
||| proofs, corresponding element-wise to the `Vect`. ||| proofs, corresponding element-wise to the `Vect`.