{
  "$schema": "../../../schemas/mko-v0.4.schema.json",
  "schema_version": "mko-v0.4",
  "id": "mko-modular-congruence",
  "semantic_family_id": "sf-modular-congruence",
  "type": "definition",
  "version": "0.10.0",
  "language": "zh-Hant",
  "titles": {
    "zh-Hant": "自然數模同餘"
  },
  "summary": {
    "zh-Hant": "固定正模數 n 時，a 與 b 模 n 同餘表示兩者除以 n 的餘數相同。"
  },
  "statement": {
    "zh-Hant": "對自然數 a、b 與正自然數 n，a≡b (mod n) 當且僅當 a mod n=b mod n；等價地，存在自然數 k、l 使 a+n·k=b+n·l。"
  },
  "formula": {
    "tex": "r(a)=r(b)",
    "mathml": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mrow><mrow><mi>r</mi><mo>(</mo><mi>a</mi><mo>)</mo></mrow><mo>=</mo><mrow><mi>r</mi><mo>(</mo><mi>b</mi><mo>)</mo></mrow></mrow></math>",
    "semantic_ast": {
      "type": "equation",
      "lhs": {
        "type": "function_call",
        "callee": {
          "type": "symbol",
          "name": "r",
          "glyph": "r"
        },
        "arguments": [
          {
            "type": "symbol",
            "name": "a",
            "glyph": "a"
          }
        ]
      },
      "rhs": {
        "type": "function_call",
        "callee": {
          "type": "symbol",
          "name": "r",
          "glyph": "r"
        },
        "arguments": [
          {
            "type": "symbol",
            "name": "b",
            "glyph": "b"
          }
        ]
      }
    },
    "compiler": {
      "id": "ocme-formula-core",
      "version": "0.4.0",
      "source_sha256": "8074fe7411112e04bdb79cf954ca7bb852f083098c16fcb936b50996e786ddb3"
    }
  },
  "assumptions": [
    {
      "id": "a1",
      "zh-Hant": "a、b 是自然數，模數 n 為正自然數。"
    },
    {
      "id": "a2",
      "zh-Hant": "本條目刻意排除 n=0，以免把程式語言的 mod-zero 慣例混入通常初等數論語義。"
    }
  ],
  "symbols": [
    {
      "token": "r",
      "role": "remainder_function",
      "role_zh": "固定正模數下的餘數函數",
      "scope": "representative_formula"
    },
    {
      "token": "a",
      "role": "first_natural",
      "role_zh": "第一自然數",
      "scope": "representative_formula"
    },
    {
      "token": "b",
      "role": "second_natural",
      "role_zh": "第二自然數",
      "scope": "representative_formula"
    }
  ],
  "dependencies": [
    {
      "id": "mko-natural-number",
      "title_zh": "自然數",
      "reason_zh": "輸入、模數與餘數都在自然數中。"
    },
    {
      "id": "mko-arithmetic-operations",
      "title_zh": "四則運算",
      "reason_zh": "同餘計算使用精確除法餘數、加法與乘法。"
    }
  ],
  "explanation": {
    "paragraphs_zh": [
      "同餘比較的是固定同一模數下的餘數，而不是數值相等。它在自然數上是等價關係。",
      "若 a≡b (mod n) 且 c≡d (mod n)，則加法與乘法保持同餘；有限題目會逐項重算餘數。",
      "取消乘法因子需要額外條件；從 c·a≡c·b 直接取消 c 通常不合法，必須考慮 c 與 n 的最大公因數。"
    ],
    "common_misconception_zh": "混用不同模數、允許零模數，或無條件在同餘式兩側取消共同因子。"
  },
  "proofs": [],
  "computational_companions": [],
  "verification": {
    "computational_status": "not_evaluated_no_computational_claim",
    "warning_zh": "固定正模數的有限餘數可精確重算；本輪不宣稱中國剩餘定理或一般取消律已形式化。",
    "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": "綁定 Nat.ModEq 的餘數定義、等價關係與 add/mul 保持；另證對稱自然數見證橋。"
  },
  "provenance": {
    "origin": "ocme_local_ai_materialization_candidate",
    "note_zh": "依 research/atlas-modular-congruence.md 整理；2026-10-13 脈衝 R05（使用者手動接續 2026-10-18 工作序列；實際日期仍為 2026-10-13），英文及 Lean 依使用者指示延後。",
    "content_license": "CC-BY-SA-4.0",
    "code_license": "MIT",
    "created_at": "2026-10-13"
  }
}
