{
  "schema_version": "ocme-derivation-reader-v1",
  "guide_id": "derivation-mko-modular-inverse-01",
  "mko_id": "mko-modular-inverse",
  "title": {
    "zh-Hant": "17模43的正規化逆元",
    "en": "The normalized inverse of 17 modulo 43"
  },
  "contract": {
    "schema_version": "ocme-derivation-guide-v0.1",
    "guide_id": "derivation-mko-modular-inverse-01",
    "source": {
      "mko_id": "mko-modular-inverse",
      "commit": "b1b2f1dcf8c50d67a93fe52d95f8eef7b3abba9f",
      "sha256": "d16e0773143022c00ff50dad2cd84ef53e2d8a9078f64c2d785413c676b002ab",
      "english_sha256": "6d3e8307627ef6fae92d80afb7cdf3347e4ca67f4f12e28c68a96a7465d52732"
    },
    "mode": "worked_example",
    "audience_prerequisites": [
      "calc"
    ],
    "goal": {
      "zh-Hant": "17模43的唯一逆類為38；17·38=15·43+1。",
      "en": "The unique inverse residue class of 17 modulo 43 is represented by 38; 17*38=15*43+1."
    },
    "givens": [
      {
        "id": "G1",
        "statement": {
          "zh-Hant": "a=17，n=43，要求0≤x<43及17x≡1 mod43。",
          "en": "a=17, n=43; require 0≤x<43 and 17x congruent to 1 modulo 43."
        }
      }
    ],
    "steps": [
      {
        "id": "S01",
        "uses": [
          "G1"
        ],
        "before_tex": "a=17,\\quad n=43",
        "after_tex": "n\\ge2,\\quad43=2\\cdot17+9,\\quad0\\le9<17",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "模數域合法；第一個帶餘除法給餘數9。",
          "en": "The modulus domain is valid; the first exact division gives remainder 9."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1"
          ],
          "explanation": {
            "zh-Hant": "除數17非零且餘數界明列，沒有近似除法。",
            "en": "The divisor 17 is nonzero and the remainder bound is explicit; no approximate division is used."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S02",
        "uses": [
          "G1",
          "S01"
        ],
        "before_tex": "17,9",
        "after_tex": "17=1\\cdot9+8,\\quad9=1\\cdot8+1,\\quad8=8\\cdot1+0",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "完整除法鏈的餘數依序8、1、0，均小於非零除數。",
          "en": "The complete division chain has remainders 8,1,0, each below its nonzero divisor."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S01"
          ],
          "explanation": {
            "zh-Hant": "到餘數0停止，不能再除以0。",
            "en": "Stop at remainder zero without a subsequent division by zero."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S03",
        "uses": [
          "G1",
          "S01",
          "S02"
        ],
        "before_tex": "u=qv+r",
        "after_tex": "d\\mid u,v\\iff d\\mid v,r;\\quad\\gcd(17,43)=1",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "共因數集合不變：r=u−qv與u=qv+r給雙方向；最後非零餘數1即gcd。",
          "en": "Common divisors are preserved in both directions using r=u-qv and u=qv+r; the last nonzero remainder 1 is the gcd."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S01",
            "S02"
          ],
          "explanation": {
            "zh-Hant": "gcd不只是猜1，已由整條鏈與共因數不變證明。",
            "en": "The gcd is not guessed; the full chain and divisor invariant prove it."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S04",
        "uses": [
          "G1",
          "S01",
          "S02",
          "S03"
        ],
        "before_tex": "1=9-8,\\quad8=17-9,\\quad9=43-2\\cdot17",
        "after_tex": "1=2\\cdot43-5\\cdot17",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "逐式回代給原輸入的Bezout係數x=−5、y=2。",
          "en": "Back-substitution gives Bezout coefficients x=-5,y=2 for the original inputs."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S01",
            "S02",
            "S03"
          ],
          "explanation": {
            "zh-Hant": "直接核86−85=1；符號錯誤會使逆元失效。",
            "en": "Directly check 86-85=1; a sign error would invalidate the inverse."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S05",
        "uses": [
          "G1",
          "S04"
        ],
        "before_tex": "17(-5)+43(2)=1",
        "after_tex": "-5\\equiv38\\pmod{43},\\quad0\\le38<43",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "把負Bezout係數加43正規化，得到候選38。",
          "en": "Add 43 to the negative Bezout coefficient to normalize the candidate to 38."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S04"
          ],
          "explanation": {
            "zh-Hant": "−5與38是同一逆類，不是兩個不同逆元類。",
            "en": "-5 and 38 represent the same inverse class, not distinct inverse classes."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S06",
        "uses": [
          "G1",
          "S05"
        ],
        "before_tex": "x=38",
        "after_tex": "17\\cdot38=646=15\\cdot43+1\\Rightarrow17\\cdot38\\equiv1\\pmod{43}",
        "relation": "implies",
        "rule": "mko_definition",
        "conditions": [],
        "explanation": {
          "zh-Hant": "整數乘積再核，證候選真是逆元。",
          "en": "An independent exact product check confirms the candidate is an inverse."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S05"
          ],
          "explanation": {
            "zh-Hant": "等式先在Z成立，再推出模43同餘，不混淆兩層。",
            "en": "The equality is in Z before passing to congruence modulo 43."
          }
        },
        "leaf_basis": "mko_definition"
      },
      {
        "id": "S07",
        "uses": [
          "G1",
          "S04",
          "S06"
        ],
        "before_tex": "17x\\equiv17x'\\equiv1\\pmod{43}",
        "after_tex": "43\\mid17(x-x');\\quad x-x'=(2\\cdot43-5\\cdot17)(x-x')\\Rightarrow43\\mid x-x'",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "以已證Bezout式消去17，證逆元只在模43意義下唯一。",
          "en": "Use the established Bezout identity to cancel 17 and prove uniqueness modulo 43."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S04",
            "S06"
          ],
          "explanation": {
            "zh-Hant": "若x與x'均在0到42，差為43倍且絕對值小43，才得整數相等。",
            "en": "Only if both are normalized to 0 through 42 does the multiple-of-43 difference force integer equality."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S08",
        "uses": [
          "G1",
          "S03"
        ],
        "before_tex": "6x+15y=1\\text{ proposed}",
        "after_tex": "3\\mid6x+15y\\text{ but }3\\nmid1\\Rightarrow6\\text{ has no inverse mod }15",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "nonunit示例gcd(6,15)=3，不可能給Bezout1，因此不能用有理1/6代替模逆元。",
          "en": "For nonunit 6 modulo 15, gcd 3 makes Bezout 1 impossible; rational 1/6 is not a modular inverse."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S03"
          ],
          "explanation": {
            "zh-Hant": "此無解證書對所有整數x、y成立，不僅有限搜尋。",
            "en": "The obstruction applies to all integer x,y, not just a bounded search."
          }
        },
        "leaf_basis": "calc"
      }
    ],
    "result": {
      "zh-Hant": "17模43的唯一逆類為38；17·38=15·43+1。",
      "en": "The unique inverse residue class of 17 modulo 43 is represented by 38; 17*38=15*43+1."
    },
    "negative_controls": [
      {
        "claim": {
          "zh-Hant": "逆元為5。",
          "en": "The inverse is 5."
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "17·5=85≡42而非1 mod43。",
          "en": "17*5=85 is 42, not 1, modulo 43."
        }
      },
      {
        "claim": {
          "zh-Hant": "6模15的逆元可寫1/6。",
          "en": "The inverse of 6 modulo 15 is 1/6."
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "3整除任何6x+15y，不可能等1。",
          "en": "Every 6x+15y is divisible by 3 and cannot equal 1."
        }
      },
      {
        "claim": {
          "zh-Hant": "逆元作整數唯一。",
          "en": "An inverse is unique as an integer."
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "38與−5均滿足同餘，只在正規化範圍選38。",
          "en": "38 and -5 both satisfy the congruence; normalization selects 38."
        }
      }
    ],
    "status": "candidate",
    "gaps": [],
    "verification": {
      "structure": "checked_local_script",
      "mathematics": "candidate_argument",
      "formalization": "not_formalized"
    },
    "rule_glossary": [
      {
        "id": "calc",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "假設精確整數算術、帶餘除法、整除與gcd的定義；同餘等式始終綁定明示模數。",
          "en": "Assume exact integer arithmetic, division with remainder, and definitions of divisibility and gcd; every congruence has an explicit modulus."
        }
      },
      {
        "id": "mko_definition",
        "kind": "cited",
        "statement": {
          "zh-Hant": "使用extended Euclid給exact Bezout certificate ax+ny=1，輸出0≤x mod n<n。modulus0無效；本輪限制n≥2。nonunit明示無inverse，不以除法近似。",
          "en": "Use extended Euclid for an exact Bezout certificate a*x+n*y=1 and return the normalized representative 0≤x mod n<n. Modulus zero is invalid, and this slice requires n≥2. A nonunit explicitly has no inverse; approximate division is not used."
        },
        "source": {
          "mko_id": "mko-modular-inverse",
          "sha256": "d16e0773143022c00ff50dad2cd84ef53e2d8a9078f64c2d785413c676b002ab",
          "commit": "b1b2f1dcf8c50d67a93fe52d95f8eef7b3abba9f"
        }
      }
    ],
    "revision_log": [],
    "numeric_checks": [
      {
        "id": "bezout",
        "lhs": "17*(-5)+43*2",
        "rhs": "1",
        "step": "S04"
      },
      {
        "id": "inverse",
        "lhs": "(17*38)%43",
        "rhs": "1",
        "step": "S06"
      }
    ]
  },
  "presentation": {
    "md_scope": {
      "zh-Hant": "n≥2的exact Euclid與Bezout證書，另列nonunit邊界。",
      "en": "Exact Euclid and Bezout for n≥2, with a nonunit boundary."
    },
    "md_symbols": [
      [
        "x",
        "正規化逆元代表",
        "normalized inverse representative"
      ],
      [
        "y",
        "Bezout模數係數",
        "Bezout coefficient of the modulus"
      ]
    ],
    "md_error_controls": [
      {
        "title": "負號 / Sign",
        "zh": "回代係數為−5，不是5。",
        "en": "Back-substitution gives -5, not 5."
      },
      {
        "title": "模數域 / Modulus domain",
        "zh": "本輪只允許n≥2，n=0或1不採用。",
        "en": "This slice requires n≥2, excluding 0 and 1."
      }
    ],
    "md_open_items": []
  },
  "revision": {
    "id": "ocme-new142-reader-adoption-20261021",
    "collection": "coverage-20261021",
    "source_commit": "b1b2f1dcf8c50d67a93fe52d95f8eef7b3abba9f",
    "adopted_source_sha256": "ad89135f0921bf66f257e43757b32ec3605667deebbc8f37408286760c155399",
    "original_source_sha256": "b707f2a218c25be9424d71c4a6c7ef3f1dc204d7cee86331914a9182b0e19932",
    "owner_adopted": true,
    "bilingual_sync": "complete_source_bound",
    "formal_Lean": "NOT_RUN",
    "reader_review": "142_of_142_source_bound",
    "wording_review": "original_Lead_decisions_resolved",
    "glossary_reader_paraphrases": [],
    "independent_AI_concurrence": "SCOPED_LEAD_AND_BILINGUAL_CONTEXT_REVIEW",
    "issue_ids": [
      "BR142-P021",
      "BR142-P022"
    ],
    "parent_manifest_sha256": "d29f4cae8229ebd24f60d496cb1d3cd4ad8c0a4dca9d44daab0c3245c544283a",
    "scope": "Owner-adopted reader revision. Lead and bilingual review concern the recorded text and premises; no new universal or Lean proof, canonical promotion or historical-label rewrite."
  }
}
