Skip to content

Rename preorder ~ relation reasoning combinators #2156

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

Merged
merged 1 commit into from
Oct 16, 2023
Merged
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: 4 additions & 2 deletions src/Codata/Musical/Colist.agda
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,12 @@ module ⊑-Reasoning {a} {A : Set a} where
module ⊆-Reasoning {A : Set a} where
private module Base = PreR (⊆-Preorder A)

open Base public hiding (step-∼)
open Base public
hiding (step-≲; step-∼)
renaming (≲-go to ⊆-go)

open begin-membership-syntax _IsRelatedTo_ _∈_ (λ x → begin x)
open ⊆-syntax _IsRelatedTo_ _IsRelatedTo_ Base.∼-go public
open ⊆-syntax _IsRelatedTo_ _IsRelatedTo_ -go public


-- take returns a prefix.
Expand Down
6 changes: 4 additions & 2 deletions src/Data/Integer/Divisibility/Signed.agda
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ open _∣_ using (quotient) public
module ∣-Reasoning where
private module Base = PreorderReasoning ∣-preorder

open Base public hiding (step-∼; step-≈; step-≈˘)
open Base public
hiding (step-≲; step-∼; step-≈; step-≈˘)
renaming (≲-go to ∣-go)

open ∣-syntax _IsRelatedTo_ _IsRelatedTo_ -go public
open ∣-syntax _IsRelatedTo_ _IsRelatedTo_ -go public

------------------------------------------------------------------------
-- Other properties of _∣_
Expand Down
4 changes: 2 additions & 2 deletions src/Data/List/Relation/Binary/BagAndSetEquality.agda
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ module ⊆-Reasoning {A : Set a} where
private module Base = PreorderReasoning (⊆-preorder A)

open Base public
hiding (step-≈; step-≈˘; step-∼)
renaming (-go to ⊆-go)
hiding (step-≈; step-≈˘; step-∼; step-≲)
renaming (-go to ⊆-go)

open begin-membership-syntax _IsRelatedTo_ _∈_ (λ x → begin x) public
open ⊆-syntax _IsRelatedTo_ _IsRelatedTo_ ⊆-go public
Expand Down
8 changes: 5 additions & 3 deletions src/Data/List/Relation/Binary/Subset/Setoid/Properties.agda
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,13 @@ module ⊆-Reasoning (S : Setoid a ℓ) where

private module Base = PreorderReasoning (⊆-preorder S)

open Base public hiding (step-∼; step-≈; step-≈˘)
open Base public
hiding (step-≲; step-≈; step-≈˘; step-∼)
renaming (≲-go to ⊆-go; ≈-go to ≋-go)

open begin-membership-syntax _IsRelatedTo_ _∈_ (λ x → Base.begin x) public
open ⊆-syntax _IsRelatedTo_ _IsRelatedTo_ Base.∼-go public
open ≋-syntax _IsRelatedTo_ _IsRelatedTo_ Base.≈-go public
open ⊆-syntax _IsRelatedTo_ _IsRelatedTo_ -go public
open ≋-syntax _IsRelatedTo_ _IsRelatedTo_ -go public

------------------------------------------------------------------------
-- Relationship with other binary relations
Expand Down
6 changes: 4 additions & 2 deletions src/Data/Nat/Divisibility.agda
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ suc n ∣? m = Dec.map (m%n≡0⇔n∣m m (suc n)) (m % suc n ≟ 0)
module ∣-Reasoning where
private module Base = PreorderReasoning ∣-preorder

open Base public hiding (step-≈; step-≈˘; step-∼)
open Base public
hiding (step-≈; step-≈˘; step-∼; step-≲)
renaming (≲-go to ∣-go)

open ∣-syntax _IsRelatedTo_ _IsRelatedTo_ Base.∼-go public
open ∣-syntax _IsRelatedTo_ _IsRelatedTo_ -go public

------------------------------------------------------------------------
-- Simple properties of _∣_
Expand Down
4 changes: 2 additions & 2 deletions src/Data/Rational/Properties.agda
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ drop-*≡* (*≡* eq) = eq
... | refl = refl

≃-sym : Symmetric _≃_
≃-sym = ≡⇒≃ ∘′ sym ∘′ ≃⇒≡
≃-sym = ≡⇒≃ ∘′ sym ∘′ ≃⇒≡

------------------------------------------------------------------------
-- Properties of ↥
Expand Down Expand Up @@ -753,7 +753,7 @@ module ≤-Reasoning where

≃-go : Trans _≃_ _IsRelatedTo_ _IsRelatedTo_
≃-go = Triple.≈-go ∘′ ≃⇒≡

open ≃-syntax _IsRelatedTo_ _IsRelatedTo_ ≃-go (λ {x y} → ≃-sym {x} {y}) public

------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Rational/Unnormalised/Properties.agda
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ p≃0⇒↥p≡0 p (*≡* eq) = begin
↥ p ℤ.* 1ℤ ≡⟨ eq ⟩
0ℤ ∎
where open ≡-Reasoning

↥p≡↥q≡0⇒p≃q : ∀ p q → ↥ p ≡ 0ℤ → ↥ q ≡ 0ℤ → p ≃ q
↥p≡↥q≡0⇒p≃q p q ↥p≡0 ↥q≡0 = ≃-trans (↥p≡0⇒p≃0 p ↥p≡0) (≃-sym (↥p≡0⇒p≃0 _ ↥q≡0))

Expand Down
2 changes: 1 addition & 1 deletion src/Function/Bundles.agda
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ module _ {A : Set a} {B : Set b} where

module _ {From : Setoid a ℓ₁} {To : Setoid b ℓ₂} where
open Setoid

infixl 5 _⟨$⟩_
_⟨$⟩_ : Func From To → Carrier From → Carrier To
_⟨$⟩_ = Func.to
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ module _ {i t} {I : Set i} (T : Rel I t) where
module StarReasoning {i t} {I : Set i} (T : Rel I t) where
private module Base = PreorderReasoning (preorder T)

open Base public hiding (step-≈; step-∼)
open Base public
hiding (step-≈; step-∼; step-≲)
renaming (≲-go to ⟶-go)

open ⟶-syntax _IsRelatedTo_ _IsRelatedTo_ (Base.∼-go ∘ (_◅ ε)) public
open ⟶*-syntax _IsRelatedTo_ _IsRelatedTo_ Base.∼-go public
open ⟶-syntax _IsRelatedTo_ _IsRelatedTo_ (-go ∘ (_◅ ε)) public
open ⟶*-syntax _IsRelatedTo_ _IsRelatedTo_ -go public
33 changes: 24 additions & 9 deletions src/Relation/Binary/Reasoning/Base/Double.agda
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ open import Relation.Binary.Reasoning.Syntax


module Relation.Binary.Reasoning.Base.Double {a ℓ₁ ℓ₂} {A : Set a}
{_≈_ : Rel A ℓ₁} {__ : Rel A ℓ₂} (isPreorder : IsPreorder _≈_ __)
{_≈_ : Rel A ℓ₁} {__ : Rel A ℓ₂} (isPreorder : IsPreorder _≈_ __)
where

open IsPreorder isPreorder
Expand All @@ -32,24 +32,24 @@ open IsPreorder isPreorder
infix 4 _IsRelatedTo_

data _IsRelatedTo_ (x y : A) : Set (a ⊔ ℓ₁ ⊔ ℓ₂) where
nonstrict : (xy : x y) → x IsRelatedTo y
nonstrict : (xy : x y) → x IsRelatedTo y
equals : (x≈y : x ≈ y) → x IsRelatedTo y

start : _IsRelatedTo_ ⇒ __
start : _IsRelatedTo_ ⇒ __
start (equals x≈y) = reflexive x≈y
start (nonstrict xy) = xy
start (nonstrict xy) = xy

≡-go : Trans _≡_ _IsRelatedTo_ _IsRelatedTo_
≡-go x≡y (equals y≈z) = equals (case x≡y of λ where P.refl → y≈z)
≡-go x≡y (nonstrict y≤z) = nonstrict (case x≡y of λ where P.refl → y≤z)

-go : Trans __ _IsRelatedTo_ _IsRelatedTo_
-go xy (equals y≈z) = nonstrict (∼-respʳ-≈ y≈z xy)
-go xy (nonstrict yz) = nonstrict (trans xy yz)
-go : Trans __ _IsRelatedTo_ _IsRelatedTo_
-go xy (equals y≈z) = nonstrict (∼-respʳ-≈ y≈z xy)
-go xy (nonstrict yz) = nonstrict (trans xy yz)

≈-go : Trans _≈_ _IsRelatedTo_ _IsRelatedTo_
≈-go x≈y (equals y≈z) = equals (Eq.trans x≈y y≈z)
≈-go x≈y (nonstrict yz) = nonstrict (∼-respˡ-≈ (Eq.sym x≈y) yz)
≈-go x≈y (nonstrict yz) = nonstrict (∼-respˡ-≈ (Eq.sym x≈y) yz)

stop : Reflexive _IsRelatedTo_
stop = equals Eq.refl
Expand Down Expand Up @@ -81,6 +81,21 @@ equalitySubRelation = record
open begin-syntax _IsRelatedTo_ start public
open begin-equality-syntax _IsRelatedTo_ equalitySubRelation public
open ≡-syntax _IsRelatedTo_ ≡-go public
open ∼-syntax _IsRelatedTo_ _IsRelatedTo_ ∼-go public
open ≈-syntax _IsRelatedTo_ _IsRelatedTo_ ≈-go Eq.sym public
open ≲-syntax _IsRelatedTo_ _IsRelatedTo_ ≲-go public
open end-syntax _IsRelatedTo_ stop public


------------------------------------------------------------------------
-- DEPRECATED NAMES
------------------------------------------------------------------------
-- Please use the new names as continuing support for the old names is
-- not guaranteed.

-- Version 2.0

open ∼-syntax _IsRelatedTo_ _IsRelatedTo_ ≲-go public
{-# WARNING_ON_USAGE step-∼
"Warning: step-∼ and _∼⟨_⟩_ syntax was deprecated in v2.0.
Please use step-≲ and _≲⟨_⟩_ instead. "
#-}
14 changes: 10 additions & 4 deletions src/Relation/Binary/Reasoning/Syntax.agda
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
------------------------------------------------------------------------
-- The Agda standard library
--
-- Syntax for the building blocks of equational reasoning modules
-- Syntax for the building blocks of equational reasoning modules
------------------------------------------------------------------------

{-# OPTIONS --cubical-compatible --safe #-}
Expand All @@ -26,7 +26,7 @@ open import Relation.Binary.PropositionalEquality.Core as P
-- Codata/Guarded/Stream/Relation/Binary/Pointwise
-- Codata/Sized/Stream/Bisimilarity
-- Function/Reasoning

module Relation.Binary.Reasoning.Syntax where

private
Expand Down Expand Up @@ -170,14 +170,20 @@ module _
forward : ∀ (x : A) {y z} → S y z → R x y → T x z
forward x yRz x∼y = step {x} x∼y yRz


-- Preorder syntax
-- Arbitrary relation syntax
module ∼-syntax where
infixr 2 step-∼
step-∼ = forward
syntax step-∼ x yRz x∼y = x ∼⟨ x∼y ⟩ yRz


-- Preorder syntax
module ≲-syntax where
infixr 2 step-≲
step-≲ = forward
syntax step-≲ x yRz x≲y = x ≲⟨ x≲y ⟩ yRz


-- Partial order syntax
module ≤-syntax where
infixr 2 step-≤
Expand Down