diff options
author | Helmut Grohne <grohne@cs.uni-bonn.de> | 2014-02-07 16:15:03 +0100 |
---|---|---|
committer | Helmut Grohne <grohne@cs.uni-bonn.de> | 2014-02-07 16:15:03 +0100 |
commit | 586d72e18898311d975f5748bca397c403b6a83b (patch) | |
tree | 2733f576b6e3ff0965ca8eb213fe0635be3631df /BFF.agda | |
parent | 95609983219f14e8f4c0758cd0688b984d8b1455 (diff) | |
download | bidiragda-586d72e18898311d975f5748bca397c403b6a83b.tar.gz |
allow shape shape updates in bff
Unlike the original version in VoigtlaenderHMW13, we do not request an
sput : ℕ → ℕ → Maybe ℕ
function for determining the updated source shape from the original
source and updated view shape. Instead we ask the caller directly to
provide the result of sput together with a proof that its getlen matches
with the provided, updated view.
The precondition assoc-enough is not enriched in this way and still
requires a non-changing shape. I.e. it says what it said before.
Diffstat (limited to 'BFF.agda')
-rw-r--r-- | BFF.agda | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -30,14 +30,18 @@ module VecBFF (A : DecSetoid ℓ₀ ℓ₀) where enumerate : {n : ℕ} → Vec Carrier n → Vec (Fin n) n enumerate _ = tabulate id + enumeratel : (n : ℕ) → Vec (Fin n) n + enumeratel _ = tabulate id + denumerate : {n : ℕ} → Vec Carrier n → Fin n → Carrier denumerate = flip lookupV - bff : (G : Get) → ({n : ℕ} → Vec Carrier n → Vec Carrier (Get.getlen G n) → Maybe (Vec Carrier n)) - bff G s v = let s′ = enumerate s + bff : (G : Get) → {n : ℕ} → (m : ℕ) → Vec Carrier n → Vec Carrier (Get.getlen G m) → Maybe (Vec Carrier m) + bff G m s v = let s′ = enumerate s t′ = Get.get G s′ g = fromFunc (denumerate s) g′ = delete-many t′ g - h = assoc t′ v - h′ = (flip union g′) <$> h - in h′ >>= flip mapMV s′ ∘ flip lookupM + t = enumeratel m + h = assoc (Get.get G t) v + h′ = (flip union (reshape g′ m)) <$> h + in h′ >>= flip mapMV t ∘ flip lookupM |