Skip to content

Commit df4910b

Browse files
Added associativity for vectors using pointwise-equality (#1621)
1 parent 8308d12 commit df4910b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,13 @@ Other minor changes
716716
→ dsubst₂ C p q (f x₁ y₁) ≡ f x₂ y₂
717717
```
718718

719+
* Added vector associativity proof to
720+
`Data/Vec/Relation/Binary/Equality/Setoid.agda`:
721+
```
722+
++-assoc : ∀ {n m k} (xs : Vec A n) → (ys : Vec A m)
723+
→ (zs : Vec A k) → (xs ++ ys) ++ zs ≋ xs ++ (ys ++ zs)
724+
```
725+
719726
NonZero/Positive/Negative changes
720727
---------------------------------
721728

src/Data/Vec/Relation/Binary/Equality/Setoid.agda

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ open PW public using (++⁺ ; ++⁻ ; ++ˡ⁻; ++ʳ⁻)
6868
++-identityʳ [] = []
6969
++-identityʳ (x ∷ xs) = refl ∷ ++-identityʳ xs
7070

71+
++-assoc : {n m k} (xs : Vec A n) (ys : Vec A m) (zs : Vec A k)
72+
(xs ++ ys) ++ zs ≋ xs ++ (ys ++ zs)
73+
++-assoc [] ys zs = ≋-refl
74+
++-assoc (x ∷ xs) ys zs = refl ∷ ++-assoc xs ys zs
75+
7176
map-++-commute : {b m n} {B : Set b}
7277
(f : B A) (xs : Vec B m) {ys : Vec B n}
7378
map f (xs ++ ys) ≋ map f xs ++ map f ys

0 commit comments

Comments
 (0)