Skip to content

Commit

Permalink
Merge pull request #251 from TOTBWF/misc-reasoning
Browse files Browse the repository at this point in the history
Add some miscellaneous reasoning combinators
  • Loading branch information
JacquesCarette authored Feb 23, 2021
2 parents b9e4221 + 3cc6fc2 commit 4aa9650
Showing 1 changed file with 32 additions and 0 deletions.
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 ∎

0 comments on commit 4aa9650

Please sign in to comment.