Skip to content

Commit da40fb8

Browse files
committed
review: only open CastReasoning locally
1 parent 31f7917 commit da40fb8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Data/Vec/Properties.agda

+8-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ open import Data.Product.Base as Prod
2121
open import Data.Sum.Base using ([_,_]′)
2222
open import Data.Sum.Properties using ([,]-map)
2323
open import Data.Vec.Base
24-
open import Data.Vec.Relation.Binary.Equality.Cast as CastReasoning renaming (begin_ to begin′_; _∎ to _∎′)
24+
import Data.Vec.Relation.Binary.Equality.Cast as CastReasoning
2525
open import Function.Base
2626
-- open import Function.Inverse using (_↔_; inverse)
2727
open import Function.Bundles using (_↔_; mk↔′)
@@ -1022,14 +1022,15 @@ map-reverse f (x ∷ xs) = begin
10221022

10231023
reverse-++ : .(eq : m + n ≡ n + m) (xs : Vec A m) (ys : Vec A n)
10241024
cast eq (reverse (xs ++ ys)) ≡ reverse ys ++ reverse xs
1025-
reverse-++ {m = zero} {n = n} eq [] ys = ≈-sym (++-identityʳ (sym eq) (reverse ys))
1025+
reverse-++ {m = zero} {n = n} eq [] ys = CastReasoning.≈-sym (++-identityʳ (sym eq) (reverse ys))
10261026
reverse-++ {m = suc m} {n = n} eq (x ∷ xs) ys = begin′
10271027
reverse (x ∷ xs ++ ys) ≂⟨ reverse-∷ x (xs ++ ys) ⟩
10281028
reverse (xs ++ ys) ∷ʳ x ≈⟨ cast-∷ʳ (cong suc (+-comm m n)) x (reverse (xs ++ ys))
10291029
≈cong[ (_∷ʳ x) ] reverse-++ _ xs ys ⟩
10301030
(reverse ys ++ reverse xs) ∷ʳ x ≈⟨ ++-∷ʳ (sym (+-suc n m)) x (reverse ys) (reverse xs) ⟩
10311031
reverse ys ++ (reverse xs ∷ʳ x) ≂˘⟨ cong (reverse ys ++_) (reverse-∷ x xs) ⟩
10321032
reverse ys ++ (reverse (x ∷ xs)) ∎′
1033+
where open CastReasoning renaming (begin_ to begin′_; _∎ to _∎′)
10331034

10341035
cast-reverse : .(eq : m ≡ n) cast eq ∘ reverse {A = A} {n = m} ≗ reverse ∘ cast eq
10351036
cast-reverse {n = zero} eq [] = refl
@@ -1040,6 +1041,7 @@ cast-reverse {n = suc n} eq (x ∷ xs) = begin′
10401041
reverse (cast _ xs) ∷ʳ x ≂˘⟨ reverse-∷ x (cast (cong pred eq) xs) ⟩
10411042
reverse (x ∷ cast _ xs) ≈⟨⟩
10421043
reverse (cast eq (x ∷ xs)) ∎′
1044+
where open CastReasoning renaming (begin_ to begin′_; _∎ to _∎′)
10431045

10441046
------------------------------------------------------------------------
10451047
-- _ʳ++_
@@ -1076,6 +1078,7 @@ map-ʳ++ {ys = ys} f xs = begin
10761078
(reverse xs ∷ʳ a) ++ ys ≈⟨ ∷ʳ-++ eq a (reverse xs) ⟩
10771079
reverse xs ++ (a ∷ ys) ≂˘⟨ unfold-ʳ++ xs (a ∷ ys) ⟩
10781080
xs ʳ++ (a ∷ ys) ∎′
1081+
where open CastReasoning renaming (begin_ to begin′_; _∎ to _∎′)
10791082

10801083
++-ʳ++ : .(eq : m + n + o ≡ n + (m + o)) (xs : Vec A m) {ys : Vec A n} {zs : Vec A o}
10811084
cast eq ((xs ++ ys) ʳ++ zs) ≡ ys ʳ++ (xs ʳ++ zs)
@@ -1087,6 +1090,7 @@ map-ʳ++ {ys = ys} f xs = begin
10871090
reverse ys ++ (reverse xs ++ zs) ≂˘⟨ cong (reverse ys ++_) (unfold-ʳ++ xs zs) ⟩
10881091
reverse ys ++ (xs ʳ++ zs) ≂˘⟨ unfold-ʳ++ ys (xs ʳ++ zs) ⟩
10891092
ys ʳ++ (xs ʳ++ zs) ∎′
1093+
where open CastReasoning renaming (begin_ to begin′_; _∎ to _∎′)
10901094

10911095
ʳ++-ʳ++ : .(eq : (m + n) + o ≡ n + (m + o)) (xs : Vec A m) {ys : Vec A n} {zs}
10921096
cast eq ((xs ʳ++ ys) ʳ++ zs) ≡ ys ʳ++ (xs ++ zs)
@@ -1099,6 +1103,7 @@ map-ʳ++ {ys = ys} f xs = begin
10991103
(reverse ys ++ xs) ++ zs ≈⟨ ++-assoc (+-assoc n m o) (reverse ys) xs zs ⟩
11001104
reverse ys ++ (xs ++ zs) ≂˘⟨ unfold-ʳ++ ys (xs ++ zs) ⟩
11011105
ys ʳ++ (xs ++ zs) ∎′
1106+
where open CastReasoning renaming (begin_ to begin′_; _∎ to _∎′)
11021107

11031108
------------------------------------------------------------------------
11041109
-- sum
@@ -1286,6 +1291,7 @@ fromList-reverse (x List.∷ xs) = begin′
12861291
reverse (fromList xs) ∷ʳ x ≂˘⟨ reverse-∷ x (fromList xs) ⟩
12871292
reverse (x ∷ fromList xs) ≈⟨⟩
12881293
reverse (fromList (x List.∷ xs)) ∎′
1294+
where open CastReasoning renaming (begin_ to begin′_; _∎ to _∎′)
12891295

12901296
------------------------------------------------------------------------
12911297
-- DEPRECATED NAMES

0 commit comments

Comments
 (0)