From 50f61bef184194fc48dd1415800830d032495f51 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sun, 31 Mar 2019 21:23:11 +0200 Subject: FinMap.lemma-tabulate-∘ is also known as Data.Vec.Properties.tabulate-cong MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FinMap.agda | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'FinMap.agda') diff --git a/FinMap.agda b/FinMap.agda index 1ae4c39..b069162 100644 --- a/FinMap.agda +++ b/FinMap.agda @@ -6,7 +6,7 @@ open import Data.Maybe using (Maybe ; just ; nothing ; maybe′) open import Data.Fin using (Fin ; zero ; suc) open import Data.Fin.Properties using (_≟_) open import Data.Vec using (Vec ; [] ; _∷_ ; _[_]≔_ ; replicate ; tabulate ; foldr ; zip ; toList) renaming (lookup to lookupVec ; map to mapV) -open import Data.Vec.Properties using (lookup∘update ; lookup∘update′ ; lookup-replicate) +open import Data.Vec.Properties using (lookup∘update ; lookup∘update′ ; lookup-replicate ; tabulate-cong) open import Data.Product using (_×_ ; _,_) open import Data.List.All as All using (All) import Data.List.All.Properties as AllP @@ -109,10 +109,6 @@ lemma-lookupM-restrict-∉ i f (j ∷ js) i∉jjs = P.trans (lookup∘update′ (All.head i∉jjs) (restrict f js) (just (f j))) (lemma-lookupM-restrict-∉ i f js (All.tail i∉jjs)) -lemma-tabulate-∘ : {n : ℕ} {A : Set} → {f g : Fin n → A} → f ≗ g → tabulate f ≡ tabulate g -lemma-tabulate-∘ {zero} {_} {f} {g} f≗g = P.refl -lemma-tabulate-∘ {suc n} {_} {f} {g} f≗g = P.cong₂ _∷_ (f≗g zero) (lemma-tabulate-∘ (f≗g ∘ suc)) - lemma-lookupM-fromFunc : {n : ℕ} {A : Set} → (f : Fin n → A) → flip lookupM (fromFunc f) ≗ Maybe.just ∘ f lemma-lookupM-fromFunc f zero = P.refl lemma-lookupM-fromFunc f (suc i) = lemma-lookupM-fromFunc (f ∘ suc) i @@ -134,7 +130,7 @@ lemma-reshape-id [] = P.refl lemma-reshape-id (x ∷ xs) = P.cong (_∷_ x) (lemma-reshape-id xs) lemma-disjoint-union : {n m : ℕ} {A : Set} → (f : Fin n → A) → (t : Vec (Fin n) m) → union (restrict f t) (delete-many t (fromFunc f)) ≡ fromFunc f -lemma-disjoint-union {n} f t = lemma-tabulate-∘ inner +lemma-disjoint-union {n} f t = tabulate-cong inner where inner : (x : Fin n) → maybe′ just (lookupM x (delete-many t (fromFunc f))) (lookupM x (restrict f t)) ≡ just (f x) inner x with is-∈ _≟_ x t inner x | yes-∈ x∈t = P.cong (maybe′ just (lookupM x (delete-many t (fromFunc f)))) (lemma-lookupM-restrict-∈ x f t x∈t) -- cgit v1.2.3