Prove the second absorption law for maps
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
parent
dc405b989f
commit
7b93654c4f
27
Map.agda
27
Map.agda
|
@ -719,3 +719,30 @@ module _ (_≈_ : B → B → Set b) where
|
||||||
let (v₂ , k,v₂∈m₂) = locate k∈km₂
|
let (v₂ , k,v₂∈m₂) = locate k∈km₂
|
||||||
in (v ⊓₂ (v ⊔₂ v₂) , (≈-sym ⊓₂-⊔₂-absorb , I⊓.intersect-combines u₁ (I⊔.union-preserves-Unique l₁ l₂ u₂) k,v∈m₁ (I⊔.union-combines u₁ u₂ k,v∈m₁ k,v₂∈m₂)))
|
in (v ⊓₂ (v ⊔₂ v₂) , (≈-sym ⊓₂-⊔₂-absorb , I⊓.intersect-combines u₁ (I⊔.union-preserves-Unique l₁ l₂ u₂) k,v∈m₁ (I⊔.union-combines u₁ u₂ k,v∈m₁ k,v₂∈m₂)))
|
||||||
... | no k∉km₂ = (v ⊓₂ v , (≈-sym (⊓₂-idemp v) , I⊓.intersect-combines u₁ (I⊔.union-preserves-Unique l₁ l₂ u₂) k,v∈m₁ (I⊔.union-preserves-∈₁ u₁ k,v∈m₁ k∉km₂)))
|
... | no k∉km₂ = (v ⊓₂ v , (≈-sym (⊓₂-idemp v) , I⊓.intersect-combines u₁ (I⊔.union-preserves-Unique l₁ l₂ u₂) k,v∈m₁ (I⊔.union-preserves-∈₁ u₁ k,v∈m₁ k∉km₂)))
|
||||||
|
|
||||||
|
union-intersect-absorb : ∀ (m₁ m₂ : Map) → lift (m₁ ⊔ (m₁ ⊓ m₂)) m₁
|
||||||
|
union-intersect-absorb m₁@(l₁ , u₁) m₂@(l₂ , u₂) = (union-intersect-absorb₁ , union-intersect-absorb₂)
|
||||||
|
where
|
||||||
|
union-intersect-absorb₁ : subset (m₁ ⊔ (m₁ ⊓ m₂)) m₁
|
||||||
|
union-intersect-absorb₁ k v k,v∈m₁m₁₂
|
||||||
|
with Expr-Provenance _ _ k ((` m₁) ∪ ((` m₁) ∩ (` m₂))) (∈-cong proj₁ k,v∈m₁m₁₂)
|
||||||
|
... | (_ , (bothᵘ (single {v₁} k,v₁∈m₁)
|
||||||
|
(bothⁱ (single {v₁'} k,v₁'∈m₁)
|
||||||
|
(single {v₂} k,v₂∈m₂)) , v₁v₁'v₂∈m₁m₁₂))
|
||||||
|
rewrite Map-functional {m = m₁} k,v₁∈m₁ k,v₁'∈m₁
|
||||||
|
rewrite Map-functional {m = m₁ ⊔ (m₁ ⊓ m₂)} k,v∈m₁m₁₂ v₁v₁'v₂∈m₁m₁₂ =
|
||||||
|
(v₁' , (⊔₂-⊓₂-absorb , k,v₁'∈m₁))
|
||||||
|
... | (_ , (in₁ (single {v₁} k,v₁∈m₁) k∉km₁₂ , k,v₁∈m₁m₁₂))
|
||||||
|
rewrite Map-functional {m = m₁ ⊔ (m₁ ⊓ m₂)} k,v∈m₁m₁₂ k,v₁∈m₁m₁₂ =
|
||||||
|
(v₁ , (≈-refl , k,v₁∈m₁))
|
||||||
|
... | (_ , (in₂ k∉km₁ (bothⁱ (single {v₁'} k,v₁'∈m₁)
|
||||||
|
(single {v₂} k,v₂∈m₂)) , _)) =
|
||||||
|
absurd (k∉km₁ (∈-cong proj₁ k,v₁'∈m₁))
|
||||||
|
|
||||||
|
union-intersect-absorb₂ : subset m₁ (m₁ ⊔ (m₁ ⊓ m₂))
|
||||||
|
union-intersect-absorb₂ k v k,v∈m₁
|
||||||
|
with ∈k-dec k l₂
|
||||||
|
... | yes k∈km₂ =
|
||||||
|
let (v₂ , k,v₂∈m₂) = locate k∈km₂
|
||||||
|
in (v ⊔₂ (v ⊓₂ v₂) , (≈-sym ⊔₂-⊓₂-absorb , I⊔.union-combines u₁ (I⊓.intersect-preserves-Unique {l₁} {l₂} u₂) k,v∈m₁ (I⊓.intersect-combines u₁ u₂ k,v∈m₁ k,v₂∈m₂)))
|
||||||
|
... | no k∉km₂ = (v , (≈-refl , I⊔.union-preserves-∈₁ u₁ k,v∈m₁ (I⊓.intersect-preserves-∉₂ {k} {l₁} {l₂} k∉km₂)))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user