{
  "$schema": "../../../schemas/mko-v0.4.schema.json",
  "schema_version": "mko-v0.4",
  "id": "mko-composition",
  "semantic_family_id": "sf-composition",
  "type": "definition",
  "version": "0.10.0",
  "language": "zh-Hant",
  "titles": {
    "zh-Hant": "函數合成"
  },
  "summary": {
    "zh-Hant": "合成 g∘f 先求 f 的輸出，再把它送入 g；合成前須確認中間值可作為 g 的輸入。"
  },
  "statement": {
    "zh-Hant": "若 f:A→B、g:B→C 為總函數，則 g∘f:A→C 由 (g∘f)(x)=g(f(x)) 定義。對不同定義域的表達式，合成允許的輸入為 {x∈dom(f):f(x)∈dom(g)}。"
  },
  "formula": {
    "tex": "g(f(x))",
    "mathml": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mrow><mi>g</mi><mo>(</mo><mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow><mo>)</mo></mrow></math>",
    "semantic_ast": {
      "type": "function_call",
      "callee": {
        "type": "symbol",
        "name": "g",
        "glyph": "g"
      },
      "arguments": [
        {
          "type": "function_call",
          "callee": {
            "type": "symbol",
            "name": "f",
            "glyph": "f"
          },
          "arguments": [
            {
              "type": "symbol",
              "name": "x",
              "glyph": "x"
            }
          ]
        }
      ]
    },
    "compiler": {
      "id": "ocme-formula-core",
      "version": "0.4.0",
      "source_sha256": "29f331a5e7dfc542466fe0ef4f2549c3853543352816af7d6ee21eb1ee287788"
    }
  },
  "assumptions": [
    {
      "id": "a1",
      "zh-Hant": "函数及其定義域、陪域已明示。"
    },
    {
      "id": "a2",
      "zh-Hant": "完整總函數合成的中間型別相容；受限合成只在明示允許集合上求值。"
    }
  ],
  "symbols": [
    {
      "token": "g",
      "role": "outer_function",
      "role_zh": "外層函數",
      "scope": "representative_formula"
    },
    {
      "token": "f",
      "role": "inner_function",
      "role_zh": "內層函數",
      "scope": "representative_formula"
    },
    {
      "token": "x",
      "role": "input",
      "role_zh": "輸入",
      "scope": "representative_formula"
    }
  ],
  "dependencies": [
    {
      "id": "mko-domain-codomain-range",
      "title_zh": "定義域、陪域與值域",
      "reason_zh": "合成需要檢查第一輸出與第二輸入的集合邊界。"
    }
  ],
  "explanation": {
    "paragraphs_zh": [
      "g(f(x)) 必須先完成 f(x)，再求 g；合成符號的書寫順序與實際求值順序相反。",
      "若中間值不屬於 g 的定義域，就不能在該輸入求合成。有限表格可明確列出允許的合成定義域。",
      "函數合成一般不交換，也不是函數值的乘法；任意改寫為 f(g(x)) 或 f(x)g(x) 都需要額外條件。"
    ],
    "common_misconception_zh": "把 g∘f 誤讀成先 g 後 f，或略過中間值的定義域檢查。"
  },
  "proofs": [],
  "computational_companions": [],
  "verification": {
    "computational_status": "not_evaluated_no_computational_claim",
    "warning_zh": "有限表格與指定線性表达式可精確重算；不構成全部函數等式或定義域法則的形式證明。",
    "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": "綁定 Function.comp 及集合限制上的合成定義域；另處理型別轉換條件。"
  },
  "provenance": {
    "origin": "ocme_local_ai_materialization_candidate",
    "note_zh": "依 research/atlas-composition.md 整理；2026-09-30 脈衝 R04，英文及 Lean 依使用者指示延後。",
    "content_license": "CC-BY-SA-4.0",
    "code_license": "MIT",
    "created_at": "2026-09-30"
  }
}
