Skip to content

Instantly share code, notes, and snippets.

@larrytheliquid
Created February 3, 2013 15:23
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 larrytheliquid/4702167 to your computer and use it in GitHub Desktop.
Save larrytheliquid/4702167 to your computer and use it in GitHub Desktop.
Trail equality
module TrailEquality where
open import Relation.Binary.PropositionalEquality
open import Relation.Binary.HeterogeneousEquality
data Maybe (A : Set) : Set where
just : (x : A) → Maybe A
nothing : Maybe A
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
data Trail : ℕ → Set where
beginning : Trail zero
route : ∀{n} (f : ℕ → ℕ) (t : Trail n) → Trail (f n)
caseTrail : (P : ∀{n} → Trail n → Set)
→ P beginning
→ ({n : ℕ} (f : ℕ → ℕ) (t : Trail n) → P t → P (route f t))
→ ∀{n} (t : Trail n) → P t
caseTrail P pb pr beginning = pb
caseTrail P pb pr (route f t) = pr f t (caseTrail P pb pr t)
compare : ∀ {n} (x y : Trail n) → Maybe (x ≡ y)
compare beginning y = {!!}
compare (route f x) y = {!!}
-- compare : ∀ {m n} (x : Trail m) (y : Trail n) → m ≡ n → Maybe (x ≅ y)
-- compare beginning beginning refl = just refl
-- compare (route f x) (route g y) p = {!!}
-- compare _ _ _ = nothing
-- compare : ∀ {m n} (x : Trail m) (y : Trail n) → Maybe (x ≅ y)
-- compare beginning beginning = just refl
-- compare (route f x) (route g y) with compare x y
-- compare (route f x) (route g y) | just p = {!!}
-- compare (route f x) (route g y) | nothing = nothing
-- compare _ _ = nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment