{
  "schema_version": "ocme-derivation-reader-v1",
  "guide_id": "derivation-mko-random-variable-01",
  "mko_id": "mko-random-variable",
  "title": {
    "zh-Hant": "有限樣本空間的隨機變數：值域、原像事件與點機率",
    "en": "Random variables on a finite sample space: range, preimage events and point probabilities"
  },
  "contract": {
    "schema_version": "ocme-derivation-guide-v0.1",
    "guide_id": "derivation-mko-random-variable-01",
    "source": {
      "mko_id": "mko-random-variable",
      "commit": "b28a5edbd46279b1db2a3f3f48bb3f447e18899f",
      "sha256": "bba00300a619b37481007904b211059750f93a4a2c4ba2b8209eac472ad33e06",
      "english_sha256": "456778ef562a2c57a14293522fad0ac209632686518a816ad9409094a4c350e1"
    },
    "mode": "worked_example",
    "audience_prerequisites": [
      "function_def",
      "image_preimage_def",
      "set_builder",
      "prob_axioms",
      "finite_sum_rules",
      "numeric_evaluation"
    ],
    "goal": {
      "zh-Hant": "S={1,2,3,4}，事件族 F=𝒫(S)，權重 w₁=1/2、w₂=1/4、w₃=1/8、w₄=1/8。隨機變數 X:S→ℝ 由表給出：X(1)=1、X(2)=0、X(3)=1、X(4)=4（即 X(s)=(s−2)²）。求 X 的值域、原像事件 {X=1}、{X≥1} 與 {X∈{2,3}}，以及每個值的點機率 P(X=t)，並證明這些點機率之和為 1。",
      "en": "S={1,2,3,4}, event family F=𝒫(S), weights w₁=1/2, w₂=1/4, w₃=1/8, w₄=1/8. The random variable X:S→ℝ is given by the table X(1)=1, X(2)=0, X(3)=1, X(4)=4 (that is, X(s)=(s−2)²). Find the range of X, the preimage events {X=1}, {X≥1} and {X∈{2,3}}, and the point probability P(X=t) of each value, and prove that these point probabilities sum to 1."
    },
    "givens": [
      {
        "id": "G1",
        "statement": {
          "zh-Hant": "S={1,2,3,4} 非空有限，事件族為全冪集 F=𝒫(S)（MKO 假設 a1）。",
          "en": "S={1,2,3,4} is nonempty and finite, and the event family is the full power set F=𝒫(S) (MKO assumption a1)."
        }
      },
      {
        "id": "G2",
        "statement": {
          "zh-Hant": "函數資料：X(1)=1、X(2)=0、X(3)=1、X(4)=4。",
          "en": "Function data: X(1)=1, X(2)=0, X(3)=1, X(4)=4."
        }
      },
      {
        "id": "G3",
        "statement": {
          "zh-Hant": "點機率題另給權重：w₁=1/2、w₂=1/4、w₃=1/8、w₄=1/8，並令 P(E)=Σ_{s∈E} w_s（E⊆S）。",
          "en": "For point-probability questions the weights are given separately: w₁=1/2, w₂=1/4, w₃=1/8, w₄=1/8, and P(E)=Σ_{s∈E} w_s for E⊆S."
        }
      }
    ],
    "steps": [
      {
        "id": "S01",
        "uses": [
          "G3"
        ],
        "before_tex": "w_1=\\tfrac12,\\ w_2=\\tfrac14,\\ w_3=\\tfrac18,\\ w_4=\\tfrac18",
        "after_tex": "w_s\\ge 0,\\ \\sum_{s\\in S}w_s=1",
        "relation": "implies",
        "rule": "numeric_evaluation",
        "conditions": [],
        "explanation": {
          "zh-Hant": "先驗權重：四個權重都是正有理數，因而非負；總和 1/2+1/4+1/8+1/8=4/8+2/8+1/8+1/8=8/8=1。這是後面使用機率律的前提。",
          "en": "First validate the weights: all four are positive rationals, hence nonnegative; their sum is 1/2+1/4+1/8+1/8=4/8+2/8+1/8+1/8=8/8=1. This is the precondition for using the probability law later."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G3",
            "numeric_evaluation"
          ],
          "explanation": {
            "zh-Hant": "只是精確有理數計算，可獨立重算；結論是權重合法，不涉及 X。",
            "en": "This is exact rational arithmetic and can be recomputed independently; the conclusion is that the weights are valid, and X is not involved."
          }
        },
        "leaf_basis": "numeric_evaluation + frac_rules"
      },
      {
        "id": "S02",
        "uses": [
          "S01",
          "G1"
        ],
        "before_tex": "w_s\\ge0,\\ \\sum_{s}w_s=1",
        "after_tex": "P(E)=\\sum_{s\\in E}w_s\\ \\text{is a valid probability law on}\\ \\mathcal{P}(S)",
        "relation": "implies",
        "rule": "L_weight_law",
        "conditions": [
          "S\\ \\text{finite}"
        ],
        "explanation": {
          "zh-Hant": "依引理 L_weight_law，由合法權重定義的 P 滿足機率公理（非負、全空間機率為 1、互斥可加）。因 F=𝒫(S)，每個子集合 E 都是事件，P(E) 都有定義。引理在 S02.1 至 S02.3 證明。",
          "en": "By Lemma L_weight_law, the P defined from valid weights satisfies the probability axioms (nonnegativity, total probability 1, additivity for disjoint events). Since F=𝒫(S), every subset E is an event and P(E) is defined. The lemma is proved in S02.1 to S02.3."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "S01",
            "L_weight_law",
            "G1"
          ],
          "explanation": {
            "zh-Hant": "需要權重非負且總和恰為 1（S01），以及 S 有限使和式有意義。反向（任何機率律都來自權重）在有限全冪集上也成立，但本稿不需要也不宣稱。",
            "en": "It needs nonnegative weights summing exactly to 1 (S01) and a finite S so that the sums make sense. The converse (every probability law comes from weights) also holds on a finite full power set, but it is neither needed nor claimed here."
          }
        },
        "leaf_basis": "prob_axioms + finite_sum_rules + order_basics"
      },
      {
        "id": "S02.1",
        "uses": [
          "S01",
          "order_basics"
        ],
        "before_tex": "w_s\\ge 0\\ \\ (s\\in E)",
        "after_tex": "P(E)=\\sum_{s\\in E}w_s\\ge 0",
        "relation": "implies",
        "rule": "order_basics",
        "conditions": [],
        "explanation": {
          "zh-Hant": "非負數相加仍非負（由 u≥0、v≥0 得 u+v≥v≥0，逐項加入）；空和為 0，所以 P(∅)=0≥0 也成立。",
          "en": "Adding nonnegative numbers stays nonnegative (from u≥0 and v≥0 we get u+v≥v≥0, adding one term at a time); the empty sum is 0, so P(∅)=0≥0 as well."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "order_basics",
            "finite_sum_rules"
          ],
          "explanation": {
            "zh-Hant": "本步只證明每項非負推出有限和非負；不主張逆向「和非負推出每項非負」。非負項的和為 0 時各項為 0 是另一個命題，不是這個逆命題，本步不使用它。",
            "en": "This step proves only that nonnegative terms have a nonnegative finite sum; it does not claim the converse that a nonnegative sum forces every term to be nonnegative. The fact that nonnegative terms summing to zero are all zero is a separate statement, not that converse, and is not used here."
          }
        },
        "leaf_basis": "order_basics + finite_sum_rules"
      },
      {
        "id": "S02.2",
        "uses": [
          "S01"
        ],
        "before_tex": "P(S)",
        "after_tex": "\\sum_{s\\in S}w_s=1",
        "relation": "implies",
        "rule": "def_unfold",
        "conditions": [],
        "explanation": {
          "zh-Hant": "依 P 的定義，P(S) 就是全部權重之和，S01 已算得為 1。",
          "en": "By the definition of P, P(S) is the sum of all weights, which S01 computed to be 1."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "S01",
            "def_unfold"
          ],
          "explanation": {
            "zh-Hant": "直接展開定義並引用 S01 的數值；若權重總和不是 1，此步就失敗。",
            "en": "This unfolds the definition and cites the value from S01; if the weights did not sum to 1, this step would fail."
          }
        },
        "leaf_basis": "def_unfold + numeric_evaluation"
      },
      {
        "id": "S02.3",
        "uses": [
          "finite_sum_rules",
          "set_operations_def"
        ],
        "before_tex": "E_1\\cap E_2=\\varnothing",
        "after_tex": "\\sum_{s\\in E_1\\cup E_2}w_s=\\sum_{s\\in E_1}w_s+\\sum_{s\\in E_2}w_s",
        "relation": "implies",
        "rule": "finite_sum_rules",
        "conditions": [
          "E_1\\cap E_2=\\varnothing"
        ],
        "explanation": {
          "zh-Hant": "E₁∪E₂ 中每個結果恰屬於 E₁ 或 E₂ 之一（不交），所以左邊的有限和可以分成兩組重排，每個權重恰好算一次。S02.1 至 S02.3 合起來證得引理 L_weight_law。",
          "en": "Each outcome of E₁∪E₂ lies in exactly one of E₁, E₂ (they are disjoint), so the finite sum on the left can be regrouped into two groups, counting each weight exactly once. S02.1 to S02.3 together prove Lemma L_weight_law."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "finite_sum_rules",
            "set_operations_def"
          ],
          "explanation": {
            "zh-Hant": "不交是本引理採用的充分前提，使每個結果只計一次。若交集含正權重，右邊重複計入該質量，等式會失敗；只有零權重的重疊則不改變數值。本例所有權重都為正，因此本例的任何重疊都造成重複質量。",
            "en": "Disjointness is the sufficient hypothesis used by the lemma, counting every outcome once. If the overlap has positive mass, the right side counts that mass twice and the equality fails; an overlap consisting only of zero-weight outcomes changes no value. All weights in this worked example are positive, so every overlap here does duplicate mass."
          }
        },
        "leaf_basis": "finite_sum_rules + set_operations_def"
      },
      {
        "id": "S03",
        "uses": [
          "G1",
          "G2"
        ],
        "before_tex": "X(1)=1,\\ X(2)=0,\\ X(3)=1,\\ X(4)=4",
        "after_tex": "X:S\\to\\mathbb{R}\\ \\text{total function}",
        "relation": "definition",
        "rule": "mko_rv_def",
        "conditions": [],
        "explanation": {
          "zh-Hant": "四個基本結果各有恰好一個實數值，所以 X 是總函數 S→ℝ，符合 MKO 對隨機變數的定義。X 指的是整張表 s↦X(s)，不是某一次試驗得到的數。",
          "en": "Each of the four outcomes has exactly one real value, so X is a total function S→ℝ, which is the MKO's definition of a random variable. X means the whole table s↦X(s), not a number obtained in one trial."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G2",
            "function_def",
            "mko_rv_def"
          ],
          "explanation": {
            "zh-Hant": "只核對函數定義的兩個要求；沒有使用權重。",
            "en": "Only the two requirements of a function are checked; the weights are not used."
          }
        },
        "leaf_basis": "function_def + mko_rv_def"
      },
      {
        "id": "S04",
        "uses": [
          "S03"
        ],
        "before_tex": "X(S)=\\{X(1),X(2),X(3),X(4)\\}",
        "after_tex": "X(S)=\\{0,1,4\\}",
        "relation": "equivalent",
        "rule": "image_preimage_def",
        "conditions": [],
        "explanation": {
          "zh-Hant": "值域是所有值的集合：{1,0,1,4}。集合不重複計算元素，所以 X(S)={0,1,4}，只有 3 個值，而 S 有 4 個結果；這是因為 X(1)=X(3)=1。",
          "en": "The range is the set of all values: {1,0,1,4}. A set does not count an element twice, so X(S)={0,1,4}, with only 3 values while S has 4 outcomes; this is because X(1)=X(3)=1."
        },
        "reverse_audit": {
          "kind": "inverse_equivalence",
          "required_ids": [
            "image_preimage_def",
            "set_extensionality"
          ],
          "explanation": {
            "zh-Hant": "兩邊有相同的元素（外延性），列舉的重複不改變集合，雙向成立。",
            "en": "Both sides have the same elements (extensionality), and listing an element twice does not change the set, so the step holds both ways."
          }
        },
        "leaf_basis": "image_preimage_def + set_extensionality"
      },
      {
        "id": "S05",
        "uses": [
          "S03",
          "G1"
        ],
        "before_tex": "\\{X=1\\}=\\{s\\in S\\mid X(s)=1\\}",
        "after_tex": "\\{1,3\\}\\in\\mathcal{P}(S)",
        "relation": "equivalent",
        "rule": "image_preimage_def",
        "conditions": [],
        "explanation": {
          "zh-Hant": "逐一檢查四個結果：X(1)=1 是、X(2)=0 否、X(3)=1 是、X(4)=4 否，所以原像 {X=1}={1,3}。它是 S 的子集合，F=𝒫(S)，因此是事件。這一步只讀函數資料。",
          "en": "Check the four outcomes one by one: X(1)=1 yes, X(2)=0 no, X(3)=1 yes, X(4)=4 no, so the preimage {X=1}={1,3}. It is a subset of S and F=𝒫(S), so it is an event. This step reads only the function data."
        },
        "reverse_audit": {
          "kind": "inverse_equivalence",
          "required_ids": [
            "image_preimage_def",
            "set_builder",
            "set_extensionality"
          ],
          "explanation": {
            "zh-Hant": "S 的四個元素都已判定，列出的元素滿足條件、其餘不滿足，兩個集合相同。",
            "en": "All four elements of S were decided; the listed elements satisfy the condition and the others do not, so the two sets are equal."
          }
        },
        "leaf_basis": "image_preimage_def + set_builder + set_extensionality"
      },
      {
        "id": "S06",
        "uses": [
          "S02",
          "S05"
        ],
        "before_tex": "P(X=1)=P(\\{1,3\\})",
        "after_tex": "w_1+w_3=\\tfrac12+\\tfrac18=\\tfrac58",
        "relation": "equivalent",
        "rule": "mko_rv_def",
        "conditions": [],
        "explanation": {
          "zh-Hant": "點機率是所有 X(s)=1 的結果權重之和：P({1,3})=w₁+w₃=1/2+1/8=5/8。兩個結果都要加上；只算 w₁ 會得到錯誤的 1/2。",
          "en": "The point probability is the sum of the weights of all outcomes with X(s)=1: P({1,3})=w₁+w₃=1/2+1/8=5/8. Both outcomes must be added; counting only w₁ would give the wrong value 1/2."
        },
        "reverse_audit": {
          "kind": "inverse_equivalence",
          "required_ids": [
            "S02",
            "S05",
            "numeric_evaluation"
          ],
          "explanation": {
            "zh-Hant": "依 P 的定義兩邊表示同一個數，精確計算可逆向核對：5/8−1/8=1/2=w₁。",
            "en": "By the definition of P both sides name the same number, and the exact arithmetic can be checked backwards: 5/8−1/8=1/2=w₁."
          }
        },
        "leaf_basis": "mko_rv_def + def_unfold + numeric_evaluation"
      },
      {
        "id": "S07",
        "uses": [
          "S02",
          "S03"
        ],
        "before_tex": "\\{X=0\\},\\ \\{X=4\\}",
        "after_tex": "\\{2\\},\\ \\{4\\};\\ P(X=0)=\\tfrac14,\\ P(X=4)=\\tfrac18",
        "relation": "equivalent",
        "rule": "image_preimage_def",
        "conditions": [],
        "explanation": {
          "zh-Hant": "同樣掃描：只有 X(2)=0，只有 X(4)=4，所以 {X=0}={2}、{X=4}={4}，點機率分別為 w₂=1/4、w₄=1/8。",
          "en": "Scan in the same way: only X(2)=0 and only X(4)=4, so {X=0}={2} and {X=4}={4}, with point probabilities w₂=1/4 and w₄=1/8."
        },
        "reverse_audit": {
          "kind": "inverse_equivalence",
          "required_ids": [
            "image_preimage_def",
            "set_extensionality",
            "S02"
          ],
          "explanation": {
            "zh-Hant": "四個結果都已判定，集合相等；機率由定義直接讀出，雙向成立。",
            "en": "All four outcomes were decided, so the sets are equal; the probabilities are read directly from the definition, so the step holds both ways."
          }
        },
        "leaf_basis": "image_preimage_def + set_extensionality + def_unfold"
      },
      {
        "id": "S08",
        "uses": [
          "S03",
          "S04"
        ],
        "before_tex": "\\{X=0\\},\\ \\{X=1\\},\\ \\{X=4\\}",
        "after_tex": "\\text{pairwise disjoint},\\ \\{2\\}\\cup\\{1,3\\}\\cup\\{4\\}=S",
        "relation": "implies",
        "rule": "L_level_partition",
        "conditions": [],
        "explanation": {
          "zh-Hant": "依引理 L_level_partition，值域中各值的水平集構成 S 的分割：兩兩不交、聯集為 S。證明在 S08.1、S08.2；在本例中可直接看到 {2}、{1,3}、{4} 不交且合起來是 {1,2,3,4}。",
          "en": "By Lemma L_level_partition, the level sets of the values in the range form a partition of S: pairwise disjoint with union S. The proof is in S08.1 and S08.2; in this example one sees directly that {2}, {1,3}, {4} are disjoint and together give {1,2,3,4}."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "L_level_partition",
            "S04"
          ],
          "explanation": {
            "zh-Hant": "引理需要 X 是總函數（每個結果有值）且單值（不會同時屬於兩個水平集），兩者由 S03 提供。",
            "en": "The lemma needs X to be total (every outcome has a value) and single-valued (no outcome lies in two level sets); both come from S03."
          }
        },
        "leaf_basis": "function_def + set_operations_def"
      },
      {
        "id": "S08.1",
        "uses": [
          "S03",
          "function_def"
        ],
        "before_tex": "s\\in\\{X=t\\}\\cap\\{X=t'\\}",
        "after_tex": "t=X(s)=t'",
        "relation": "implies",
        "rule": "function_def",
        "conditions": [],
        "explanation": {
          "zh-Hant": "若 s 同時在 {X=t} 與 {X=t′} 中，則 X(s)=t 且 X(s)=t′；函數在 s 只有一個值，所以 t=t′。因此不同值的水平集沒有共同元素。",
          "en": "If s lies in both {X=t} and {X=t′}, then X(s)=t and X(s)=t′; a function has only one value at s, so t=t′. Hence level sets of different values have no common element."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "function_def",
            "eq_refl_symm_trans"
          ],
          "explanation": {
            "zh-Hant": "只用到單值性與等號的對稱、傳遞。",
            "en": "Only single-valuedness and symmetry and transitivity of equality are used."
          }
        },
        "leaf_basis": "function_def + eq_refl_symm_trans"
      },
      {
        "id": "S08.2",
        "uses": [
          "S03",
          "function_def"
        ],
        "before_tex": "s\\in S",
        "after_tex": "s\\in\\{X=X(s)\\},\\ X(s)\\in X(S)",
        "relation": "implies",
        "rule": "function_def",
        "conditions": [],
        "explanation": {
          "zh-Hant": "X 是總函數，每個 s∈S 都有值 X(s)，它屬於值域，而 s 屬於這個值的水平集。所以水平集的聯集包含 S；反過來每個水平集都是 S 的子集合，故聯集恰為 S。S08.1 與 S08.2 合起來證得引理 L_level_partition。",
          "en": "X is total, so every s∈S has a value X(s), which lies in the range, and s lies in the level set of that value. So the union of the level sets contains S; conversely every level set is a subset of S, so the union is exactly S. S08.1 and S08.2 together prove Lemma L_level_partition."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "function_def",
            "set_extensionality",
            "image_preimage_def"
          ],
          "explanation": {
            "zh-Hant": "總性保證每個結果都落入一個水平集。若漏掉正權重結果，所列水平集的機率和會小於 1；只漏零權重結果時和仍可為 1，但表仍不是 S 上的總函數。本例全部權重為正，漏任何結果都會失去正質量。",
            "en": "Totality puts every outcome in a level set. Omitting a positive-weight outcome makes the total mass of the listed level sets less than 1. Omitting only a zero-weight outcome can leave total mass 1, but the table still is not a total function on S. Here all weights are positive, so omitting any outcome loses positive mass."
          }
        },
        "leaf_basis": "function_def + set_extensionality + image_preimage_def"
      },
      {
        "id": "S09",
        "uses": [
          "S02",
          "S06",
          "S07",
          "S08"
        ],
        "before_tex": "P(X=0)+P(X=1)+P(X=4)",
        "after_tex": "P(S)=1",
        "relation": "implies",
        "rule": "L_weight_law",
        "conditions": [],
        "explanation": {
          "zh-Hant": "三個水平集兩兩不交（S08），對兩集合可加性用兩次：P({2}∪{1,3}∪{4})=P({2}∪{1,3})+P({4})=P({2})+P({1,3})+P({4})，左邊是 P(S)=1。數值核對：1/4+5/8+1/8=1。所以點機率合起來恰為 1。",
          "en": "The three level sets are pairwise disjoint (S08), so two-set additivity applied twice gives P({2}∪{1,3}∪{4})=P({2}∪{1,3})+P({4})=P({2})+P({1,3})+P({4}), and the left side is P(S)=1. Numerically: 1/4+5/8+1/8=1. So the point probabilities add up to exactly 1."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "S02",
            "S08",
            "L_weight_law"
          ],
          "explanation": {
            "zh-Hant": "第二次使用可加性需要 ({2}∪{1,3})∩{4}=∅，這由兩兩不交推得。數值核對與一般論證一致，但結論由 S08 的分割與可加性證得。",
            "en": "The second use of additivity needs ({2}∪{1,3})∩{4}=∅, which follows from pairwise disjointness. The numeric check agrees with the general argument, but the conclusion is proved from the partition in S08 and additivity."
          }
        },
        "leaf_basis": "prob_axioms + set_operations_def + numeric_evaluation"
      },
      {
        "id": "S10",
        "uses": [
          "S02",
          "S03"
        ],
        "before_tex": "\\{X\\ge 1\\}=X^{-1}([1,\\infty))",
        "after_tex": "\\{1,3,4\\},\\ P=\\tfrac12+\\tfrac18+\\tfrac18=\\tfrac34",
        "relation": "equivalent",
        "rule": "image_preimage_def",
        "conditions": [],
        "explanation": {
          "zh-Hant": "取 T=[1,∞)。以條件 X(s)≥1 篩選結果：X(1)=1、X(3)=1、X(4)=4 符合，X(2)=0 不符合，所以 {X≥1}={1,3,4}，機率為 w₁+w₃+w₄=3/4。",
          "en": "Take T=[1,∞). Filter the outcomes by X(s)≥1: X(1)=1, X(3)=1 and X(4)=4 qualify and X(2)=0 does not, so {X≥1}={1,3,4} with probability w₁+w₃+w₄=3/4."
        },
        "reverse_audit": {
          "kind": "inverse_equivalence",
          "required_ids": [
            "image_preimage_def",
            "set_builder",
            "S02"
          ],
          "explanation": {
            "zh-Hant": "四個結果都已判定，集合相等；機率依定義相加，兩邊同值。",
            "en": "All four outcomes were decided, so the sets are equal; the probability is summed by definition and both sides have the same value."
          }
        },
        "leaf_basis": "image_preimage_def + set_builder + numeric_evaluation"
      },
      {
        "id": "S11",
        "uses": [
          "S07",
          "S10",
          "S02"
        ],
        "before_tex": "\\{X\\ge1\\}=S\\setminus\\{X=0\\}",
        "after_tex": "P(X\\ge1)=1-\\tfrac14=\\tfrac34",
        "relation": "equivalent",
        "rule": "prob_axioms",
        "conditions": [],
        "explanation": {
          "zh-Hant": "交叉核對：值域中只有 0 小於 1，所以 {X≥1} 是 {X=0}={2} 的補集。依補集規則 P(Eᶜ)=1−P(E)，得 1−1/4=3/4，與 S10 的直接加總相同。",
          "en": "Cross-check: only the value 0 in the range is below 1, so {X≥1} is the complement of {X=0}={2}. By the complement rule P(Eᶜ)=1−P(E), this gives 1−1/4=3/4, agreeing with the direct sum in S10."
        },
        "reverse_audit": {
          "kind": "inverse_equivalence",
          "required_ids": [
            "prob_axioms",
            "S02",
            "set_operations_def"
          ],
          "explanation": {
            "zh-Hant": "補集規則由可加性與 P(S)=1 推出，是等式，可雙向使用；兩種算法得到同一數值。",
            "en": "The complement rule follows from additivity and P(S)=1 and is an equation, usable both ways; the two computations give the same value."
          }
        },
        "leaf_basis": "prob_axioms + set_operations_def + numeric_evaluation"
      },
      {
        "id": "S12",
        "uses": [
          "S03",
          "G1"
        ],
        "before_tex": "X^{-1}(\\{2,3\\})",
        "after_tex": "\\varnothing\\in\\mathcal{P}(S),\\ P(\\varnothing)=0",
        "relation": "equivalent",
        "rule": "image_preimage_def",
        "conditions": [],
        "explanation": {
          "zh-Hant": "取 T={2,3}：沒有任何結果的值是 2 或 3，所以原像是空集合。空集合也是 S 的子集合，屬於 F=𝒫(S)，是事件，機率為空和 0。這說明 MKO 所說「任何實數子集合的原像都是事件」包含空的情形。",
          "en": "Take T={2,3}: no outcome has value 2 or 3, so the preimage is empty. The empty set is also a subset of S, belongs to F=𝒫(S), and is an event, with probability the empty sum 0. This shows that the MKO's 'the preimage of any subset of ℝ is an event' includes the empty case."
        },
        "reverse_audit": {
          "kind": "inverse_equivalence",
          "required_ids": [
            "image_preimage_def",
            "set_builder",
            "prob_axioms"
          ],
          "explanation": {
            "zh-Hant": "四個結果都已檢查，沒有一個符合，集合相等；P(∅)=0 由定義（空和）得出。",
            "en": "All four outcomes were checked and none qualifies, so the sets are equal; P(∅)=0 follows from the definition (empty sum)."
          }
        },
        "leaf_basis": "image_preimage_def + set_builder + prob_axioms"
      },
      {
        "id": "S13",
        "uses": [
          "S04",
          "S05",
          "S06",
          "S07",
          "S09",
          "S10",
          "S12"
        ],
        "before_tex": "\\text{S04 to S12}",
        "after_tex": "X(S)=\\{0,1,4\\};\\ P(X=0)=\\tfrac14,\\ P(X=1)=\\tfrac58,\\ P(X=4)=\\tfrac18;\\ \\textstyle\\sum=1",
        "relation": "implies",
        "rule": "and_intro_elim",
        "conditions": [],
        "explanation": {
          "zh-Hant": "整理：值域 {0,1,4}；原像事件 {X=1}={1,3}、{X≥1}={1,3,4}、{X∈{2,3}}=∅；點機率 1/4、5/8、1/8，總和為 1。值域與事件只用函數資料，點機率才用權重。",
          "en": "Summary: range {0,1,4}; preimage events {X=1}={1,3}, {X≥1}={1,3,4}, {X∈{2,3}}=∅; point probabilities 1/4, 5/8, 1/8, summing to 1. The range and events use only the function data; only the point probabilities use the weights."
        },
        "reverse_audit": {
          "kind": "sufficient_goal_reduction",
          "required_ids": [
            "S04",
            "S05",
            "S06",
            "S07",
            "S09",
            "S10",
            "S12",
            "and_intro_elim"
          ],
          "explanation": {
            "zh-Hant": "目標 G 是 goal 中要求的全部結果；足夠條件 H 是各步結論的合取，皆已正向證成，H⇒G 只用合取引入。",
            "en": "Goal G is the full list of results requested in the goal; the sufficient condition H is the conjunction of the step results, all proved forwards, and H⇒G uses only conjunction introduction."
          }
        },
        "leaf_basis": "and_intro_elim"
      }
    ],
    "result": {
      "zh-Hant": "X 是總函數 S→ℝ，值域為 {0,1,4}（三個值，S 有四個結果）。原像事件 {X=1}={1,3}、{X≥1}={1,3,4}、{X∈{2,3}}=∅ 都是事件。點機率 P(X=0)=1/4、P(X=1)=w₁+w₃=5/8、P(X=4)=1/8，因水平集分割 S，三者之和為 1；P(X≥1)=3/4，以補集法交叉核對一致。",
      "en": "X is a total function S→ℝ with range {0,1,4} (three values while S has four outcomes). The preimage events {X=1}={1,3}, {X≥1}={1,3,4} and {X∈{2,3}}=∅ are all events. The point probabilities are P(X=0)=1/4, P(X=1)=w₁+w₃=5/8 and P(X=4)=1/8, and since the level sets partition S they sum to 1; P(X≥1)=3/4, confirmed by the complement."
    },
    "negative_controls": [
      {
        "claim": {
          "zh-Hant": "X 取三個值，所以 P(X=1)=1/3",
          "en": "X takes three values, so P(X=1)=1/3"
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "點機率由權重決定：P(X=1)=w₁+w₃=5/8≠1/3。",
          "en": "Point probabilities come from the weights: P(X=1)=w₁+w₃=5/8≠1/3."
        }
      },
      {
        "claim": {
          "zh-Hant": "X(1)=1 且 w₁=1/2，所以 P(X=1)=1/2",
          "en": "X(1)=1 and w₁=1/2, so P(X=1)=1/2"
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "結果 3 也有 X(3)=1，必須加上 w₃=1/8，得 5/8。",
          "en": "Outcome 3 also has X(3)=1, so w₃=1/8 must be added, giving 5/8."
        }
      },
      {
        "claim": {
          "zh-Hant": "四個結果中有兩個取值 1，所以 P(X=1)=2/4",
          "en": "Two of the four outcomes have value 1, so P(X=1)=2/4"
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "這假設了等可能，但題目給的權重不相等；依給定權重 P(X=1)=5/8。",
          "en": "This assumes equal likelihood, but the given weights are not equal; with the given weights P(X=1)=5/8."
        }
      },
      {
        "claim": {
          "zh-Hant": "{s: X(s)∈{2,3}} 是空的，所以不是事件",
          "en": "{s: X(s)∈{2,3}} is empty, so it is not an event"
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "∅∈𝒫(S)=F，是事件，機率為 0。",
          "en": "∅∈𝒫(S)=F, so it is an event, with probability 0."
        }
      }
    ],
    "status": "candidate",
    "gaps": [],
    "verification": {
      "structure": "checked_local_script",
      "mathematics": "candidate_argument",
      "formalization": "not_formalized"
    },
    "rule_glossary": [
      {
        "id": "function_def",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "函數：f:A→B 對每個 a∈A 指定恰好一個 f(a)∈B。兩函數相等 ⇔ 定義域、對應域相同且對每個 a 都有相同值。",
          "en": "Function: f:A→B assigns to each a∈A exactly one f(a)∈B. Two functions are equal ⇔ they have the same domain and codomain and agree at every a."
        }
      },
      {
        "id": "image_preimage_def",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "像與原像：f(S)={f(a) ∣ a∈S}；f⁻¹(T)={a∈A ∣ f(a)∈T}。原像記號不預設 f 有反函數。",
          "en": "Image and preimage: f(S)={f(a) ∣ a∈S}; f⁻¹(T)={a∈A ∣ f(a)∈T}. The preimage notation does not presuppose that f has an inverse."
        }
      },
      {
        "id": "set_builder",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "集合建構式：x∈{y∈A ∣ P(y)} 當且僅當 x∈A 且 P(x)。",
          "en": "Set-builder notation: x∈{y∈A ∣ P(y)} if and only if x∈A and P(x)."
        }
      },
      {
        "id": "prob_axioms",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "機率公理：P(A)≥0；P(Ω)=1；兩兩互斥事件的（可數）聯集機率等於各機率之和。由此 P(∅)=0、P(Aᶜ)=1−P(A)。",
          "en": "Probability axioms: P(A)≥0; P(Ω)=1; the probability of a (countable) union of pairwise disjoint events is the sum of their probabilities. Hence P(∅)=0 and P(Aᶜ)=1−P(A)."
        }
      },
      {
        "id": "finite_sum_rules",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "有限和：Σ_{i=1}^{0} a_i=0、Σ_{i=1}^{n+1} a_i=Σ_{i=1}^{n} a_i + a_{n+1}；Σ(a_i+b_i)=Σa_i+Σb_i；Σ c·a_i=c·Σa_i。",
          "en": "Finite sums: Σ_{i=1}^{0} a_i=0 and Σ_{i=1}^{n+1} a_i=Σ_{i=1}^{n} a_i + a_{n+1}; Σ(a_i+b_i)=Σa_i+Σb_i; Σ c·a_i=c·Σa_i."
        }
      },
      {
        "id": "numeric_evaluation",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "明確整數或有理數算式的精確求值；可以獨立重算。",
          "en": "Exact evaluation of an explicit integer or rational expression; independently recomputable."
        }
      },
      {
        "id": "frac_rules",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "分數運算（分母皆非零）：a/c+b/c=(a+b)/c；(a/b)(c/d)=(ac)/(bd)；(a/b)/(c/d)=(ad)/(bc)（另需 c≠0）；a/b=(ak)/(bk)（k≠0）。",
          "en": "Fraction rules (all denominators nonzero): a/c+b/c=(a+b)/c; (a/b)(c/d)=(ac)/(bd); (a/b)/(c/d)=(ad)/(bc) (also needing c≠0); a/b=(ak)/(bk) for k≠0."
        }
      },
      {
        "id": "order_basics",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "實數的序：任兩數恰有 u<v、u=v、u>v 之一；u<v 且 v<w 推出 u<w；u<v 推出 u+w<v+w；u<v 且 w>0 推出 uw<vw；u<v 且 w<0 推出 uw>vw。",
          "en": "Order of the reals: exactly one of u<v, u=v, u>v holds; u<v and v<w give u<w; u<v gives u+w<v+w; u<v and w>0 give uw<vw; u<v and w<0 give uw>vw."
        }
      },
      {
        "id": "def_unfold",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "展開定義：把一個已定義的詞換成它的定義內容（或反向收回），命題的真假不變。",
          "en": "Unfolding a definition: replacing a defined term by its definition (or folding it back) does not change whether a statement is true."
        }
      },
      {
        "id": "set_operations_def",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "集合運算：x∈A∪B ⇔ x∈A 或 x∈B；x∈A∩B ⇔ x∈A 且 x∈B；x∈A∖B ⇔ x∈A 且 x∉B；在全集 U 中 Aᶜ=U∖A。",
          "en": "Set operations: x∈A∪B ⇔ x∈A or x∈B; x∈A∩B ⇔ x∈A and x∈B; x∈A∖B ⇔ x∈A and x∉B; in a universe U, Aᶜ=U∖A."
        }
      },
      {
        "id": "set_extensionality",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "集合相等：A=B 當且僅當 A⊆B 且 B⊆A，即兩者有相同元素。",
          "en": "Set equality: A=B if and only if A⊆B and B⊆A, i.e. they have the same elements."
        }
      },
      {
        "id": "eq_refl_symm_trans",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "等號的性質：u=u；若 u=v 則 v=u；若 u=v 且 v=w 則 u=w。",
          "en": "Properties of equality: u=u; if u=v then v=u; if u=v and v=w then u=w."
        }
      },
      {
        "id": "and_intro_elim",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "合取：由 P 與 Q 得 P∧Q；由 P∧Q 可分別得 P 與 Q。",
          "en": "Conjunction: from P and Q infer P∧Q; from P∧Q infer P and infer Q."
        }
      },
      {
        "id": "mko_rv_def",
        "kind": "cited",
        "source": {
          "mko_id": "mko-random-variable",
          "sha256": "bba00300a619b37481007904b211059750f93a4a2c4ba2b8209eac472ad33e06",
          "commit": "b28a5edbd46279b1db2a3f3f48bb3f447e18899f"
        },
        "statement": {
          "zh-Hant": "在非空有限樣本空間 S、事件族 F=𝒫(S) 和合法機率律 P 下，實值隨機變數為總函數 X:S→R。對任何實數子集合 T，其原像 {s∈S:X(s)∈T} 是事件；點機率 P(X=t) 是所有 X(s)=t 的結果權重之和。",
          "en": "On a nonempty finite sample space S with event family F=𝒫(S) and a valid probability law P, a real random variable is a total function X:S→R. For any subset T of ℝ, the preimage {s∈S:X(s)∈T} is an event. P(X=t) sums the weights of all outcomes with X(s)=t."
        }
      },
      {
        "id": "L_weight_law",
        "kind": "lemma",
        "proved_in": [
          "S02.1",
          "S02.2",
          "S02.3"
        ],
        "statement": {
          "zh-Hant": "設 S 有限、F=𝒫(S)，且對所有 s 有 w_s≥0、Σ_{s∈S} w_s=1。則 P(E)=Σ_{s∈E} w_s 滿足：P(E)≥0；P(S)=1；E₁∩E₂=∅ 時 P(E₁∪E₂)=P(E₁)+P(E₂)。",
          "en": "Let S be finite with F=𝒫(S), and let w_s≥0 for all s with Σ_{s∈S} w_s=1. Then P(E)=Σ_{s∈E} w_s satisfies: P(E)≥0; P(S)=1; and P(E₁∪E₂)=P(E₁)+P(E₂) whenever E₁∩E₂=∅."
        }
      },
      {
        "id": "L_level_partition",
        "kind": "lemma",
        "proved_in": [
          "S08.1",
          "S08.2"
        ],
        "statement": {
          "zh-Hant": "對總函數 X:S→ℝ 與其值域 R=X(S)，水平集 {X=t}（t∈R）兩兩不交，且其聯集為 S。",
          "en": "For a total function X:S→ℝ with range R=X(S), the level sets {X=t} (t∈R) are pairwise disjoint and their union is S."
        }
      }
    ],
    "revision_log": [],
    "numeric_checks": [
      {
        "id": "N1",
        "step": "S01",
        "lhs": "1/2+1/4+1/8+1/8",
        "rhs": "1"
      },
      {
        "id": "N2",
        "step": "S04",
        "lhs": "(1-2)**2",
        "rhs": "(3-2)**2"
      },
      {
        "id": "N3",
        "step": "S04",
        "lhs": "(4-2)**2",
        "rhs": "4"
      },
      {
        "id": "N4",
        "step": "S06",
        "lhs": "1/2+1/8",
        "rhs": "5/8"
      },
      {
        "id": "N5",
        "step": "S09",
        "lhs": "1/4+5/8+1/8",
        "rhs": "1"
      },
      {
        "id": "N6",
        "step": "S10",
        "lhs": "1/2+1/8+1/8",
        "rhs": "3/4"
      },
      {
        "id": "N7",
        "step": "S11",
        "lhs": "1-1/4",
        "rhs": "3/4"
      },
      {
        "id": "N8",
        "step": "S06",
        "lhs": "5/8",
        "relation": "!=",
        "rhs": "1/3"
      },
      {
        "id": "N9",
        "step": "S06",
        "lhs": "5/8",
        "relation": "!=",
        "rhs": "1/2"
      },
      {
        "id": "N10",
        "step": "S06",
        "lhs": "5/8",
        "relation": "!=",
        "rhs": "2/4"
      }
    ]
  },
  "presentation": {
    "md_scope": {
      "zh-Hant": "只在 MKO 的有限切片內：S 非空有限、F 為全冪集、X 為總函數，權重是明示的有理數。值域與原像事件只讀函數資料，不使用權重；點機率另用給定權重（MKO 假設 a2）。由權重建立機率律的引理在本稿證明；不處理一般可測空間、連續密度或機率分布的一般表示；不改動 canonical MKO 或英文 edition。",
      "en": "Stays inside the MKO's finite slice: S nonempty and finite, F the full power set, X a total function, weights explicit rationals. The range and preimage events read only the function data and do not use the weights; point probabilities use the separately given weights (MKO assumption a2). The lemma building a probability law from weights is proved here; general measurable spaces, continuous densities and general representations of distributions are not treated; the canonical MKO and its English edition are not changed."
    },
    "md_symbols": [
      [
        "S=\\{1,2,3,4\\}",
        "樣本空間（基本結果）",
        "the sample space (elementary outcomes)"
      ],
      [
        "w_s",
        "結果 s 的權重 P(\\{s\\})",
        "the weight P({s}) of outcome s"
      ],
      [
        "X:S\\to\\mathbb{R}",
        "隨機變數，即整張函數表",
        "the random variable, i.e. the whole function table"
      ],
      [
        "X(S)",
        "X 的值域（去除重複值）",
        "the range of X (duplicates removed)"
      ],
      [
        "\\{X\\in T\\}",
        "原像事件 {s∈S ∣ X(s)∈T}",
        "the preimage event {s∈S ∣ X(s)∈T}"
      ]
    ],
    "md_error_controls": [
      {
        "title": "隨機變數不是一次抽樣結果 / A random variable is not the result of one draw",
        "zh": "MKO 的誤解之一是把隨機變數當成一次抽樣得到的數。X 是整張表 s↦X(s)；「X=1」指的是事件 {1,3}，是結果的集合，而 P(X=1)=5/8 是這個事件的機率。某次試驗得到 1 只是一個觀察，不是 X 本身。",
        "en": "One misconception identified in the MKO is taking a random variable for the number obtained in one draw. X is the whole table s↦X(s); 'X=1' names the event {1,3}, a set of outcomes, and P(X=1)=5/8 is the probability of that event. Getting 1 in some trial is one observation, not X itself."
      },
      {
        "title": "值域大小不是機率 / The size of the range is not a probability",
        "zh": "值域有 3 個值，但這不表示每個值的機率是 1/3。P(X=1)=5/8、P(X=0)=1/4、P(X=4)=1/8，機率只由權重決定。沒有給權重時也不能假設等可能（a2）。",
        "en": "The range has 3 values, but that does not make each value have probability 1/3. P(X=1)=5/8, P(X=0)=1/4, P(X=4)=1/8; probabilities come only from the weights. Without given weights one may not assume equal likelihood either (a2)."
      },
      {
        "title": "相同輸出值的權重全部相加 / Add the weights of every outcome with the same value",
        "zh": "X(1)=X(3)=1，所以 P(X=1) 必須是 w₁+w₃=5/8。只看第一個找到的結果會得到 1/2，漏掉了結果 3。S08 的分割論證保證每個結果恰被算進一個值。",
        "en": "X(1)=X(3)=1, so P(X=1) must be w₁+w₃=5/8. Stopping at the first outcome found gives 1/2 and misses outcome 3. The partition argument of S08 guarantees that every outcome is counted for exactly one value."
      }
    ],
    "md_open_items": [
      {
        "zh-Hant": "本稿只處理有限 S 與全冪集事件族；一般可測空間中原像是否為事件需要可測性，另列義務。",
        "en": "This guide treats only finite S with the full power set as event family; in general measurable spaces, whether preimages are events requires measurability, which is a separate obligation."
      },
      {
        "zh-Hant": "點機率構成的分布（pushforward）在 S09 只以「總和為 1」描述，未正式定義為新的機率律。",
        "en": "The distribution formed by the point probabilities (the pushforward) is described in S09 only by its total 1 and is not formally defined as a new probability law."
      }
    ]
  },
  "revision": {
    "id": "production-20261019-adopted-96",
    "source_commit": "b28a5edbd46279b1db2a3f3f48bb3f447e18899f",
    "adopted_source_sha256": "e3ee00cdf7973380a94ca35efae4aee08d70223d37aeaa04c4bea83e742cc89e",
    "original_source_sha256": "271553651a5de4e20f2099e671fec4d0d536a0ca7d03824e10700a37afda8f57",
    "owner_adopted": true,
    "bilingual_sync": "complete_source_bound",
    "formal_Lean": "NOT_RUN",
    "independent_AI_concurrence": "NOT_MEASURED",
    "issue_ids": [
      "BR-M013",
      "BR-M014"
    ],
    "scope": "Owner-adopted natural-language teaching guide; not a formal proof, canonical MKO rewrite or evidence-status promotion."
  }
}
