Skip to content

Commit 5fa0412

Browse files
authored
Added reverse permutation
1 parent 1f106b3 commit 5fa0412

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -3037,3 +3037,8 @@ This is a full list of proofs that have changed form to use irrelevant instance
30373037
```agda
30383038
<-weakInduction-startingFrom : P i → (∀ j → P (inject₁ j) → P (suc j)) → ∀ {j} → j ≥ i → P j
30393039
```
3040+
3041+
* Added new function to `Data.List.Relation.Binary.Permutation.Propositional.Properties`
3042+
```agda
3043+
↭-reverse : (xs : List A) → reverse xs ↭ xs
3044+
```

src/Data/List/Relation/Binary/Permutation/Propositional/Properties.agda

+12
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,18 @@ drop-∷ = drop-mid [] []
324324
++↭ʳ++ [] ys = ↭-refl
325325
++↭ʳ++ (x ∷ xs) ys = ↭-trans (↭-sym (shift x xs ys)) (++↭ʳ++ xs (x ∷ ys))
326326

327+
------------------------------------------------------------------------
328+
-- reverse
329+
330+
↭-reverse : (xs : List A) reverse xs ↭ xs
331+
↭-reverse [] = ↭-refl
332+
↭-reverse (x ∷ xs) = begin
333+
reverse (x ∷ xs) ≡⟨ Lₚ.unfold-reverse x xs ⟩
334+
reverse xs ∷ʳ x ↭˘⟨ ∷↭∷ʳ x (reverse xs) ⟩
335+
x ∷ reverse xs ↭⟨ prep x (↭-reverse xs) ⟩
336+
x ∷ xs ∎
337+
where open PermutationReasoning
338+
327339
------------------------------------------------------------------------
328340
-- merge
329341

0 commit comments

Comments
 (0)