Skip to content

Commit b0ea369

Browse files
committed
refactor: simplify Translation.Lang.VariantList-to-VT
1 parent 3ad62bc commit b0ea369

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/Vatras/Translation/Lang/VariantList-to-VT.agda

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
open 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

55
open import Data.Bool as Bool using (if_then_else_; true; false)
66
open import Data.List using (List; []; _∷_; _++_)
@@ -26,8 +26,8 @@ open import Vatras.Framework.Relation.Expressiveness Forest using (_≽_; expres
2626

2727
open import Vatras.Lang.VariantList Forest as VariantList using (VariantList; VariantListL)
2828
open 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
{-|
3333
This function encodes a non-empty list of forests into a rootless variation tree.
@@ -41,7 +41,7 @@ Arguments:
4141
translate' : {A} Forest A List (Forest A) List (UnrootedVT A)
4242
translate' n x [] = encode-forest x
4343
translate' 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
{-|
5454
A 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
-}
5757
conf : Configuration
58-
conf i (_ , j) = i ≡ᵇ j
58+
conf = _≡ᵇ_
5959

6060
{-|
6161
From 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
6868
fnoci : (offset max i : ℕ) Configuration
6969
fnoci offset max zero c = max
7070
fnoci 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
8686
fnoci-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) ++ []

src/Vatras/Translation/LanguageMap.lagda.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,8 @@ open import Vatras.Lang.VariantList.Properties
371371
ADT-is-sound-on : ∀ {F : 𝔽} (V : 𝕍) (_==_ : DecidableEquality F) → Sound-on V (ADTL F V)
372372
ADT-is-sound-on {F} V _==_ = soundness-by-expressiveness-on V (VariantList-is-sound-on V) (ADT-to-VariantList.VariantList≽ADT F V _==_)
373373
374-
VT-is-complete : ∀ (F : 𝔽) (f : F) → Complete-on Forest (VTL (Indexed F))
375-
VT-is-complete F f = VariantList-to-VT.VT-is-complete F f
374+
VT-is-complete : Complete-on Forest (VTL )
375+
VT-is-complete = VariantList-to-VT.VT-is-complete
376376
377377
VT-is-sound : ∀ {F : 𝔽} (_==_ : DecidableEquality F) → Sound-on Forest (VTL F)
378378
VT-is-sound {F} _==_ = soundness-by-expressiveness-on Forest (ADT-is-sound-on Forest _==_) (VT-to-ADT.ADT≽VT F)

0 commit comments

Comments
 (0)