Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Causal Bayesian networks, local interventions, causal influence diagrams and policy oracles

Definition
RobustAgentsCausal_Basic

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

bayesian-networkscausal-inferencedomain-adaptationidentifiabilityinfluence-diagrams

Objects of Sections 2.1-2.3 and Appendices A.1-A.3 of Richens and Everitt (2024).

  1. Chance variables. Finitely many chance variables CiC_iCi​, i∈Ii\in Ii∈I; CiC_iCi​ takes the categorical values 0,…,ki−10,\dots,k_i-10,…,ki​−1. A joint state is c=(ci)i∈Ic=(c_i)_{i\in I}c=(ci​)i∈I​. Two joint states agree on S⊆IS\subseteq IS⊆I if their coordinates in SSS coincide, and a function of ccc depends only on SSS if it is equal at any two states that agree on SSS.
  2. Graphs (Definition 1). A graph on III is given by parent sets Pai⊆I\mathrm{Pa}_i\subseteq IPai​⊆I (edges Cj→CiC_j\to C_iCj​→Ci​ for j∈Paij\in\mathrm{Pa}_ij∈Pai​). CjC_jCj​ is a proper ancestor of CiC_iCi​ if there is a directed path Cj→⋯→CiC_j\to\cdots\to C_iCj​→⋯→Ci​, and the graph is a DAG if no variable is its own proper ancestor.
  3. Causal Bayesian networks (Definition 1). A family of conditional distributions for the graph assigns to each iii and joint state ccc a probability vector P(⋅∣pai)P(\cdot\mid \mathrm{pa}_i)P(⋅∣pai​) on the values of CiC_iCi​ that depends on ccc only through the parents. The joint law is the Markov factorisation P(c)=∏iP(ci∣pai)P(c)=\prod_iP(c_i\mid\mathrm{pa}_i)P(c)=∏i​P(ci​∣pai​).
  4. Interventions (Definitions 2, 3). A local intervention is a family of maps fi:{0,…,ki−1}→{0,…,ki−1}f_i:\{0,\dots,k_i-1\}\to\{0,\dots,k_i-1\}fi​:{0,…,ki​−1}→{0,…,ki​−1}, one per variable (fi=idf_i=\mathrm{id}fi​=id means no intervention, a constant fif_ifi​ is a hard intervention). It replaces each conditional by P(ci∣pai;σ)=∑ci′:fi(ci′)=ciP(ci′∣pai)P(c_i\mid\mathrm{pa}_i;\sigma)=\sum_{c_i':f_i(c_i')=c_i}P(c_i'\mid\mathrm{pa}_i)P(ci​∣pai​;σ)=∑ci′​:fi​(ci′​)=ci​​P(ci′​∣pai​), and P(c;σ)=∏iP(ci∣pai;σ)P(c;\sigma)=\prod_iP(c_i\mid\mathrm{pa}_i;\sigma)P(c;σ)=∏i​P(ci​∣pai​;σ). A mixture is a probability vector www on the (finitely many) local interventions, with P(c;σ∗)=∑fwfP(c;σf)P(c;\sigma^*)=\sum_fw_fP(c;\sigma_f)P(c;σ∗)=∑f​wf​P(c;σf​). A soft intervention on a set TTT replaces P(ci∣pai)P(c_i\mid\mathrm{pa}_i)P(ci​∣pai​), i∈Ti\in Ti∈T, by conditional distributions P′(ci∣pai∗)P'(c_i\mid\mathrm{pa}^*_i)P′(ci​∣pai∗​) for new parent sets Pai∗\mathrm{Pa}^*_iPai∗​, provided the modified graph is still acyclic; then P(c;σ)=∏i∈TP′(ci∣pai∗)∏i∉TP(ci∣pai)P(c;\sigma)=\prod_{i\in T}P'(c_i\mid\mathrm{pa}^*_i)\prod_{i\notin T}P(c_i\mid\mathrm{pa}_i)P(c;σ)=∏i∈T​P′(ci​∣pai∗​)∏i∈/T​P(ci​∣pai​).
  5. Decision task (Definition 4, Assumption 1). The decision DDD takes values in a finite nonempty set A\mathcal AA; its parents are the chance variables PaD\mathrm{Pa}_DPaD​, and its only child is the utility UUU, whose parents are DDD and the chance variables PaU\mathrm{Pa}_UPaU​. The utility is a real function U(d,x)U(d,x)U(d,x) of ddd and the configuration xxx of PaU\mathrm{Pa}_UPaU​. The chance variables of AncU\mathrm{Anc}_UAncU​ are those of PaU∪PaD\mathrm{Pa}_U\cup\mathrm{Pa}_DPaU​∪PaD​ together with their proper ancestors.
  6. Parameters (Appendix A.2). θP\theta_PθP​ consists of one real number P(ci∣pai)P(c_i\mid\mathrm{pa}_i)P(ci​∣pai​) for each variable, configuration of its parents and state ci≤ki−2c_i\le k_i-2ci​≤ki​−2; it is valid if these numbers are nonnegative and sum to at most 111, and the last state receives 1−∑ci≤ki−2P(ci∣pai)1-\sum_{c_i\le k_i-2}P(c_i\mid\mathrm{pa}_i)1−∑ci​≤ki​−2​P(ci​∣pai​). θU\theta_UθU​ consists of one real number U(d,x)U(d,x)U(d,x) for each decision and configuration of PaU\mathrm{Pa}_UPaU​. "Almost all CIDs" refers to Lebesgue measure on the finite-dimensional space of (θP,θU)(\theta_P,\theta_U)(θP​,θU​), the graph being fixed.
  7. Policies and regret (Section 2.2). A policy with input SSS is a stochastic kernel π(d∣c)\pi(d\mid c)π(d∣c) depending on ccc only through SSS. Its expected utility under a joint law μ\muμ is Eπ[U]=∑cμ(c)∑dπ(d∣c)U(d,c)\mathbb E^\pi[U]=\sum_c\mu(c)\sum_d\pi(d\mid c)U(d,c)Eπ[U]=∑c​μ(c)∑d​π(d∣c)U(d,c). It has regret at most δ\deltaδ if Eπ′[U]≤Eπ[U]+δ\mathbb E^{\pi'}[U]\le\mathbb E^\pi[U]+\deltaEπ′[U]≤Eπ[U]+δ for every policy π′\pi'π′ with input SSS, and is optimal if δ=0\delta=0δ=0.
  8. Policy oracles (Definition 5). A policy oracle maps a masking S⊆PaDS\subseteq\mathrm{Pa}_DS⊆PaD​ and a mixture www of local interventions to a policy. It is δ\deltaδ-optimal if for every S⊆PaDS\subseteq\mathrm{Pa}_DS⊆PaD​ and every mixture www it returns a policy with input SSS and regret at most δ\deltaδ under P(⋅;σw)P(\cdot;\sigma_w)P(⋅;σw​).
  9. Domain dependence (Assumption 2). There are joint laws P,P′P,P'P,P′ that factorise according to the graph such that no policy (with input PaD\mathrm{Pa}_DPaD​) optimal under PPP is optimal under P′P'P′.
  10. Context quantities (Appendix C). For a context c0c_0c0​ on SSS, P(paD′;σ)=∑c:c∣S=c0∣Sμ(c)P(\mathrm{pa}_D';\sigma)=\sum_{c:c|_S=c_0|_S}\mu(c)P(paD′​;σ)=∑c:c∣S​=c0​∣S​​μ(c) and ∑zP(c;σ)U(d,c)=∑c:c∣S=c0∣Sμ(c)U(d,c)\sum_zP(c;\sigma)U(d,c)=\sum_{c:c|_S=c_0|_S}\mu(c)U(d,c)∑z​P(c;σ)U(d,c)=∑c:c∣S​=c0​∣S​​μ(c)U(d,c), with Z=C∖SZ=C\setminus SZ=C∖S.

Formalization Note The decision has no chance-variable children: the paper's proofs use ChD={U}\mathrm{Ch}_D=\{U\}ChD​={U} (Appendix C, proof of Lemma 4), and under Assumption 1 any chance descendant of DDD is outside AncU\mathrm{Anc}_UAncU​ and does not affect any expected utility. Assumption 1 then holds automatically. A local intervention acts on all variables at once, as in the proofs of Lemma 3 and Theorem 1. Conditional distributions are written as functions of the whole joint state that depend only on the parents.

Definition code
import Mathlib

/-!
Richens and Everitt, *Robust agents learn causal world models*, ICLR 2024, arXiv:2402.10877v7:
causal Bayesian networks over finitely many categorical chance variables, local, mixed and soft
interventions, single-decision single-utility causal influence diagrams with Assumptions 1 and 2,
policies, regret, policy oracles, and the parameterisation of CIDs used for "almost all CIDs"
(Sections 2.1-2.3 and Appendices A.1-A.3).
-/

open MeasureTheory

noncomputable section

namespace RobustAgentsCausal

variable {ι : Type*} [Fintype ι] [DecidableEq ι] {k : ι → ℕ} {A : Type*} [Fintype A]

/-- Section 2.1 and Appendix A.2: a joint state `c` of the chance variables `C = {C_i}`, the
variable `C_i` taking the categorical values `0, …, k i - 1`. -/
abbrev Cfg (k : ι → ℕ) := (i : ι) → Fin (k i)

/-- The joint states `c` and `c'` agree on the variables in `S`. -/
def AgreeOn (S : Finset ι) (c c' : Cfg k) : Prop := ∀ i ∈ S, c i = c' i

/-- A function of the joint state depends only on the variables in `S`. -/
def DependsOnlyOn {β : Type*} (S : Finset ι) (f : Cfg k → β) : Prop :=
  ∀ c c' : Cfg k, AgreeOn S c c' → f c = f c'

/-- Appendix A.1: `C_j` is a (proper) ancestor of `C_i` in the graph whose parent sets are `pa`,
i.e. there is a directed path `C_j → ⋯ → C_i` with edges `C_a → C_b` for `a ∈ pa b`. -/
def IsProperAncestor (pa : ι → Finset ι) (j i : ι) : Prop :=
  Relation.TransGen (fun a b => a ∈ pa b) j i

/-- Definition 1: the graph with parent sets `pa` is a directed acyclic graph. -/
def IsAcyclic (pa : ι → Finset ι) : Prop := ∀ i, ¬ IsProperAncestor pa i i

/-- Appendix A.1, Figure 5: the chance variables in `Anc_U`. The utility `U` has the decision `D`
and the chance variables `paU` as parents and the decision has the chance variables `paD` as
parents, so these are the chance variables in `paU ∪ paD` and their ancestors. -/
def ancU (pa : ι → Finset ι) (paD paU : Finset ι) : Set ι :=
  {j | ∃ i ∈ paU ∪ paD, j = i ∨ IsProperAncestor pa j i}

/-- Definition 1: `P i c` is a conditional probability distribution `P(C_i = · ∣ pa_i)` over the
values of `C_i` that depends on the joint state `c` only through the parents `pa i`. -/
def IsCPDAt (pa : ι → Finset ι) (P : (i : ι) → Cfg k → Fin (k i) → ℝ) (i : ι) : Prop :=
  (∀ c v, 0 ≤ P i c v) ∧ (∀ c, ∑ v, P i c v = 1) ∧ DependsOnlyOn (pa i) (P i)

/-- Definition 1: a family of conditional probability distributions for the graph `pa`. -/
def IsCPD (pa : ι → Finset ι) (P : (i : ι) → Cfg k → Fin (k i) → ℝ) : Prop :=
  ∀ i, IsCPDAt pa P i

/-- Definition 1: the Markov factorisation `P(c) = ∏_i P(c_i ∣ pa_i)`. -/
def jointProb (P : (i : ι) → Cfg k → Fin (k i) → ℝ) (c : Cfg k) : ℝ := ∏ i, P i c (c i)

/-- Definition 2: a local intervention `do(C_i = f_i(c_i))` on every chance variable at once, as used
in the proofs of Lemma 3 and Theorem 1 (`f_i = id` leaves `C_i` untouched, a constant `f_i` is a
hard intervention). -/
abbrev LocalInt (k : ι → ℕ) := (i : ι) → Fin (k i) → Fin (k i)

/-- Definition 2, eq. (1): the conditional distribution after the local intervention `f`,
`P(c_i ∣ pa_i; σ) = ∑_{c_i' : f_i(c_i') = c_i} P(c_i' ∣ pa_i)`. -/
def localCPD (P : (i : ι) → Cfg k → Fin (k i) → ℝ) (f : LocalInt k) (i : ι) (c : Cfg k)
    (v : Fin (k i)) : ℝ :=
  ∑ v' ∈ Finset.univ.filter (fun v' => f i v' = v), P i c v'

/-- Section 2.1: the joint distribution of the chance variables after the local intervention `f`,
`P(c; σ) = ∏_i P(c_i ∣ pa_i; σ)`. -/
def localJoint (P : (i : ι) → Cfg k → Fin (k i) → ℝ) (f : LocalInt k) (c : Cfg k) : ℝ :=
  ∏ i, localCPD P f i c (c i)

/-- Definition 3: `w` is a mixed intervention `σ* = ∑_f w_f σ_f` over the local interventions
(`w_f ≥ 0`, `∑_f w_f = 1`). -/
def IsMixture (w : LocalInt k → ℝ) : Prop := (∀ f, 0 ≤ w f) ∧ ∑ f, w f = 1

/-- Definition 3: `P(c ∣ σ*) = ∑_f w_f P(c ∣ σ_f)`. -/
def mixJoint (P : (i : ι) → Cfg k → Fin (k i) → ℝ) (w : LocalInt k → ℝ) (c : Cfg k) : ℝ :=
  ∑ f, w f * localJoint P f c

/-- Section 2.1: a soft intervention on the chance variables in `T`, replacing the conditional
distribution of each `C_i`, `i ∈ T`, by `newCPD i`, which depends on a new parent set `newPa i`. -/
structure SoftInt (k : ι → ℕ) where
  /-- The intervened variables. -/
  T : Finset ι
  /-- The new parent sets `Pa*_i`. -/
  newPa : ι → Finset ι
  /-- The new conditional distributions `P'(C_i ∣ Pa*_i)`. -/
  newCPD : (i : ι) → Cfg k → Fin (k i) → ℝ

/-- Section 2.1: the parent sets of the graph after the soft intervention `σ`. -/
def SoftInt.modPa (σ : SoftInt k) (pa : ι → Finset ι) : ι → Finset ι :=
  fun i => if i ∈ σ.T then σ.newPa i else pa i

/-- Section 2.1: `σ` is a soft intervention for the graph `pa`: its new conditional distributions
are conditional distributions for the new parent sets, and no cycle is introduced. -/
def SoftInt.IsCompatible (σ : SoftInt k) (pa : ι → Finset ι) : Prop :=
  (∀ i ∈ σ.T, IsCPDAt σ.newPa σ.newCPD i) ∧ IsAcyclic (σ.modPa pa)

/-- Section 2.1: `P(c; σ) = ∏_{i ∈ T} P'(c_i ∣ pa*_i) ∏_{i ∉ T} P(c_i ∣ pa_i)`. -/
def softJoint (P : (i : ι) → Cfg k → Fin (k i) → ℝ) (σ : SoftInt k) (c : Cfg k) : ℝ :=
  ∏ i, if i ∈ σ.T then σ.newCPD i c (c i) else P i c (c i)

/-- Appendix A.2: a configuration `pa_i` of the parents of `C_i`. -/
abbrev PaCfg (k : ι → ℕ) (pa : ι → Finset ι) (i : ι) := (j : ↥(pa i)) → Fin (k j)

/-- Appendix A.2: the parameters `θ_P = {P(c_i ∣ pa_i) : c_i ∈ {0, …, k_i - 2}}` of the joint
distribution, one real number per variable, parent configuration and non-final state. -/
abbrev CPDParam (k : ι → ℕ) (pa : ι → Finset ι) :=
  ((i : ι) × (PaCfg k pa i × Fin (k i - 1))) → ℝ

/-- Appendix A.2: the parameters `θ_P` define conditional distributions: they are nonnegative and
sum to at most `1` for each variable and parent configuration. -/
def ValidParam (pa : ι → Finset ι) (θ : CPDParam k pa) : Prop :=
  ∀ i (p : PaCfg k pa i),
    (∀ v, 0 ≤ θ ⟨i, (p, v)⟩) ∧ ∑ v : Fin (k i - 1), θ ⟨i, (p, v)⟩ ≤ 1

/-- Appendix A.2: the conditional distributions defined by `θ_P`; the last state receives
`P(C_i = k_i - 1 ∣ pa_i) = 1 - ∑_{c_i ≤ k_i - 2} P(c_i ∣ pa_i)`. -/
def cpdOf (pa : ι → Finset ι) (θ : CPDParam k pa) (i : ι) (c : Cfg k) (v : Fin (k i)) : ℝ :=
  if h : (v : ℕ) + 1 < k i then θ ⟨i, (fun j => c j.1, ⟨v, by omega⟩)⟩
  else 1 - ∑ v' : Fin (k i - 1), θ ⟨i, (fun j => c j.1, v')⟩

/-- Appendix A.2: the parameters `θ_U = {U(d, x)}` of the utility, one real number per decision `d`
and configuration `x` of the chance parents `paU` of `U`. -/
abbrev UParam (k : ι → ℕ) (A : Type*) (paU : Finset ι) := A → ((j : ↥paU) → Fin (k j)) → ℝ

/-- Definition 4: the utility `U(d, x)` as a function of the decision and the joint state. -/
def utilOf (paU : Finset ι) (uθ : UParam k A paU) (d : A) (c : Cfg k) : ℝ :=
  uθ d (fun j => c j.1)

/-- Section 2.2: a (stochastic) policy `π(d ∣ pa_D)` whose input is the chance variables in `S`. -/
def IsPolicy (S : Finset ι) (π : Cfg k → A → ℝ) : Prop :=
  (∀ c d, 0 ≤ π c d) ∧ (∀ c, ∑ d, π c d = 1) ∧ DependsOnlyOn S π

/-- Section 2.2: the expected utility `E^π[U] = ∑_c P(c) ∑_d π(d ∣ pa_D) U(d, c)` of a policy when the
chance variables have joint distribution `μ` (the decision has no chance descendants). -/
def expUtil (μ : Cfg k → ℝ) (u : A → Cfg k → ℝ) (π : Cfg k → A → ℝ) : ℝ :=
  ∑ c, μ c * ∑ d, π c d * u d c

/-- Section 2.2 and Definition 5: `π` has regret at most `δ`, `E^π[U] ≥ E^{π*}[U] - δ`, among the
policies with input `S`. -/
def IsDeltaOptimal (δ : ℝ) (S : Finset ι) (μ : Cfg k → ℝ) (u : A → Cfg k → ℝ)
    (π : Cfg k → A → ℝ) : Prop :=
  IsPolicy S π ∧ ∀ π', IsPolicy S π' → expUtil μ u π' ≤ expUtil μ u π + δ

/-- Section 2.2: `π` is an optimal policy among the policies with input `S`. -/
def IsOptimal (S : Finset ι) (μ : Cfg k → ℝ) (u : A → Cfg k → ℝ) (π : Cfg k → A → ℝ) : Prop :=
  IsDeltaOptimal 0 S μ u π

/-- Definition 5: a policy oracle on the domains `Σ` (mixtures of local interventions together with
a masking `Pa_D' ⊆ Pa_D` of the policy's inputs), returning the policy `π_σ(d ∣ pa_D')`. -/
abbrev Oracle (k : ι → ℕ) (A : Type*) := Finset ι → (LocalInt k → ℝ) → Cfg k → A → ℝ

/-- Definition 5: the policy oracle is `δ`-optimal for the CID with conditional distributions `P`,
utility `u` and decision parents `paD`: for every masking `S ⊆ paD` and mixture `w` of local
interventions it returns a policy with input `S` and regret at most `δ` in `M(σ)`. -/
def IsDeltaOptimalOracle (δ : ℝ) (paD : Finset ι) (P : (i : ι) → Cfg k → Fin (k i) → ℝ)
    (u : A → Cfg k → ℝ) (O : Oracle k A) : Prop :=
  ∀ S ⊆ paD, ∀ w : LocalInt k → ℝ, IsMixture w → IsDeltaOptimal δ S (mixJoint P w) u (O S w)

/-- Definition 5: an optimal policy oracle (`δ = 0`). -/
def IsOptimalOracle (paD : Finset ι) (P : (i : ι) → Cfg k → Fin (k i) → ℝ)
    (u : A → Cfg k → ℝ) (O : Oracle k A) : Prop :=
  IsDeltaOptimalOracle 0 paD P u O

/-- Assumption 2 (domain dependence): there are joint distributions `P`, `P'` compatible with the
graph `pa` such that no policy optimal under `P` is optimal under `P'`. -/
def DomainDependent (pa : ι → Finset ι) (paD : Finset ι) (u : A → Cfg k → ℝ) : Prop :=
  ∃ P P' : (i : ι) → Cfg k → Fin (k i) → ℝ, IsCPD pa P ∧ IsCPD pa P' ∧
    ∀ π, IsOptimal paD (jointProb P) u π → ¬ IsOptimal paD (jointProb P') u π

open Classical in
/-- Appendix C: the probability `P(Pa_D' = pa_D'; σ) = ∑_z P(C = c; σ)` of the context `c₀` on the
variables `S`, `Z = C ∖ S`, under the joint distribution `μ`. -/
def ctxProb (μ : Cfg k → ℝ) (S : Finset ι) (c₀ : Cfg k) : ℝ :=
  ∑ c ∈ Finset.univ.filter (fun c => AgreeOn S c₀ c), μ c

open Classical in
/-- Appendix C, eqs. (8)-(9): the unnormalised conditional expected utility
`∑_z P(C = c; σ) U(d, c) = P(pa_D'; σ) E[u ∣ pa_D', do(D = d); σ]` of decision `d` in the context
`c₀` on the variables `S`, `Z = C ∖ S`. -/
def ctxUtil (μ : Cfg k → ℝ) (u : A → Cfg k → ℝ) (S : Finset ι) (c₀ : Cfg k) (d : A) : ℝ :=
  ∑ c ∈ Finset.univ.filter (fun c => AgreeOn S c₀ c), μ c * u d c

end RobustAgentsCausal
Source
Richens and Everitt, Robust agents learn causal world models, ICLR 2024, arXiv:2402.10877v7, Sections 2.1-2.3 (Definitions 1-4, Assumptions 1-2) and Appendices A.1-A.3 (parameterisation, Definition 5), pp. 2-4, 15-18
Read-back

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

Common setting. Throughout, III is a finite index set with decidable equality, whose elements index the chance variables. k:I→Nk : I \to \mathbb Nk:I→N assigns to each i∈Ii \in Ii∈I a number of states kik_iki​. AAA is a finite set of decisions. Neither III nor AAA is required to be nonempty, and any kik_iki​ may be 000. For m∈Nm \in \mathbb Nm∈N write [m]={0,1,…,m−1}[m] = \{0, 1, \dots, m-1\}[m]={0,1,…,m−1}, so [0]=∅[0] = \varnothing[0]=∅.

Joint state (Cfg). A joint state is a function ccc assigning to each i∈Ii \in Ii∈I a value ci∈[ki]c_i \in [k_i]ci​∈[ki​]. Write

Ck=∏i∈I[ki]\mathcal C_k = \prod_{i \in I} [k_i]Ck​=i∈I∏​[ki​]

for the set of all joint states. If some ki=0k_i = 0ki​=0, then Ck\mathcal C_kCk​ is empty. In that case every statement below of the form "for all joint states ccc" holds vacuously, and every sum over Ck\mathcal C_kCk​ equals 000.

Agreement (AgreeOn). For a finite set S⊆IS \subseteq IS⊆I and c,c′∈Ckc, c' \in \mathcal C_kc,c′∈Ck​: ccc and c′c'c′ agree on SSS when ci=ci′c_i = c'_ici​=ci′​ for every i∈Si \in Si∈S. If S=∅S = \varnothingS=∅, every pair agrees.

Dependence (DependsOnlyOn). A function f:Ck→βf : \mathcal C_k \to \betaf:Ck​→β, into an arbitrary type β\betaβ, depends only on SSS when f(c)=f(c′)f(c) = f(c')f(c)=f(c′) for all c,c′c, c'c,c′ that agree on SSS. For S=∅S = \varnothingS=∅ this means fff is constant.

Proper ancestor (IsProperAncestor). Let pa:I→{finite subsets of I}\mathrm{pa} : I \to \{\text{finite subsets of } I\}pa:I→{finite subsets of I} be an arbitrary assignment of parent sets. Then jjj is a proper ancestor of iii when there is a chain

j=a0, a1, …, an=i(n≥1)j = a_0,\ a_1,\ \dots,\ a_n = i \qquad (n \ge 1)j=a0​, a1​, …, an​=i(n≥1)

with at−1∈pa(at)a_{t-1} \in \mathrm{pa}(a_t)at−1​∈pa(at​) for every ttt. In other words, it is the transitive (not reflexive) closure of "is a parent of". If i∈pa(i)i \in \mathrm{pa}(i)i∈pa(i), then iii is a proper ancestor of itself.

Acyclicity (IsAcyclic). pa\mathrm{pa}pa is acyclic when no i∈Ii \in Ii∈I is a proper ancestor of itself. This excludes self-loops i∈pa(i)i \in \mathrm{pa}(i)i∈pa(i) as well as longer cycles.

Ancestor set (ancU). Given pa\mathrm{pa}pa and finite sets paD,paU⊆I\mathrm{pa}_D, \mathrm{pa}_U \subseteq IpaD​,paU​⊆I,

AncU={ j∈I:∃ i∈paU∪paD, j=i or j is a proper ancestor of i }.\mathrm{Anc}_U = \{\, j \in I : \exists\, i \in \mathrm{pa}_U \cup \mathrm{pa}_D,\ j = i \text{ or } j \text{ is a proper ancestor of } i \,\}.AncU​={j∈I:∃i∈paU​∪paD​, j=i or j is a proper ancestor of i}.

Only indices in III appear. No decision or utility node exists as an element of III.

Conditional distribution at one variable (IsCPDAt). A family PPP assigns to each i∈Ii \in Ii∈I, each c∈Ckc \in \mathcal C_kc∈Ck​ and each v∈[ki]v \in [k_i]v∈[ki​] a real number Pi(v∣c)P_i(v \mid c)Pi​(v∣c). It is a conditional distribution at iii for pa\mathrm{pa}pa when all three of the following hold:

  • Pi(v∣c)≥0P_i(v \mid c) \ge 0Pi​(v∣c)≥0 for all ccc and vvv;
  • ∑v∈[ki]Pi(v∣c)=1\sum_{v \in [k_i]} P_i(v \mid c) = 1∑v∈[ki​]​Pi​(v∣c)=1 for every ccc;
  • the map c↦Pi(⋅∣c)c \mapsto P_i(\cdot \mid c)c↦Pi​(⋅∣c) depends only on pa(i)\mathrm{pa}(i)pa(i).

Acyclicity of pa\mathrm{pa}pa is not required. If i∈pa(i)i \in \mathrm{pa}(i)i∈pa(i), the distribution of CiC_iCi​ may depend on cic_ici​ itself.

Conditional distributions for a graph (IsCPD). PPP is a family of conditional distributions for pa\mathrm{pa}pa when the previous condition holds at every i∈Ii \in Ii∈I. Again pa\mathrm{pa}pa need not be acyclic.

Markov product (jointProb). For any PPP (no conditions imposed) and c∈Ckc \in \mathcal C_kc∈Ck​,

P(c)=∏i∈IPi(ci∣c).P(c) = \prod_{i \in I} P_i(c_i \mid c).P(c)=i∈I∏​Pi​(ci​∣c).

This is just the product. Nothing asserts that it is nonnegative or sums to 111. If I=∅I = \varnothingI=∅, it equals 111.

Local intervention (LocalInt). A local intervention fff is a choice, for every i∈Ii \in Ii∈I simultaneously, of an arbitrary function fi:[ki]→[ki]f_i : [k_i] \to [k_i]fi​:[ki​]→[ki​]. The set of all of them is finite.

Intervened conditional (localCPD). For any PPP, any local intervention fff, any iii, ccc, and v∈[ki]v \in [k_i]v∈[ki​]:

Pi(v∣c; f)=∑v′∈[ki]fi(v′)=vPi(v′∣c).P_i(v \mid c;\, f) = \sum_{\substack{v' \in [k_i] \\ f_i(v') = v}} P_i(v' \mid c).Pi​(v∣c;f)=v′∈[ki​]fi​(v′)=v​∑​Pi​(v′∣c).

An empty sum is 000.

Intervened joint (localJoint).

P(c; f)=∏i∈IPi(ci∣c; f).P(c;\, f) = \prod_{i \in I} P_i(c_i \mid c;\, f).P(c;f)=i∈I∏​Pi​(ci​∣c;f).

Mixture weights (IsMixture). A function www from local interventions to R\mathbb RR is a mixture when wf≥0w_f \ge 0wf​≥0 for every local intervention fff and ∑fwf=1\sum_f w_f = 1∑f​wf​=1, the sum running over all local interventions. This is satisfiable exactly when at least one local intervention exists, which is always the case: if some ki=0k_i = 0ki​=0, the empty function still counts.

Mixed joint (mixJoint). For any PPP and any www (not required to be a mixture),

P(c; w)=∑fwf P(c; f).P(c;\, w) = \sum_f w_f \, P(c;\, f).P(c;w)=f∑​wf​P(c;f).

Soft intervention (SoftInt). A soft intervention σ\sigmaσ consists of three unconstrained pieces of data:

  • a finite set T⊆IT \subseteq IT⊆I;
  • new parent sets pa∗(i)⊆I\mathrm{pa}^*(i) \subseteq Ipa∗(i)⊆I for every i∈Ii \in Ii∈I;
  • real numbers Pi′(v∣c)P'_i(v \mid c)Pi′​(v∣c) for every i∈Ii \in Ii∈I, c∈Ckc \in \mathcal C_kc∈Ck​, v∈[ki]v \in [k_i]v∈[ki​].

The values of pa∗\mathrm{pa}^*pa∗ and P′P'P′ at i∉Ti \notin Ti∈/T are carried along but never used below.

Modified parents (SoftInt.modPa). The parent sets after σ\sigmaσ are pa∗(i)\mathrm{pa}^*(i)pa∗(i) if i∈Ti \in Ti∈T, and pa(i)\mathrm{pa}(i)pa(i) otherwise.

Compatibility (SoftInt.IsCompatible). σ\sigmaσ is compatible with pa\mathrm{pa}pa when two conditions hold. First, for each i∈Ti \in Ti∈T, P′P'P′ is a conditional distribution at iii for pa∗\mathrm{pa}^*pa∗, in the sense of IsCPDAt. Second, the modified parent assignment is acyclic. Acyclicity of the original pa\mathrm{pa}pa is not required.

Soft joint (softJoint). For any PPP and σ\sigmaσ,

P(c; σ)=∏i∈I{Pi′(ci∣c)i∈T,Pi(ci∣c)i∉T.P(c;\, \sigma) = \prod_{i \in I} \begin{cases} P'_i(c_i \mid c) & i \in T, \\ P_i(c_i \mid c) & i \notin T. \end{cases}P(c;σ)=i∈I∏​{Pi′​(ci​∣c)Pi​(ci​∣c)​i∈T,i∈/T.​

Parent configuration (PaCfg). A parent configuration of iii is a function ppp assigning to each j∈pa(i)j \in \mathrm{pa}(i)j∈pa(i) a value pj∈[kj]p_j \in [k_j]pj​∈[kj​].

CPD parameters (CPDParam). A parameter θ\thetaθ assigns a real number θ(i,p,v)\theta(i, p, v)θ(i,p,v) to each triple consisting of:

  • i∈Ii \in Ii∈I;
  • a parent configuration ppp of iii;
  • v∈[ki−1]v \in [k_i - 1]v∈[ki​−1], where ki−1k_i - 1ki​−1 is truncated subtraction in N\mathbb NN.

So vvv ranges over {0,…,ki−2}\{0, \dots, k_i - 2\}{0,…,ki​−2}, and over the empty set when ki≤1k_i \le 1ki​≤1.

Valid parameters (ValidParam). θ\thetaθ is valid when, for every iii and every parent configuration ppp of iii, both of the following hold:

  • θ(i,p,v)≥0\theta(i, p, v) \ge 0θ(i,p,v)≥0 for all vvv;
  • ∑v∈[ki−1]θ(i,p,v)≤1\sum_{v \in [k_i - 1]} \theta(i, p, v) \le 1∑v∈[ki​−1]​θ(i,p,v)≤1.

Distributions from parameters (cpdOf). For any θ\thetaθ (not required valid), iii, ccc, and v∈[ki]v \in [k_i]v∈[ki​]:

Piθ(v∣c)={θ(i, c∣pa(i), v)if v+1<ki,1−∑v′∈[ki−1]θ(i, c∣pa(i), v′)otherwise, i.e. v=ki−1.P^\theta_i(v \mid c) = \begin{cases} \theta\big(i,\, c|_{\mathrm{pa}(i)},\, v\big) & \text{if } v + 1 < k_i, \\[4pt] 1 - \sum_{v' \in [k_i - 1]} \theta\big(i,\, c|_{\mathrm{pa}(i)},\, v'\big) & \text{otherwise, i.e. } v = k_i - 1. \end{cases}Piθ​(v∣c)={θ(i,c∣pa(i)​,v)1−∑v′∈[ki​−1]​θ(i,c∣pa(i)​,v′)​if v+1<ki​,otherwise, i.e. v=ki​−1.​

Here c∣pa(i)c|_{\mathrm{pa}(i)}c∣pa(i)​ is the restriction of ccc to pa(i)\mathrm{pa}(i)pa(i).

Utility parameters (UParam). For a finite paU⊆I\mathrm{pa}_U \subseteq IpaU​⊆I, a utility parameter assigns an arbitrary real number U(d,x)U(d, x)U(d,x) to each decision d∈Ad \in Ad∈A and each assignment xxx of values xj∈[kj]x_j \in [k_j]xj​∈[kj​] to the j∈paUj \in \mathrm{pa}_Uj∈paU​.

Utility of a joint state (utilOf). u(d,c)=U(d, c∣paU)u(d, c) = U\big(d,\, c|_{\mathrm{pa}_U}\big)u(d,c)=U(d,c∣paU​​).

Policy (IsPolicy). A function π:Ck×A→R\pi : \mathcal C_k \times A \to \mathbb Rπ:Ck​×A→R, written π(d∣c)\pi(d \mid c)π(d∣c), is a policy with input SSS when all three of the following hold:

  • π(d∣c)≥0\pi(d \mid c) \ge 0π(d∣c)≥0 for all ccc and ddd;
  • ∑d∈Aπ(d∣c)=1\sum_{d \in A} \pi(d \mid c) = 1∑d∈A​π(d∣c)=1 for every ccc;
  • c↦π(⋅∣c)c \mapsto \pi(\cdot \mid c)c↦π(⋅∣c) depends only on SSS.

If A=∅A = \varnothingA=∅ and Ck≠∅\mathcal C_k \neq \varnothingCk​=∅, no policy exists. If Ck=∅\mathcal C_k = \varnothingCk​=∅, every function is a policy.

Expected utility (expUtil). For arbitrary real functions μ\muμ on Ck\mathcal C_kCk​ and uuu on A×CkA \times \mathcal C_kA×Ck​, and any π\piπ:

Eπ[u]=∑c∈Ckμ(c)∑d∈Aπ(d∣c) u(d,c).\mathbb E^\pi[u] = \sum_{c \in \mathcal C_k} \mu(c) \sum_{d \in A} \pi(d \mid c)\, u(d, c).Eπ[u]=c∈Ck​∑​μ(c)d∈A∑​π(d∣c)u(d,c).

Nothing requires μ\muμ to be a probability distribution.

δ\deltaδ-optimality (IsDeltaOptimal). For δ∈R\delta \in \mathbb Rδ∈R, π\piπ is δ\deltaδ-optimal for (S,μ,u)(S, \mu, u)(S,μ,u) when both of the following hold:

  • π\piπ is a policy with input SSS;
  • every policy π′\pi'π′ with input SSS satisfies Eπ′[u]≤Eπ[u]+δ\mathbb E^{\pi'}[u] \le \mathbb E^{\pi}[u] + \deltaEπ′[u]≤Eπ[u]+δ.

Taking π′=π\pi' = \piπ′=π shows that this is unsatisfiable when δ<0\delta < 0δ<0.

Optimality (IsOptimal). π\piπ is optimal when it is 000-optimal.

Oracle (Oracle). An oracle OOO is an arbitrary function that takes a finite set S⊆IS \subseteq IS⊆I and a weight function www on local interventions, and returns a function OS,w:Ck×A→RO_{S,w} : \mathcal C_k \times A \to \mathbb ROS,w​:Ck​×A→R.

δ\deltaδ-optimal oracle (IsDeltaOptimalOracle). Let δ\deltaδ be real, paD⊆I\mathrm{pa}_D \subseteq IpaD​⊆I finite, and PPP, uuu arbitrary. The oracle OOO is δ\deltaδ-optimal when, for every S⊆paDS \subseteq \mathrm{pa}_DS⊆paD​ and every mixture www, OS,wO_{S,w}OS,w​ is δ\deltaδ-optimal for input SSS, joint function μ=P(⋅ ; w)\mu = P(\cdot\,;\, w)μ=P(⋅;w) (the mixed joint) and utility uuu.

Several things are not required:

  • PPP need not be a family of conditional distributions;
  • paD\mathrm{pa}_DpaD​ is not tied to any graph;
  • the interventions range over all local interventions on all of III, with no restriction to AncU\mathrm{Anc}_UAncU​.

Optimal oracle (IsOptimalOracle). The oracle is optimal when it is δ\deltaδ-optimal with δ=0\delta = 0δ=0.

Domain dependence (DomainDependent). Given pa\mathrm{pa}pa, a finite paD⊆I\mathrm{pa}_D \subseteq IpaD​⊆I, and uuu, the setting is domain dependent when there exist PPP and P′P'P′, both families of conditional distributions for pa\mathrm{pa}pa (with pa\mathrm{pa}pa not required acyclic), such that every policy π\piπ that is optimal for input paD\mathrm{pa}_DpaD​ under the Markov product of PPP is not optimal for input paD\mathrm{pa}_DpaD​ under the Markov product of P′P'P′.

Two edge cases follow:

  • If A=∅A = \varnothingA=∅ and Ck≠∅\mathcal C_k \neq \varnothingCk​=∅, no optimal policy exists. The condition then holds vacuously, provided suitable PPP and P′P'P′ exist.
  • If Ck=∅\mathcal C_k = \varnothingCk​=∅, every function is an optimal policy under both. The condition then fails.

Context probability (ctxProb). For any μ\muμ, finite S⊆IS \subseteq IS⊆I, and c0∈Ckc^0 \in \mathcal C_kc0∈Ck​:

μS(c0)=∑c∈Ckc agrees with c0 on Sμ(c).\mu_S(c^0) = \sum_{\substack{c \in \mathcal C_k \\ c \text{ agrees with } c^0 \text{ on } S}} \mu(c).μS​(c0)=c∈Ck​c agrees with c0 on S​∑​μ(c).

Context utility (ctxUtil). For any μ\muμ, uuu, finite SSS, c0c^0c0, and d∈Ad \in Ad∈A:

∑c∈Ckc agrees with c0 on Sμ(c) u(d,c).\sum_{\substack{c \in \mathcal C_k \\ c \text{ agrees with } c^0 \text{ on } S}} \mu(c)\, u(d, c).c∈Ck​c agrees with c0 on S​∑​μ(c)u(d,c).
Human review
  • Endorsed by Shuze Chen · Nov 23, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 23, 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