| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Core definitions for metrics over ℚ |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Data.Rational.Base |
| 10 |
open import Function.Base using (const) |
| 11 |
open import Level using (Level; suc) |
| 12 |
open import Relation.Binary.Core using (Rel) |
| 13 |
open import Relation.Binary.PropositionalEquality.Core using (_≡_) |
| 14 |
|
| 15 |
open import Function.Metric.Rational.Core |
| 16 |
open import Function.Metric.Rational.Definitions |
| 17 |
import Function.Metric.Structures as Base |
| 18 |
|
| 19 |
module Function.Metric.Rational.Structures where |
| 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 |