Skip to content

Instantly share code, notes, and snippets.

@mlieberman85
Created July 20, 2016 01:55
Show Gist options
  • Save mlieberman85/a63b8a311fb27cb1f639c85ad69f1459 to your computer and use it in GitHub Desktop.
Save mlieberman85/a63b8a311fb27cb1f639c85ad69f1459 to your computer and use it in GitHub Desktop.
xor-linear : ∀ {n} (x y : BitVector n) → bitwise-xor x y ≡ zipWith _xor_ x y
xor-linear x y = refl
xor-comm : ∀ {n} (x y : BitVector n) → bitwise-xor x y ≡ bitwise-xor y x
xor-comm [] [] = refl
xor-comm (0# ∷ xs) (0# ∷ ys) rewrite xor-comm xs ys = refl
xor-comm (0# ∷ xs) (1# ∷ ys) rewrite xor-comm xs ys = refl
xor-comm (1# ∷ xs) (0# ∷ ys) rewrite xor-comm xs ys = refl
xor-comm (1# ∷ xs) (1# ∷ ys) rewrite xor-comm xs ys = refl
xor-involution : ∀ {n} (x y : BitVector n) → bitwise-xor (bitwise-xor x y) y ≡ x
xor-involution [] [] = refl
xor-involution (0# ∷ xs) (0# ∷ ys) rewrite xor-involution xs ys = refl
xor-involution (0# ∷ xs) (1# ∷ ys) rewrite xor-involution xs ys = refl
xor-involution (1# ∷ xs) (0# ∷ ys) rewrite xor-involution xs ys = refl
xor-involution (1# ∷ xs) (1# ∷ ys) rewrite xor-involution xs ys = refl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment