{
  "$schema": "../../../schemas/mko-v0.4.schema.json",
  "schema_version": "mko-v0.4",
  "id": "mko-modular-inverse",
  "semantic_family_id": "sf-modular-inverse",
  "type": "definition",
  "version": "0.10.0",
  "language": "zh-Hant",
  "titles": {
    "zh-Hant": "模反元素"
  },
  "summary": {
    "zh-Hant": "n≥2時，a模n有乘法反元素恰當gcd(a,n)=1；反元素在模n意義唯一。"
  },
  "statement": {
    "zh-Hant": "使用extended Euclid給exact Bezout certificate ax+ny=1，輸出0≤x mod n<n。modulus0無效；本輪限制n≥2。nonunit明示無inverse，不以除法近似。"
  },
  "formula": {
    "tex": "I(a)",
    "mathml": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mrow><mi>I</mi><mo>(</mo><mi>a</mi><mo>)</mo></mrow></math>",
    "semantic_ast": {
      "type": "function_call",
      "callee": {
        "type": "symbol",
        "name": "I",
        "glyph": "I"
      },
      "arguments": [
        {
          "type": "symbol",
          "name": "a",
          "glyph": "a"
        }
      ]
    },
    "compiler": {
      "id": "ocme-formula-core",
      "version": "0.4.0",
      "source_sha256": "11a21519cda1d5073e9f0093587eda5b8001200fe5237266abf3e2751596edd2"
    }
  },
  "assumptions": [
    {
      "id": "a1",
      "zh-Hant": "整數a與模數n≥2。"
    },
    {
      "id": "a2",
      "zh-Hant": "所有同餘及gcd以exact integer arithmetic。"
    }
  ],
  "symbols": [
    {
      "token": "I",
      "role": "modular_inverse",
      "role_zh": "模反元素",
      "scope": "representative_formula"
    },
    {
      "token": "a",
      "role": "integer_residue",
      "role_zh": "整數代表",
      "scope": "representative_formula"
    }
  ],
  "dependencies": [
    {
      "id": "mko-gcd-coprime",
      "title_zh": "最大公因數與互質",
      "reason_zh": "存在條件及Bezout。"
    },
    {
      "id": "mko-modular-congruence",
      "title_zh": "模同餘",
      "reason_zh": "唯一性只到residue class。"
    },
    {
      "id": "mko-equation",
      "title_zh": "方程",
      "reason_zh": "ax+ny=1。"
    }
  ],
  "explanation": {
    "paragraphs_zh": [
      "gcd=1等價存在inverse。",
      "extended Euclid給Bezout witness。",
      "輸出normalized residue；nonunit無inverse。"
    ],
    "common_misconception_zh": "對nonunit或modulus0除法，或把整數representative唯一當成residue唯一。"
  },
  "proofs": [],
  "computational_companions": [],
  "verification": {
    "computational_status": "not_evaluated_no_computational_claim",
    "warning_zh": "本輪n≥2；不採n=1退化慣例。",
    "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": "加入CRT與模線性方程。"
  },
  "provenance": {
    "origin": "ocme_local_ai_materialization_candidate",
    "note_zh": "依 research/atlas-modular-inverse.md 整理；2026-10-14 脈衝 R07（使用者手動接續 2026-11-03 工作序列；實際日期仍為 2026-10-14），英文及 Lean 依使用者指示延後。",
    "content_license": "CC-BY-SA-4.0",
    "code_license": "MIT",
    "created_at": "2026-10-14"
  }
}
