{
  "$schema": "../../../schemas/mko-v0.4.schema.json",
  "schema_version": "mko-v0.4",
  "id": "mko-quadratic-residue",
  "semantic_family_id": "sf-quadratic-residue",
  "type": "definition",
  "version": "0.10.0",
  "language": "zh-Hant",
  "titles": {
    "zh-Hant": "二次剩餘"
  },
  "summary": {
    "zh-Hant": "本節點採odd prime p上的nonzero convention：a mod p非零且等於某個nonzero square時為quadratic residue。"
  },
  "statement": {
    "zh-Hant": "a先normalize至0,...,p-1；zero class另列，不稱nonzero quadratic residue。對odd prime p，每個nonzero residue有兩個distinct opposite roots x與-x。p=2、composite modulus及zero不得靜默混入；本節點不預先使用Euler criterion或Legendre symbol。"
  },
  "formula": {
    "tex": "Q(a,p)",
    "mathml": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mrow><mi>Q</mi><mo>(</mo><mi>a</mi><mo>,</mo><mi>p</mi><mo>)</mo></mrow></math>",
    "semantic_ast": {
      "type": "function_call",
      "callee": {
        "type": "symbol",
        "name": "Q",
        "glyph": "Q"
      },
      "arguments": [
        {
          "type": "symbol",
          "name": "a",
          "glyph": "a"
        },
        {
          "type": "symbol",
          "name": "p",
          "glyph": "p"
        }
      ]
    },
    "compiler": {
      "id": "ocme-formula-core",
      "version": "0.4.0",
      "source_sha256": "f6460436328ef8ed8f50336a0ebe96b1803d674ab42bffb2b05cdf9875032aee"
    }
  },
  "assumptions": [
    {
      "id": "a1",
      "zh-Hant": "positive families完整枚舉x=1,...,p-1 squares。"
    },
    {
      "id": "a2",
      "zh-Hant": "p為bounded odd prime，a為safe integer。"
    }
  ],
  "symbols": [
    {
      "token": "Q",
      "role": "quadratic_residue_predicate",
      "role_zh": "二次剩餘述詞",
      "scope": "representative_formula"
    },
    {
      "token": "a",
      "role": "normalized_residue_candidate",
      "role_zh": "剩餘類候選",
      "scope": "representative_formula"
    },
    {
      "token": "p",
      "role": "odd_prime_modulus",
      "role_zh": "奇質數模數",
      "scope": "representative_formula"
    }
  ],
  "dependencies": [
    {
      "id": "mko-modular-congruence",
      "title_zh": "模同餘",
      "reason_zh": "square congruence。"
    },
    {
      "id": "mko-prime-number",
      "title_zh": "自然數質數",
      "reason_zh": "odd prime domain。"
    },
    {
      "id": "mko-power-root",
      "title_zh": "冪與根式",
      "reason_zh": "square operation。"
    }
  ],
  "explanation": {
    "paragraphs_zh": [
      "complete nonzero square table決定membership。",
      "roots成x與-x pair。",
      "zero/even/composite boundaries分開。"
    ],
    "common_misconception_zh": "把0算入nonzero residues，或在composite modulus照搬two-root結論。"
  },
  "proofs": [],
  "computational_companions": [],
  "verification": {
    "computational_status": "not_evaluated_no_computational_claim",
    "warning_zh": "Euler criterion與Legendre symbol留待後續節點。",
    "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": "加入Legendre symbol。"
  },
  "provenance": {
    "origin": "ocme_local_ai_materialization_candidate",
    "note_zh": "依 research/atlas-quadratic-residue.md 整理；2026-10-14 脈衝 R06（使用者手動接續 2026-11-11 工作序列；實際日期仍為 2026-10-14），英文及 Lean 依使用者指示延後。",
    "content_license": "CC-BY-SA-4.0",
    "code_license": "MIT",
    "created_at": "2026-10-14"
  }
}
