A theorem on metrics based on min and max #
In this file we give a formal proof that in terms of d(X,Y)= m min(|X\Y|, |Y\X|) + M max(|X\Y|, |Y\X|) the function D(X,Y) = d(X,Y)/(|X ∩ Y|+d(X,Y)) is a metric if 0 < m ≤ M and 1 ≤ M. In particular, taking m=M=1, the Jaccard distance is a metric on Finset ℕ.
Main results #
noncomputable instance jaccard_nid.metric_space
: the proof of the main result described above.noncomputable instance jaccard.metric_space
: the special case of the Jaccard distance.
Notation #
|_|
: Notation for cardinality.
References #
For the original proof see https://arxiv.org/abs/2111.02498
theorem
delta_nonneg
{m M : ℝ}
{α : Type u_1}
[DecidableEq α]
{x y : Finset α}
(hm : 0 ≤ m)
(hM : m ≤ M)
:
Equations
- jaccard_nid.metric_space hm hM h1M = MetricSpace.mk ⋯
Equations
- jaccard.metric_space hm hM h1M = MetricSpace.mk ⋯
instance
instSDiffFinsetOfFintypeOfDecidablePredMem_jaccard
{α : Type}
[Fintype α]
[(X : Finset α) → DecidablePred fun (a : α) => a ∈ X]
:
Equations
- instSDiffFinsetOfFintypeOfDecidablePredMem_jaccard = { sdiff := fun (X Y : Finset α) => Finset.filter (fun (a : α) => a ∈ X ∧ a ∉ Y) Finset.univ }
instance
instUnionFinsetOfFintypeOfDecidablePredMem_jaccard
{α : Type}
[Fintype α]
[(X : Finset α) → DecidablePred fun (a : α) => a ∈ X]
: