csci8980-f21/extra/broken.lagda
2019-01-08 14:11:20 +00:00

19 lines
473 B
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Our first corollary: rearranging
We can apply associativity to rearrange parentheses however we like.
Here is an example.
\begin{code}
+-rearrange : ∀ (m n p q : ) → (m + n) + (p + q) ≡ m + ((n + p) + q)
+-rearrange m n p q =
begin
(m + n) + (p + q)
≡⟨ +-assoc m n (p + q) ⟩
m + (n + (p + q))
≡⟨ cong (m +_) (sym (+-assoc n p q)) ⟩
m + ((n + p) + q)
≡⟨ sym (+-assoc m (n + p) q) ⟩
(m + (n + p)) + q
\end{code}