{
  "$schema": "../../../schemas/mko-v0.4.schema.json",
  "schema_version": "mko-v0.4",
  "id": "mko-context-free-grammar",
  "semantic_family_id": "sf-context-free-grammar",
  "type": "definition",
  "version": "0.10.0",
  "language": "zh-Hant",
  "titles": {
    "zh-Hant": "上下文無關文法"
  },
  "summary": {
    "zh-Hant": "CFG由有限且不交的nonterminals、terminals、start與單一nonterminal左側的finite productions生成語言。"
  },
  "statement": {
    "zh-Hant": "rhs為terminal/nonterminal finite strings並明示epsilon convention。derivation是finite production sequence；language只含start導出的terminal-only words。空語言不等於含epsilon。witness證membership，但bounded search failure不證nonmembership，亦不自動推unambiguous、regular或PDA equivalence。"
  },
  "formula": {
    "tex": "G(N,T)",
    "mathml": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mrow><mi>G</mi><mo>(</mo><mi>N</mi><mo>,</mo><mi>T</mi><mo>)</mo></mrow></math>",
    "semantic_ast": {
      "type": "function_call",
      "callee": {
        "type": "symbol",
        "name": "G",
        "glyph": "G"
      },
      "arguments": [
        {
          "type": "symbol",
          "name": "N",
          "glyph": "N"
        },
        {
          "type": "symbol",
          "name": "T",
          "glyph": "T"
        }
      ]
    },
    "compiler": {
      "id": "ocme-formula-core",
      "version": "0.4.0",
      "source_sha256": "4353b36789292db5ab412df898289d8268f3f4243b775e0a4a2982928ee103f9"
    }
  },
  "assumptions": [
    {
      "id": "a1",
      "zh-Hant": "nonterminal與terminal alphabets finite、unique且disjoint。"
    },
    {
      "id": "a2",
      "zh-Hant": "每條production lhs恰一nonterminal，rhs symbols合法。"
    }
  ],
  "symbols": [
    {
      "token": "G",
      "role": "context_free_grammar",
      "role_zh": "上下文無關文法",
      "scope": "representative_formula"
    },
    {
      "token": "N",
      "role": "nonterminal_alphabet",
      "role_zh": "非終結符字母表",
      "scope": "representative_formula"
    },
    {
      "token": "T",
      "role": "terminal_alphabet",
      "role_zh": "終結符字母表",
      "scope": "representative_formula"
    }
  ],
  "dependencies": [
    {
      "id": "mko-computational-model",
      "title_zh": "計算模型",
      "reason_zh": "grammar execution model。"
    },
    {
      "id": "mko-set",
      "title_zh": "集合",
      "reason_zh": "alphabets與production set。"
    },
    {
      "id": "mko-sequence",
      "title_zh": "數列",
      "reason_zh": "finite strings與derivations。"
    }
  ],
  "explanation": {
    "paragraphs_zh": [
      "grammar qualification與derivation分開。",
      "terminal-only final word是membership witness。",
      "bounded failure不是nonmembership proof。"
    ],
    "common_misconception_zh": "有限深度找不到derivation便稱word不在language，或混同empty language與epsilon。"
  },
  "proofs": [],
  "computational_companions": [],
  "verification": {
    "computational_status": "not_evaluated_no_computational_claim",
    "warning_zh": "本輪不宣稱ambiguity、regularity或CFG-PDA equivalence。",
    "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": "加入pushdown automata與parsing。"
  },
  "provenance": {
    "origin": "ocme_local_ai_materialization_candidate",
    "note_zh": "依 research/atlas-context-free-grammar.md 整理；2026-10-14 脈衝 R07（使用者手動接續 2026-11-09 工作序列；實際日期仍為 2026-10-14），英文及 Lean 依使用者指示延後。",
    "content_license": "CC-BY-SA-4.0",
    "code_license": "MIT",
    "created_at": "2026-10-14"
  }
}
