Debian Codegraph @

src/Function/Metric/Rational/Bundles.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Bundles for metrics over ℚ
5 ------------------------------------------------------------------------
6
7 -- Unfortunately, unlike definitions and structures, the bundles over
8 -- general metric spaces cannot be reused as it is impossible to
9 -- constrain the image set to ℚ.
10
11 {-# OPTIONS --cubical-compatible --safe #-}
12
13 module Function.Metric.Rational.Bundles where
14
15 open import Function.Base using (const)
16 open import Level using (Level; suc; _⊔_)
17 open import Relation.Binary.Core using (Rel)
18 open import Relation.Binary.PropositionalEquality.Core using (_≡_)
19 open import Relation.Binary.PropositionalEquality.Properties using (isEquivalence)
20
21 open import Function.Metric.Rational.Core using (DistanceFunction)
22 open import Function.Metric.Rational.Structures
23 open import Function.Metric.Bundles as Base
24 using (GeneralMetric)
25
26 ------------------------------------------------------------------------
27 -- Proto-metric
28
29 record ProtoMetric a ℓ : Set (suc (a ⊔ ℓ)) where
30 field
31 Carrier : Set a
32 _≈_ : Rel Carrier ℓ
33 d : DistanceFunction Carrier
34 isProtoMetric : IsProtoMetric _≈_ d
35
36 infix 4 _≈_
37
38 open IsProtoMetric isProtoMetric public
39
40 ------------------------------------------------------------------------
41 -- PreMetric
42
43 record PreMetric a ℓ : Set (suc (a ⊔ ℓ)) where
44 field
45 Carrier : Set a
46 _≈_ : Rel Carrier ℓ
47 d : DistanceFunction Carrier
48 isPreMetric : IsPreMetric _≈_ d
49
50 infix 4 _≈_
51
52 open IsPreMetric isPreMetric public
53
54 protoMetric : ProtoMetric a ℓ
55 protoMetric = record
56 { isProtoMetric = isProtoMetric
57 }
58
59 ------------------------------------------------------------------------
60 -- QuasiSemiMetric
61
62 record QuasiSemiMetric a ℓ : Set (suc (a ⊔ ℓ)) where
63 field
64 Carrier : Set a
65 _≈_ : Rel Carrier ℓ
66 d : DistanceFunction Carrier
67 isQuasiSemiMetric : IsQuasiSemiMetric _≈_ d
68
69 infix 4 _≈_
70
71 open IsQuasiSemiMetric isQuasiSemiMetric public
72
73 preMetric : PreMetric a ℓ
74 preMetric = record
75 { isPreMetric = isPreMetric
76 }
77
78 open PreMetric preMetric public
79 using (protoMetric)
80
81 ------------------------------------------------------------------------
82 -- SemiMetric
83
84 record SemiMetric a ℓ : Set (suc (a ⊔ ℓ)) where
85 field
86 Carrier : Set a
87 _≈_ : Rel Carrier ℓ
88 d : DistanceFunction Carrier
89 isSemiMetric : IsSemiMetric _≈_ d
90
91 infix 4 _≈_
92
93 open IsSemiMetric isSemiMetric public
94
95 quasiSemiMetric : QuasiSemiMetric a ℓ
96 quasiSemiMetric = record
97 { isQuasiSemiMetric = isQuasiSemiMetric
98 }
99
100 open QuasiSemiMetric quasiSemiMetric public
101 using (protoMetric; preMetric)
102
103 ------------------------------------------------------------------------
104 -- Metrics
105
106 record Metric a ℓ : Set (suc (a ⊔ ℓ)) where
107 field
108 Carrier : Set a
109 _≈_ : Rel Carrier ℓ
110 d : DistanceFunction Carrier
111 isMetric : IsMetric _≈_ d
112
113 infix 4 _≈_
114
115 open IsMetric isMetric public
116
117 semiMetric : SemiMetric a ℓ
118 semiMetric = record
119 { isSemiMetric = isSemiMetric
120 }
121
122 open SemiMetric semiMetric public
123 using (protoMetric; preMetric; quasiSemiMetric)
124
125 ------------------------------------------------------------------------
126 -- UltraMetrics
127
128 record UltraMetric a ℓ : Set (suc (a ⊔ ℓ)) where
129 field
130 Carrier : Set a
131 _≈_ : Rel Carrier ℓ
132 d : DistanceFunction Carrier
133 isUltraMetric : IsUltraMetric _≈_ d
134
135 infix 4 _≈_
136
137 open IsUltraMetric isUltraMetric public
138
139 semiMetric : SemiMetric a ℓ
140 semiMetric = record
141 { isSemiMetric = isSemiMetric
142 }
143
144 open SemiMetric semiMetric public
145 using (protoMetric; preMetric; quasiSemiMetric)