{
  "$schema": "../../../schemas/mko-v0.4.schema.json",
  "schema_version": "mko-v0.4",
  "id": "mko-euler-criterion-quadratic-residue",
  "semantic_family_id": "sf-euler-criterion-quadratic-residue",
  "type": "theorem",
  "version": "0.10.0",
  "language": "zh-Hant",
  "titles": {
    "zh-Hant": "Euler二次剩餘判準"
  },
  "summary": {
    "zh-Hant": "若p為奇質數且p不整除a，則a^((p-1)/2)模p等於Legendre符號(a/p)的模p代表。"
  },
  "statement": {
    "zh-Hant": "domain先要求odd prime p及a mod p非零。Legendre值必須由完整nonzero square table獨立重算；modular exponent以repeated squaring獨立計算，再把p-1解讀為-1。residue case輸出+1，nonresidue輸出-1。完整有限square table只核指定p與a，不能取代全體奇質數上的一般定理證明。p=2、composite modulus與a≡0 mod p不屬本定理domain；不得反過來用Euler criterion定義Legendre symbol，composite modulus也無此一般converse。"
  },
  "formula": {
    "tex": "P(a,p)=L(a,p)",
    "mathml": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mrow><mrow><mi>P</mi><mo>(</mo><mi>a</mi><mo>,</mo><mi>p</mi><mo>)</mo></mrow><mo>=</mo><mrow><mi>L</mi><mo>(</mo><mi>a</mi><mo>,</mo><mi>p</mi><mo>)</mo></mrow></mrow></math>",
    "semantic_ast": {
      "type": "equation",
      "lhs": {
        "type": "function_call",
        "callee": {
          "type": "symbol",
          "name": "P",
          "glyph": "P"
        },
        "arguments": [
          {
            "type": "symbol",
            "name": "a",
            "glyph": "a"
          },
          {
            "type": "symbol",
            "name": "p",
            "glyph": "p"
          }
        ]
      },
      "rhs": {
        "type": "function_call",
        "callee": {
          "type": "symbol",
          "name": "L",
          "glyph": "L"
        },
        "arguments": [
          {
            "type": "symbol",
            "name": "a",
            "glyph": "a"
          },
          {
            "type": "symbol",
            "name": "p",
            "glyph": "p"
          }
        ]
      }
    },
    "compiler": {
      "id": "ocme-formula-core",
      "version": "0.4.0",
      "source_sha256": "4a34fb4d586836cd35d299a27211fb09a38e9ba3c66e722ad0284103052674d9"
    }
  },
  "assumptions": [
    {
      "id": "a1",
      "zh-Hant": "p為bounded odd prime；a為safe integer並先normalize。"
    },
    {
      "id": "a2",
      "zh-Hant": "square-table與powmod使用兩條獨立計算路徑。"
    }
  ],
  "symbols": [
    {
      "token": "P",
      "role": "half_exponent_residue",
      "role_zh": "半指數冪剩餘",
      "scope": "representative_formula"
    },
    {
      "token": "a",
      "role": "integer_argument",
      "role_zh": "整數參數",
      "scope": "representative_formula"
    },
    {
      "token": "p",
      "role": "odd_prime_modulus",
      "role_zh": "奇質數模數",
      "scope": "representative_formula"
    },
    {
      "token": "L",
      "role": "legendre_symbol",
      "role_zh": "Legendre符號",
      "scope": "representative_formula"
    }
  ],
  "dependencies": [
    {
      "id": "mko-euler-theorem-number-theory",
      "title_zh": "Euler定理",
      "reason_zh": "非零mod-p群中的冪關係。"
    },
    {
      "id": "mko-quadratic-residue",
      "title_zh": "二次剩餘",
      "reason_zh": "square classification。"
    },
    {
      "id": "mko-legendre-symbol",
      "title_zh": "Legendre符號",
      "reason_zh": "三值編碼。"
    }
  ],
  "explanation": {
    "paragraphs_zh": [
      "domain qualification先於公式。",
      "square-table與half exponent比對避免循環定義。",
      "zero、even與composite boundaries分離。"
    ],
    "common_misconception_zh": "把zero class套成+1、對composite modulus照搬判準，或用判準自身定義Legendre。"
  },
  "proofs": [],
  "computational_companions": [],
  "verification": {
    "computational_status": "not_evaluated_no_computational_claim",
    "warning_zh": "本輪不物化Jacobi symbol、quadratic reciprocity或一般合數平方根判定。",
    "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": "加入二次互反律與Jacobi符號。"
  },
  "provenance": {
    "origin": "ocme_local_ai_materialization_candidate",
    "note_zh": "依 research/atlas-euler-criterion-quadratic-residue.md 整理；2026-10-15 脈衝 R04（使用者手動接續 2026-11-13 工作序列；實際日期仍為 2026-10-15），英文及 Lean 依使用者指示延後。",
    "content_license": "CC-BY-SA-4.0",
    "code_license": "MIT",
    "created_at": "2026-10-15"
  }
}
