Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some miscellaneous reasoning combinators #251

Merged
merged 1 commit into from
Feb 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/Categories/Morphism/Reasoning/Core.agda
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ module IntroElim (a≡id : a ≈ id) where
introˡ : f ≈ a ∘ f
introˡ = Equiv.sym elimˡ

intro-center : f ∘ g ≈ f ∘ a ∘ g
intro-center = ∘-resp-≈ʳ introˡ

elim-center : f ∘ a ∘ g ≈ f ∘ g
elim-center = ∘-resp-≈ʳ elimˡ

open IntroElim public

module Extends (s : CommutativeSquare f g h i) where
Expand Down Expand Up @@ -194,12 +200,18 @@ module Cancellers (inv : h ∘ i ≈ id) where
f ∘ id ≈⟨ identityʳ ⟩
f ∎

insertʳ : f ≈ (f ∘ h) ∘ i
insertʳ = Equiv.sym cancelʳ

cancelˡ : h ∘ (i ∘ f) ≈ f
cancelˡ {f = f} = begin
h ∘ (i ∘ f) ≈⟨ pullˡ inv ⟩
id ∘ f ≈⟨ identityˡ ⟩
f ∎

insertˡ : f ≈ h ∘ (i ∘ f)
insertˡ = Equiv.sym cancelˡ

cancelInner : (f ∘ h) ∘ (i ∘ g) ≈ f ∘ g
cancelInner {f = f} {g = g} = begin
(f ∘ h) ∘ (i ∘ g) ≈⟨ pullˡ cancelʳ ⟩
Expand Down Expand Up @@ -230,3 +242,23 @@ pull-first {f = f} {g = g} {a = a} {h = h} {i = i} eq = begin
f ∘ (g ∘ h) ∘ i ≈⟨ refl⟩∘⟨ assoc ⟩
f ∘ g ∘ h ∘ i ≈⟨ pullˡ eq ⟩
a ∘ h ∘ i ∎

pull-center : g ∘ h ≈ a → f ∘ g ∘ h ∘ i ≈ f ∘ a ∘ i
pull-center eq = ∘-resp-≈ʳ (pullˡ eq)

push-center : g ∘ h ≈ a → f ∘ a ∘ i ≈ f ∘ g ∘ h ∘ i
push-center eq = Equiv.sym (pull-center eq)

intro-first : a ∘ b ≈ id → f ∘ g ≈ a ∘ (b ∘ f) ∘ g
intro-first {a = a} {b = b} {f = f} {g = g} eq = begin
f ∘ g ≈⟨ introˡ eq ⟩
(a ∘ b) ∘ f ∘ g ≈⟨ assoc ⟩
a ∘ b ∘ f ∘ g ≈˘⟨ refl⟩∘⟨ assoc ⟩
a ∘ (b ∘ f) ∘ g ∎

intro-last : a ∘ b ≈ id → f ∘ g ≈ f ∘ (g ∘ a) ∘ b
intro-last {a = a} {b = b} {f = f} {g = g} eq = begin
f ∘ g ≈⟨ introʳ eq ⟩
(f ∘ g) ∘ a ∘ b ≈⟨ assoc ⟩
f ∘ g ∘ a ∘ b ≈˘⟨ refl⟩∘⟨ assoc ⟩
f ∘ (g ∘ a) ∘ b ∎