module Base.Syntax.Vars
(Type : Set)
where
open import Base.Syntax.Context Type
open import Relation.Binary.PropositionalEquality
open import Data.Unit
open import Data.Sum
open import Data.Bool
open import Base.Data.DependentList public
Free : Type → Set
Free _ = Bool
Vars : Context → Set
Vars = DependentList Free
none : {Γ : Context} → Vars Γ
none = tabulate (λ _ → false)
singleton : ∀ {τ Γ} → Var Γ τ → Vars Γ
singleton {Γ = τ • Γ₀} this = true • none
singleton (that x) = false • singleton x
infixl 6 _∪_
_∪_ : ∀ {Γ} → Vars Γ → Vars Γ → Vars Γ
_∪_ = zipWith _∨_
empty? : ∀ {Γ} → (vs : Vars Γ) → (vs ≡ none) ⊎ ⊤
empty? ∅ = inj₁ refl
empty? (true • vs) = inj₂ tt
empty? (false • vs) with empty? vs
... | inj₁ vs=∅ = inj₁ (cong₂ _•_ refl vs=∅)
... | inj₂ _ = inj₂ tt