Debian Codegraph @

src/Function/Metric/Nat/Structures.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Core definitions for metrics over ℕ
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --safe #-}
8
9 module Function.Metric.Nat.Structures where
10
11 open import Data.Nat.Base hiding (suc)
12 open import Function.Base using (const)
13 open import Level using (Level; suc)
14 open import Relation.Binary.Core using (Rel)
15 open import Relation.Binary.PropositionalEquality.Core using (_≡_)
16 open import Function.Metric.Nat.Core using (DistanceFunction)
17 import Function.Metric.Structures as Base
18 using (IsGeneralMetric; IsProtoMetric; IsPreMetric; IsQuasiSemiMetric
19 ; IsSemiMetric)
20
21 private
22 variable
23 a ℓ : Level
24 A : Set a
25
26 ------------------------------------------------------------------------
27 -- Proto-metrics
28
29 IsProtoMetric : Rel A ℓ → DistanceFunction A → Set _
30 IsProtoMetric _≈_ = Base.IsProtoMetric _≈_ _≡_ _≤_ 0
31
32 open Base using (module IsProtoMetric) public
33
34 ------------------------------------------------------------------------
35 -- Pre-metrics
36
37 IsPreMetric : Rel A ℓ → DistanceFunction A → Set _
38 IsPreMetric _≈_ = Base.IsPreMetric _≈_ _≡_ _≤_ 0
39
40 open Base using (module IsPreMetric) public
41
42 ------------------------------------------------------------------------
43 -- Quasi-semi-metrics
44
45 IsQuasiSemiMetric : Rel A ℓ → DistanceFunction A → Set _
46 IsQuasiSemiMetric _≈_ = Base.IsQuasiSemiMetric _≈_ _≡_ _≤_ 0
47
48 open Base using (module IsQuasiSemiMetric) public
49
50 ------------------------------------------------------------------------
51 -- Semi-metrics
52
53 IsSemiMetric : Rel A ℓ → DistanceFunction A → Set _
54 IsSemiMetric _≈_ = Base.IsSemiMetric _≈_ _≡_ _≤_ 0
55
56 open Base using (module IsSemiMetric) public
57
58 ------------------------------------------------------------------------
59 -- Metrics
60
61 IsMetric : Rel A ℓ → DistanceFunction A → Set _
62 IsMetric _≈_ = Base.IsGeneralMetric _≈_ _≡_ _≤_ 0 _+_
63
64 module IsMetric {_≈_ : Rel A ℓ} {d : DistanceFunction A}
65 (M : IsMetric _≈_ d) where
66 open Base.IsGeneralMetric M public
67
68 ------------------------------------------------------------------------
69 -- Ultra-metrics
70
71 IsUltraMetric : Rel A ℓ → DistanceFunction A → Set _
72 IsUltraMetric _≈_ = Base.IsGeneralMetric _≈_ _≡_ _≤_ 0 _⊔_
73
74 module IsUltraMetric {_≈_ : Rel A ℓ} {d : DistanceFunction A}
75 (UM : IsUltraMetric _≈_ d) where
76 open Base.IsGeneralMetric UM public