From 3d9fa0da96f3abdafe9998d8eadeb0a689be87ab Mon Sep 17 00:00:00 2001 From: cflmy Date: Wed, 18 Nov 2026 10:03:32 +0800 Subject: [PATCH] =?UTF-8?q?docs(public):=20=E6=96=B0=E5=A2=9E=2023-prove?= =?UTF-8?q?=20=E7=89=B9=E6=80=A7=E9=A1=B5=E2=80=94=E2=80=94=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=87=AA=E8=BA=AB=E5=AE=9A=E7=90=86=E8=A1=A8=E7=BB=8F?= =?UTF-8?q?=20Lean=20=E5=85=A8=20proved?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 英文特性页(public/features/23-prove.mq.md):六段管线/状态阶梯/ 反例见证/单调性护栏/可证片段边界,示例即页面内的台账.记一笔; - import result 模块使 result.ok 内联(轨迹语义与定理匹配:大额必经复核 + 大额单次外呼 + 必有回执); - 实测 marqdo prove 23-prove.mq.md → status proved,3 定理全部 decided_by=lean;公开文档重建后 23-prove 页面入站。 --- public/features/23-prove.mq.md | 61 ++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 public/features/23-prove.mq.md diff --git a/public/features/23-prove.mq.md b/public/features/23-prove.mq.md new file mode 100644 index 0000000..58e0137 --- /dev/null +++ b/public/features/23-prove.mq.md @@ -0,0 +1,61 @@ +--- +markup: occlusion +import: + result: ../../lib/result.mq.md +title: Prove what a page claims: theorem tables judged by Lean 4 +description: v2.8.0 marqdo prove compiles theorem tables to Lean 4 and judges them. Offline symbolic execution works without a toolchain and never outruns Lean. +--- + +# main + +| 返回 | 类型 | 说明 | +|---|---|---| +| result | any | None; execute this page's documented steps in order and observe their output or stated effects | + +v2.8.0 adds one command: `marqdo prove`. A theorem table in a knowledge file is compiled to Lean 4 and judged automatically. The claim stops being prose that a reader agrees with and becomes a statement a proof assistant checks. + +```text +marqdo prove examples/approval.mq.md --json +``` + +The pipeline has six stages: load, lower to an intermediate representation, type the claim, generate a Lean module, judge it, and issue a certificate. Judging has two layers. Offline symbolic execution runs first — path enumeration over the pure fragment, milliseconds, no toolchain required. When a Lean toolchain is available it re-checks the emitted module and upgrades the verdict. + +The status ladder is honest by construction: `proved > checked > unverified > rejected > unproved > error`. Offline `checked` is a decided trace for the explored paths, never a proof; `proved` exists only when Lean says so. Without a toolchain the verdict stays at `checked` or `unverified` and the process exits zero — advisory, not silent. `--require-lean` flips unjudged states into failures for CI. + +A false theorem does not get a shrug. The judge produces a counterexample witness — concrete input values that walk the function down a path where the conclusion fails — and points back at the theorem-table row. + +The boundary that makes this trustworthy is monotonicity: whatever the offline layer claims, Lean must be able to confirm. If the offline verdict says checked and Lean cannot prove it, or a counterexample is proven away, the command fails with `proof.divergence` and exits non-zero. A judger defect fails loudly; a green light is never defended. + +The fragment is deliberately small: pure functions, branch comparisons, call-trace shapes, constructor structure, interval restatements. Loops report `proof.foreach_pending` instead of pretending. Cross-module calls stay opaque until assumption tables arrive. Every simplification is recorded in the design docs, because a proof system that hides its boundaries is marketing, not verification. + +This page runs — the theorems below live in the same file that explains them. `轨迹` is the implicit call trace of the function: the big-amount path must pass through 复核, opaque calls append to it, and inlined `result.ok` constructors do not. + +# 台账 + +## 记一笔 ++ `金额` + +| 参数 | 类型 | 说明 | +|---|---|---| +| 金额 | int | 记账金额(元) | + +| 定理 | 结论 | 前提 | 策略 | +|---|---|---|---| +| 大额必经复核 | 包含(轨迹, "复核") | 金额 > 10000 | auto | +| 大额单次外呼 | 长度(轨迹) = 1 | 金额 > 10000 | auto | +| 必有回执 | 结果.ok = True | | auto | + +1. 当`金额`小于等于10000时 + **回执 = [直接记账](result.ok(value="记"))** +2. * + **复核结论 = [转复核](复核(金额=`金额`))** + **回执 = [采纳](result.ok(value=`复核结论`))** + +*回执* + +## 复核 ++ `金额` + +**复核回执 = [复核通过](result.ok(value="复核"))** + +*复核回执*