Skip to content

Commit 6c5d2e7

Browse files
Saransh-cppSofia-Insa
authored andcommitted
Add new fixities (#2116)
Co-authored-by: Sofia El Boufi--Crouzet <[email protected]>
1 parent 9db6707 commit 6c5d2e7

File tree

28 files changed

+94
-13
lines changed

28 files changed

+94
-13
lines changed

CHANGELOG.md

+28
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,34 @@ Bug-fixes
120120
infixl 6 _+ℤ_ (Relation.Binary.HeterogeneousEquality.Quotients.Examples)
121121
infix 4 _≉_ _≈ᵢ_ _≤ᵢ_ (Relation.Binary.Indexed.Homogeneous.Bundles)
122122
infixr 5 _∷ᴹ_ _∷⁻¹ᴹ_ (Text.Regex.Search)
123+
infixr 4 _,_ (Data.Refinement)
124+
infixr 4 _,_ (Data.Container.Relation.Binary.Pointwise)
125+
infixr 4 _,_ (Data.Tree.AVL.Value)
126+
infixr 4 _,_ (Foreign.Haskell.Pair)
127+
infixr 4 _,_ (Reflection.AnnotatedAST)
128+
infixr 4 _,_ (Reflection.AST.Traversal)
129+
infixl 6.5 _P′_ _P_ _C′_ _C_ (Data.Nat.Combinatorics.Base)
130+
infixl 1 _>>=-cong_ _≡->>=-cong_ (Effect.Monad.Partiality)
131+
infixl 1 _?>=′_ (Effect.Monad.Predicate)
132+
infixl 1 _>>=-cong_ _>>=-congP_ (Effect.Monad.Partiality.All)
133+
infix 4 _∈FV_ (Reflection.AST.DeBruijn)
134+
infixr 9 _;_ (Relation.Binary.Construct.Composition)
135+
infixl 6 _+²_ (Relation.Binary.HeterogeneousEquality.Quotients.Examples)
136+
infixr -1 _atₛ_ (Relation.Binary.Indexed.Heterogeneous.Construct.At)
137+
infixr -1 _atₛ_ (Relation.Binary.Indexed.Homogeneous.Construct.At)
138+
infix 4 _∈_ _∉_ (Relation.Unary.Indexed)
139+
infixr 9 _⍮_ (Relation.Unary.PredicateTransformer)
140+
infix 8 ∼_ (Relation.Unary.PredicateTransformer)
141+
infix 2 _×?_ _⊙?_ (Relation.Unary.Properties)
142+
infix 10 _~? (Relation.Unary.Properties)
143+
infixr 1 _⊎?_ (Relation.Unary.Properties)
144+
infixr 7 _∩?_ (Relation.Unary.Properties)
145+
infixr 6 _∪?_ (Relation.Unary.Properties)
146+
infixl 6 _`⊜_ (Tactic.RingSolver)
147+
infix 8 ⊝_ (Tactic.RingSolver.Core.Expression)
148+
infix 4 _∈ᴿ?_ _∉ᴿ?_ _∈?ε _∈?[_] _∈?[^_] (Text.Regex.Properties)
149+
infix 4 _∈?_ _∉?_ (Text.Regex.Derivative.Brzozowski)
150+
infix 4 _∈_ _∉_ _∈?_ _∉?_ (Text.Regex.String.Unsafe)
123151
```
124152

125153
* In `System.Exit`, the `ExitFailure` constructor is now carrying an integer

README/Design/Fixity.agda

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ module README.Design.Fixity where
2323
-- ternary reasoning infix 1 _⊢_≈_
2424
-- composition infixr 9 _∘_
2525
-- application infixr -1 _$_ _$!_
26+
-- combinatorics infixl 6.5 _P_ _P′_ _C_ _C′_
27+
-- pair infixr 4 _,_
2628

2729
-- Reasoning:
2830
-- QED infix 3 _∎

src/Data/Container/Relation/Binary/Pointwise.agda

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module _ {s p} (C : Container s p) where
2626
constructor _,_
2727
field shape : proj₁ cx ≡ proj₁ cy
2828
position : p R (proj₂ cx p) (proj₂ cy (subst _ shape p))
29+
infixr 4 _,_
2930

3031
module _ {s p} {C : Container s p} {x y} {X : Set x} {Y : Set y}
3132
{ℓ ℓ′} {R : REL X Y ℓ} {R′ : REL X Y ℓ′}

src/Data/Nat/Combinatorics.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ nCk≡nC[n∸k] {k} {n} k≤n = begin-equality
7575
_ = k !* (n ∸ k) !≢0
7676
_ = (n ∸ k) !* (n ∸ (n ∸ k)) !≢0
7777

78-
nCk≡nPk/k! : k ≤ n n C k ≡ (n P k / k !) {{k !≢0}}
78+
nCk≡nPk/k! : k ≤ n n C k ≡ ((n P k) / k !) {{k !≢0}}
7979
nCk≡nPk/k! {k} {n} k≤n = begin-equality
8080
n C k ≡⟨ nCk≡n!/k![n-k]! k≤n ⟩
8181
n ! / (k ! * (n ∸ k) !) ≡˘⟨ /-congʳ (*-comm ((n ∸ k)!) (k !)) ⟩

src/Data/Nat/Combinatorics/Base.agda

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ open import Data.Nat.Properties using (_!≢0)
2525

2626
-- n P k = n ! / (n ∸ k) !
2727

28+
infixl 6.5 _P′_ _P_
29+
2830
-- Base definition. Only valid for k ≤ n.
2931

3032
_P′_ :
@@ -44,6 +46,8 @@ n P k = if k ≤ᵇ n then n P′ k else 0
4446

4547
-- n C k = n ! / (k ! * (n ∸ k) !)
4648

49+
infixl 6.5 _C′_ _C_
50+
4751
-- Base definition. Only valid for k ≤ n.
4852

4953
_C′_ :

src/Data/Nat/Combinatorics/Specification.agda

+9-9
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,20 @@ nP′k≡n[n∸1P′k∸1] : ∀ n k → .{{NonZero n}} → .{{NonZero k}} →
5757
nP′k≡n[n∸1P′k∸1] n (suc zero) = refl
5858
nP′k≡n[n∸1P′k∸1] n@(suc n-1) k@(suc k-1@(suc k-2)) = begin-equality
5959
n P′ k ≡⟨⟩
60-
(n ∸ k-1) * n P′ k-1 ≡⟨ cong ((n ∸ k-1) *_) (nP′k≡n[n∸1P′k∸1] n k-1) ⟩
61-
(n ∸ k-1) * (n * n-1 P′ k-2) ≡⟨ x∙yz≈y∙xz (n ∸ k-1) n (n-1 P′ k-2) ⟩
62-
n * ((n ∸ k-1) * n-1 P′ k-2) ≡⟨⟩
63-
n * n-1 P′ k-1
60+
(n ∸ k-1) * (n P′ k-1) ≡⟨ cong ((n ∸ k-1) *_) (nP′k≡n[n∸1P′k∸1] n k-1) ⟩
61+
(n ∸ k-1) * (n * (n-1 P′ k-2)) ≡⟨ x∙yz≈y∙xz (n ∸ k-1) n (n-1 P′ k-2) ⟩
62+
n * ((n ∸ k-1) * (n-1 P′ k-2)) ≡⟨⟩
63+
n * (n-1 P′ k-1)
6464
where open ≤-Reasoning; open *-CS
6565

6666
P′-rec : {n k} k ≤ n .{{NonZero k}}
6767
n P′ k ≡ k * (pred n P′ pred k) + pred n P′ k
6868
P′-rec n@{suc n-1} k@{suc k-1} k≤n = begin-equality
69-
n P′ k ≡⟨ nP′k≡n[n∸1P′k∸1] n k ⟩
70-
n * n-1 P′ k-1 ≡˘⟨ cong (_* n-1 P′ k-1) (m+[n∸m]≡n {k} {n} k≤n) ⟩
71-
(k + (n ∸ k)) * n-1 P′ k-1 ≡⟨ *-distribʳ-+ (n-1 P′ k-1) k (n ∸ k) ⟩
72-
k * (n-1 P′ k-1) + (n-1 ∸ k-1) * n-1 P′ k-1 ≡⟨⟩
73-
k * (n-1 P′ k-1) + n-1 P′ k ∎
69+
n P′ k ≡⟨ nP′k≡n[n∸1P′k∸1] n k ⟩
70+
n * (n-1 P′ k-1) ≡˘⟨ cong (_* (n-1 P′ k-1)) (m+[n∸m]≡n {k} {n} k≤n) ⟩
71+
(k + (n ∸ k)) * (n-1 P′ k-1) ≡⟨ *-distribʳ-+ (n-1 P′ k-1) k (n ∸ k) ⟩
72+
k * (n-1 P′ k-1) + (n-1 ∸ k-1) * (n-1 P′ k-1) ≡⟨⟩
73+
k * (n-1 P′ k-1) + (n-1 P′ k)
7474
where open ≤-Reasoning
7575

7676
nP′n≡n! : n n P′ n ≡ n !

src/Data/Refinement.agda

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ record Refinement {a p} (A : Set a) (P : A → Set p) : Set (a ⊔ p) where
2323
constructor _,_
2424
field value : A
2525
proof : Irrelevant (P value)
26+
infixr 4 _,_
2627
open Refinement public
2728

2829
-- The syntax declaration below is meant to mimick set comprehension.

src/Data/Tree/AVL/Value.agda

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ record K&_ {v} (V : Value v) : Set (a ⊔ v) where
3434
field
3535
key : Key
3636
value : Value.family V key
37+
infixr 4 _,_
3738
open K&_ public
3839

3940
module _ {v} {V : Value v} where

src/Effect/Monad/Partiality.agda

+4
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,8 @@ module _ {A B : Set s}
517517

518518
-- Bind preserves all the relations.
519519

520+
infixl 1 _>>=-cong_
521+
520522
_>>=-cong_ :
521523
{k} {x₁ x₂ : A ⊥} {f₁ f₂ : A B ⊥} let open M in
522524
Rel _∼A_ k x₁ x₂
@@ -578,6 +580,8 @@ module _ {A B : Set ℓ} {_∼_ : B → B → Set ℓ} where
578580

579581
-- A variant of _>>=-cong_.
580582

583+
infixl 1 _≡->>=-cong_
584+
581585
_≡->>=-cong_ :
582586
{k} {x₁ x₂ : A ⊥} {f₁ f₂ : A B ⊥} let open M in
583587
Rel _≡_ k x₁ x₂

src/Effect/Monad/Partiality/All.agda

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ data All {A : Set a} (P : A → Set p) : A ⊥ → Set (a ⊔ p) where
4444

4545
-- Bind preserves All in the following way:
4646

47+
infixl 1 _>>=-cong_
48+
4749
_>>=-cong_ : {p q} {P : A Set p} {Q : B Set q}
4850
{x : A ⊥} {f : A B ⊥}
4951
All P x ( {x} P x All Q (f x))
@@ -118,6 +120,8 @@ module Alternative {a p : Level} where
118120
_≳⟨_⟩P_ : x {y} (x≳y : x ≳ y) (p : AllP P y) AllP P x
119121
_⟨_⟩P : x (p : AllP P x) AllP P x
120122

123+
infixl 1 _>>=-congP_
124+
121125
private
122126

123127
-- WHNFs.

src/Effect/Monad/Predicate.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ private
2929

3030
record RawPMonad {I : Set i} (M : Pt I (i ⊔ ℓ)) : Set (suc i ⊔ suc ℓ) where
3131

32-
infixl 1 _?>=_ _?>_ _>?>_
32+
infixl 1 _?>=_ _?>_ _>?>_ _?>=′_
3333
infixr 1 _=<?_ _<?<_
3434

3535
-- ``Demonic'' operations (the opponent chooses the state).

src/Foreign/Haskell/Pair.agda

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ record Pair (A : Set a) (B : Set b) : Set (a ⊔ b) where
2424
constructor _,_
2525
field fst : A
2626
snd : B
27+
infixr 4 _,_
2728
open Pair public
2829

2930
{-# FOREIGN GHC type AgdaPair l1 l2 a b = (a , b) #-}

src/Function/Construct/Composition.agda

+2
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ _↔-∘_ = inverse
234234

235235
-- Version v2.0
236236

237+
infix 8 _∘-⟶_ _∘-↣_ _∘-↠_ _∘-⤖_ _∘-⇔_ _∘-↩_ _∘-↪_ _∘-↔_
238+
237239
_∘-⟶_ = _⟶-∘_
238240
{-# WARNING_ON_USAGE _∘-⟶_
239241
"Warning: _∘-⟶_ was deprecated in v2.0.

src/Reflection/AST/DeBruijn.agda

+2
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,7 @@ module _ where
128128
actions : Actions
129129
actions i = record defaultActions { onVar = fvVar i }
130130

131+
infix 4 _∈FV_
132+
131133
_∈FV_ : Term Bool
132134
i ∈FV t = traverseTerm (actions i) (0 , []) t

src/Reflection/AST/Traversal.agda

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ record Cxt : Set where
3131
field
3232
len :
3333
context : List (String × Arg Term)
34+
infixr 4 _,_
3435

3536
private
3637
_∷cxt_ : String × Arg Term Cxt Cxt

src/Reflection/AnnotatedAST.agda

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Argₐ Tyₐ = ⟪ Argₐ′ Tyₐ ⟫
8383

8484
data Namedₐ′ (Tyₐ : Typeₐ ℓ u) : Typeₐ ℓ (⟨named⟩ u) where
8585
_,_ : {t} x Tyₐ Ann t Namedₐ′ Tyₐ Ann (x , t)
86+
infixr 4 _,_
8687

8788
Namedₐ : Typeₐ ℓ u Typeₐ ℓ (⟨named⟩ u)
8889
Namedₐ Tyₐ = ⟪ Namedₐ′ Tyₐ ⟫

src/Relation/Binary/Construct/Composition.agda

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ private
2626
------------------------------------------------------------------------
2727
-- Definition
2828

29+
infixr 9 _;_
30+
2931
_;_ : {A : Set a} {B : Set b} {C : Set c}
3032
REL A B ℓ₁ REL B C ℓ₂ REL A C (b ⊔ ℓ₁ ⊔ ℓ₂)
3133
L ; R = λ i j λ k L i k × R k j

src/Relation/Binary/HeterogeneousEquality/Quotients/Examples.agda

+4-2
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,12 @@ module Integers (quot : Quotients 0ℓ 0ℓ) where
5959

6060
open Quotient Int renaming (Q to ℤ)
6161

62+
infixl 6 _+²_
63+
6264
_+²_ : ℕ² ℕ² ℕ²
6365
(x₁ , y₁) +² (x₂ , y₂) = x₁ + x₂ , y₁ + y₂
6466

65-
+²-cong : {a b a′ b′} a ∼ a′ b ∼ b′ a +² b ∼ a′ +² b′
67+
+²-cong : {a b a′ b′} a ∼ a′ b ∼ b′ (a +² b)(a′ +² b′)
6668
+²-cong {a₁ , b₁} {c₁ , d₁} {a₂ , b₂} {c₂ , d₂} ab∼cd₁ ab∼cd₂ = begin
6769
(a₁ + c₁) + (b₂ + d₂) ≡⟨ ≡.cong (_+ (b₂ + d₂)) (+-comm a₁ c₁) ⟩
6870
(c₁ + a₁) + (b₂ + d₂) ≡⟨ +-assoc c₁ a₁ (b₂ + d₂) ⟩
@@ -128,7 +130,7 @@ module Integers (quot : Quotients 0ℓ 0ℓ) where
128130
abs (zero² +² a) ≅⟨ compat-abs (+²-identityˡ a) ⟩
129131
abs a ∎
130132

131-
+²-assoc : (i j k : ℕ²) (i +² j) +² k ∼ i +² (j +² k)
133+
+²-assoc : (i j k : ℕ²) ((i +² j) +² k)(i +² (j +² k))
132134
+²-assoc (a , b) (c , d) (e , f) = begin
133135
((a + c) + e) + (b + (d + f)) ≡⟨ ≡.cong (_+ (b + (d + f))) (+-assoc a c e) ⟩
134136
(a + (c + e)) + (b + (d + f)) ≡⟨ ≡.cong ((a + (c + e)) +_) (≡.sym (+-assoc b d f)) ⟩

src/Relation/Binary/Indexed/Heterogeneous/Construct/At.agda

+2
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,7 @@ module _ {a i} {I : Set i} where
6464

6565
module _ {a i} {I : Set i} where
6666

67+
infixr -1 _atₛ_
68+
6769
_atₛ_ : {ℓ} IndexedSetoid I a ℓ I Setoid a ℓ
6870
_atₛ_ = setoid

src/Relation/Binary/Indexed/Homogeneous/Construct/At.agda

+2
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,7 @@ preorder O index = record
6868
------------------------------------------------------------------------
6969
-- Some useful shorthand infix notation
7070

71+
infixr -1 _atₛ_
72+
7173
_atₛ_ : {ℓ} IndexedSetoid I a ℓ I Setoid a ℓ
7274
_atₛ_ = setoid

src/Relation/Unary/Indexed.agda

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ IPred A ℓ = ∀ {i} → A i → Set ℓ
1717

1818
module _ {i a} {I : Set i} {A : I Set a} where
1919

20+
infix 4 _∈_ _∉_
21+
2022
_∈_ : {ℓ} ( i A i) IPred A ℓ Set _
2123
x ∈ P = i P (x i)
2224

src/Relation/Unary/PredicateTransformer.agda

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Pt A ℓ = PT A A ℓ ℓ
3434
------------------------------------------------------------------------
3535
-- Composition and identity
3636

37+
infixr 9 _⍮_
38+
3739
_⍮_ : PT B C ℓ₂ ℓ₃ PT A B ℓ₁ ℓ₂ PT A C ℓ₁ _
3840
S ⍮ T = S ∘ T
3941

@@ -53,6 +55,8 @@ magic = λ _ → U
5355

5456
-- Negation.
5557

58+
infix 8 ∼_
59+
5660
∼_ : PT A B ℓ₁ ℓ₂ PT A B ℓ₁ ℓ₂
5761
∼ T = ∁ ∘ T
5862

src/Relation/Unary/Properties.agda

+6
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ U-Universal = λ _ → _
202202
∁? : {P : Pred A ℓ} Decidable P Decidable (∁ P)
203203
∁? P? x = ¬? (P? x)
204204

205+
infix 2 _×?_ _⊙?_
206+
infix 10 _~?
207+
infixr 1 _⊎?_
208+
infixr 7 _∩?_
209+
infixr 6 _∪?_
210+
205211
_∪?_ : {P : Pred A ℓ₁} {Q : Pred A ℓ₂}
206212
Decidable P Decidable Q Decidable (P ∪ Q)
207213
_∪?_ P? Q? x = (P? x) ⊎-dec (Q? x)

src/Tactic/RingSolver.agda

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ module RingSolverReflection (ring : Term) (numberOfVariables : ℕ) where
141141
`I : Term Term
142142
`I x = quote Ι $ᵉ (x ⟨∷⟩ [])
143143

144+
infixl 6 _`⊜_
145+
144146
_`⊜_ : Term Term Term
145147
x `⊜ y = quote _⊜_ $ʳ (`numberOfVariables ⟅∷⟆ x ⟨∷⟩ y ⟨∷⟩ [])
146148

src/Tactic/RingSolver/Core/Expression.agda

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ open import Algebra
1717
infixl 6 _⊕_
1818
infixl 7 _⊗_
1919
infixr 8 _⊛_
20+
infix 8 ⊝_
2021

2122
data Expr {a} (A : Set a) (n : ℕ) : Set a where
2223
Κ : A Expr A n -- Constant

src/Text/Regex/Derivative/Brzozowski.agda

+2
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ eat-complete′ x (e R.⋆) (refl ∷ eq) (star (sum (inj₂ (prod (refl ∷ app
107107
------------------------------------------------------------------------
108108
-- Consequence: matching is decidable
109109

110+
infix 4 _∈?_ _∉?_
111+
110112
_∈?_ : Decidable _∈_
111113
[] ∈? e = []∈? e
112114
(x ∷ xs) ∈? e = map′ (eat-sound x e) (eat-complete x e) (xs ∈? eat x e)

src/Text/Regex/Properties.agda

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ open import Text.Regex.Properties.Core preorder public
4949
$ ([]∈? e) ×-dec ([]∈? f)
5050
[]∈? (e ⋆) = yes (star (sum (inj₁ ε)))
5151

52+
infix 4 _∈ᴿ?_ _∉ᴿ?_ _∈?ε _∈?[_] _∈?[^_]
53+
5254
_∈ᴿ?_ : Decidable _∈ᴿ_
5355
c ∈ᴿ? [ a ] = map′ [_] (λ where [ eq ] eq) (c ≟ a)
5456
c ∈ᴿ? (lb ─ ub) = map′ (uncurry _─_) (λ where (ge ─ le) ge , le)

src/Text/Regex/String/Unsafe.agda

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ open import Text.Regex.String as Regex public
2626
------------------------------------------------------------------------
2727
-- Specialised definitions
2828

29+
infix 4 _∈_ _∉_ _∈?_ _∉?_
30+
2931
_∈_ : String Exp Set
3032
str ∈ e = toList str Regex.∈ e
3133

0 commit comments

Comments
 (0)