@@ -11,25 +11,18 @@ module Data.Fin.Permutation.Components where
11
11
open import Data.Bool.Base using (Bool; true; false)
12
12
open import Data.Fin.Base using (Fin; suc; opposite; toℕ)
13
13
open import Data.Fin.Properties
14
- using (_≟_; opposite-prop; opposite-involutive; opposite-suc)
15
- open import Data.Nat.Base as ℕ using (zero; suc; _∸_)
16
- open import Data.Product.Base using (proj₂)
17
- open import Function.Base using (_∘_)
14
+ using (_≟_; ≟-diag; ≟-diag-refl
15
+ ; opposite-prop; opposite-involutive; opposite-suc)
18
16
open import Relation.Nullary.Reflects using (invert)
19
- open import Relation.Nullary using (does; _because_; yes; no)
20
- open import Relation.Nullary.Decidable using (dec-true; dec-false)
17
+ open import Relation.Nullary.Decidable.Core using (does; _because_)
21
18
open import Relation.Binary.PropositionalEquality.Core
22
- using (_≡_; refl; sym; trans)
23
- open import Relation.Binary.PropositionalEquality.Properties
24
- using (module ≡-Reasoning )
25
- open import Algebra.Definitions using (Involutive)
26
- open ≡-Reasoning
19
+ using (_≡_; refl; sym)
27
20
28
21
------------------------------------------------------------------------
29
22
-- Functions
30
23
------------------------------------------------------------------------
31
24
32
- -- 'tranpose i j' swaps the places of 'i' and 'j'.
25
+ -- 'transpose i j' swaps the places of 'i' and 'j'.
33
26
34
27
transpose : ∀ {n} → Fin n → Fin n → Fin n → Fin n
35
28
transpose i j k with does (k ≟ i)
@@ -42,17 +35,31 @@ transpose i j k with does (k ≟ i)
42
35
-- Properties
43
36
------------------------------------------------------------------------
44
37
38
+ transpose-iij : ∀ {n} (i j : Fin n) → transpose i i j ≡ j
39
+ transpose-iij i j with j ≟ i in j≟i
40
+ ... | true because [j≡i] = sym (invert [j≡i])
41
+ ... | false because _ rewrite j≟i = refl
42
+
43
+ transpose-ijj : ∀ {n} (i j : Fin n) → transpose i j j ≡ i
44
+ transpose-ijj i j with j ≟ i
45
+ ... | true because [j≡i] = invert [j≡i]
46
+ ... | false because _ rewrite ≟-diag-refl j = refl
47
+
48
+ transpose-iji : ∀ {n} (i j : Fin n) → transpose i j i ≡ j
49
+ transpose-iji i j rewrite ≟-diag-refl i = refl
50
+
51
+ transpose-transpose : ∀ {n} {i j k l : Fin n} →
52
+ transpose i j k ≡ l → transpose j i l ≡ k
53
+ transpose-transpose {n} {i} {j} {k} {l} eq with k ≟ i in k≟i
54
+ ... | true because [k≡i] rewrite ≟-diag (sym eq) = sym (invert [k≡i])
55
+ ... | false because [k≢i] with k ≟ j in k≟j
56
+ ... | true because [k≡j] rewrite eq | transpose-ijj j l = sym (invert [k≡j])
57
+ ... | false because [k≢j] rewrite eq | k≟j | k≟i = refl
58
+
45
59
transpose-inverse : ∀ {n} (i j : Fin n) {k} →
46
60
transpose i j (transpose j i k) ≡ k
47
- transpose-inverse i j {k} with k ≟ j
48
- ... | true because [k≡j] rewrite dec-true (i ≟ i) refl = sym (invert [k≡j])
49
- ... | false because [k≢j] with k ≟ i
50
- ... | true because [k≡i]
51
- rewrite dec-false (j ≟ i) (invert [k≢j] ∘ trans (invert [k≡i]) ∘ sym)
52
- | dec-true (j ≟ j) refl
53
- = sym (invert [k≡i])
54
- ... | false because [k≢i] rewrite dec-false (k ≟ i) (invert [k≢i])
55
- | dec-false (k ≟ j) (invert [k≢j]) = refl
61
+ transpose-inverse i j = transpose-transpose refl
62
+
56
63
57
64
------------------------------------------------------------------------
58
65
-- DEPRECATED NAMES
0 commit comments