-
Notifications
You must be signed in to change notification settings - Fork 259
Added functional vector permutation #2066
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
MatthewDaggitt
merged 14 commits into
agda:master
from
guilhermehas:functional-vec-permutation
Feb 25, 2024
Merged
Changes from 3 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4cf6dd5
added functional vector permutation
guilhermehas a023d08
added one line to CHANGELOG
guilhermehas a9898bd
added permutation properties
guilhermehas 219913c
Added Base to imports
guilhermehas 1745594
Added Base to import
guilhermehas 370a169
Added core to import
guilhermehas ec67762
added definitions
guilhermehas 349e408
removed unnecessary zs
guilhermehas 603cec1
renamed types in changelog
guialvares 3c7538f
Merge branch 'master' into functional-vec-permutation
guialvares b68ce54
removed unnecessary code
guialvares cc83c87
added more to changelog
guialvares 8607d4d
Merge branch 'master' into functional-vec-permutation
guialvares 99019fd
added end of changelog
guialvares File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| ------------------------------------------------------------------------ | ||
| -- The Agda standard library | ||
| -- | ||
| -- Permutation relations over Vector | ||
| ------------------------------------------------------------------------ | ||
|
|
||
| {-# OPTIONS --cubical-compatible --safe #-} | ||
|
|
||
| module Data.Vec.Functional.Relation.Binary.Permutation where | ||
|
|
||
| open import Level using (Level) | ||
| open import Data.Product using (Σ-syntax) | ||
| open import Data.Fin.Permutation using (Permutation; _⟨$⟩ʳ_) | ||
| open import Data.Vec.Functional using (Vector) | ||
| open import Relation.Binary.Indexed.Heterogeneous.Core using (IRel) | ||
| open import Relation.Binary.PropositionalEquality using (_≡_) | ||
guilhermehas marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| private | ||
| variable | ||
| ℓ : Level | ||
| A : Set ℓ | ||
|
|
||
| infix 3 _↭_ | ||
|
|
||
| _↭_ : IRel (Vector A) _ | ||
| xs ↭ ys = Σ[ ρ ∈ Permutation _ _ ] (∀ i → xs (ρ ⟨$⟩ʳ i) ≡ ys i) | ||
44 changes: 44 additions & 0 deletions
44
src/Data/Vec/Functional/Relation/Binary/Permutation/Properties.agda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| ------------------------------------------------------------------------ | ||
| -- The Agda standard library | ||
| -- | ||
| -- Properties of permutation | ||
| ------------------------------------------------------------------------ | ||
|
|
||
| {-# OPTIONS --cubical-compatible --safe #-} | ||
|
|
||
| module Data.Vec.Functional.Relation.Binary.Permutation.Properties where | ||
|
|
||
| open import Level using (Level) | ||
| open import Data.Product using (_,_; proj₁; proj₂) | ||
| open import Data.Nat using (ℕ) | ||
guilhermehas marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| open import Data.Fin.Permutation using (id; flip; _⟨$⟩ʳ_; inverseʳ; _∘ₚ_) | ||
| open import Data.Vec.Functional | ||
| open import Data.Vec.Functional.Relation.Binary.Permutation | ||
| open import Relation.Binary.PropositionalEquality | ||
| using (refl; trans; _≡_; cong; module ≡-Reasoning) | ||
|
|
||
| open ≡-Reasoning | ||
|
|
||
| private | ||
| variable | ||
| ℓ : Level | ||
| A : Set ℓ | ||
| n : ℕ | ||
| xs ys zs : Vector A n | ||
|
|
||
| ↭-refl : xs ↭ xs | ||
Taneb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ↭-refl = id , λ _ → refl | ||
|
|
||
| ↭-reflexive : xs ≡ ys → xs ↭ ys | ||
| ↭-reflexive refl = ↭-refl | ||
|
|
||
| ↭-sym : xs ↭ ys → ys ↭ xs | ||
| proj₁ (↭-sym (xs↭ys , _)) = flip xs↭ys | ||
| proj₂ (↭-sym {xs = xs} {ys = ys} (xs↭ys , xs↭ys≡)) i = begin | ||
| ys (flip xs↭ys ⟨$⟩ʳ i) ≡˘⟨ xs↭ys≡ _ ⟩ | ||
| xs (xs↭ys ⟨$⟩ʳ (flip xs↭ys ⟨$⟩ʳ i)) ≡⟨ cong xs (inverseʳ xs↭ys) ⟩ | ||
| xs i ∎ | ||
|
|
||
| ↭-trans : xs ↭ ys → ys ↭ zs → xs ↭ zs | ||
| proj₁ (↭-trans (xs↭ys , _) (ys↭zs , _)) = ys↭zs ∘ₚ xs↭ys | ||
| proj₂ (↭-trans (_ , xs↭ys) (_ , ys↭zs)) _ = trans (xs↭ys _) (ys↭zs _) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.