diff options
author | Helmut Grohne <grohne@cs.uni-bonn.de> | 2013-12-17 08:22:12 +0100 |
---|---|---|
committer | Helmut Grohne <grohne@cs.uni-bonn.de> | 2013-12-17 08:35:23 +0100 |
commit | 066861f9cdde4ded6c5442508bef1a27576c68d7 (patch) | |
tree | 3e199fdfd1cb746d3c637b5b2817ec53b17a6d67 /BFF.agda | |
parent | 2c37e0c2f32b4c6b5c121827a4abddf7fc1dd7e0 (diff) | |
download | bidiragda-066861f9cdde4ded6c5442508bef1a27576c68d7.tar.gz |
update bff implementation to use delete
In the presence of shape-changing updates, bff needs to shrink one of
the mappings before unifying them. As long the shape does not change,
the union becomes a disjoint union. With this insight we can adapt the
proof of theorem-1 using the adapted lemma-disjoint-union. Unfortunately
theorem-2 requires more work and assoc-enough becomes non-trivial due to
the introduction of mapMV.
Diffstat (limited to 'BFF.agda')
-rw-r--r-- | BFF.agda | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -14,6 +14,7 @@ open import Function using (id ; _∘_ ; flip) open import Relation.Binary.Core using (Decidable ; _≡_) open import FinMap +open import Generic using (mapMV) import CheckInsert import FreeTheorems @@ -33,7 +34,9 @@ module VecBFF (Carrier : Set) (deq : Decidable {A = Carrier} _≡_) where bff : {getlen : ℕ → ℕ} → (get-type getlen) → ({n : ℕ} → Vec Carrier n → Vec Carrier (getlen n) → Maybe (Vec Carrier n)) bff get s v = let s′ = enumerate s - g = fromFunc (denumerate s) - h = assoc (get s′) v - h′ = (flip union g) <$> h - in (flip mapV s′ ∘ flip lookupV) <$> h′ + t′ = get s′ + g = partialize (fromFunc (denumerate s)) + g′ = delete-many t′ g + h = assoc t′ v + h′ = (flip union g′) <$> h + in h′ >>= flip mapMV s′ ∘ flip lookupV |