From da429008d25ac87ec67a4fb18a5cbee0ba756bcf Mon Sep 17 00:00:00 2001 From: Chloe Brown Date: Mon, 5 Apr 2021 14:31:57 +0100 Subject: Clean-up Language hierarchy. --- src/Cfe/Language/Properties.agda | 856 +++++++++++++++++++++++++++++++++++---- 1 file changed, 774 insertions(+), 82 deletions(-) (limited to 'src/Cfe/Language/Properties.agda') diff --git a/src/Cfe/Language/Properties.agda b/src/Cfe/Language/Properties.agda index 52b5470..5792216 100644 --- a/src/Cfe/Language/Properties.agda +++ b/src/Cfe/Language/Properties.agda @@ -1,123 +1,815 @@ {-# OPTIONS --without-K --safe #-} -open import Relation.Binary +open import Relation.Binary hiding (Decidable; Irrelevant; Recomputable) module Cfe.Language.Properties {c ℓ} (over : Setoid c ℓ) where -open Setoid over using () renaming (Carrier to C) +open Setoid over using () renaming (Carrier to C; _≈_ to _∼_; refl to ∼-refl) + +open import Algebra +open import Cfe.Function.Power open import Cfe.Language.Base over -open import Data.List +open import Cfe.List.Compare over +open import Data.Empty using (⊥-elim) +import Data.Fin as Fin +open import Data.List as L +open import Data.List.Properties open import Data.List.Relation.Binary.Equality.Setoid over -open import Function -open import Level hiding (Lift) +import Data.List.Relation.Unary.Any as Any +import Data.Nat as ℕ +open import Data.Product as P +open import Data.Sum as S +open import Function hiding (_⟶_) +open import Level renaming (suc to lsuc) +import Relation.Binary.Construct.On as On +open import Relation.Binary.PropositionalEquality hiding (setoid; [_]) +open import Relation.Nullary hiding (Irrelevant) +open import Relation.Nullary.Decidable +open import Relation.Nullary.Product using (_×-dec_) +open import Relation.Nullary.Sum using (_⊎-dec_) -≈-refl : ∀ {a} → Reflexive (_≈_ {a}) -≈-refl {x = A} = record - { f = id - ; f⁻¹ = id - } +private + variable + a b d ℓ₁ ℓ₂ : Level + A X : Language b + B Y : Language d + U Z : Language ℓ₁ + V : Language ℓ₂ + F : Language a → Language a + G : Language b → Language b -≈-sym : ∀ {a b} → Sym (_≈_ {a} {b}) _≈_ -≈-sym A≈B = record - { f = A≈B.f⁻¹ - ; f⁻¹ = A≈B.f - } - where - module A≈B = _≈_ A≈B + w++[]≋w : ∀ w → w ++ [] ≋ w + w++[]≋w [] = [] + w++[]≋w (x ∷ w) = ∼-refl ∷ w++[]≋w w + +------------------------------------------------------------------------ +-- Properties of _⊆_ +------------------------------------------------------------------------ +-- Relational properties of _⊆_ + +⊆-refl : Reflexive (_⊆_ {a}) +⊆-refl = sub id + +⊆-reflexive : (_≈_ {a} {b}) ⇒ _⊆_ +⊆-reflexive = proj₁ + +⊇-reflexive : (_≈_ {a} {b}) ⇒ flip _⊆_ +⊇-reflexive = proj₂ + +⊆-trans : Trans (_⊆_ {a}) (_⊆_ {b} {d}) _⊆_ +⊆-trans (sub A⊆B) (sub B⊆C) = sub (B⊆C ∘ A⊆B) + +⊆-antisym : Antisym (_⊆_ {a} {b}) _⊆_ _≈_ +⊆-antisym = _,_ + +------------------------------------------------------------------------ +-- Membership properties of _⊆_ + +∈-resp-⊆ : ∀ {w} → (w ∈_) ⟶ (w ∈_) Respects (_⊆_ {a} {b}) +∈-resp-⊆ (sub A⊆B) = A⊆B -≈-trans : ∀ {a b c} → Trans (_≈_ {a}) (_≈_ {b} {c}) _≈_ -≈-trans {i = A} {B} {C} A≈B B≈C = record - { f = B≈C.f ∘ A≈B.f - ; f⁻¹ = A≈B.f⁻¹ ∘ B≈C.f⁻¹ +∉-resp-⊇ : ∀ {w} → (w ∉_) ⟶ (w ∉_) Respects flip (_⊆_ {b} {a}) +∉-resp-⊇ (sub A⊇B) w∉A = w∉A ∘ A⊇B + +Null-resp-⊆ : Null {a} ⟶ Null {b} Respects _⊆_ +Null-resp-⊆ = ∈-resp-⊆ + +First-resp-⊆ : ∀ {c} → flip (First {a}) c ⟶ flip (First {a}) c Respects _⊆_ +First-resp-⊆ (sub A⊆B) = P.map₂ A⊆B + +Flast-resp-⊆ : ∀ {c} → flip (Flast {a}) c ⟶ flip (Flast {a}) c Respects _⊆_ +Flast-resp-⊆ (sub A⊆B) = P.map₂ (P.map₂ (P.map A⊆B (P.map₂ A⊆B))) + +------------------------------------------------------------------------ +-- Properties of _≈_ +------------------------------------------------------------------------ +-- Relational properties of _≈_ + +≈-refl : Reflexive (_≈_ {a}) +≈-refl = ⊆-refl , ⊆-refl + +≈-sym : Sym (_≈_ {a} {b}) _≈_ +≈-sym = P.swap + +≈-trans : Trans (_≈_ {a}) (_≈_ {b} {d}) _≈_ +≈-trans = P.zip ⊆-trans (flip ⊆-trans) + +------------------------------------------------------------------------ +-- Structures + +≈-isPartialEquivalence : IsPartialEquivalence (_≈_ {a}) +≈-isPartialEquivalence = record + { sym = ≈-sym + ; trans = ≈-trans } - where - module A≈B = _≈_ A≈B - module B≈C = _≈_ B≈C -≈-isEquivalence : ∀ {a} → IsEquivalence (_≈_ {a}) +≈-isEquivalence : IsEquivalence (_≈_ {a}) ≈-isEquivalence = record { refl = ≈-refl ; sym = ≈-sym ; trans = ≈-trans } -setoid : ∀ a → Setoid (c ⊔ ℓ ⊔ suc a) (c ⊔ ℓ ⊔ a) -setoid a = record { isEquivalence = ≈-isEquivalence {a} } - -≤-refl : ∀ {a} → Reflexive (_≤_ {a}) -≤-refl = record - { f = id +⊆-isPreorder : IsPreorder (_≈_ {a}) _⊆_ +⊆-isPreorder = record + { isEquivalence = ≈-isEquivalence + ; reflexive = ⊆-reflexive + ; trans = ⊆-trans } -≤-reflexive : ∀ {a b} → _≈_ {a} {b} ⇒ _≤_ -≤-reflexive A≈B = record - { f = A≈B.f +⊆-isPartialOrder : IsPartialOrder (_≈_ {a}) _⊆_ +⊆-isPartialOrder = record + { isPreorder = ⊆-isPreorder + ; antisym = ⊆-antisym } + +------------------------------------------------------------------------ +-- Bundles + +partialSetoid : PartialSetoid (c ⊔ ℓ ⊔ lsuc a) (c ⊔ ℓ ⊔ lsuc a) +partialSetoid {a} = record { isPartialEquivalence = ≈-isPartialEquivalence {a} } + +setoid : Setoid (c ⊔ ℓ ⊔ lsuc a) (c ⊔ ℓ ⊔ lsuc a) +setoid {a} = record { isEquivalence = ≈-isEquivalence {a} } + +⊆-preorder : Preorder (c ⊔ ℓ ⊔ lsuc a) (c ⊔ ℓ ⊔ lsuc a) (c ⊔ ℓ ⊔ lsuc a) +⊆-preorder {a} = record { isPreorder = ⊆-isPreorder {a} } + +⊆-poset : Poset (c ⊔ ℓ ⊔ lsuc a) (c ⊔ ℓ ⊔ lsuc a) (c ⊔ ℓ ⊔ lsuc a) +⊆-poset {a} = record { isPartialOrder = ⊆-isPartialOrder {a} } + +------------------------------------------------------------------------ +-- Membership properties of _≈_ + +∈-resp-≈ : ∀ {w} → (w ∈_) ⟶ (w ∈_) Respects (_≈_ {a} {b}) +∈-resp-≈ = ∈-resp-⊆ ∘ ⊆-reflexive + +∉-resp-≈ : ∀ {w} → (w ∉_) ⟶ (w ∉_) Respects flip (_≈_ {b} {a}) +∉-resp-≈ = ∉-resp-⊇ ∘ ⊆-reflexive + +Null-resp-≈ : Null {a} ⟶ Null {b} Respects _≈_ +Null-resp-≈ = Null-resp-⊆ ∘ ⊆-reflexive + +First-resp-≈ : ∀ {c} → flip (First {a}) c ⟶ flip (First {a}) c Respects _≈_ +First-resp-≈ = First-resp-⊆ ∘ ⊆-reflexive + +Flast-resp-≈ : ∀ {c} → flip (Flast {a}) c ⟶ flip (Flast {a}) c Respects _≈_ +Flast-resp-≈ = Flast-resp-⊆ ∘ ⊆-reflexive + +------------------------------------------------------------------------ +-- Proof properties of _≈_ + +Decidable-resp-≈ : Decidable {a} ⟶ Decidable {b} Respects _≈_ +Decidable-resp-≈ (sub A⊆B , sub A⊇B) A? l = map′ A⊆B A⊇B (A? l) + +Recomputable-resp-≈ : Recomputable {a} ⟶ Recomputable {b} Respects _≈_ +Recomputable-resp-≈ (sub A⊆B , sub A⊇B) recomp l∈B = A⊆B (recomp (A⊇B l∈B)) + +------------------------------------------------------------------------ +-- Properties of ∅ +------------------------------------------------------------------------ +-- Algebraic properties of ∅ + +⊆-min : Min (_⊆_ {a} {b}) ∅ +⊆-min _ = sub λ () + +------------------------------------------------------------------------ +-- Membership properties of ∅ + +w∉∅ : ∀ w → w ∉ ∅ {a} +w∉∅ _ () + +ε∉∅ : ¬ Null {a} ∅ +ε∉∅ () + +∄[First[∅]] : ∀ c → ¬ First {a} ∅ c +∄[First[∅]] _ () + +∄[Flast[∅]] : ∀ c → ¬ Flast {a} ∅ c +∄[Flast[∅]] _ () + +ε∉A+∄[First[A]]⇒A≈∅ : ¬ Null A → (∀ c → ¬ First A c) → A ≈ ∅ {a} +ε∉A+∄[First[A]]⇒A≈∅ {A = A} ε∉A cw∉A = + ⊆-antisym + (sub λ {w} w∈A → case ∃[ w ] w ∈ A ∋ w , w∈A of λ + { ([] , ε∈A) → lift (ε∉A ε∈A) + ; (c ∷ w , cw∈A) → lift (cw∉A c (w , cw∈A)) + }) + (⊆-min A) + +------------------------------------------------------------------------ +-- Proof properties of ∅ + +∅? : Decidable (∅ {a}) +∅? w = no λ () + +∅-irrelevant : Irrelevant (∅ {a}) +∅-irrelevant () + +∅-recomputable : Recomputable (∅ {a}) +∅-recomputable () + +------------------------------------------------------------------------ +-- Properties of {ε} +------------------------------------------------------------------------ +-- Membership properties of ∅ + +ε∈{ε} : Null ({ε}{a}) +ε∈{ε} = lift refl + +∄[First[{ε}]] : ∀ c → ¬ First ({ε} {a}) c +∄[First[{ε}]] _ () + +∄[Flast[{ε}]] : ∀ c → ¬ Flast ({ε} {a}) c +∄[Flast[{ε}]] _ () + +∄[First[A]]⇒A⊆{ε} : (∀ c → ¬ First A c) → A ⊆ {ε} {a} +∄[First[A]]⇒A⊆{ε} {A = A} cw∉A = + sub λ {w} w∈A → case ∃[ w ] w ∈ A ∋ w , w∈A return (λ (w , _) → w ∈ {ε}) of λ + { ([] , w∈A) → lift refl + ; (c ∷ w , cw∈A) → ⊥-elim (cw∉A c (w , cw∈A)) + } + +------------------------------------------------------------------------ +-- Proof properties of {ε} + +{ε}? : Decidable ({ε} {a}) +{ε}? [] = yes (lift refl) +{ε}? (_ ∷ _) = no λ () + +{ε}-irrelevant : Irrelevant ({ε} {a}) +{ε}-irrelevant (lift refl) (lift refl) = refl + +{ε}-recomputable : Recomputable ({ε} {a}) +{ε}-recomputable {w = []} _ = lift refl + +------------------------------------------------------------------------ +-- Properties of {_} +------------------------------------------------------------------------ +-- Membership properties of {_} + +ε∉{c} : ∀ c → ¬ Null { c } +ε∉{c} _ () + +c′∈First[{c}]⇒c∼c′ : ∀ {c c′} → First { c } c′ → c ∼ c′ +c′∈First[{c}]⇒c∼c′ (_ , c∼c′ ∷ []) = c∼c′ + +c∼c′⇒c′∈{c} : ∀ {c c′} → c ∼ c′ → [ c′ ] ∈ { c } +c∼c′⇒c′∈{c} c∼c′ = c∼c′ ∷ [] + +∄[Flast[{c}]] : ∀ {c} c′ → ¬ Flast { c } c′ +∄[Flast[{c}]] _ (_ , _ , _ ∷ [] , _ , _ ∷ ()) + +xyw∉{c} : ∀ c x y w → x ∷ y ∷ w ∉ { c } +xyw∉{c} c x y w (_ ∷ ()) + +------------------------------------------------------------------------ +-- Properties of _∙_ +------------------------------------------------------------------------ +-- Membership properties of _∙_ + +-- Null + +ε∈A⇒B⊆A∙B : ∀ (A : Language b) (B : Language d) → Null A → B ⊆ A ∙ B +ε∈A⇒B⊆A∙B _ _ ε∈A = sub λ w∈B → -, -, ε∈A , w∈B , ≋-refl + +ε∈B⇒A⊆A∙B : ∀ (A : Language b) (B : Language d) → Null B → A ⊆ A ∙ B +ε∈B⇒A⊆A∙B _ _ ε∈B = sub λ {w} w∈A → -, -, w∈A , ε∈B , w++[]≋w w + +ε∈A+ε∈B⇒ε∈A∙B : Null A → Null B → Null (A ∙ B) +ε∈A+ε∈B⇒ε∈A∙B ε∈A ε∈B = -, -, ε∈A , ε∈B , ≋-refl + +ε∈A∙B⇒ε∈A : ∀ (A : Language b) (B : Language d) → Null (A ∙ B) → Null A +ε∈A∙B⇒ε∈A _ _ ([] , [] , ε∈A , ε∈B , []) = ε∈A + +ε∈A∙B⇒ε∈B : ∀ (A : Language b) (B : Language d) → Null (A ∙ B) → Null B +ε∈A∙B⇒ε∈B _ _ ([] , [] , ε∈A , ε∈B , []) = ε∈B + +-- First + +c∈First[A]+w′∈B⇒c∈First[A∙B] : ∀ {c} → First A c → ∃[ w ] w ∈ B → First (A ∙ B) c +c∈First[A]+w′∈B⇒c∈First[A∙B] (_ , cw∈A) (_ , w′∈B) = -, -, -, cw∈A , w′∈B , ≋-refl + +ε∈A+c∈First[B]⇒c∈First[A∙B] : ∀ {c} → Null A → First B c → First (A ∙ B) c +ε∈A+c∈First[B]⇒c∈First[A∙B] ε∈A (_ , cw∈B) = -, -, -, ε∈A , cw∈B , ≋-refl + +-- Flast + +c∈Flast[B]+w∈A⇒c∈Flast[A∙B] : ∀ {c} → Flast B c → ∃[ w ] w ∈ A → Flast (A ∙ B) c +c∈Flast[B]+w∈A⇒c∈Flast[A∙B] (_ , _ , w∈B , _ , wcw′∈B) ( [] , ε∈A) = + -, -, (-, -, ε∈A , w∈B , ≋-refl) , -, -, -, ε∈A , wcw′∈B , ≋-refl +c∈Flast[B]+w∈A⇒c∈Flast[A∙B] {c = c} (x , w , xw∈B , w′ , xwcw′∈B) (c′ ∷ w′′ , c′w′′∈A) = + -, -, c′w′′xw∈A∙B , -, c′w′′xwcw′∈A∙B where - module A≈B = _≈_ A≈B + c′w′′xw∈A∙B = -, -, c′w′′∈A , xw∈B , ≋-refl + c′w′′xwcw′∈A∙B = -, -, c′w′′∈A , xwcw′∈B , ∼-refl ∷ ≋-reflexive (sym (++-assoc w′′ (x ∷ w) (c ∷ w′))) -≤-trans : ∀ {a b c} → Trans (_≤_ {a}) (_≤_ {b} {c}) _≤_ -≤-trans A≤B B≤C = record - { f = B≤C.f ∘ A≤B.f - } +ε∈B+x∈First[A]+c∈First[B]⇒c∈Flast[A∙B] : + ∀ {c} → Null B → ∃[ x ] First A x → First B c → Flast (A ∙ B) c +ε∈B+x∈First[A]+c∈First[B]⇒c∈Flast[A∙B] ε∈B (x , w , xw∈A) (_ , cw′∈B) = -, -, xw∈A∙B , -, xwcw′∈A∙B where - module A≤B = _≤_ A≤B - module B≤C = _≤_ B≤C + xw∈A∙B = -, -, xw∈A , ε∈B , w++[]≋w (x ∷ w) + xwcw′∈A∙B = -, -, xw∈A , cw′∈B , ≋-refl -≤-antisym : ∀ {a b} → Antisym (_≤_ {a} {b}) _≤_ _≈_ -≤-antisym A≤B B≤A = record - { f = A≤B.f - ; f⁻¹ = B≤A.f - } +ε∈B+c∈Flast[A]⇒c∈Flast[A∙B] : ∀ {c} → Null B → Flast A c → Flast (A ∙ B) c +ε∈B+c∈Flast[A]⇒c∈Flast[A∙B] {c = c} ε∈B (x , w , xw∈A , w′ , xwcw′∈A) = -, -, xw∈A∙B , -, xwcw′∈A∙B where - module A≤B = _≤_ A≤B - module B≤A = _≤_ B≤A + xw∈A∙B = -, -, xw∈A , ε∈B , w++[]≋w (x ∷ w) + xwcw′∈A∙B = -, -, xwcw′∈A , ε∈B , w++[]≋w (x ∷ w ++ c ∷ w′) -≤-min : ∀ {b} → Min (_≤_ {b = b}) ∅ -≤-min A = record - { f = λ () - } +------------------------------------------------------------------------ +-- Algebraic properties of _∙_ -≤-isPartialOrder : ∀ a → IsPartialOrder (_≈_ {a}) _≤_ -≤-isPartialOrder a = record - { isPreorder = record - { isEquivalence = ≈-isEquivalence - ; reflexive = ≤-reflexive - ; trans = ≤-trans - } - ; antisym = ≤-antisym +∙-mono : X ⊆ Y → U ⊆ V → X ∙ U ⊆ Y ∙ V +∙-mono (sub X⊆Y) (sub U⊆V) = sub λ (_ , _ , w₁∈X , w₂∈U , eq) → -, -, X⊆Y w₁∈X , U⊆V w₂∈U , eq + +∙-cong : X ≈ Y → U ≈ V → X ∙ U ≈ Y ∙ V +∙-cong X≈Y U≈V = ⊆-antisym + (∙-mono (⊆-reflexive X≈Y) (⊆-reflexive U≈V)) + (∙-mono (⊇-reflexive X≈Y) (⊇-reflexive U≈V)) + +∙-assoc : ∀ (A : Language a) (B : Language b) (C : Language d) → (A ∙ B) ∙ C ≈ A ∙ (B ∙ C) +∙-assoc A B C = + (sub λ {w} (w₁w₂ , w₃ , (w₁ , w₂ , w₁∈A , w₂∈B , eq₁) , w₃∈C , eq₂) → + -, -, w₁∈A , (-, -, w₂∈B , w₃∈C , ≋-refl) , + (begin + w₁ ++ w₂ ++ w₃ ≡˘⟨ ++-assoc w₁ w₂ w₃ ⟩ + (w₁ ++ w₂) ++ w₃ ≈⟨ ++⁺ eq₁ ≋-refl ⟩ + w₁w₂ ++ w₃ ≈⟨ eq₂ ⟩ + w ∎)) , + (sub λ {w} (w₁ , w₂w₃ , w₁∈A , (w₂ , w₃ , w₂∈B , w₃∈C , eq₁) , eq₂) → + -, -, (-, -, w₁∈A , w₂∈B , ≋-refl) , w₃∈C , + (begin + (w₁ ++ w₂) ++ w₃ ≡⟨ ++-assoc w₁ w₂ w₃ ⟩ + w₁ ++ w₂ ++ w₃ ≈⟨ ++⁺ ≋-refl eq₁ ⟩ + w₁ ++ w₂w₃ ≈⟨ eq₂ ⟩ + w ∎)) + where + open import Relation.Binary.Reasoning.Setoid ≋-setoid + +∙-identityˡ : ∀ (A : Language a) → {ε} {b} ∙ A ≈ A +∙-identityˡ A = + ⊆-antisym + (sub λ { (_ , _ , lift refl , w′∈A , eq) → A.∈-resp-≋ eq w′∈A }) + (ε∈A⇒B⊆A∙B {ε} A ε∈{ε}) + where + module A = Language A + +∙-identityʳ : ∀ (A : Language a) → A ∙ {ε} {b} ≈ A +∙-identityʳ X = + ⊆-antisym + (sub λ {w} → λ + { (w′ , _ , w′∈X , lift refl , eq) → + X.∈-resp-≋ + (begin + w′ ≈˘⟨ w++[]≋w w′ ⟩ + w′ ++ [] ≈⟨ eq ⟩ + w ∎) + w′∈X + }) + (ε∈B⇒A⊆A∙B X {ε} ε∈{ε}) + where + open import Relation.Binary.Reasoning.Setoid ≋-setoid + module X = Language X + +∙-identity : (∀ (A : Language a) → {ε} {b} ∙ A ≈ A) × (∀ (A : Language a) → A ∙ {ε} {b} ≈ A) +∙-identity = ∙-identityˡ , ∙-identityʳ + +∙-zeroˡ : ∀ (A : Language a) → ∅ {b} ∙ A ≈ ∅ {d} +∙-zeroˡ A = ⊆-antisym (sub λ ()) (⊆-min (∅ ∙ A)) + +∙-zeroʳ : ∀ (A : Language a) → A ∙ ∅ {b} ≈ ∅ {d} +∙-zeroʳ A = ⊆-antisym (sub λ ()) (⊆-min (A ∙ ∅)) + +∙-zero : (∀ (A : Language a) → ∅ {b} ∙ A ≈ ∅ {d}) × (∀ (A : Language a) → A ∙ ∅ {b} ≈ ∅ {d}) +∙-zero = ∙-zeroˡ , ∙-zeroʳ + +-- Structures + +∙-isMagma : ∀ {a} → IsMagma _≈_ (_∙_ {c ⊔ ℓ ⊔ a}) +∙-isMagma = record + { isEquivalence = ≈-isEquivalence + ; ∙-cong = ∙-cong } -poset : ∀ a → Poset (c ⊔ ℓ ⊔ suc a) (c ⊔ ℓ ⊔ a) (c ⊔ a) -poset a = record { isPartialOrder = ≤-isPartialOrder a } +∙-isSemigroup : ∀ {a} → IsSemigroup _≈_ (_∙_ {c ⊔ ℓ ⊔ a}) +∙-isSemigroup {a} = record + { isMagma = ∙-isMagma {a} + ; assoc = ∙-assoc + } -<-trans : ∀ {a b c} → Trans (_<_ {a}) (_<_ {b} {c}) _<_ -<-trans A cmp +... | tri< l _ _ = ⊥-elim (∄[l₁∩f₂] (c∈Flast[A] , c∈First[B])) + where + module A = Language A + module B = Language B + lsplit = left-split cmp l + xw∈A = x′w₁′∈A + xwcw′∈A = A.∈-resp-≋ ((proj₁ ∘ proj₂ ∘ proj₂) lsplit) xw₁∈A + cw′∈B = B.∈-resp-≋ (≋-sym ((proj₂ ∘ proj₂ ∘ proj₂) lsplit)) w₂′∈B + c∈Flast[A] = -, -, xw∈A , -, xwcw′∈A + c∈First[B] = -, cw′∈B +... | tri≈ _ e _ = proj₁ (eq-split cmp e) +... | tri> _ _ r = ⊥-elim (∄[l₁∩f₂] (c∈Flast[A] , c∈First[B])) where - module A cmp +... | tri< l _ _ = ⊥-elim (∄[l₁∩f₂] (c∈Flast[A] , c∈First[B])) + where + module A = Language A + module B = Language B + lsplit = left-split cmp l + xw∈A = x′w₁′∈A + xwcw′∈A = A.∈-resp-≋ ((proj₁ ∘ proj₂ ∘ proj₂) lsplit) xw₁∈A + cw′∈B = B.∈-resp-≋ (≋-sym ((proj₂ ∘ proj₂ ∘ proj₂) lsplit)) w₂′∈B + c∈Flast[A] = -, -, xw∈A , -, xwcw′∈A + c∈First[B] = -, cw′∈B +... | tri≈ _ e _ = proj₂ (eq-split cmp e) +... | tri> _ _ r = ⊥-elim (∄[l₁∩f₂] (c∈Flast[A] , c∈First[B])) where - module A≈B = _≈_ A≈B - module A