Voe: gone back to equational reasoning, as it's fairly cheap now.

This commit is contained in:
Andrea Vezzosi 2018-05-16 10:50:56 +02:00
parent 9f7a13b5da
commit 47c881ba2a

View file

@ -141,10 +141,19 @@ module voe {a b : Level} ( : Category a b) where
back = §1-fromMonad Kleisli→Monoidal §2-3.§2.toMonad back = §1-fromMonad Kleisli→Monoidal §2-3.§2.toMonad
forthEq : m (forth back) m m forthEq : m (forth back) m m
forthEq m = trans forthEq m = begin
(trans (cong-d (§2-fromMonad Monoidal→Kleisli) (lemmaz (Kleisli→Monoidal (§2-3.§2.toMonad m)))) §2-fromMonad
(cong-d (\ φ §2-fromMonad (φ (§2-3.§2.toMonad m))) re-ve)) (Monoidal→Kleisli
lemma (§2-3.§1.toMonad
(§1-fromMonad (Kleisli→Monoidal (§2-3.§2.toMonad m)))))
≡⟨ cong-d (§2-fromMonad Monoidal→Kleisli) (lemmaz (Kleisli→Monoidal (§2-3.§2.toMonad m)))
§2-fromMonad
((Monoidal→Kleisli Kleisli→Monoidal)
(§2-3.§2.toMonad m))
≡⟨ (cong-d (\ φ §2-fromMonad (φ (§2-3.§2.toMonad m))) re-ve)
(§2-fromMonad §2-3.§2.toMonad) m
≡⟨ lemma
m
where where
lemma : (§2-fromMonad §2-3.§2.toMonad) m m lemma : (§2-fromMonad §2-3.§2.toMonad) m m
§2-3.§2.bind (lemma i) = §2-3.§2.bind m §2-3.§2.bind (lemma i) = §2-3.§2.bind m
@ -154,10 +163,23 @@ module voe {a b : Level} ( : Category a b) where
M.Monad.isMonad (lemmaz m i) = M.Monad.isMonad m M.Monad.isMonad (lemmaz m i) = M.Monad.isMonad m
backEq : m (back forth) m m backEq : m (back forth) m m
backEq m = trans (cong-d (§1-fromMonad Kleisli→Monoidal) (lemma (Monoidal→Kleisli (§2-3.§1.toMonad m)))) backEq m = begin
(trans (cong-d (\ φ §1-fromMonad (φ (§2-3.§1.toMonad m))) ve-re) §1-fromMonad
lemmaz) (Kleisli→Monoidal
(§2-3.§2.toMonad
(§2-fromMonad (Monoidal→Kleisli (§2-3.§1.toMonad m)))))
≡⟨ cong-d (§1-fromMonad Kleisli→Monoidal) (lemma (Monoidal→Kleisli (§2-3.§1.toMonad m)))
§1-fromMonad
((Kleisli→Monoidal Monoidal→Kleisli)
(§2-3.§1.toMonad m))
≡⟨ (cong-d (\ φ §1-fromMonad (φ (§2-3.§1.toMonad m))) ve-re)
§1-fromMonad (§2-3.§1.toMonad m)
≡⟨ lemmaz
m
where where
-- having eta equality on causes roughly the same work as checking this proof of foo,
-- which is quite expensive because it ends up reducing complex terms.
-- rhs = §1-fromMonad (Kleisli→Monoidal ((Monoidal→Kleisli (§2-3.§1.toMonad m)))) -- rhs = §1-fromMonad (Kleisli→Monoidal ((Monoidal→Kleisli (§2-3.§1.toMonad m))))
-- foo : §1-fromMonad (Kleisli→Monoidal (§2-3.§2.toMonad (§2-fromMonad (Monoidal→Kleisli (§2-3.§1.toMonad m))))) -- foo : §1-fromMonad (Kleisli→Monoidal (§2-3.§2.toMonad (§2-fromMonad (Monoidal→Kleisli (§2-3.§1.toMonad m)))))
-- ≡ §1-fromMonad (Kleisli→Monoidal ((Monoidal→Kleisli (§2-3.§1.toMonad m)))) -- ≡ §1-fromMonad (Kleisli→Monoidal ((Monoidal→Kleisli (§2-3.§1.toMonad m))))