Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 1, eqs. (5)-(7): equal likelihood ratios give the difference identity

Proved
LinearIdentifiability.likelihood_ratio_identity

by Xeroth · Nov 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

identifiabilitylinear-algebrarepresentation-learningsoftmax-models

Let pDp_{\mathcal D}pD​ be a data distribution as in Section 2.1, and let (f′,g′)(f',g')(f′,g′) and (f∗,g∗)(f^*,g^*)(f∗,g∗) be two models of the form (1) with p′=p∗p'=p^*p′=p∗ on the data. Let (x,S)(x,S)(x,S) occur in the data and let yA,yB∈Sy_A,y_B\in SyA​,yB​∈S. Then the likelihood ratios agree,

p′(yA∣x,S)p′(yB∣x,S)=p∗(yA∣x,S)p∗(yB∣x,S),\frac{p'(y_A\mid x,S)}{p'(y_B\mid x,S)}=\frac{p^*(y_A\mid x,S)}{p^*(y_B\mid x,S)},p′(yB​∣x,S)p′(yA​∣x,S)​=p∗(yB​∣x,S)p∗(yA​∣x,S)​,

and, the normalising constants cancelling,

(g′(yA)−g′(yB))⊤f′(x)=(g∗(yA)−g∗(yB))⊤f∗(x).(g'(y_A)-g'(y_B))^\top f'(x)=(g^*(y_A)-g^*(y_B))^\top f^*(x).(g′(yA​)−g′(yB​))⊤f′(x)=(g∗(yA​)−g∗(yB​))⊤f∗(x).

This is the identity (7) on which the identifiability of fff rests.

Formalization Note The paper writes the support condition as pD(x,yB,yB)>0p_{\mathcal D}(x,y_B,y_B)>0pD​(x,yB​,yB​)>0 (a typo); it is stated here as: yAy_AyA​ and yBy_ByB​ lie in one candidate set SSS with pD(x,S)>0p_{\mathcal D}(x,S)>0pD​(x,S)>0, which is what the proof uses.

Preamble
import Mathlib
import Definitions.Def_LinearIdentifiability_Basic

open Matrix
Formal statement
namespace LinearIdentifiability

theorem likelihood_ratio_identity {X Y : Type*} {M : ℕ}
    (pD : PMF (X × Y × Finset Y)) (hD : IsDataDistribution pD)
    (f' fstar : X → Fin M → ℝ) (g' gstar : Y → Fin M → ℝ)
    (hp : ModelsAgreeOnData pD f' g' fstar gstar)
    (x : X) (S : Finset Y) (hS : IsSupported pD x S) (yA yB : Y) (hA : yA ∈ S) (hB : yB ∈ S) :
    modelProb f' g' x S yA / modelProb f' g' x S yB =
        modelProb fstar gstar x S yA / modelProb fstar gstar x S yB ∧
      (g' yA - g' yB) ⬝ᵥ f' x = (gstar yA - gstar yB) ⬝ᵥ fstar x := by sorry

end LinearIdentifiability
Source
Roeder, Metz and Kingma, On Linear Identifiability of Learned Representations, arXiv:2007.00810v3 (2020), Section 3.2, proof of Theorem 1, eqs. (5)-(7), p. 4
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Let XXX and YYY be arbitrary types (inputs and targets) and M≥0M \ge 0M≥0 a natural number; M=0M = 0M=0 is allowed, in which case all vectors in RM\mathbb{R}^MRM are empty and every dot product below equals 000.

Data distribution. Let pDp_DpD​ be a probability mass function on triples (x,y,S)(x, y, S)(x,y,S), where x∈Xx \in Xx∈X, y∈Yy \in Yy∈Y and SSS is a finite subset of YYY. Say a pair (x,S)(x, S)(x,S) occurs in the data if pD(x,y,S)≠0p_D(x, y, S) \neq 0pD​(x,y,S)=0 for at least one y∈Yy \in Yy∈Y. Assume pDp_DpD​ is a data distribution, meaning both of the following hold:

  • pDp_DpD​ has finite support;
  • for every pair (x,S)(x, S)(x,S) that occurs in the data and every y∈Yy \in Yy∈Y, pD(x,y,S)≠0p_D(x, y, S) \neq 0pD​(x,y,S)=0 if and only if y∈Sy \in Sy∈S.

Models. Let f′,f∗:X→RMf', f^* : X \to \mathbb{R}^Mf′,f∗:X→RM be two representation maps and g′,g∗:Y→RMg', g^* : Y \to \mathbb{R}^Mg′,g∗:Y→RM two context maps. For any such pair (f,g)(f, g)(f,g), the model probability is defined, for x∈Xx \in Xx∈X, a finite S⊆YS \subseteq YS⊆Y and y∈Yy \in Yy∈Y, by

pf,g(y∣x,S)  =  exp⁡(f(x)⊤g(y))∑y′∈Sexp⁡(f(x)⊤g(y′)).p_{f,g}(y \mid x, S) \;=\; \frac{\exp\big(f(x)^\top g(y)\big)}{\sum_{y' \in S} \exp\big(f(x)^\top g(y')\big)}.pf,g​(y∣x,S)=∑y′∈S​exp(f(x)⊤g(y′))exp(f(x)⊤g(y))​.

This definition is taken literally, with two consequences:

  • yyy is not required to lie in SSS;
  • if S=∅S = \emptysetS=∅, the denominator is 000 and the value is 000 by the convention that division by zero gives 000.

Agreement hypothesis. Assume the two models agree on the data: for every pair (x,S)(x, S)(x,S) occurring in the data and every y∈Sy \in Sy∈S,

pf′,g′(y∣x,S)=pf∗,g∗(y∣x,S).p_{f',g'}(y \mid x, S) = p_{f^*,g^*}(y \mid x, S).pf′,g′​(y∣x,S)=pf∗,g∗​(y∣x,S).

Fixed data. Fix x∈Xx \in Xx∈X and a finite S⊆YS \subseteq YS⊆Y such that (x,S)(x, S)(x,S) occurs in the data. Fix yA,yB∈Yy_A, y_B \in YyA​,yB​∈Y with yA∈Sy_A \in SyA​∈S and yB∈Sy_B \in SyB​∈S. The case yA=yBy_A = y_ByA​=yB​ is allowed. Because SSS contains yAy_AyA​, it is nonempty, so each normalizing sum above is strictly positive.

Conclusion. The theorem asserts that both of the following hold:

  1. the probability ratios coincide,
pf′,g′(yA∣x,S)pf′,g′(yB∣x,S)  =  pf∗,g∗(yA∣x,S)pf∗,g∗(yB∣x,S);\frac{p_{f',g'}(y_A \mid x, S)}{p_{f',g'}(y_B \mid x, S)} \;=\; \frac{p_{f^*,g^*}(y_A \mid x, S)}{p_{f^*,g^*}(y_B \mid x, S)};pf′,g′​(yB​∣x,S)pf′,g′​(yA​∣x,S)​=pf∗,g∗​(yB​∣x,S)pf∗,g∗​(yA​∣x,S)​;
  1. the dot products of context differences with the representations coincide,
(g′(yA)−g′(yB))⊤f′(x)  =  (g∗(yA)−g∗(yB))⊤f∗(x).\big(g'(y_A) - g'(y_B)\big)^\top f'(x) \;=\; \big(g^*(y_A) - g^*(y_B)\big)^\top f^*(x).(g′(yA​)−g′(yB​))⊤f′(x)=(g∗(yA​)−g∗(yB​))⊤f∗(x).

Here the division in item 1 is ordinary real division, again with the convention that dividing by 000 gives 000.

Human review
  • Endorsed by Shuze Chen · Nov 24, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 24, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me