{
  "schema_version": "ocme-reviewed-question-reader-v1",
  "question_id": "q-20261014-advance-20261103-r07-modular-inverse-0011",
  "pilot_number": "P1000-0336",
  "number": 336,
  "family_id": "qf-mod34-modinv-existence",
  "title": {
    "zh-Hant": "第 336 題：模反元素",
    "en": "Question 336: A Modular Inverse Exists Exactly for a Unit"
  },
  "original_question": {
    "schema_version": "ocme-question-v0.1",
    "id": "q-20261014-advance-20261103-r07-modular-inverse-0011",
    "batch_id": "batch-20261014-advance-20261103-r07-modular-inverse-foundations",
    "language": "zh-Hant",
    "source_mko_ids": [
      "mko-modular-inverse"
    ],
    "title_zh": "模反元素",
    "stem_zh": "整數a與模數n大於等於2的exact Euclidean arithmetic。操作=modinv-existence；資料={\"a\":2,\"n\":37}。請依 [a,n,gcd,exists,inverse] 欄序回答。",
    "answer": {
      "kind": "expression",
      "value": "(2, 37, 1, 是, 19)",
      "explanation_zh": "Wave5第三層核對=(2, 37, 1, 是, 19)；依完整明示資料重算；存在等價gcd等於1且extended Euclid給Bezout證書；輸出normalized residue且唯一只在mod n；nonunit無inverse。"
    },
    "difficulty": {
      "band": "undergraduate_core",
      "level": 2,
      "skills": [
        "模反元素"
      ]
    },
    "variant": {
      "family_id": "qf-mod34-modinv-existence",
      "seed": 202611037011,
      "parameters": {
        "a": 2,
        "n": 37,
        "domain": "Exact_extended_Euclid_modular_inverse",
        "operation": "modinv-existence",
        "semantic_template": "qf-mod34-modinv-existence/{\"a\":2,\"n\":37}"
      }
    },
    "verification": {
      "status": "candidate",
      "checks": [
        "producer_exact_finite_or_symbolic_model",
        "producer_source_snapshot_check",
        "producer_substantive_template_deduplication",
        "producer_json_schema"
      ],
      "warning_zh": "候選須由主端獨立重算；不構成人工審定、sampled rank upper bound、infinite-domain uniformity、finite-prefix series proof、posterior/identifiability、graph connectivity、nonexhaustive maximum、Lean或形式Evidence。"
    },
    "provenance": {
      "generator_role": "question_producer",
      "generator_model": "model_unknown",
      "generated_at": "2026-10-14",
      "contract_version": "ocme-question-factory-v0.1"
    }
  },
  "original_english_edition": {
    "schema_version": "ocme-question-localization-v0.1",
    "question_id": "q-20261014-advance-20261103-r07-modular-inverse-0011",
    "batch_id": "batch-20261014-advance-20261103-r07-modular-inverse-foundations",
    "locale": "en",
    "translation_state": "ai_candidate",
    "source": {
      "question_sha256": "308abe01d2d62998bf26feccf5a465cbd7f80bb56950d8b5b0d48a989340877b",
      "family_id": "qf-mod34-modinv-existence",
      "seed": 202611037011,
      "semantic_template": "qf-mod34-modinv-existence/{\"a\":2,\"n\":37}"
    },
    "fields": {
      "title": "A Modular Inverse Exists Exactly for a Unit",
      "stem": "Use the original signed integer a=2 and modulus n=37≥2. Exact extended Euclid gives nonnegative g=gcd(a,n) and signed coefficients x,y satisfying a*x+n*y=g. An inverse exists exactly when g=1; normalize its representative to 0≤inverse<n. Uniqueness means one residue class modulo n, not a unique integer representative. This family excludes moduli 0 and 1 and does not use approximate division. Give (a,n,gcd,exists?,inverse), with inverse=null for a nonunit.",
      "answer": {
        "kind": "expression",
        "value": "(2, 37, 1, Yes, 19)",
        "explanation": "Compute the exact gcd first. A unit obtains its normalized inverse from the Bezout coefficient; a gcd greater than one excludes an inverse modulo n. The exact result, retaining the requested order, is (2, 37, 1, Yes, 19)."
      },
      "skills": [
        "A Modular Inverse Exists Exactly for a Unit"
      ],
      "verification_warning": "This is a candidate exercise. Mechanical recomputation checks only the stated conditions and this instance; it is neither a formal proof nor human review."
    }
  },
  "givens": [
    {
      "id": "G001",
      "text": {
        "zh-Hant": "整數a與模數n大於等於2的exact Euclidean arithmetic。操作=modinv-existence；資料={\"a\":2,\"n\":37}。請依 [a,n,gcd,exists,inverse] 欄序回答。",
        "en": "Use the original signed integer a=2 and modulus n=37≥2. Exact extended Euclid gives nonnegative g=gcd(a,n) and signed coefficients x,y satisfying a*x+n*y=g. An inverse exists exactly when g=1; normalize its representative to 0≤inverse<n. Uniqueness means one residue class modulo n, not a unique integer representative. This family excludes moduli 0 and 1 and does not use approximate division. Give (a,n,gcd,exists?,inverse), with inverse=null for a nonunit."
      }
    }
  ],
  "steps": [
    {
      "id": "S001",
      "uses": [
        "G001"
      ],
      "before": "a=2; n=37≥2",
      "after": "compute gcd and a Bezout certificate before inversion",
      "relation": "implies",
      "rule_id": "modular_domain",
      "conditions": [],
      "explanation": {
        "zh-Hant": "逆元存在性需要互質；先保留模數條件。",
        "en": "Invertibility requires coprimality, after qualifying the modulus."
      },
      "reverse_audit": {
        "kind": "premise_and_result_audit",
        "explanation": {
          "zh-Hant": "核對整數等式、餘數範圍與 gcd 條件，不把同餘當整數相等。",
          "en": "Check integer identities, remainder bounds and gcd conditions; congruence is not integer equality."
        }
      },
      "arithmetic": null
    },
    {
      "id": "S002",
      "uses": [
        "G001",
        "S001"
      ],
      "before": "divide 2 by 37",
      "after": "2=0·37+2",
      "relation": "implies",
      "rule_id": "euclidean_division",
      "conditions": [],
      "explanation": {
        "zh-Hant": "下一步改用除數與餘數，非零餘數嚴格下降。",
        "en": "Continue with divisor and remainder; nonzero remainders decrease strictly."
      },
      "reverse_audit": {
        "kind": "premise_and_result_audit",
        "explanation": {
          "zh-Hant": "核對整數等式、餘數範圍與 gcd 條件，不把同餘當整數相等。",
          "en": "Check integer identities, remainder bounds and gcd conditions; congruence is not integer equality."
        }
      },
      "arithmetic": {
        "operation": "euclidean_division",
        "inputs": [
          "2",
          "37",
          "0"
        ],
        "output": "2",
        "label": "remainder"
      }
    },
    {
      "id": "S003",
      "uses": [
        "G001",
        "S002"
      ],
      "before": "divide 37 by 2",
      "after": "37=18·2+1",
      "relation": "implies",
      "rule_id": "euclidean_division",
      "conditions": [],
      "explanation": {
        "zh-Hant": "下一步改用除數與餘數，非零餘數嚴格下降。",
        "en": "Continue with divisor and remainder; nonzero remainders decrease strictly."
      },
      "reverse_audit": {
        "kind": "premise_and_result_audit",
        "explanation": {
          "zh-Hant": "核對整數等式、餘數範圍與 gcd 條件，不把同餘當整數相等。",
          "en": "Check integer identities, remainder bounds and gcd conditions; congruence is not integer equality."
        }
      },
      "arithmetic": {
        "operation": "euclidean_division",
        "inputs": [
          "37",
          "2",
          "18"
        ],
        "output": "1",
        "label": "remainder"
      }
    },
    {
      "id": "S004",
      "uses": [
        "G001",
        "S003"
      ],
      "before": "divide 2 by 1",
      "after": "2=2·1+0",
      "relation": "implies",
      "rule_id": "euclidean_division",
      "conditions": [],
      "explanation": {
        "zh-Hant": "下一步改用除數與餘數，非零餘數嚴格下降。",
        "en": "Continue with divisor and remainder; nonzero remainders decrease strictly."
      },
      "reverse_audit": {
        "kind": "premise_and_result_audit",
        "explanation": {
          "zh-Hant": "核對整數等式、餘數範圍與 gcd 條件，不把同餘當整數相等。",
          "en": "Check integer identities, remainder bounds and gcd conditions; congruence is not integer equality."
        }
      },
      "arithmetic": {
        "operation": "euclidean_division",
        "inputs": [
          "2",
          "1",
          "2"
        ],
        "output": "0",
        "label": "remainder"
      }
    },
    {
      "id": "S005",
      "uses": [
        "G001",
        "S004"
      ],
      "before": "a·x := mul(2, -18)",
      "after": "a·x = -36",
      "relation": "calculation",
      "rule_id": "exact_rational_arithmetic",
      "conditions": [],
      "explanation": {
        "zh-Hant": "乘回原本帶符號的 a。",
        "en": "Multiply by the original signed a."
      },
      "reverse_audit": {
        "kind": "premise_and_result_audit",
        "explanation": {
          "zh-Hant": "以精確有理數重算 a·x，不以小數近似替代。",
          "en": "Recompute a·x with exact rational arithmetic, not rounded decimals."
        }
      },
      "arithmetic": {
        "operation": "mul",
        "inputs": [
          "2",
          "-18"
        ],
        "output": "-36",
        "label": "a·x"
      }
    },
    {
      "id": "S006",
      "uses": [
        "G001",
        "S005"
      ],
      "before": "n·y := mul(37, 1)",
      "after": "n·y = 37",
      "relation": "calculation",
      "rule_id": "exact_rational_arithmetic",
      "conditions": [],
      "explanation": {
        "zh-Hant": "同時保留模數係數。",
        "en": "Retain the modulus coefficient as well."
      },
      "reverse_audit": {
        "kind": "premise_and_result_audit",
        "explanation": {
          "zh-Hant": "以精確有理數重算 n·y，不以小數近似替代。",
          "en": "Recompute n·y with exact rational arithmetic, not rounded decimals."
        }
      },
      "arithmetic": {
        "operation": "mul",
        "inputs": [
          "37",
          "1"
        ],
        "output": "37",
        "label": "n·y"
      }
    },
    {
      "id": "S007",
      "uses": [
        "G001",
        "S006"
      ],
      "before": "Bezout value := sum(-36, 37)",
      "after": "Bezout value = 1",
      "relation": "calculation",
      "rule_id": "exact_rational_arithmetic",
      "conditions": [],
      "explanation": {
        "zh-Hant": "兩項相加應等於最後非零餘數 gcd。",
        "en": "The two terms must sum to the final nonzero remainder, the gcd."
      },
      "reverse_audit": {
        "kind": "premise_and_result_audit",
        "explanation": {
          "zh-Hant": "以精確有理數重算 Bezout value，不以小數近似替代。",
          "en": "Recompute Bezout value with exact rational arithmetic, not rounded decimals."
        }
      },
      "arithmetic": {
        "operation": "sum",
        "inputs": [
          "-36",
          "37"
        ],
        "output": "1",
        "label": "Bezout value"
      }
    },
    {
      "id": "S008",
      "uses": [
        "G001",
        "S007"
      ],
      "before": "2·(-18)+37·(1)=1",
      "after": "inverse representative=19; 2·19≡1 (mod 37)",
      "relation": "implies",
      "rule_id": "reduce_bezout",
      "conditions": [],
      "explanation": {
        "zh-Hant": "模 n 下模數項消失，a 的係數就是逆元類，再正規化到[0,n)。",
        "en": "Modulo n the modulus term vanishes; normalize the coefficient of a into[0,n)."
      },
      "reverse_audit": {
        "kind": "premise_and_result_audit",
        "explanation": {
          "zh-Hant": "核對整數等式、餘數範圍與 gcd 條件，不把同餘當整數相等。",
          "en": "Check integer identities, remainder bounds and gcd conditions; congruence is not integer equality."
        }
      },
      "arithmetic": null
    }
  ],
  "math_model": {
    "result": [
      2,
      37,
      1,
      true,
      19
    ]
  },
  "conclusion": {
    "canonical_value": "(2, 37, 1, 是, 19)",
    "explanation": {
      "zh-Hant": "上述完整代值與條件核對得到原題答案；欄位次序及真假標記保持原始合約。",
      "en": "The full substitutions and premise audits recover the original answer, retaining its field order and verdict meanings."
    }
  },
  "definition_note": {
    "zh-Hant": "整數 a、模數 n≥2；逆元存在恰當 gcd(a,n)=1，代表元正規化到 [0,n)。",
    "en": "Integer a and modulus n≥2. An inverse exists exactly when gcd(a,n)=1; normalize the representative into [0,n)."
  },
  "source": {
    "input_commit": "0f7be61e2c22317a4075561dc822c87d881a50db",
    "question_binding": {
      "batch_id": "batch-20261014-advance-20261103-r07-modular-inverse-foundations",
      "batch_path": "public/data/questions/batches/batch-20261014-advance-20261103-r07-modular-inverse-foundations/questions.jsonl",
      "batch_sha256": "6f8b1a188424712b3dea0297748d5fd301e16f3efee3dc899d1ddc19ef02403b",
      "original_line": 11,
      "original_line_sha256": "081f83ee31ee8aee460a056e1a30d23a0d8998fb384b90dc9ab2318ca36a88ae",
      "question_compact_sha256": "308abe01d2d62998bf26feccf5a465cbd7f80bb56950d8b5b0d48a989340877b",
      "english_manifest_path": "public/data/i18n/editions/batch-20261014-advance-20261103-r07-modular-inverse-foundations.en.json",
      "english_rows_path": "public/data/i18n/questions/batch-20261014-advance-20261103-r07-modular-inverse-foundations.en.jsonl",
      "english_row_compact_sha256": "9a82ee4417f4eae069185fb42c119a73d8b369cad2a3a4d78f2f6cd0a23c4a6a"
    },
    "mko_bindings": {
      "mko-modular-inverse": {
        "sha256": "d16e0773143022c00ff50dad2cd84ef53e2d8a9078f64c2d785413c676b002ab",
        "english_sha256": "6d3e8307627ef6fae92d80afb7cdf3347e4ca67f4f12e28c68a96a7465d52732",
        "original_path": "public/data/mko/modular-inverse.json",
        "english_path": "public/data/i18n/editions/mko-modular-inverse.en.json"
      }
    },
    "selected_manifest_sha256": "5233edba9654a6cffd8b6b2d83c932f82ded15f9c0b7c733bd049943e672acff",
    "selected_part_sha256": "afa7c0e9f7084cc5929124dcffe9929d5db7def32e40047056d19ea25535873e",
    "original_candidate_sha256": "4ecdbce087203d481af24765620ecb1ec2b176b83f0fddfbee8d1c8951ee9131",
    "original_candidate_line_sha256": "4ecdbce087203d481af24765620ecb1ec2b176b83f0fddfbee8d1c8951ee9131"
  },
  "historical_source_state": {
    "review_state": {
      "derivation": "candidate_authored_and_locally_checked",
      "source_question_state": "candidate",
      "independent_AI_or_human_review": "NOT_PERFORMED",
      "formalization": "not_formalized",
      "Lean": "NOT_RUN"
    },
    "scope_note": {
      "zh-Hant": "來源綁定的教學推導候選；精確算術及有限列舉不是獨立AI審查或一般形式化證明。原題、答案、MKO、公式、AST及歷史保持不變。",
      "en": "Source-bound pedagogical derivation candidate: exact arithmetic and finite enumeration are not independent AI review or general formal proof. Original questions, answers, MKOs, formulas, ASTs and history remain unchanged."
    },
    "label": "Frozen producer metadata; current per-question review is separate below."
  },
  "revision": {
    "id": "review-20261026-003-01",
    "review_date": "2026-10-26",
    "owner_authorized_reader_publication": true,
    "scope": "Thirty family prototypes and their mathematical/bilingual reasoning variants, stems, boundary statements and every distinct sentence shape were reviewed in a context independent of the producer; parameter substitutions, source bindings, full answer tuples, model results and every arithmetic step were independently reconstructed per question from the original parameters only, with negative controls. This grouped method does not claim a separate literal AI reading of every repeated sentence or an extra AI voter.",
    "review_receipts": {
      "semantic_review_sha256": "6c2c6d46aded7582a11ac41a8c0b3bdde2669a53bdb6e796eea2039994a02772",
      "question_first_witness_sha256": "77e43898df9efdbf8094ad81fe4ab91cf4b4bd82f481eb9b4699b73cb4da612b"
    },
    "status": "second_context_reviewed",
    "mathematical_semantics": true,
    "bilingual_semantics": true,
    "steps_reviewed": 8,
    "method": "family_template_semantic_review_plus_independent_per_instance_reconstruction",
    "exact_question_first_check": {
      "model_sha256": "3451c2931a9f0b7043e8b374b9f0ad7bc2bb5750e5fccf1ab640f2fd777fd704",
      "arithmetic_steps": 6
    },
    "uses_answer_as_premise": false,
    "human_review": "NOT_PERFORMED",
    "formalization": "not_formalized",
    "Lean": "NOT_RUN",
    "Canonical_truth_promotion": false,
    "authority": "Owner-authorized reviewed reader publication; original question/candidate states remain historical and unchanged."
  }
}
