{
  "schema_version": "ocme-derivation-reader-v1",
  "guide_id": "derivation-mko-wilson-theorem-01",
  "mko_id": "mko-wilson-theorem",
  "title": {
    "zh-Hant": "完整逆元配對與Wilson雙向證明",
    "en": "Complete inverse pairing and both Wilson directions"
  },
  "contract": {
    "schema_version": "ocme-derivation-guide-v0.1",
    "guide_id": "derivation-mko-wilson-theorem-01",
    "source": {
      "mko_id": "mko-wilson-theorem",
      "commit": "b1b2f1dcf8c50d67a93fe52d95f8eef7b3abba9f",
      "sha256": "32b4a0da9e832eb6c7c0c33d723d8f66608b7013dcd990ad19fa2596126d9eb8",
      "english_sha256": "0ea5bedaf95ddb7a9d900b474d7830c9ce429c691d48ecd945d3920fcd1d2b48"
    },
    "mode": "theorem_proof",
    "audience_prerequisites": [
      "calc"
    ],
    "goal": {
      "zh-Hant": "n>1時(n−1)!≡−1 modn恰當n prime；模7完整逆元表核6!≡6。",
      "en": "For n>1, (n-1)!=-1 mod n exactly when n is prime; the full modulo-7 inverse table checks 6!=6 mod 7."
    },
    "givens": [
      {
        "id": "G1",
        "statement": {
          "zh-Hant": "n為整數且n>1；prime方向另記p；實例p=7。",
          "en": "n is an integer greater than 1; use p in the prime direction, with p=7 as the example."
        }
      }
    ],
    "steps": [
      {
        "id": "S01",
        "uses": [
          "G1"
        ],
        "before_tex": "p\\text{ prime},\\quad1\\le a<p",
        "after_tex": "\\gcd(a,p)=1\\Rightarrow\\exists a^{-1}\\pmod p",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "prime的proper正因數只有1，所以全部非零類互質，Bezout給逆元。",
          "en": "A prime has only proper positive divisor 1, so every nonzero class is coprime and Bezout provides an inverse."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1"
          ],
          "explanation": {
            "zh-Hant": "逆元唯一到類，因若ab=ac=1則b=b(ac)=(ba)c=c。",
            "en": "The inverse is unique as a class: ab=ac=1 gives b=b(ac)=(ba)c=c."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S02",
        "uses": [
          "G1",
          "S01"
        ],
        "before_tex": "a=a^{-1}\\pmod p",
        "after_tex": "a^2\\equiv1\\Rightarrow p\\mid(a-1)(a+1)\\Rightarrow a\\equiv1\\text{ or }-1\\pmod p",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "Euclid引理決定全部self-inverse類；p>2時1與−1不同。",
          "en": "Euclid's lemma determines all self-inverse classes; for p>2,1 and -1 are distinct."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S01"
          ],
          "explanation": {
            "zh-Hant": "prime前提是零乘積推因子的關鍵，合數不保證。",
            "en": "Primality is essential for the zero-product implication; composite moduli need not satisfy it."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S03",
        "uses": [
          "G1",
          "S01",
          "S02"
        ],
        "before_tex": "p>2,\\quad a\\ne a^{-1}",
        "after_tex": "\\{a,a^{-1}\\}\\text{ disjoint inverse pairs},\\quad aa^{-1}\\equiv1\\pmod p",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "取逆是involution，所以除兩個self-inverse外的全部類正好配成不交雙元素對。",
          "en": "Inversion is an involution, partitioning all non-self-inverse classes into disjoint two-element pairs."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S01",
            "S02"
          ],
          "explanation": {
            "zh-Hant": "a^{-1}的逆是a，因此不會漏類或把一類配兩次。",
            "en": "The inverse of a inverse is a, so no class is missed or paired twice."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S04",
        "uses": [
          "G1",
          "S02",
          "S03"
        ],
        "before_tex": "\\prod_{a=1}^{p-1}a\\text{ paired as above}",
        "after_tex": "(p-1)!\\equiv1\\cdot(-1)\\cdot1\\equiv-1\\pmod p",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "完整所有非零類乘積中，普通逆對給1，自逆的1、−1留下−1。",
          "en": "In the product of all nonzero classes, ordinary inverse pairs give 1 and self-inverses 1,-1 leave -1."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S02",
            "S03"
          ],
          "explanation": {
            "zh-Hant": "這是對任意odd prime的論證，不是只用p=7表外推。",
            "en": "This argument covers arbitrary odd primes rather than extrapolating the p=7 table."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S05",
        "uses": [
          "G1",
          "S01"
        ],
        "before_tex": "p=2",
        "after_tex": "(2-1)!=1\\equiv-1\\pmod2",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "偶prime2時1與−1同一類，只出現一次，公式直接成立。",
          "en": "At even prime 2,1 and -1 are the same single class; the formula holds directly."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S01"
          ],
          "explanation": {
            "zh-Hant": "不能把兩個相同self-inverse代表重複計入乘積。",
            "en": "Do not count the coincident self-inverse representatives twice."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S06",
        "uses": [
          "G1",
          "S01",
          "S02"
        ],
        "before_tex": "p=7,\\quad a=1,2,3,4,5,6",
        "after_tex": "a^{-1}=1,4,5,2,3,6\\text{ respectively}",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "完整六格逆元表給配對{1}、{6}、{2,4}、{3,5}。",
          "en": "The complete six-entry inverse list gives pairs {1},{6},{2,4},{3,5}."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S01",
            "S02"
          ],
          "explanation": {
            "zh-Hant": "2·4=8≡1、3·5=15≡1、6²=36≡1，全部覆核。",
            "en": "2*4=8,3*5=15,6^2=36 all reduce to 1, checking every listed pair."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S07",
        "uses": [
          "G1",
          "S04",
          "S06"
        ],
        "before_tex": "j=1,2,3,4,5,6",
        "after_tex": "j!\\bmod7=1,2,6,3,1,6\\text{ respectively};\\quad6!=720\\equiv6\\pmod7",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "完整逐乘factorial表獨立核prime7方向，6代表−1。",
          "en": "A complete incremental factorial table independently checks prime 7, with residue 6 representing -1."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S04",
            "S06"
          ],
          "explanation": {
            "zh-Hant": "Wilson使用factorial不是Fermat的base power。",
            "en": "Wilson uses a factorial rather than a Fermat base power."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S08",
        "uses": [
          "G1"
        ],
        "before_tex": "n>1\\text{ composite},\\quad1<d<n,\\quad d\\mid n",
        "after_tex": "d\\mid(n-1)!",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "合數有proper因數d，且d是1至n−1乘積中的一項，所以d整除factorial。",
          "en": "A composite has a proper divisor d, which appears as a factor in 1 through n-1, so d divides the factorial."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1"
          ],
          "explanation": {
            "zh-Hant": "不需聲稱所有合數factorial都0 modn；n=4也由此證法涵蓋。",
            "en": "No claim that every composite factorial is zero modulo n is needed; n=4 is covered too."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S09",
        "uses": [
          "G1",
          "S08"
        ],
        "before_tex": "(n-1)!\\equiv-1\\pmod n,\\quad d\\mid n,\\quad d\\mid(n-1)!",
        "after_tex": "d\\mid((n-1)!+1)\\text{ and }d\\mid(n-1)!\\Rightarrow d\\mid1\\text{ impossible}",
        "relation": "implies",
        "rule": "calc",
        "conditions": [],
        "explanation": {
          "zh-Hant": "若合數通過Wilson，取差就使d>1整除1，矛盾，證converse。",
          "en": "If a composite passed Wilson, subtraction would make d>1 divide 1, a contradiction, proving the converse."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S08"
          ],
          "explanation": {
            "zh-Hant": "這是一般反證，不是以幾個composite測試取代。",
            "en": "This is a general contradiction argument, not a substitute based on several composite tests."
          }
        },
        "leaf_basis": "calc"
      },
      {
        "id": "S10",
        "uses": [
          "G1",
          "S04",
          "S05",
          "S07",
          "S09"
        ],
        "before_tex": "n>1,\\quad\\text{prime direction and composite contradiction}",
        "after_tex": "n\\text{ prime}\\iff(n-1)!\\equiv-1\\pmod n",
        "relation": "implies",
        "rule": "mko_definition",
        "conditions": [],
        "explanation": {
          "zh-Hant": "兩方向連同p=2完成雙向定理，模7表只是實例證書。",
          "en": "Both directions together with p=2 complete the equivalence; the modulo-7 table is only an instance certificate."
        },
        "reverse_audit": {
          "kind": "premise_audit",
          "required_ids": [
            "G1",
            "S04",
            "S05",
            "S07",
            "S09"
          ],
          "explanation": {
            "zh-Hant": "n=1不在domain，不能以0!=1的偶然餘數擴張。",
            "en": "n=1 is outside the domain and cannot be added from a degenerate factorial residue."
          }
        },
        "leaf_basis": "mko_definition"
      }
    ],
    "result": {
      "zh-Hant": "n>1時(n−1)!≡−1 modn恰當n prime；模7完整逆元表核6!≡6。",
      "en": "For n>1, (n-1)!=-1 mod n exactly when n is prime; the full modulo-7 inverse table checks 6!=6 mod 7."
    },
    "negative_controls": [
      {
        "claim": {
          "zh-Hant": "合數4也通過Wilson。",
          "en": "Composite 4 also passes Wilson."
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "3!=6≡2 mod4而−1≡3。",
          "en": "3!=6 is 2 modulo 4, while -1 is 3."
        }
      },
      {
        "claim": {
          "zh-Hant": "p=2必有兩個不同self-inverse類。",
          "en": "p=2 has two distinct self-inverse classes."
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "1≡−1 mod2，只有一類。",
          "en": "1=-1 modulo 2, giving one class."
        }
      },
      {
        "claim": {
          "zh-Hant": "Wilson就是a^{p−1}≡1。",
          "en": "Wilson is the statement a^(p-1)=1."
        },
        "expected": "reject",
        "reason": {
          "zh-Hant": "Wilson是(p−1)!，Fermat才是固定base的power。",
          "en": "Wilson concerns (p-1)!; Fermat concerns powers of a fixed base."
        }
      }
    ],
    "status": "candidate",
    "gaps": [],
    "verification": {
      "structure": "checked_local_script",
      "mathematics": "candidate_argument",
      "formalization": "not_formalized"
    },
    "rule_glossary": [
      {
        "id": "calc",
        "kind": "prerequisite",
        "statement": {
          "zh-Hant": "假設精確整數算術、帶餘除法、整除與gcd的定義；同餘等式始終綁定明示模數。明示假設互質Bezout定理及prime的Euclid引理p|ab⇒p|a或p|b。",
          "en": "Assume exact integer arithmetic, division with remainder, and definitions of divisibility and gcd; every congruence has an explicit modulus. Explicitly assume coprime Bezout and Euclid's prime lemma p dividing ab implies p dividing a or b."
        }
      },
      {
        "id": "mko_definition",
        "kind": "cited",
        "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。",
          "en": "Qualify the integer domain n>1. For a prime modulus list the inverses of every nonzero residue and cancel the distinct inverse pairs. When p>2 the self-inverse residues are 1 and p−1; at p=2 they coincide. Exact factorial tables check the congruence at the specified modulus. Composite instances do not replace the converse proof, and a finite testing range does not prove the universal equivalence. Wilson factorial congruence and Fermat power congruence are different statements."
        },
        "source": {
          "mko_id": "mko-wilson-theorem",
          "sha256": "32b4a0da9e832eb6c7c0c33d723d8f66608b7013dcd990ad19fa2596126d9eb8",
          "commit": "b1b2f1dcf8c50d67a93fe52d95f8eef7b3abba9f"
        }
      }
    ],
    "revision_log": [],
    "numeric_checks": [
      {
        "id": "factorial",
        "lhs": "factorial(6)%7",
        "rhs": "6",
        "step": "S07"
      },
      {
        "id": "composite4",
        "lhs": "factorial(3)%4",
        "rhs": "2",
        "step": "S09"
      }
    ]
  },
  "presentation": {
    "md_scope": {
      "zh-Hant": "一般雙向教學論證加上模7全表與p=2分支；有限測試不替代證明。",
      "en": "A general two-direction teaching argument plus full modulo-7 data and the p=2 branch; finite tests do not replace proof."
    },
    "md_symbols": [
      [
        "d",
        "proper正因數",
        "proper positive divisor"
      ],
      [
        "p",
        "prime modulus",
        "prime modulus"
      ]
    ],
    "md_error_controls": [
      {
        "title": "全部配對 / Complete pairing",
        "zh": "全部非零類都需配對或列為self-inverse。",
        "en": "Every nonzero class must be paired or listed as self-inverse."
      },
      {
        "title": "雙向證明 / Both directions",
        "zh": "prime配對與composite proper-divisor矛盾分開，不由finite test推全稱。",
        "en": "Separate prime pairing from the composite proper-divisor contradiction, without universal inference from tests."
      }
    ],
    "md_open_items": []
  },
  "revision": {
    "id": "ocme-new142-reader-adoption-20261021",
    "collection": "coverage-20261021",
    "source_commit": "b1b2f1dcf8c50d67a93fe52d95f8eef7b3abba9f",
    "adopted_source_sha256": "21bca817d48683970a4a4d8b31d62b9415855aa678ab3aa40682b18bfd6d1cdb",
    "original_source_sha256": "a2d4d999d4312d01eaa71a10b634018e935b72665829e46b09f492efd7ebc702",
    "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": [
      "mko_definition"
    ],
    "independent_AI_concurrence": "SCOPED_LEAD_AND_BILINGUAL_CONTEXT_REVIEW",
    "issue_ids": [
      "BR142-S251"
    ],
    "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."
  }
}
