Skip to content

Commit bd22937

Browse files
committed
Merge branch 'Padright' of https://github.com/e-mniang/My-agda-stdlib into Padright
2 parents 28cc0c0 + 2763f34 commit bd22937

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1445
-449
lines changed

.github/workflows/ci-ubuntu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ jobs:
7676
if [[ '${{ github.ref }}' == 'refs/heads/experimental' \
7777
|| '${{ github.base_ref }}' == 'experimental' ]]; then
7878
# Pick Agda version for experimental
79-
echo "AGDA_COMMIT=18cc53941e924b144c0f1f3953280ef726009f7e" >> "${GITHUB_ENV}";
79+
echo "AGDA_COMMIT=ef912c68fd329ad3046d156e3c1a70a7fec19ba1" >> "${GITHUB_ENV}";
8080
echo "AGDA_HTML_DIR=html/experimental" >> "${GITHUB_ENV}"
8181
else
8282
# Pick Agda version for master
83-
echo "AGDA_COMMIT=tags/v2.7.0.1" >> "${GITHUB_ENV}";
83+
echo "AGDA_COMMIT=tags/v2.8.0-rc3" >> "${GITHUB_ENV}";
8484
echo "AGDA_HTML_DIR=html/master" >> "${GITHUB_ENV}"
8585
fi
8686

CHANGELOG.md

Lines changed: 145 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ Deprecated names
137137
∈⇒∣product ↦ Data.Nat.ListAction.Properties.∈⇒∣product
138138
product≢0 ↦ Data.Nat.ListAction.Properties.product≢0
139139
∈⇒≤product ↦ Data.Nat.ListAction.Properties.∈⇒≤product
140+
∷-ʳ++-eqFree ↦ Data.List.Properties.ʳ++-ʳ++-eqFree
140141
```
141142

142143
* In `Data.List.Relation.Binary.Permutation.Propositional.Properties`:
@@ -150,11 +151,18 @@ Deprecated names
150151
left-inverse ↦ rightInverse
151152
```
152153

154+
* In `Data.Product.Nary.NonDependent`:
155+
```agda
156+
Allₙ ↦ Pointwiseₙ
157+
```
158+
153159
New modules
154160
-----------
155161

156162
* `Algebra.Module.Properties.{Bimodule|LeftModule|RightModule}`.
157163

164+
* `Algebra.Morphism.Construct.DirectProduct`.
165+
158166
* `Data.List.Base.{and|or|any|all}` have been lifted out into `Data.Bool.ListAction`.
159167

160168
* `Data.List.Base.{sum|product}` and their properties have been lifted out into `Data.Nat.ListAction` and `Data.Nat.ListAction.Properties`.
@@ -163,15 +171,42 @@ New modules
163171

164172
* `Data.List.Relation.Binary.Suffix.Propositional.Properties` showing the equivalence to right divisibility induced by the list monoid.
165173

174+
* `Data.List.Sort.InsertionSort.{agda|Base|Properties}` defines insertion sort and proves properties of insertion sort such as Sorted and Permutation properties.
175+
176+
* `Data.List.Sort.MergenSort.{agda|Base|Properties}` is a refactor of the previous `Data.List.Sort.MergenSort`.
177+
166178
* `Data.Sign.Show` to show a sign.
167179

168180
* `Relation.Binary.Morphism.Construct.Product` to plumb in the (categorical) product structure on `RawSetoid`.
169181

170182
* `Relation.Binary.Properties.PartialSetoid` to systematise properties of a PER
171183

184+
* `Relation.Nullary.Recomputable.Core`
185+
172186
Additions to existing modules
173187
-----------------------------
174188

189+
* In `Algebra.Consequences.Base`:
190+
```agda
191+
module Congruence (_≈_ : Rel A ℓ) (cong : Congruent₂ _≈_ _∙_) (refl : Reflexive _≈_)
192+
where
193+
∙-congˡ : LeftCongruent _≈_ _∙_
194+
∙-congʳ : RightCongruent _≈_ _∙_
195+
```
196+
197+
* In `Algebra.Consequences.Setoid`:
198+
```agda
199+
module Congruence (cong : Congruent₂ _≈_ _∙_) where
200+
∙-congˡ : LeftCongruent _≈_ _∙_
201+
∙-congʳ : RightCongruent _≈_ _∙_
202+
```
203+
204+
* In `Algebra.Construct.Initial`:
205+
```agda
206+
assoc : Associative _≈_ _∙_
207+
idem : Idempotent _≈_ _∙_
208+
```
209+
175210
* In `Algebra.Construct.Pointwise`:
176211
```agda
177212
isNearSemiring : IsNearSemiring _≈_ _+_ _*_ 0# →
@@ -225,6 +260,29 @@ Additions to existing modules
225260
∣ˡ-preorder : Preorder a ℓ _
226261
```
227262

263+
* In `Algebra.Properties.Semigroup` adding consequences for associativity for semigroups
264+
265+
```
266+
uv≈w⇒xu∙v≈xw : ∀ x → (x ∙ u) ∙ v ≈ x ∙ w
267+
uv≈w⇒u∙vx≈wx : ∀ x → u ∙ (v ∙ x) ≈ w ∙ x
268+
uv≈w⇒u[vx∙y]≈w∙xy : ∀ x y → u ∙ ((v ∙ x) ∙ y) ≈ w ∙ (x ∙ y)
269+
uv≈w⇒x[uv∙y]≈x∙wy : ∀ x y → x ∙ (u ∙ (v ∙ y)) ≈ x ∙ (w ∙ y)
270+
uv≈w⇒[x∙yu]v≈x∙yw : ∀ x y → (x ∙ (y ∙ u)) ∙ v ≈ x ∙ (y ∙ w)
271+
uv≈w⇒[xu∙v]y≈x∙wy : ∀ x y → ((x ∙ u) ∙ v) ∙ y ≈ x ∙ (w ∙ y)
272+
uv≈w⇒[xy∙u]v≈x∙yw : ∀ x y → ((x ∙ y) ∙ u) ∙ v ≈ x ∙ (y ∙ w)
273+
uv≈w⇒xu∙vy≈x∙wy : ∀ x y → (x ∙ u) ∙ (v ∙ y) ≈ x ∙ (w ∙ y)
274+
uv≈w⇒xy≈z⇒u[vx∙y]≈wz : ∀ z → x ∙ y ≈ z → u ∙ ((v ∙ x) ∙ y) ≈ w ∙ z
275+
uv≈w⇒x∙wy≈x∙[u∙vy] : x ∙ (w ∙ y) ≈ x ∙ (u ∙ (v ∙ y))
276+
[uv∙w]x≈u[vw∙x] : ((u ∙ v) ∙ w) ∙ x ≈ u ∙ ((v ∙ w) ∙ x)
277+
[uv∙w]x≈u[v∙wx] : ((u ∙ v) ∙ w) ∙ x ≈ u ∙ (v ∙ (w ∙ x))
278+
[u∙vw]x≈uv∙wx : (u ∙ (v ∙ w)) ∙ x ≈ (u ∙ v) ∙ (w ∙ x)
279+
[u∙vw]x≈u[v∙wx] : (u ∙ (v ∙ w)) ∙ x ≈ u ∙ (v ∙ (w ∙ x))
280+
uv∙wx≈u[vw∙x] : (u ∙ v) ∙ (w ∙ x) ≈ u ∙ ((v ∙ w) ∙ x)
281+
uv≈wx⇒yu∙v≈yw∙x : ∀ y → (y ∙ u) ∙ v ≈ (y ∙ w) ∙ x
282+
uv≈wx⇒u∙vy≈w∙xy : ∀ y → u ∙ (v ∙ y) ≈ w ∙ (x ∙ y)
283+
uv≈wx⇒yu∙vz≈yw∙xz : ∀ y z → (y ∙ u) ∙ (v ∙ z) ≈ (y ∙ w) ∙ (x ∙ z)
284+
```
285+
228286
* In `Algebra.Properties.Semigroup.Divisibility`:
229287
```agda
230288
∣ˡ-trans : Transitive _∣ˡ_
@@ -239,21 +297,43 @@ Additions to existing modules
239297
∙-cong-∣ : x ∣ y → a ∣ b → x ∙ a ∣ y ∙ b
240298
```
241299

300+
* In `Data.Bool.Properties`:
301+
```agda
302+
if-eta : ∀ b → (if b then x else x) ≡ x
303+
if-idem-then : ∀ b → (if b then (if b then x else y) else y) ≡ (if b then x else y)
304+
if-idem-else : ∀ b → (if b then x else (if b then x else y)) ≡ (if b then x else y)
305+
if-swap-then : ∀ b c → (if b then (if c then x else y) else y) ≡ (if c then (if b then x else y) else y)
306+
if-swap-else : ∀ b c → (if b then x else (if c then x else y)) ≡ (if c then x else (if b then x else y))
307+
if-not : ∀ b → (if not b then x else y) ≡ (if b then y else x)
308+
if-∧ : ∀ b → (if b ∧ c then x else y) ≡ (if b then (if c then x else y) else y)
309+
if-∨ : ∀ b → (if b ∨ c then x else y) ≡ (if b then x else (if c then x else y))
310+
if-xor : ∀ b → (if b xor c then x else y) ≡ (if b then (if c then y else x) else (if c then x else y))
311+
if-cong : b ≡ c → (if b then x else y) ≡ (if c then x else y)
312+
if-cong-then : ∀ b → x ≡ z → (if b then x else y) ≡ (if b then z else y)
313+
if-cong-else : ∀ b → y ≡ z → (if b then x else y) ≡ (if b then x else z)
314+
if-cong₂ : ∀ b → x ≡ z → y ≡ w → (if b then x else y) ≡ (if b then z else w)
315+
```
316+
242317
* In `Data.Fin.Base`:
243318
```agda
244319
_≰_ : Rel (Fin n) 0ℓ
245320
_≮_ : Rel (Fin n) 0ℓ
321+
lower : ∀ (i : Fin m) → .(toℕ i ℕ.< n) → Fin n
246322
```
247323

248324
* In `Data.Fin.Permutation`:
249325
```agda
250326
cast-id : .(m ≡ n) → Permutation m n
251-
swap : Permutation m n → Permutation (suc (suc m)) (suc (suc n))
327+
swap : Permutation m n → Permutation (2+ m) (2+ n)
252328
```
253329

254330
* In `Data.Fin.Properties`:
255331
```agda
256-
cast-involutive : .(eq₁ : m ≡ n) .(eq₂ : n ≡ m) → ∀ k → cast eq₁ (cast eq₂ k) ≡ k
332+
cast-involutive : .(eq₁ : m ≡ n) .(eq₂ : n ≡ m) → ∀ k → cast eq₁ (cast eq₂ k) ≡ k
333+
inject!-injective : Injective _≡_ _≡_ inject!
334+
inject!-< : (k : Fin′ i) → inject! k < i
335+
lower-injective : lower i i<n ≡ lower j j<n → i ≡ j
336+
injective⇒existsPivot : ∀ (f : Fin n → Fin m) → Injective _≡_ _≡_ f → ∀ (i : Fin n) → ∃ λ j → j ≤ i × i ≤ f j
257337
```
258338

259339
* In `Data.Fin.Subset`:
@@ -355,6 +435,23 @@ Additions to existing modules
355435
LeftInverse (I ×ₛ A) (J ×ₛ B)
356436
```
357437

438+
* In `Data.Vec.Properties`:
439+
```agda
440+
toList-injective : ∀ {m n} → .(m=n : m ≡ n) → (xs : Vec A m) (ys : Vec A n) → toList xs ≡ toList ys → xs ≈[ m=n ] ys
441+
442+
toList-∷ʳ : ∀ x (xs : Vec A n) → toList (xs ∷ʳ x) ≡ toList xs List.++ List.[ x ]
443+
444+
fromList-reverse : (xs : List A) → (fromList (List.reverse xs)) ≈[ List.length-reverse xs ] reverse (fromList xs)
445+
446+
fromList∘toList : ∀ (xs : Vec A n) → fromList (toList xs) ≈[ length-toList xs ] xs
447+
```
448+
449+
* In `Data.Product.Nary.NonDependent`:
450+
```agda
451+
HomoProduct′ n f = Product n (stabulate n (const _) f)
452+
HomoProduct n A = HomoProduct′ n (const A)
453+
```
454+
358455
* In `Data.Vec.Relation.Binary.Pointwise.Inductive`:
359456
```agda
360457
zipWith-assoc : Associative _∼_ f → Associative (Pointwise _∼_) (zipWith {n = n} f)
@@ -364,17 +461,46 @@ Additions to existing modules
364461
zipWith-cong : Congruent₂ _∼_ f → Pointwise _∼_ ws xs → Pointwise _∼_ ys zs → Pointwise _∼_ (zipWith f ws ys) (zipWith f xs zs)
365462
```
366463

464+
* In `Function.Nary.NonDependent.Base`:
465+
```agda
466+
lconst l n = ⨆ l (lreplicate l n)
467+
stabulate : ∀ n → (f : Fin n → Level) → (g : (i : Fin n) → Set (f i)) → Sets n (ltabulate n f)
468+
sreplicate : ∀ n → Set a → Sets n (lreplicate n a)
469+
```
470+
471+
* In `Relation.Binary.Consequences`:
472+
```agda
473+
mono₂⇒monoˡ : Reflexive ≤₁ → Monotonic₂ ≤₁ ≤₂ ≤₃ f → LeftMonotonic ≤₂ ≤₃ f
474+
mono₂⇒monoˡ : Reflexive ≤₂ → Monotonic₂ ≤₁ ≤₂ ≤₃ f → RightMonotonic ≤₁ ≤₃ f
475+
monoˡ∧monoʳ⇒mono₂ : Transitive ≤₃ →
476+
LeftMonotonic ≤₂ ≤₃ f → RightMonotonic ≤₁ ≤₃ f →
477+
Monotonic₂ ≤₁ ≤₂ ≤₃ f
478+
```
479+
367480
* In `Relation.Binary.Construct.Add.Infimum.Strict`:
368481
```agda
369482
<₋-accessible-⊥₋ : Acc _<₋_ ⊥₋
370483
<₋-accessible[_] : Acc _<_ x → Acc _<₋_ [ x ]
371484
<₋-wellFounded : WellFounded _<_ → WellFounded _<₋_
372485
```
373486

487+
* In `Relation.Binary.Definitions`:
488+
```agda
489+
LeftMonotonic : Rel B ℓ₁ → Rel C ℓ₂ → (A → B → C) → Set _
490+
RightMonotonic : Rel A ℓ₁ → Rel C ℓ₂ → (A → B → C) → Set _
491+
```
492+
493+
* In `Relation.Nullary.Decidable`:
494+
```agda
495+
dec-yes-recompute : (a? : Dec A) → .(a : A) → a? ≡ yes (recompute a? a)
496+
```
497+
374498
* In `Relation.Nullary.Decidable.Core`:
375499
```agda
376500
⊤-dec : Dec {a} ⊤
377501
⊥-dec : Dec {a} ⊥
502+
recompute-irrelevant-id : (a? : Decidable A) → Irrelevant A →
503+
(a : A) → recompute a? a ≡ a
378504
```
379505

380506
* In `Relation.Unary`:
@@ -400,12 +526,18 @@ Additions to existing modules
400526
```agda
401527
⊤-reflects : Reflects (⊤ {a}) true
402528
⊥-reflects : Reflects (⊥ {a}) false
529+
```
403530

404531
* In `Data.List.Relation.Unary.AllPairs.Properties`:
405532
```agda
406533
map⁻ : AllPairs R (map f xs) → AllPairs (R on f) xs
407534
```
408535

536+
* In `Data.List.Relation.Unary.Linked`:
537+
```agda
538+
lookup : Transitive R → Linked R xs → Connected R (just x) (head xs) → ∀ i → R x (List.lookup xs i)
539+
```
540+
409541
* In `Data.List.Relation.Unary.Unique.Setoid.Properties`:
410542
```agda
411543
map⁻ : Congruent _≈₁_ _≈₂_ f → Unique R (map f xs) → Unique S xs
@@ -415,3 +547,14 @@ Additions to existing modules
415547
```agda
416548
map⁻ : Unique (map f xs) → Unique xs
417549
```
550+
551+
* In `Data.List.Relation.Unary.Sorted.TotalOrder.Properties`:
552+
```agda
553+
lookup-mono-≤ : Sorted xs → i Fin.≤ j → lookup xs i ≤ lookup xs j
554+
↗↭↗⇒≋ : Sorted xs → Sorted ys → xs ↭ ys → xs ≋ ys
555+
```
556+
557+
* In `Data.List.Sort.Base`:
558+
```agda
559+
SortingAlgorithm.sort-↭ₛ : ∀ xs → sort xs Setoid.↭ xs
560+
```

CHANGELOG/v1.3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ Deprecated modules
226226

227227
* A warning is now raised whenever you import a deprecated module. This should
228228
aid the transition to the new modules. These warnings can be disabled locally
229-
by adding the pragma `{-# OPTIONS --warn=noUserWarning #-}` to the top of a module.
229+
by adding the pragma `{-# OPTIONS --warning=noUserWarning #-}` to the top of a module.
230230

231231
The following modules have been renamed as part of a drive to improve
232232
consistency across the library. The deprecated modules still exist and

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[![Ubuntu build](https://github.com/agda/agda-stdlib/actions/workflows/ci-ubuntu.yml/badge.svg?branch=experimental)](https://github.com/agda/agda-stdlib/actions/workflows/ci-ubuntu.yml)
44

5+
**Note**: The library is currently tracking Agda 2.8.0 release candidate 3 in preparation for the release of Agda 2.8.0 and version 2.3 of the library. You will need to have the release candidate installed in order to type-check it.
6+
57
The Agda standard library
68
=========================
79

src/Algebra/Consequences/Base.agda

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,35 @@ module Algebra.Consequences.Base
1111
{a} {A : Set a} where
1212

1313
open import Algebra.Core using (Op₁; Op₂)
14-
open import Algebra.Definitions
15-
using (Selective; Idempotent; SelfInverse; Involutive)
14+
import Algebra.Definitions as Definitions
15+
using (Congruent₂; LeftCongruent; RightCongruent
16+
; Selective; Idempotent; SelfInverse; Involutive)
1617
open import Data.Sum.Base using (_⊎_; reduce)
18+
open import Relation.Binary.Consequences
19+
using (mono₂⇒monoˡ; mono₂⇒monoʳ)
1720
open import Relation.Binary.Core using (Rel)
1821
open import Relation.Binary.Definitions using (Reflexive)
1922

20-
module _ {ℓ} {_•_ : Op₂ A} (_≈_ : Rel A ℓ) where
23+
module Congruence {ℓ} {_∙_ : Op₂ A} (_≈_ : Rel A ℓ) (open Definitions _≈_)
24+
(cong : Congruent₂ _∙_) (refl : Reflexive _≈_)
25+
where
2126

22-
sel⇒idem : Selective _≈_ _•_ Idempotent _≈_ _•_
27+
∙-congˡ : LeftCongruent _∙_
28+
∙-congˡ {x} = mono₂⇒monoˡ _ _≈_ _≈_ (refl {x = x}) cong x
29+
30+
∙-congʳ : RightCongruent _∙_
31+
∙-congʳ {x} = mono₂⇒monoʳ _≈_ _ _≈_ (refl {x = x}) cong x
32+
33+
module _ {ℓ} {_∙_ : Op₂ A} (_≈_ : Rel A ℓ) (open Definitions _≈_) where
34+
35+
sel⇒idem : Selective _∙_ Idempotent _∙_
2336
sel⇒idem sel x = reduce (sel x x)
2437

25-
module _ {ℓ} {f : Op₁ A} (_≈_ : Rel A ℓ) where
38+
module _ {ℓ} {f : Op₁ A} (_≈_ : Rel A ℓ) (open Definitions _≈_) where
2639

2740
reflexive∧selfInverse⇒involutive : Reflexive _≈_
28-
SelfInverse _≈_ f
29-
Involutive _≈_ f
41+
SelfInverse f
42+
Involutive f
3043
reflexive∧selfInverse⇒involutive refl inv _ = inv refl
3144

3245
------------------------------------------------------------------------

src/Algebra/Consequences/Propositional.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
module Algebra.Consequences.Propositional
1111
{a} {A : Set a} where
1212

13+
open import Algebra.Core using (Op₁; Op₂)
1314
open import Data.Sum.Base using (inj₁; inj₂)
1415
open import Relation.Binary.Core using (Rel)
1516
open import Relation.Binary.Bundles using (Setoid)
@@ -19,7 +20,6 @@ open import Relation.Binary.PropositionalEquality.Core
1920
open import Relation.Binary.PropositionalEquality.Properties
2021
using (setoid)
2122
open import Relation.Unary using (Pred)
22-
open import Algebra.Core using (Op₁; Op₂)
2323

2424
open import Algebra.Definitions {A = A} _≡_
2525
import Algebra.Consequences.Setoid (setoid A) as Base

0 commit comments

Comments
 (0)