forked from agda/agda-stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProperties.agda
98 lines (75 loc) · 2.61 KB
/
Properties.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
------------------------------------------------------------------------
-- The Agda standard library
--
-- Properties of the unit type
------------------------------------------------------------------------
{-# OPTIONS --cubical-compatible --safe #-}
module Data.Unit.Properties where
open import Data.Sum.Base using (inj₁)
open import Data.Unit.Base using (⊤)
open import Level using (0ℓ)
open import Relation.Binary.Bundles
using (Setoid; DecSetoid; Poset; DecTotalOrder)
open import Relation.Binary.Structures
using (IsPreorder; IsPartialOrder; IsTotalOrder; IsDecTotalOrder)
open import Relation.Binary.Definitions
using (DecidableEquality; Total; Antisymmetric)
open import Relation.Binary.PropositionalEquality.Core
using (_≡_; refl; trans)
open import Relation.Binary.PropositionalEquality.Properties
using (setoid; decSetoid; isEquivalence)
open import Relation.Nullary.Decidable.Core using (yes)
open import Relation.Nullary.Irrelevant using (Irrelevant)
------------------------------------------------------------------------
-- Irrelevancy
⊤-irrelevant : Irrelevant ⊤
⊤-irrelevant _ _ = refl
------------------------------------------------------------------------
-- Equality
infix 4 _≟_
_≟_ : DecidableEquality ⊤
_ ≟ _ = yes refl
≡-setoid : Setoid 0ℓ 0ℓ
≡-setoid = setoid ⊤
≡-decSetoid : DecSetoid 0ℓ 0ℓ
≡-decSetoid = decSetoid _≟_
------------------------------------------------------------------------
-- Relational properties
≡-total : Total {A = ⊤} _≡_
≡-total _ _ = inj₁ refl
≡-antisym : Antisymmetric {A = ⊤} _≡_ _≡_
≡-antisym eq _ = eq
------------------------------------------------------------------------
-- Structures
≡-isPreorder : IsPreorder {A = ⊤} _≡_ _≡_
≡-isPreorder = record
{ isEquivalence = isEquivalence
; reflexive = λ x → x
; trans = trans
}
≡-isPartialOrder : IsPartialOrder _≡_ _≡_
≡-isPartialOrder = record
{ isPreorder = ≡-isPreorder
; antisym = ≡-antisym
}
≡-isTotalOrder : IsTotalOrder _≡_ _≡_
≡-isTotalOrder = record
{ isPartialOrder = ≡-isPartialOrder
; total = ≡-total
}
≡-isDecTotalOrder : IsDecTotalOrder _≡_ _≡_
≡-isDecTotalOrder = record
{ isTotalOrder = ≡-isTotalOrder
; _≟_ = _≟_
; _≤?_ = _≟_
}
------------------------------------------------------------------------
-- Bundles
≡-poset : Poset 0ℓ 0ℓ 0ℓ
≡-poset = record
{ isPartialOrder = ≡-isPartialOrder
}
≡-decTotalOrder : DecTotalOrder 0ℓ 0ℓ 0ℓ
≡-decTotalOrder = record
{ isDecTotalOrder = ≡-isDecTotalOrder
}