forked from agda/agda-stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEquality.agda
42 lines (31 loc) · 1.25 KB
/
Equality.agda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
------------------------------------------------------------------------
-- The Agda standard library
--
-- Substituting equalities for binary relations
------------------------------------------------------------------------
-- For more general transformations between binary relations
-- see `Relation.Binary.Morphisms`.
{-# OPTIONS --cubical-compatible --safe #-}
open import Data.Product.Base as Prod
open import Relation.Binary
module Relation.Binary.Construct.Subst.Equality
{a ℓ₁ ℓ₂} {A : Set a} {≈₁ : Rel A ℓ₁} {≈₂ : Rel A ℓ₂}
(equiv@(to , from) : ≈₁ ⇔ ≈₂)
where
open import Function.Base
------------------------------------------------------------------------
-- Definitions
refl : Reflexive ≈₁ → Reflexive ≈₂
refl refl = to refl
sym : Symmetric ≈₁ → Symmetric ≈₂
sym sym = to ∘′ sym ∘′ from
trans : Transitive ≈₁ → Transitive ≈₂
trans trans x≈y y≈z = to (trans (from x≈y) (from y≈z))
------------------------------------------------------------------------
-- Structures
isEquivalence : IsEquivalence ≈₁ → IsEquivalence ≈₂
isEquivalence E = record
{ refl = refl E.refl
; sym = sym E.sym
; trans = trans E.trans
} where module E = IsEquivalence E