@@ -20,7 +20,7 @@ open import Data.Product.Base as Prod using (_×_; _,_; proj₁; proj₂)
2020open import Data.Vec.Base as Vec using (Vec; _∷_)
2121open import Function.Base using (const; flip; id; _∘′_; _$′_; _⟨_⟩_; _∘₂′_)
2222open import Level using (Level)
23- open import Relation.Binary.PropositionalEquality.Core as P using (_≡_; cong; cong₂)
23+ open import Relation.Binary.PropositionalEquality.Core as ≡ using (_≡_; cong; cong₂)
2424open import Relation.Binary.PropositionalEquality.Properties
2525 using (module ≡-Reasoning )
2626
@@ -39,7 +39,7 @@ cong-lookup : ∀ {as bs : Stream A} → as ≈ bs → ∀ n → lookup as n ≡
3939cong-lookup = B.lookup⁺
4040
4141cong-take : ∀ n {as bs : Stream A} → as ≈ bs → take n as ≡ take n bs
42- cong-take zero as≈bs = P .refl
42+ cong-take zero as≈bs = ≡ .refl
4343cong-take (suc n) as≈bs = cong₂ _∷_ (as≈bs .head) (cong-take n (as≈bs .tail))
4444
4545cong-drop : ∀ n {as bs : Stream A} → as ≈ bs → drop n as ≈ drop n bs
@@ -63,7 +63,7 @@ cong-concat ass≈bss = cong-++-concat [] ass≈bss
6363 cong-++-concat : ∀ (as : List A) {ass bss} → ass ≈ bss → ++-concat as ass ≈ ++-concat as bss
6464 cong-++-concat [] ass≈bss .head = cong List⁺.head (ass≈bss .head)
6565 cong-++-concat [] ass≈bss .tail rewrite ass≈bss .head = cong-++-concat _ (ass≈bss .tail)
66- cong-++-concat (a ∷ as) ass≈bss .head = P .refl
66+ cong-++-concat (a ∷ as) ass≈bss .head = ≡ .refl
6767 cong-++-concat (a ∷ as) ass≈bss .tail = cong-++-concat as ass≈bss
6868
6969cong-interleave : {as bs cs ds : Stream A} → as ≈ bs → cs ≈ ds →
@@ -79,11 +79,11 @@ cong-chunksOf n as≈bs .tail = cong-chunksOf n (cong-drop n as≈bs)
7979-- Properties of repeat
8080
8181lookup-repeat : ∀ n (a : A) → lookup (repeat a) n ≡ a
82- lookup-repeat zero a = P .refl
82+ lookup-repeat zero a = ≡ .refl
8383lookup-repeat (suc n) a = lookup-repeat n a
8484
8585splitAt-repeat : ∀ n (a : A) → splitAt n (repeat a) ≡ (Vec.replicate n a , repeat a)
86- splitAt-repeat zero a = P .refl
86+ splitAt-repeat zero a = ≡ .refl
8787splitAt-repeat (suc n) a = cong (Prod.map₁ (a ∷_)) (splitAt-repeat n a)
8888
8989take-repeat : ∀ n (a : A) → take n (repeat a) ≡ Vec.replicate n a
@@ -93,28 +93,28 @@ drop-repeat : ∀ n (a : A) → drop n (repeat a) ≡ repeat a
9393drop-repeat n a = cong proj₂ (splitAt-repeat n a)
9494
9595map-repeat : ∀ (f : A → B) a → map f (repeat a) ≈ repeat (f a)
96- map-repeat f a .head = P .refl
96+ map-repeat f a .head = ≡ .refl
9797map-repeat f a .tail = map-repeat f a
9898
9999ap-repeat : ∀ (f : A → B) a → ap (repeat f) (repeat a) ≈ repeat (f a)
100- ap-repeat f a .head = P .refl
100+ ap-repeat f a .head = ≡ .refl
101101ap-repeat f a .tail = ap-repeat f a
102102
103103ap-repeatˡ : ∀ (f : A → B) as → ap (repeat f) as ≈ map f as
104- ap-repeatˡ f as .head = P .refl
104+ ap-repeatˡ f as .head = ≡ .refl
105105ap-repeatˡ f as .tail = ap-repeatˡ f (as .tail)
106106
107107ap-repeatʳ : ∀ (fs : Stream (A → B)) a → ap fs (repeat a) ≈ map (_$′ a) fs
108- ap-repeatʳ fs a .head = P .refl
108+ ap-repeatʳ fs a .head = ≡ .refl
109109ap-repeatʳ fs a .tail = ap-repeatʳ (fs .tail) a
110110
111111interleave-repeat : (a : A) → interleave (repeat a) (repeat a) ≈ repeat a
112- interleave-repeat a .head = P .refl
112+ interleave-repeat a .head = ≡ .refl
113113interleave-repeat a .tail = interleave-repeat a
114114
115115zipWith-repeat : ∀ (f : A → B → C) a b →
116116 zipWith f (repeat a) (repeat b) ≈ repeat (f a b)
117- zipWith-repeat f a b .head = P .refl
117+ zipWith-repeat f a b .head = ≡ .refl
118118zipWith-repeat f a b .tail = zipWith-repeat f a b
119119
120120chunksOf-repeat : ∀ n (a : A) → chunksOf n (repeat a) ≈ repeat (Vec.replicate n a)
@@ -125,52 +125,52 @@ chunksOf-repeat n a = begin go where
125125 go : chunksOf n (repeat a) ≈∞ repeat (Vec.replicate n a)
126126 go .head = take-repeat n a
127127 go .tail =
128- chunksOf n (drop n (repeat a)) ≡⟨ P .cong (chunksOf n) (drop-repeat n a) ⟩
128+ chunksOf n (drop n (repeat a)) ≡⟨ ≡ .cong (chunksOf n) (drop-repeat n a) ⟩
129129 chunksOf n (repeat a) ↺⟨ go ⟩
130130 repeat (Vec.replicate n a) ∎
131131
132132------------------------------------------------------------------------
133133-- Properties of map
134134
135135map-const : (a : A) (bs : Stream B) → map (const a) bs ≈ repeat a
136- map-const a bs .head = P .refl
136+ map-const a bs .head = ≡ .refl
137137map-const a bs .tail = map-const a (bs .tail)
138138
139139map-id : (as : Stream A) → map id as ≈ as
140- map-id as .head = P .refl
140+ map-id as .head = ≡ .refl
141141map-id as .tail = map-id (as .tail)
142142
143143map-∘ : ∀ (g : B → C) (f : A → B) as → map g (map f as) ≈ map (g ∘′ f) as
144- map-∘ g f as .head = P .refl
144+ map-∘ g f as .head = ≡ .refl
145145map-∘ g f as .tail = map-∘ g f (as .tail)
146146
147147map-unfold : ∀ (g : B → C) (f : A → A × B) a →
148148 map g (unfold f a) ≈ unfold (Prod.map₂ g ∘′ f) a
149- map-unfold g f a .head = P .refl
149+ map-unfold g f a .head = ≡ .refl
150150map-unfold g f a .tail = map-unfold g f (proj₁ (f a))
151151
152152map-drop : ∀ (f : A → B) n as → map f (drop n as) ≡ drop n (map f as)
153- map-drop f zero as = P .refl
153+ map-drop f zero as = ≡ .refl
154154map-drop f (suc n) as = map-drop f n (as .tail)
155155
156156map-zipWith : ∀ (g : C → D) (f : A → B → C) as bs →
157157 map g (zipWith f as bs) ≈ zipWith (g ∘₂′ f) as bs
158- map-zipWith g f as bs .head = P .refl
158+ map-zipWith g f as bs .head = ≡ .refl
159159map-zipWith g f as bs .tail = map-zipWith g f (as .tail) (bs .tail)
160160
161161map-interleave : ∀ (f : A → B) as bs →
162162 map f (interleave as bs) ≈ interleave (map f as) (map f bs)
163- map-interleave f as bs .head = P .refl
163+ map-interleave f as bs .head = ≡ .refl
164164map-interleave f as bs .tail = map-interleave f bs (as .tail)
165165
166166map-concat : ∀ (f : A → B) ass → map f (concat ass) ≈ concat (map (List⁺.map f) ass)
167167map-concat f ass = map-++-concat [] ass
168168 where
169169 open Concat
170170 map-++-concat : ∀ acc ass → map f (++-concat acc ass) ≈ ++-concat (List.map f acc) (map (List⁺.map f) ass)
171- map-++-concat [] ass .head = P .refl
171+ map-++-concat [] ass .head = ≡ .refl
172172 map-++-concat [] ass .tail = map-++-concat (ass .head .List⁺.tail) (ass .tail)
173- map-++-concat (a ∷ as) ass .head = P .refl
173+ map-++-concat (a ∷ as) ass .head = ≡ .refl
174174 map-++-concat (a ∷ as) ass .tail = map-++-concat as ass
175175
176176map-cycle : ∀ (f : A → B) as → map f (cycle as) ≈ cycle (List⁺.map f as)
@@ -186,29 +186,29 @@ map-cycle f as = run
186186-- Properties of lookup
187187
188188lookup-drop : ∀ m (as : Stream A) n → lookup (drop m as) n ≡ lookup as (m + n)
189- lookup-drop zero as n = P .refl
189+ lookup-drop zero as n = ≡ .refl
190190lookup-drop (suc m) as n = lookup-drop m (as .tail) n
191191
192192lookup-map : ∀ n (f : A → B) as → lookup (map f as) n ≡ f (lookup as n)
193- lookup-map zero f as = P .refl
193+ lookup-map zero f as = ≡ .refl
194194lookup-map (suc n) f as = lookup-map n f (as . tail)
195195
196196lookup-iterate : ∀ n f (x : A) → lookup (iterate f x) n ≡ ℕ.iterate f x n
197- lookup-iterate zero f x = P .refl
197+ lookup-iterate zero f x = ≡ .refl
198198lookup-iterate (suc n) f x = lookup-iterate n f (f x)
199199
200200lookup-zipWith : ∀ n (f : A → B → C) as bs →
201201 lookup (zipWith f as bs) n ≡ f (lookup as n) (lookup bs n)
202- lookup-zipWith zero f as bs = P .refl
202+ lookup-zipWith zero f as bs = ≡ .refl
203203lookup-zipWith (suc n) f as bs = lookup-zipWith n f (as .tail) (bs .tail)
204204
205205lookup-unfold : ∀ n (f : A → A × B) a →
206206 lookup (unfold f a) n ≡ proj₂ (f (ℕ.iterate (proj₁ ∘′ f) a n))
207- lookup-unfold zero f a = P .refl
207+ lookup-unfold zero f a = ≡ .refl
208208lookup-unfold (suc n) f a = lookup-unfold n f (proj₁ (f a))
209209
210210lookup-tabulate : ∀ n (f : ℕ → A) → lookup (tabulate f) n ≡ f n
211- lookup-tabulate zero f = P .refl
211+ lookup-tabulate zero f = ≡ .refl
212212lookup-tabulate (suc n) f = lookup-tabulate n (f ∘′ suc)
213213
214214lookup-transpose : ∀ n (ass : List (Stream A)) →
@@ -237,81 +237,81 @@ lookup-tails zero as = B.refl
237237lookup-tails (suc n) as = lookup-tails n (as .tail)
238238
239239lookup-evens : ∀ n (as : Stream A) → lookup (evens as) n ≡ lookup as (n * 2 )
240- lookup-evens zero as = P .refl
240+ lookup-evens zero as = ≡ .refl
241241lookup-evens (suc n) as = lookup-evens n (as .tail .tail)
242242
243243lookup-odds : ∀ n (as : Stream A) → lookup (odds as) n ≡ lookup as (suc (n * 2 ))
244- lookup-odds zero as = P .refl
244+ lookup-odds zero as = ≡ .refl
245245lookup-odds (suc n) as = lookup-odds n (as .tail .tail)
246246
247247lookup-interleave-even : ∀ n (as bs : Stream A) →
248248 lookup (interleave as bs) (n * 2 ) ≡ lookup as n
249- lookup-interleave-even zero as bs = P .refl
249+ lookup-interleave-even zero as bs = ≡ .refl
250250lookup-interleave-even (suc n) as bs = lookup-interleave-even n (as .tail) (bs .tail)
251251
252252lookup-interleave-odd : ∀ n (as bs : Stream A) →
253253 lookup (interleave as bs) (suc (n * 2 )) ≡ lookup bs n
254- lookup-interleave-odd zero as bs = P .refl
254+ lookup-interleave-odd zero as bs = ≡ .refl
255255lookup-interleave-odd (suc n) as bs = lookup-interleave-odd n (as .tail) (bs .tail)
256256
257257------------------------------------------------------------------------
258258-- Properties of take
259259
260260take-iterate : ∀ n f (x : A) → take n (iterate f x) ≡ Vec.iterate f x n
261- take-iterate zero f x = P .refl
261+ take-iterate zero f x = ≡ .refl
262262take-iterate (suc n) f x = cong (x ∷_) (take-iterate n f (f x))
263263
264264take-zipWith : ∀ n (f : A → B → C) as bs →
265265 take n (zipWith f as bs) ≡ Vec.zipWith f (take n as) (take n bs)
266- take-zipWith zero f as bs = P .refl
266+ take-zipWith zero f as bs = ≡ .refl
267267take-zipWith (suc n) f as bs =
268268 cong (f (as .head) (bs .head) ∷_) (take-zipWith n f (as .tail) (bs . tail))
269269
270270------------------------------------------------------------------------
271271-- Properties of drop
272272
273273drop-drop : ∀ m n (as : Stream A) → drop n (drop m as) ≡ drop (m + n) as
274- drop-drop zero n as = P .refl
274+ drop-drop zero n as = ≡ .refl
275275drop-drop (suc m) n as = drop-drop m n (as .tail)
276276
277277drop-zipWith : ∀ n (f : A → B → C) as bs →
278278 drop n (zipWith f as bs) ≡ zipWith f (drop n as) (drop n bs)
279- drop-zipWith zero f as bs = P .refl
279+ drop-zipWith zero f as bs = ≡ .refl
280280drop-zipWith (suc n) f as bs = drop-zipWith n f (as .tail) (bs .tail)
281281
282282drop-ap : ∀ n (fs : Stream (A → B)) as →
283283 drop n (ap fs as) ≡ ap (drop n fs) (drop n as)
284- drop-ap zero fs as = P .refl
284+ drop-ap zero fs as = ≡ .refl
285285drop-ap (suc n) fs as = drop-ap n (fs .tail) (as .tail)
286286
287287drop-iterate : ∀ n f (x : A) → drop n (iterate f x) ≡ iterate f (ℕ.iterate f x n)
288- drop-iterate zero f x = P .refl
288+ drop-iterate zero f x = ≡ .refl
289289drop-iterate (suc n) f x = drop-iterate n f (f x)
290290
291291------------------------------------------------------------------------
292292-- Properties of zipWith
293293
294294zipWith-defn : ∀ (f : A → B → C) as bs →
295295 zipWith f as bs ≈ (repeat f ⟨ ap ⟩ as ⟨ ap ⟩ bs)
296- zipWith-defn f as bs .head = P .refl
296+ zipWith-defn f as bs .head = ≡ .refl
297297zipWith-defn f as bs .tail = zipWith-defn f (as .tail) (bs .tail)
298298
299299zipWith-const : (as : Stream A) (bs : Stream B) →
300300 zipWith const as bs ≈ as
301- zipWith-const as bs .head = P .refl
301+ zipWith-const as bs .head = ≡ .refl
302302zipWith-const as bs .tail = zipWith-const (as .tail) (bs .tail)
303303
304304zipWith-flip : ∀ (f : A → B → C) as bs →
305305 zipWith (flip f) as bs ≈ zipWith f bs as
306- zipWith-flip f as bs .head = P .refl
306+ zipWith-flip f as bs .head = ≡ .refl
307307zipWith-flip f as bs .tail = zipWith-flip f (as .tail) (bs. tail)
308308
309309------------------------------------------------------------------------
310310-- Properties of interleave
311311
312312interleave-evens-odds : (as : Stream A) → interleave (evens as) (odds as) ≈ as
313- interleave-evens-odds as .head = P .refl
314- interleave-evens-odds as .tail .head = P .refl
313+ interleave-evens-odds as .head = ≡ .refl
314+ interleave-evens-odds as .tail .head = ≡ .refl
315315interleave-evens-odds as .tail .tail = interleave-evens-odds (as .tail .tail)
316316
317317------------------------------------------------------------------------
0 commit comments