{
  "$schema": "../../../schemas/mko-v0.4.schema.json",
  "schema_version": "mko-v0.4",
  "id": "mko-wilson-theorem",
  "semantic_family_id": "sf-wilson-theorem",
  "type": "theorem",
  "version": "0.10.0",
  "language": "zh-Hant",
  "titles": {
    "zh-Hant": "Wilson定理"
  },
  "summary": {
    "zh-Hant": "整數n>1為質數，恰當(n-1)!模n同餘於-1。"
  },
  "statement": {
    "zh-Hant": "先核n>1。prime direction完整枚舉nonzero residues的modular inverses；除self-inverse residues外成對相消，p>2時self-inverse恰1與p-1，p=2時兩者是同一residue。exact factorial table核(n-1)! mod n。Composite examples只證指定n，不取代converse proof；不得混同Fermat little theorem，有限testing不證所有n。"
  },
  "formula": {
    "tex": "W(n)=b",
    "mathml": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mrow><mrow><mi>W</mi><mo>(</mo><mi>n</mi><mo>)</mo></mrow><mo>=</mo><mi>b</mi></mrow></math>",
    "semantic_ast": {
      "type": "equation",
      "lhs": {
        "type": "function_call",
        "callee": {
          "type": "symbol",
          "name": "W",
          "glyph": "W"
        },
        "arguments": [
          {
            "type": "symbol",
            "name": "n",
            "glyph": "n"
          }
        ]
      },
      "rhs": {
        "type": "symbol",
        "name": "b",
        "glyph": "b"
      }
    },
    "compiler": {
      "id": "ocme-formula-core",
      "version": "0.4.0",
      "source_sha256": "6901f1278572d47b5b09e5b80b1f6912b252aebd361e580c4be56586f28898eb"
    }
  },
  "assumptions": [
    {
      "id": "a1",
      "zh-Hant": "n為exact integer且先核n>1。"
    },
    {
      "id": "a2",
      "zh-Hant": "inverse pairing只在prime modulus的全部nonzero residues上使用。"
    }
  ],
  "symbols": [
    {
      "token": "W",
      "role": "wilson_predicate",
      "role_zh": "Wilson定理述詞",
      "scope": "representative_formula"
    },
    {
      "token": "n",
      "role": "integer_modulus",
      "role_zh": "整數模數",
      "scope": "representative_formula"
    },
    {
      "token": "b",
      "role": "prime_congruence_equivalence",
      "role_zh": "質數同餘等價結論",
      "scope": "representative_formula"
    }
  ],
  "dependencies": [
    {
      "id": "mko-prime-number",
      "title_zh": "質數",
      "reason_zh": "prime iff。"
    },
    {
      "id": "mko-modular-congruence",
      "title_zh": "模同餘",
      "reason_zh": "factorial congruence。"
    },
    {
      "id": "mko-factorial",
      "title_zh": "階乘",
      "reason_zh": "(n-1)!。"
    },
    {
      "id": "mko-modular-inverse",
      "title_zh": "模反元素",
      "reason_zh": "prime-direction inverse pairing。"
    }
  ],
  "explanation": {
    "paragraphs_zh": [
      "n>1 domain與prime/composite classification先行。",
      "inverse pairing完整列舉且p=2特判。",
      "finite examples不取代雙向一般證明。"
    ],
    "common_misconception_zh": "把Wilson當Fermat定理、忽略p=2，或從有限測試推普遍性。"
  },
  "proofs": [],
  "computational_companions": [],
  "verification": {
    "computational_status": "not_evaluated_no_computational_claim",
    "warning_zh": "factorial modular computation只證指定n。",
    "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": "加入Wilson quotient與primality algorithms。"
  },
  "provenance": {
    "origin": "ocme_local_ai_materialization_candidate",
    "note_zh": "依 research/atlas-wilson-theorem.md 整理；2026-10-15 脈衝 R04（使用者手動接續 2026-11-18 工作序列；實際日期仍為 2026-10-15），英文及 Lean 依使用者指示延後。",
    "content_license": "CC-BY-SA-4.0",
    "code_license": "MIT",
    "created_at": "2026-10-15"
  }
}
