Skip to content
Closed
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Important changes since 0.16:
Non-backwards compatible changes
--------------------------------

#### New results regarding cancellative operators

* `Algebra.FunctionProperties.Consequences` now contains a proof of the
equi-provability of left and right cancellation for a binary operator,
provided we have access to an injective function that is contravariant on the operation.

#### New codata library

* A new `Codata` library using copatterns and sized types rather
Expand Down
6 changes: 6 additions & 0 deletions src/Algebra/FunctionProperties.agda
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ _DistributesOver_ : Op₂ A → Op₂ A → Set _
_IdempotentOn_ : Op₂ A → A → Set _
_∙_ IdempotentOn x = (x ∙ x) ≈ x

_ContravariantOn_ : Op₁ A → Op₂ A → Set _
f ContravariantOn _∙_ = ∀ x y → f (x ∙ y) ≈ (f y ∙ f x)

_NecessarilyIdempotentFor_ : A → Op₂ A → Set _
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the discussion in #392 I think (modulo any further comments from @andreasabel) I think we've decided we're going to call this property Conical. No need for any infix notation I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conical would be inappropraite in this case --no monoid, no any geometry is present.

Even if it were an acceptable name, as mentioned in the other thread for monoidal units being necessairly idempotent, then the usage would be misleading since one might expect a monoid.

The result is for an arbitrary element z, and the name NecessarilyIdempotentFor accurately captures the property.

z NecessarilyIdempotentFor _∙_ = ∀ x y → (x ∙ y) ≈ z → (x ≈ z) × (y ≈ z)

Idempotent : Op₂ A → Set _
Idempotent ∙ = ∀ x → ∙ IdempotentOn x

Expand Down
20 changes: 20 additions & 0 deletions src/Algebra/FunctionProperties/Consequences.agda
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ open import Algebra.FunctionProperties _≈_
open import Relation.Binary.EqReasoning S
open import Data.Sum using (inj₁; inj₂)
open import Data.Product using (proj₁; proj₂)
open import Function.Injection using (Injection)

------------------------------------------------------------------------
-- Existence of identity elements
Expand Down Expand Up @@ -164,6 +165,25 @@ comm+cancelʳ⇒cancelˡ {_•_} comm cancelʳ x {y} {z} eq = cancelʳ y z (begi
x • z ≈⟨ comm x z ⟩
z • x ∎)

module InjectiveContravariantOperator {_•_ : Op₂ Carrier} (dual : Injection S S)
(let open Injection dual renaming (_⟨$⟩_ to _˘))
(contravariant : _˘ ContravariantOn _•_)
where

cancelʳ⇒cancelˡ : RightCancellative _•_ → LeftCancellative _•_
cancelʳ⇒cancelˡ cancelʳ x {y} {z} xy≈xz = injective (cancelʳ _ _ (begin
(y ˘) • (x ˘) ≈⟨ sym (contravariant _ _) ⟩
(x • y) ˘ ≈⟨ cong xy≈xz ⟩
(x • z) ˘ ≈⟨ contravariant _ _ ⟩
(z ˘) • (x ˘) ∎))

cancelˡ⇒cancelʳ : LeftCancellative _•_ → RightCancellative _•_
cancelˡ⇒cancelʳ cancelˡ {x} y z yx≈zx = injective (cancelˡ _ ( begin
(x ˘) • (y ˘) ≈⟨ sym (contravariant _ _) ⟩
(y • x) ˘ ≈⟨ cong yx≈zx ⟩
(z • x) ˘ ≈⟨ contravariant _ _ ⟩
(x ˘) • (z ˘) ∎ ) )

------------------------------------------------------------------------
-- Selectivity implies idempotence

Expand Down