Tweak signature of 'forget' to simplify proofs

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
2024-03-07 20:04:33 -08:00
parent 34203840c8
commit 7905d106e2
2 changed files with 20 additions and 20 deletions

View File

@@ -488,7 +488,9 @@ _∈k_ k m = MemProp._∈_ k (keys m)
locate : {k : A} {m : Map} k ∈k m Σ B (λ v (k , v) m)
locate k∈km = locate-impl k∈km
forget : {k : A} {v : B} {m : Map} (k , v) m k ∈k m
-- defined this way because ∈ for maps uses projection, so the full map can't be guessed.
-- On the other hand, list can be guessed.
forget : {k : A} {v : B} {l : List (A × B)} (k , v) ∈ˡ l k ∈ˡ (ImplKeys.keys l)
forget = ∈-cong proj₁
Map-functional : {k : A} {v v' : B} {m : Map} (k , v) m (k , v') m v v'
@@ -594,7 +596,7 @@ Expr-Provenance k (e₁ ∩ e₂) k∈ke₁e₂
Expr-Provenance-≡ : {k : A} {v : B} (e : Expr) (k , v) e Provenance k v e
Expr-Provenance-≡ {k} {v} e k,v∈e
with (v' , (p , k,v'∈e)) Expr-Provenance k e (forget {m = e } k,v∈e)
with (v' , (p , k,v'∈e)) Expr-Provenance k e (forget k,v∈e)
rewrite Map-functional {m = e } k,v∈e k,v'∈e = p
module _ (≈₂-dec : IsDecidable _≈₂_) where
@@ -609,7 +611,7 @@ module _ (≈₂-dec : IsDecidable _≈₂_) where
let (v , k,v∈m₁) = locate-impl k∈km₁
in no (λ m₁⊆m₂
let (v' , (_ , k,v'∈m₂)) = m₁⊆m₂ k v k,v∈m₁
in k∉km₂ (∈-cong proj₁ k,v'∈m₂))
in k∉km₂ (forget k,v'∈m₂))
SubsetInfo-to-dec {m₁} {m₂} (mismatch k v₁ v₂ k,v₁∈m₁ k,v₂∈m₂ v₁̷≈v₂) =
no (λ m₁⊆m₂
let (v' , (v₁≈v' , k,v'∈m₂)) = m₁⊆m₂ k v₁ k,v₁∈m₁
@@ -979,7 +981,7 @@ updating-via-k∈ks-forward m {ks} f k∈ks k∈km rewrite transform-keys-≡ (p
updating-via-k∈ks-≡ : (m : Map) {ks : List A} (f : A B) {k : A} {v : B}
k ∈ˡ ks (k , v) (m updating ks via f) v f k
updating-via-k∈ks-≡ m {ks} f k∈ks k,v∈um
with updating-via-k∈ks m f k∈ks (forget {m = (m updating ks via f)} k,v∈um)
with updating-via-k∈ks m f k∈ks (forget k,v∈um)
... | k,fk∈um = Map-functional {m = (m updating ks via f)} k,v∈um k,fk∈um
updating-via-k∉ks-forward : (m : Map) {ks : List A} (f : A B) {k : A} {v : B}
@@ -1017,11 +1019,11 @@ module _ {l} {L : Set l}
with Expr-Provenance-≡ ((` (f' l₁)) (` (f' l₂))) k,v∈f'l₁f'l₂
... | in (single k,v∈f'l₁) k∉kf'l₂ =
let
k∈kfl₁ = updating-via-∈k-backward (f l₁) ks (updater l₁) (forget {m = f' l₁} k,v∈f'l₁)
k∈kfl₁ = updating-via-∈k-backward (f l₁) ks (updater l₁) (forget k,v∈f'l₁)
k∈kfl₁fl₂ = union-preserves-∈k₁ {l₁ = proj₁ (f l₁)} {l₂ = proj₁ (f l₂)} k∈kfl₁
(v' , k,v'∈fl₁l₂) = locate {m = (f l₁ f l₂)} k∈kfl₁fl₂
(v'' , (v'≈v'' , k,v''∈fl₂)) = fl₁fl₂⊆fl₂ k v' k,v'∈fl₁l₂
k∈kf'l₂ = updating-via-∈k-forward (f l₂) ks (updater l₂) (forget {m = f l₂} k,v''∈fl₂)
k∈kf'l₂ = updating-via-∈k-forward (f l₂) ks (updater l₂) (forget k,v''∈fl₂)
in
⊥-elim (k∉kf'l₂ k∈kf'l₂)
... | in k∉kf'l₁ (single k,v'∈f'l₂) =
@@ -1044,7 +1046,7 @@ module _ {l} {L : Set l}
f'l₂⊆f'l₁f'l₂ : f' l₂ ((f' l₁) (f' l₂))
f'l₂⊆f'l₁f'l₂ k v k,v∈f'l₂
with k∈kfl₂ updating-via-∈k-backward (f l₂) ks (updater l₂) (forget {m = f' l₂} k,v∈f'l₂)
with k∈kfl₂ updating-via-∈k-backward (f l₂) ks (updater l₂) (forget k,v∈f'l₂)
with (v' , k,v'∈fl₂) locate {m = f l₂} k∈kfl₂
with (v'' , (v'≈v'' , k,v''∈fl₁fl₂)) fl₂⊆fl₁fl₂ k v' k,v'∈fl₂
with Expr-Provenance-≡ ((` (f l₁)) (` (f l₂))) k,v''∈fl₁fl₂
@@ -1058,8 +1060,8 @@ module _ {l} {L : Set l}
with k∈-dec k ks
... | yes k∈ks with refl updating-via-k∈ks-≡ (f l₂) (updater l₂) k∈ks k,v∈f'l₂ =
let
k,uv₁∈f'l₁ = updating-via-k∈ks-forward (f l₁) (updater l₁) k∈ks (forget {m = f l₁} k,v₁∈fl₁)
k,uv₂∈f'l₂ = updating-via-k∈ks-forward (f l₂) (updater l₂) k∈ks (forget {m = f l₂} k,v₂∈fl₂)
k,uv₁∈f'l₁ = updating-via-k∈ks-forward (f l₁) (updater l₁) k∈ks (forget k,v₁∈fl₁)
k,uv₂∈f'l₂ = updating-via-k∈ks-forward (f l₂) (updater l₂) k∈ks (forget k,v₂∈fl₂)
k,uv₁uv₂∈f'l₁f'l₂ = ⊔-combines {m₁ = f' l₁} {m₂ = f' l₂} k,uv₁∈f'l₁ k,uv₂∈f'l₂
in
(updater l₁ k ⊔₂ updater l₂ k , (IsLattice.≈-sym lB (g-Monotonicʳ k l₁≼l₂) , k,uv₁uv₂∈f'l₁f'l₂))