view agda/revision.agda @ 105:e6499a50ccbd

Retrying prove monad-laws for delta
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Tue, 27 Jan 2015 17:49:25 +0900
parents ebd0d6e2772c
children
line wrap: on
line source

open import Relation.Binary.PropositionalEquality
module revision where

data Rev : Set where
  init   : Rev
  commit : Rev -> Rev

merge : Rev -> Rev -> Rev
merge init b       = commit b
merge (commit a) b = commit (merge a b)

tip : Rev -> Rev -> Rev
tip init init             = init
tip init (commit b)       = commit b
tip (commit a) init       = commit a
tip (commit a) (commit b) = commit (tip a b)

open ≡-Reasoning

same-tip : (a : Rev) -> tip a a ≡ a
same-tip init       = refl
same-tip (commit v) = begin
     tip (commit v) (commit v) ≡⟨ refl ⟩
     commit (tip v v)          ≡⟨ cong commit (same-tip v) ⟩
     commit v                  ∎