11open import Vatras.Framework.Definitions using (𝔽; 𝔸)
22-- We assume the existence of at least one atom.
3- module Vatras.Translation.Lang.VariantList-to-VT (F : 𝔽) (f : F) where
3+ module Vatras.Translation.Lang.VariantList-to-VT where
44
55open import Data.Bool as Bool using (if_then_else_; true; false)
66open import Data.List using (List; []; _∷_; _++_)
@@ -26,8 +26,8 @@ open import Vatras.Framework.Relation.Expressiveness Forest using (_≽_; expres
2626
2727open import Vatras.Lang.VariantList Forest as VariantList using (VariantList; VariantListL)
2828open import Vatras.Lang.VariantList.Properties Forest using (VariantList-is-Complete)
29- open import Vatras.Lang.VT (Indexed F)
30- open import Vatras.Lang.VT.Encode (Indexed F)
29+ open import Vatras.Lang.VT ℕ
30+ open import Vatras.Lang.VT.Encode ℕ
3131
3232{-|
3333This function encodes a non-empty list of forests into a rootless variation tree.
@@ -41,7 +41,7 @@ Arguments:
4141translate' : ∀ {A} → ℕ → Forest A → List (Forest A) → List (UnrootedVT A)
4242translate' n x [] = encode-forest x
4343translate' n x (y ∷ ys) =
44- if[ var (f , n) ]then[
44+ if[ var n ]then[
4545 encode-forest x
4646 ]else[
4747 translate' (suc n) y ys
@@ -52,10 +52,10 @@ translate (x ∷ xs) = if-true[ translate' zero x xs ]
5252
5353{-|
5454A variation tree created by "translate" from a list l produces a forest
55- from the list at index i when exactly the feature (f , i) is set to true.
55+ from the list at index i when exactly the feature i is set to true.
5656-}
5757conf : ℕ → Configuration
58- conf i (_ , j) = i ≡ᵇ j
58+ conf = _≡ᵇ_
5959
6060{-|
6161From a configuration, we can compute the index of the produced variant in the initial list.
@@ -68,7 +68,7 @@ The "offset" value is needed for induction to specify at which point in a sublis
6868fnoci : (offset max i : ℕ) → Configuration → ℕ
6969fnoci offset max zero c = max
7070fnoci offset max (suc i) c =
71- if c (f , offset + (max ∸ suc i))
71+ if c (offset + (max ∸ suc i))
7272 then max ∸ suc i
7373 else fnoci offset max i c
7474
@@ -86,7 +86,7 @@ fnoci-invariant x xs n m zero c z≤n = refl
8686fnoci-invariant x xs n (suc m) (suc i) c (s≤s i≤m)
8787 rewrite +-∸-assoc 1 i≤m
8888 | sym (+-suc n (m ∸ i))
89- with c (f , n + suc (m ∸ i))
89+ with c (n + suc (m ∸ i))
9090... | true = refl
9191... | false = fnoci-invariant x xs n (suc m) i c (m≤n⇒m≤1+n i≤m)
9292
@@ -141,7 +141,7 @@ module Preservation (A : 𝔸) where
141141 configure-all c (translate' n x xs)
142142 ≡ VariantList.⟦ x ∷ xs ⟧ (fnoci n (List⁺.length (x ∷ xs)) (List⁺.length (x ∷ xs)) c)
143143 translate'-preserves-fnoc x [] n c = encode-idemp Forest A encoder c x
144- translate'-preserves-fnoc x (y ∷ ys) n c with c (f , n) in eq
144+ translate'-preserves-fnoc x (y ∷ ys) n c with c n in eq
145145 ... | true rewrite n∸n≡0 (List⁺.length (y ∷ ys)) | +-identityʳ n | eq =
146146 begin
147147 configure-all c (encode-forest x) ++ []
0 commit comments