Skip to content

Commit e1fbae0

Browse files
Move just a few more things over to new Function hierarchy. (#2044)
1 parent 67a030d commit e1fbae0

File tree

4 files changed

+16
-17
lines changed

4 files changed

+16
-17
lines changed

src/Data/List/Relation/Binary/Pointwise.agda

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Data.List.Relation.Binary.Pointwise where
1010

1111
open import Algebra.Core using (Op₂)
1212
open import Function.Base
13-
open import Function.Inverse using (Inverse)
13+
open import Function.Bundles using (Inverse)
1414
open import Data.Bool.Base using (true; false)
1515
open import Data.Product.Base hiding (map)
1616
open import Data.List.Base as List hiding (map; head; tail; uncons)
@@ -269,10 +269,9 @@ Pointwise-≡⇒≡ (P.refl ∷ xs∼ys) with Pointwise-≡⇒≡ xs∼ys
269269

270270
Pointwise-≡↔≡ : Inverse (setoid (P.setoid A)) (P.setoid (List A))
271271
Pointwise-≡↔≡ = record
272-
{ to = record { _⟨$⟩_ = id; cong = Pointwise-≡⇒≡ }
273-
; from = record { _⟨$⟩_ = id; cong = ≡⇒Pointwise-≡ }
274-
; inverse-of = record
275-
{ left-inverse-of = λ _ refl P.refl
276-
; right-inverse-of = λ _ P.refl
277-
}
272+
{ to = id
273+
; from = id
274+
; to-cong = Pointwise-≡⇒≡
275+
; from-cong = ≡⇒Pointwise-≡
276+
; inverse = Pointwise-≡⇒≡ , ≡⇒Pointwise-≡
278277
}

src/Data/List/Relation/Unary/All/Properties.agda

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ open import Data.Nat.Base using (zero; suc; s≤s; _<_; z<s; s<s)
3333
open import Data.Nat.Properties using (≤-refl; m≤n⇒m≤1+n)
3434
open import Data.Product.Base as Prod using (_×_; _,_; uncurry; uncurry′)
3535
open import Function.Base
36+
import Function.Bundles as B
3637
open import Function.Equality using (_⟨$⟩_)
3738
open import Function.Equivalence using (_⇔_; equivalence; Equivalence)
38-
open import Function.Inverse using (_↔_; inverse)
3939
open import Function.Surjection using (_↠_; surjection)
4040
open import Level using (Level)
4141
open import Relation.Binary as B using (REL; Setoid; _Respects_)
@@ -405,8 +405,8 @@ mapMaybe⁺ {xs = x ∷ xs} {f = f} (px ∷ pxs) with f x
405405
++⁻ [] p = [] , p
406406
++⁻ (x ∷ xs) (px ∷ pxs) = Prod.map (px ∷_) id (++⁻ _ pxs)
407407

408-
++↔ : (All P xs × All P ys) ↔ All P (xs ++ ys)
409-
++↔ {xs = zs} = inverse (uncurry ++⁺) (++⁻ zs) ++⁻∘++⁺ (++⁺∘++⁻ zs)
408+
++↔ : (All P xs × All P ys) B.↔ All P (xs ++ ys)
409+
++↔ {xs = zs} = B.mk↔′ (uncurry ++⁺) (++⁻ zs) (++⁺∘++⁻ zs) ++⁻∘++⁺
410410
where
411411
++⁺∘++⁻ : xs (p : All P (xs ++ ys)) uncurry′ ++⁺ (++⁻ xs p) ≡ p
412412
++⁺∘++⁻ [] p = refl

src/Data/Vec/Properties.agda

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ open import Data.Sum.Base using ([_,_]′)
2121
open import Data.Sum.Properties using ([,]-map)
2222
open import Data.Vec.Base
2323
open import Function.Base
24-
open import Function.Inverse using (_↔_; inverse)
24+
-- open import Function.Inverse using (_↔_; inverse)
25+
open import Function.Bundles using (_↔_; mk↔′)
2526
open import Level using (Level)
2627
open import Relation.Binary hiding (Decidable)
2728
open import Relation.Binary.PropositionalEquality
@@ -199,9 +200,8 @@ lookup⇒[]= zero (_ ∷ _) refl = here
199200
lookup⇒[]= (suc i) (_ ∷ xs) p = there (lookup⇒[]= i xs p)
200201

201202
[]=↔lookup : {i} xs [ i ]= x ↔ lookup xs i ≡ x
202-
[]=↔lookup {i = i} =
203-
inverse []=⇒lookup (lookup⇒[]= _ _)
204-
lookup⇒[]=∘[]=⇒lookup ([]=⇒lookup∘lookup⇒[]= _ i)
203+
[]=↔lookup {xs = ys} {i = i} =
204+
mk↔′ []=⇒lookup (lookup⇒[]= i ys) ([]=⇒lookup∘lookup⇒[]= _ i) lookup⇒[]=∘[]=⇒lookup
205205
where
206206
lookup⇒[]=∘[]=⇒lookup : {i} (p : xs [ i ]= x)
207207
lookup⇒[]= i xs ([]=⇒lookup p) ≡ p
@@ -706,7 +706,7 @@ zip∘unzip [] = refl
706706
zip∘unzip (xy ∷ xys) = cong (xy ∷_) (zip∘unzip xys)
707707

708708
×v↔v× : (Vec A n × Vec B n) ↔ Vec (A × B) n
709-
×v↔v× = inverse (uncurry zip) unzip (uncurry unzip∘zip) zip∘unzip
709+
×v↔v× = mk↔′ (uncurry zip) unzip zip∘unzip (uncurry unzip∘zip)
710710

711711
------------------------------------------------------------------------
712712
-- _⊛_

src/Data/Vec/Recursive/Properties.agda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ open import Data.Nat.Base hiding (_^_)
1313
open import Data.Product
1414
open import Data.Vec.Recursive
1515
open import Data.Vec.Base using (Vec; _∷_)
16-
open import Function.Inverse using (_↔_; inverse)
16+
open import Function.Bundles using (_↔_; mk↔′)
1717
open import Relation.Binary.PropositionalEquality.Core as P
1818
open ≡-Reasoning
1919

@@ -82,7 +82,7 @@ toVec∘fromVec {n = suc n} (x Vec.∷ xs) = begin
8282
tl-prf = tail-cons-identity _ x (fromVec xs)
8383

8484
↔Vec : n A ^ n ↔ Vec A n
85-
↔Vec n = inverse (toVec n) fromVec (fromVec∘toVec n) toVec∘fromVec
85+
↔Vec n = mk↔′ (toVec n) fromVec toVec∘fromVec (fromVec∘toVec n)
8686

8787
------------------------------------------------------------------------
8888
-- DEPRECATED NAMES

0 commit comments

Comments
 (0)