{
  "$schema": "../../../schemas/mko-v0.4.schema.json",
  "schema_version": "mko-v0.4",
  "id": "mko-trapezoidal-quadrature",
  "semantic_family_id": "sf-trapezoidal-quadrature",
  "type": "algorithm",
  "version": "0.10.0",
  "language": "zh-Hant",
  "titles": {
    "zh-Hant": "複合梯形數值積分"
  },
  "summary": {
    "zh-Hant": "在嚴格遞增partition上逐段以端點平均乘各自寬度，得到定積分的複合梯形近似。"
  },
  "statement": {
    "zh-Hant": "給定a=x_0<x_1<...<x_n=b及全部endpoint values y_i=f(x_i)，複合梯形值是sum_{i=1}^n (x_i-x_{i-1})(y_{i-1}+y_i)/2。本輪允許非均勻partition，逐段使用自己的寬度並以exact rationals計算；n個subintervals恰有n+1個nodes。Affine函數在任意合法partition上exact；二次多項式只做指定partition的exact reference integral與signed error I-T及absolute error，不外推一般二階誤差界或收斂階。sample table若未綁完整函數，只決定此quadrature sum，不決定一般積分。"
  },
  "formula": {
    "tex": "T(P,f)=q",
    "mathml": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mrow><mrow><mi>T</mi><mo>(</mo><mi>P</mi><mo>,</mo><mi>f</mi><mo>)</mo></mrow><mo>=</mo><mi>q</mi></mrow></math>",
    "semantic_ast": {
      "type": "equation",
      "lhs": {
        "type": "function_call",
        "callee": {
          "type": "symbol",
          "name": "T",
          "glyph": "T"
        },
        "arguments": [
          {
            "type": "symbol",
            "name": "P",
            "glyph": "P"
          },
          {
            "type": "symbol",
            "name": "f",
            "glyph": "f"
          }
        ]
      },
      "rhs": {
        "type": "symbol",
        "name": "q",
        "glyph": "q"
      }
    },
    "compiler": {
      "id": "ocme-formula-core",
      "version": "0.4.0",
      "source_sha256": "75c00746c66c9ae7681c06f07498a8b817157aea3cea646312b0f0c095362413"
    }
  },
  "assumptions": [
    {
      "id": "a1",
      "zh-Hant": "nodes與values等長且至少兩項；nodes為嚴格遞增exact rationals。"
    },
    {
      "id": "a2",
      "zh-Hant": "quadratic reference slice明示完整多項式，因此可獨立算exact definite integral。"
    },
    {
      "id": "a3",
      "zh-Hant": "signed error固定為exact integral減trapezoid value，absolute error另列。"
    }
  ],
  "symbols": [
    {
      "token": "T",
      "role": "composite_trapezoid_operator",
      "role_zh": "複合梯形算子",
      "scope": "representative_formula"
    },
    {
      "token": "P",
      "role": "strict_partition",
      "role_zh": "嚴格遞增partition",
      "scope": "representative_formula"
    },
    {
      "token": "f",
      "role": "integrand_or_endpoint_table",
      "role_zh": "被積函數或端點值表",
      "scope": "representative_formula"
    },
    {
      "token": "q",
      "role": "exact_quadrature_value",
      "role_zh": "精確quadrature值",
      "scope": "representative_formula"
    }
  ],
  "dependencies": [
    {
      "id": "mko-definite-integral",
      "title_zh": "有限區間上的多項式定積分",
      "reason_zh": "reference integral與orientation。"
    },
    {
      "id": "mko-numerical-approximation-error",
      "title_zh": "數值近似與誤差",
      "reason_zh": "signed及absolute error。"
    },
    {
      "id": "mko-arithmetic-operations",
      "title_zh": "算術運算",
      "reason_zh": "逐段端點平均。"
    },
    {
      "id": "mko-order-relation",
      "title_zh": "偏序與全序",
      "reason_zh": "partition嚴格遞增。"
    },
    {
      "id": "mko-sequence",
      "title_zh": "數列",
      "reason_zh": "nodes與values是對齊有序序列。"
    }
  ],
  "explanation": {
    "paragraphs_zh": [
      "partition資格與node/value arity先核。",
      "非均勻subinterval各自保留寬度，不偷換成單一h。",
      "affine exactness與指定quadratic誤差不構成一般誤差定理。"
    ],
    "common_misconception_zh": "把n個nodes叫n個subintervals、對非均勻partition硬套單一h，或從線性exact推所有函數exact。"
  },
  "proofs": [],
  "computational_companions": [],
  "verification": {
    "computational_status": "not_evaluated_no_computational_claim",
    "warning_zh": "未加入需要二階導數及supremum的通用誤差界，也不宣稱floating-point結果。",
    "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": "加入有明示smoothness與supremum bound的複合梯形誤差定理。"
  },
  "provenance": {
    "origin": "ocme_local_ai_materialization_candidate",
    "note_zh": "依 research/atlas-trapezoidal-quadrature.md 整理；2026-10-15 脈衝 R02（使用者手動接續 2026-11-19 工作序列；實際日期仍為 2026-10-15），英文及 Lean 依使用者指示延後。",
    "content_license": "CC-BY-SA-4.0",
    "code_license": "MIT",
    "created_at": "2026-10-15"
  }
}
