Prove that foldr is monotonic when input lists are pairwise monotonic

This should help prove that "join" is monotonic

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
2024-03-07 21:53:45 -08:00
parent 7905d106e2
commit 332b7616cf
2 changed files with 36 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
module Utils where
open import Agda.Primitive using () renaming (_⊔_ to _⊔_)
open import Data.Nat using (; suc)
open import Data.List using (List; []; _∷_; _++_)
open import Data.List.Membership.Propositional using (_∈_)
@@ -43,3 +44,9 @@ All-x∈xs (x ∷ xs') = here refl ∷ map there (All-x∈xs xs')
iterate : {a} {A : Set a} (n : ) (f : A A) A A
iterate 0 _ a = a
iterate (suc n) f a = f (iterate n f a)
data Pairwise {a} {b} {c} {A : Set a} {B : Set b} (P : A B Set c) : List A List B Set (a ⊔ℓ b ⊔ℓ c) where
[] : Pairwise P [] []
_∷_ : {x : A} {y : B} {xs : List A} {ys : List B}
P x y Pairwise P xs ys
Pairwise P (x xs) (y ys)