{
  "$schema": "../../../schemas/mko-v0.4.schema.json",
  "schema_version": "mko-v0.4",
  "id": "mko-regular-expression",
  "semantic_family_id": "sf-regular-expression",
  "type": "definition",
  "version": "0.10.0",
  "language": "zh-Hant",
  "titles": {
    "zh-Hant": "正規表示式"
  },
  "summary": {
    "zh-Hant": "正規表示式由empty language、epsilon、alphabet symbols、union、concatenation與Kleene star遞迴建構語言。"
  },
  "statement": {
    "zh-Hant": "typed AST只允許empty-language、epsilon、alphabet symbol、union、ordered concatenation與star；每個symbol須屬明示alphabet。語義遞迴定義language，star的bounded enumeration以fixed-point closure處理epsilon cycle並extensional dedup。word membership必須完整決定，不因某個不足的bound沒列出就判false。Union canonicalize permutation/idempotence，concatenation保留次序。empty language與{epsilon}、regex與shell wildcard分開；長度≤N語言相同不證全語言等價。"
  },
  "formula": {
    "tex": "R(A,w)=b",
    "mathml": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mrow><mrow><mi>R</mi><mo>(</mo><mi>A</mi><mo>,</mo><mi>w</mi><mo>)</mo></mrow><mo>=</mo><mi>b</mi></mrow></math>",
    "semantic_ast": {
      "type": "equation",
      "lhs": {
        "type": "function_call",
        "callee": {
          "type": "symbol",
          "name": "R",
          "glyph": "R"
        },
        "arguments": [
          {
            "type": "symbol",
            "name": "A",
            "glyph": "A"
          },
          {
            "type": "symbol",
            "name": "w",
            "glyph": "w"
          }
        ]
      },
      "rhs": {
        "type": "symbol",
        "name": "b",
        "glyph": "b"
      }
    },
    "compiler": {
      "id": "ocme-formula-core",
      "version": "0.4.0",
      "source_sha256": "a8a9dd20af1f64b91af7ea7b04376731a385602976b7efcd0735c1915e8579fe"
    }
  },
  "assumptions": [
    {
      "id": "a1",
      "zh-Hant": "alphabet finite unique，word是alphabet symbols的有限序列。"
    },
    {
      "id": "a2",
      "zh-Hant": "AST node types與arity完整驗證。"
    },
    {
      "id": "a3",
      "zh-Hant": "bounded language只標示長度≤N，不冒充unbounded equivalence。"
    }
  ],
  "symbols": [
    {
      "token": "R",
      "role": "regular_expression_semantics",
      "role_zh": "正規表示式語義算子",
      "scope": "representative_formula"
    },
    {
      "token": "A",
      "role": "finite_alphabet",
      "role_zh": "有限alphabet",
      "scope": "representative_formula"
    },
    {
      "token": "w",
      "role": "finite_word",
      "role_zh": "有限word",
      "scope": "representative_formula"
    },
    {
      "token": "b",
      "role": "membership_boolean",
      "role_zh": "成員布林值",
      "scope": "representative_formula"
    }
  ],
  "dependencies": [
    {
      "id": "mko-regular-language",
      "title_zh": "正規語言",
      "reason_zh": "語義codomain。"
    },
    {
      "id": "mko-set",
      "title_zh": "集合",
      "reason_zh": "language union。"
    },
    {
      "id": "mko-sequence",
      "title_zh": "數列",
      "reason_zh": "word與concatenation。"
    },
    {
      "id": "mko-mathematical-induction",
      "title_zh": "數學歸納法",
      "reason_zh": "AST與star語義遞迴。"
    }
  ],
  "explanation": {
    "paragraphs_zh": [
      "typed AST與alphabet資格先行。",
      "bounded star closure處理epsilon與去重。",
      "membership completeness和bounded-equivalence邊界分開。"
    ],
    "common_misconception_zh": "把empty language當epsilon、把shell wildcard當Kleene star，或以有限bound宣稱regex等價。"
  },
  "proofs": [],
  "computational_companions": [],
  "verification": {
    "computational_status": "not_evaluated_no_computational_claim",
    "warning_zh": "bounded enumeration只證指定長度切片。",
    "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": "加入regex-to-NFA construction與equivalence decision。"
  },
  "provenance": {
    "origin": "ocme_local_ai_materialization_candidate",
    "note_zh": "依 research/atlas-regular-expression.md 整理；2026-10-15 脈衝 R06（使用者手動接續 2026-11-18 工作序列；實際日期仍為 2026-10-15），英文及 Lean 依使用者指示延後。",
    "content_license": "CC-BY-SA-4.0",
    "code_license": "MIT",
    "created_at": "2026-10-15"
  }
}
