{
  "$schema": "../../../schemas/mko-v0.4.schema.json",
  "schema_version": "mko-v0.4",
  "id": "mko-law-of-total-expectation",
  "semantic_family_id": "sf-law-of-total-expectation",
  "type": "theorem",
  "version": "0.10.0",
  "language": "zh-Hant",
  "titles": {
    "zh-Hant": "全期望公式"
  },
  "summary": {
    "zh-Hant": "同一有限機率空間上，完整partition各cell的conditional mean按cell probability加權後等於E[X]。"
  },
  "statement": {
    "zh-Hant": "令G為完整partition生成的sigma-algebra，tower identity為E(E(X|G))=E(X)。partition兩兩不交且union為sample space；positive-mass cells使用P(B_i)E[X|B_i]，zero-mass cell conditional value只a.s.決定且weighted contribution為0，禁止division by zero。不需independence也不混同Bayes。"
  },
  "formula": {
    "tex": "E(E(X\\mid G))=E(X)",
    "mathml": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mrow><mrow><mi>E</mi><mo>(</mo><mrow><mi>E</mi><mo>(</mo><mrow><mi>X</mi><mo>|</mo><mi>G</mi></mrow><mo>)</mo></mrow><mo>)</mo></mrow><mo>=</mo><mrow><mi>E</mi><mo>(</mo><mi>X</mi><mo>)</mo></mrow></mrow></math>",
    "semantic_ast": {
      "type": "equation",
      "lhs": {
        "type": "function_call",
        "callee": {
          "type": "symbol",
          "name": "E",
          "glyph": "E"
        },
        "arguments": [
          {
            "type": "function_call",
            "callee": {
              "type": "symbol",
              "name": "E",
              "glyph": "E"
            },
            "arguments": [
              {
                "type": "conditional",
                "expression": {
                  "type": "symbol",
                  "name": "X",
                  "glyph": "X"
                },
                "condition": {
                  "type": "symbol",
                  "name": "G",
                  "glyph": "G"
                }
              }
            ]
          }
        ]
      },
      "rhs": {
        "type": "function_call",
        "callee": {
          "type": "symbol",
          "name": "E",
          "glyph": "E"
        },
        "arguments": [
          {
            "type": "symbol",
            "name": "X",
            "glyph": "X"
          }
        ]
      }
    },
    "compiler": {
      "id": "ocme-formula-core",
      "version": "0.4.0",
      "source_sha256": "71daadce26433a15514d34085abc36c77587128b73a35fdbf1481e1fc7b15f2b"
    }
  },
  "assumptions": [
    {
      "id": "a1",
      "zh-Hant": "完整正規化有限law、integrable random variable X與完整partition；G由該partition生成。"
    },
    {
      "id": "a2",
      "zh-Hant": "zero-mass cells不計算conditional division。"
    }
  ],
  "symbols": [
    {
      "token": "E",
      "role": "expectation_operator",
      "role_zh": "期望與條件期望算子",
      "scope": "representative_formula"
    },
    {
      "token": "X",
      "role": "integrable_random_variable",
      "role_zh": "可積隨機變數",
      "scope": "representative_formula"
    },
    {
      "token": "G",
      "role": "partition_generated_sigma_algebra",
      "role_zh": "完整partition生成的sigma-algebra",
      "scope": "representative_formula"
    }
  ],
  "dependencies": [
    {
      "id": "mko-conditional-expectation",
      "title_zh": "有限模型的條件期望",
      "reason_zh": "cell conditional means。"
    },
    {
      "id": "mko-expectation",
      "title_zh": "有限模型的期望值",
      "reason_zh": "global mean。"
    },
    {
      "id": "mko-event",
      "title_zh": "事件",
      "reason_zh": "partition cells。"
    }
  ],
  "explanation": {
    "paragraphs_zh": [
      "partition completeness與disjointness先驗。",
      "positive cells exact conditional means。",
      "zero-mass contribution為0且tower expectation保留。"
    ],
    "common_misconception_zh": "在zero-mass cell除法，或要求partition events independent。"
  },
  "proofs": [],
  "computational_companions": [],
  "verification": {
    "computational_status": "not_evaluated_no_computational_claim",
    "warning_zh": "本輪限完整有限models；一般sigma-algebra tower另需measure proof。",
    "evidence_refs": [],
    "producers": [
      {
        "id": "lean-mathlib",
        "adapter": "formal_system",
        "config_path": "formal/lean/lakefile.toml",
        "status": "configured"
      }
    ]
  },
  "formalization": {
    "status": "not_formalized",
    "target_systems": [
      "Lean 4",
      "Mathlib"
    ],
    "next_obligation_zh": "加入全變異數公式。"
  },
  "provenance": {
    "origin": "ocme_local_ai_materialization_candidate",
    "note_zh": "依 research/atlas-law-of-total-expectation.md 整理；2026-10-14 脈衝 R04（使用者手動接續 2026-11-09 工作序列；實際日期仍為 2026-10-14），英文及 Lean 依使用者指示延後。",
    "content_license": "CC-BY-SA-4.0",
    "code_license": "MIT",
    "created_at": "2026-10-14"
  }
}
