Skip to content

Instantly share code, notes, and snippets.

@gallais
Created June 2, 2018 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gallais/8a689a20373d643896a643ef10eefc88 to your computer and use it in GitHub Desktop.
Save gallais/8a689a20373d643896a643ef10eefc88 to your computer and use it in GitHub Desktop.
Names with offsets
open import Data.String.Base
open import Data.Nat.Base
open import Data.List.Base
open import Relation.Binary.PropositionalEquality
infix 5 _at_
record Variable : Set where
constructor _at_
field name : String
offset : ℕ
open Variable public
infix 3 _∈_
data _∈_ : Variable → List String → Set where
here : ∀ {s xs} → s at 0 ∈ s ∷ xs
next : ∀ {s t xs} → s ∈ xs → name s ≢ t → s ∈ t ∷ xs
skip : ∀ {s n xs} → s at n ∈ xs → s at suc n ∈ s ∷ xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment