Theorem 7: multi-class OOD detection in the separate space with finite feature space
ProvedOODLearnable.multiclass_separate_learnableLet be finite, let be a loss with iff that satisfies Condition 2,
let be a nonempty set of functions , and let be a set of functions with ( all functions , ). Then OOD detection is learnable in the separate space for .
Formalization Note The nonemptiness of is implicit in the paper (for and the space is empty and the claim fails). The binary labels are in Fin 2. The feature space is with the Borel structure; every hypothesis in is assumed measurable (the paper's implicit convention, needed for the risks to be defined).
import Mathlib import Definitions.Def_OODLearnable_Basic open MeasureTheory Filter Topology open scoped ENNReal NNReal
namespace OODLearnable
theorem multiclass_separate_learnable {dim : ℕ} {𝒳 : Set (EuclideanSpace ℝ (Fin dim))}
(h𝒳 : 𝒳.Finite) {K : ℕ} (ℓ : Fin (K + 1) → Fin (K + 1) → ℝ≥0) (hℓ : IsOODLoss ℓ)
(Hin : Set (𝒳 → Fin K)) (hHin : Hin.Nonempty) (Hb : Set (𝒳 → Fin 2))
(hHmeas : ∀ h ∈ dotSpace Hin Hb, Measurable h)
(hHb : {g : 𝒳 → Fin 2 | g ≠ fun _ => 1} ⊆ Hb) (hC2 : LossCondition2 ℓ) :
IsLearnable ℓ (separateSpace : Set (Domain 𝒳 K)) (dotSpace Hin Hb) := by sorry
end OODLearnableRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. The theorem is stated for the following data:
- Ambient space. Fix a natural number (possibly , in which case is a single point). Let be an arbitrary finite subset (possibly empty) of Euclidean space.
- Structure on . carries the subspace topology and the subspace (trace) Borel σ-algebra. Because is finite, the topology is discrete and every subset of is measurable.
- Labels. Fix (possibly ). The label set is , where are the "ID" labels and is the "OOD" label.
- Loss. Let satisfy for all labels. The first argument is the predicted label and the second is the true label.
- Loss Condition 2. Assume
So predicting any ID label when the truth is ID label costs no more than predicting OOD.
- ID classifiers. Let be a nonempty set of functions . When , this nonemptiness forces .
- Binary detectors. Let be a set of functions . Assume contains every such function except possibly the constant function . When this assumption is empty.
- Combined hypothesis space. Define as the set of all for which there exist and with
- Measurability. Assume every is measurable. Given the discrete σ-algebra noted above, this holds automatically.
Domains and risk. A domain consists of three pieces:
- a probability measure on ;
- a probability measure on ;
- a number .
Its ID marginal is the pushforward of to . The risk of is the -valued quantity
The separate space is the set of all domains whose ID marginal and OOD distribution have disjoint supports. Here the support is the set of points all of whose neighbourhoods have positive measure. In the discrete topology on , this is the set of points of positive mass.
Conclusion. OOD detection is learnable in for . That is, there exist an algorithm and a sequence with the following properties.
- The algorithm. assigns to every sample size and every sample a function .
- Range. For every and every , . Nothing is required at .
- Rate. is non-increasing and . Consequently .
- Consistency. For every domain and every :
- the map is almost-everywhere measurable with respect to the -fold product (i.i.d. samples drawn only from the ID distribution);
- the following bound holds:
Degenerate cases.
- If , or if , there are no domains, since no probability measure exists on an empty space. There are also no samples of size . The conclusion then holds trivially.
- An infimum over an empty would be .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.