tests: unknown outcome and stale-bundle rejection; never commit generated caches
- e2e: goals outside the fixed strategy -> unknown; prose-only source edit makes an exported bundle stale (certificate.stale, exit 1) - fixtures/unknown.mq.md - remove accidentally tracked examples/.marqdo cache and ignore **/.marqdo/
This commit is contained in:
1 parent
bd7e46b208
commit
a4964154a6
15 files changed
+63
-357085
No files matched your search
+2
-2
@@ -10,8 +10,8 @@
|
||||
lean/.lake/
|
||||
lean/scratch/
|
||||
|
||||
# Generated Marqdo cache directories are per-user artifacts.
|
||||
/.marqdo/
|
||||
# Generated Marqdo cache directories are per-user artifacts; never commit them.
|
||||
**/.marqdo/
|
||||
|
||||
# Backend scratch/build state generated at runtime
|
||||
lean/.marqdo-gen/
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
-72
@@ -1,72 +0,0 @@
|
||||
{
|
||||
"schema": "marqdo.proof",
|
||||
"schema_version": 1,
|
||||
"tool": {
|
||||
"name": "marqdo-prove",
|
||||
"version": "0.1.0"
|
||||
},
|
||||
"target": {
|
||||
"unit_id": "root:default::algebra.mq.md#基础代数/整数平方非负性",
|
||||
"unit_path": [
|
||||
"基础代数",
|
||||
"整数平方非负性"
|
||||
],
|
||||
"locator": "algebra.mq.md",
|
||||
"scope": "mathematical",
|
||||
"outcome": "verified",
|
||||
"statement_literal": "\\forall x\\in\\mathbb{Z},\\quad x^2\\geq 0\n",
|
||||
"statement_normalized": "∀ x : ℤ, x^2 ≥ 0",
|
||||
"statement_lean": "∀ mqx0 : Int, ((mqx0 ^ (2 : Nat)) ≥ (0 : Int))",
|
||||
"goal_span": {
|
||||
"start": 88,
|
||||
"end": 132
|
||||
},
|
||||
"goal_payload_span": {
|
||||
"start": 91,
|
||||
"end": 130
|
||||
},
|
||||
"goal_digest": "08340b3ea68d6027d14ea100cd1c66a60ec79b51427d69eb041d1b5297c66b5e",
|
||||
"premises": [],
|
||||
"theorem_name": "marqdoTarget_56304010d2fd7740d17a",
|
||||
"expected_name": "marqdoExpected_56304010d2fd7740d17a",
|
||||
"model_definitions": []
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"locator": "algebra.mq.md",
|
||||
"module_id": "root:default::algebra.mq.md",
|
||||
"source_digest": "ed9a14ef1e695605743cffac56066dbf8cb13200c0a0537084f2c65157195b22",
|
||||
"analysis_digest": "1a1b1a237a43368284ccc39d01e46ec2789d5ed878b897241c8d402ae541e2f9"
|
||||
}
|
||||
],
|
||||
"environment": {
|
||||
"lean_toolchain": "leanprover/lean4:v4.36.0",
|
||||
"lean_version": "86_64",
|
||||
"mathlib_rev": "fc4f59e577feb1a4956671bc04ac18aaaf8cd842",
|
||||
"lake_manifest_digest": "bb82472009ad8aba44b75c1a1095dfe290dd87319421d55039e02fe57f2e0022",
|
||||
"replay_verifier_digest": "02cbc2c8b00dbdac2c5bcf359b25a62f896372b9964f7578caca4d4346d544c1",
|
||||
"con_leche_version": "con-leche-a6380d68b4fb3641",
|
||||
"formula_compiler": "marqdo-prove-0.1.0",
|
||||
"semantic_mapping": "marqdo-int-exact-v1",
|
||||
"environment_id": "9622d44bfc5540616117b8e4b60b3e06a84122535d4495925739a08acc14877a"
|
||||
},
|
||||
"declared_dependencies": [],
|
||||
"used_dependencies": [],
|
||||
"transitive_dependencies": [
|
||||
"algebra.mq.md#基础代数/整数平方非负性"
|
||||
],
|
||||
"axioms": [
|
||||
"Classical.choice",
|
||||
"Quot.sound",
|
||||
"propext"
|
||||
],
|
||||
"proof": {
|
||||
"file": "proof.ndjson",
|
||||
"bytes": 3713445,
|
||||
"sha256": "264138ec6f095b4162b1ea2691f86ad0d06c70ac20b056352f99885b21226db1",
|
||||
"export_format": "lean4export-3.1.0",
|
||||
"target_decl": "marqdoTarget_56304010d2fd7740d17a",
|
||||
"expected_decl": "marqdoExpected_56304010d2fd7740d17a"
|
||||
},
|
||||
"cache_key": "00ff63bc5e80b023b3714d2f85c892de6be99831aa8a0baec9f852b2371a9bbf"
|
||||
}
|
||||
-69917
File diff suppressed because it is too large.
Load diff
-73
@@ -1,73 +0,0 @@
|
||||
{
|
||||
"schema": "marqdo.proof",
|
||||
"schema_version": 1,
|
||||
"tool": {
|
||||
"name": "marqdo-prove",
|
||||
"version": "0.1.0"
|
||||
},
|
||||
"target": {
|
||||
"unit_id": "root:default::algebra.mq.md#基础代数/非负整数加法",
|
||||
"unit_path": [
|
||||
"基础代数",
|
||||
"非负整数加法"
|
||||
],
|
||||
"locator": "algebra.mq.md",
|
||||
"scope": "mathematical",
|
||||
"outcome": "verified",
|
||||
"statement_literal": "\\forall a,b\\in\\mathbb{Z},\\quad (a\\geq0\\land b\\geq0)\\Rightarrow a+b\\geq0\n",
|
||||
"statement_normalized": "∀ a b : ℤ, (a ≥ 0 ∧ b ≥ 0) → a + b ≥ 0",
|
||||
"statement_lean": "∀ mqx0 mqx1 : Int, (((mqx0 ≥ (0 : Int)) ∧ (mqx1 ≥ (0 : Int))) → ((mqx0 + mqx1) ≥ (0 : Int)))",
|
||||
"goal_span": {
|
||||
"start": 227,
|
||||
"end": 304
|
||||
},
|
||||
"goal_payload_span": {
|
||||
"start": 230,
|
||||
"end": 302
|
||||
},
|
||||
"goal_digest": "05b19fe479e9065a6e45ea3a5cb50315cdd05ec88d9951d998ef8435f57d3624",
|
||||
"premises": [
|
||||
"a ≥ 0 ∧ b ≥ 0"
|
||||
],
|
||||
"theorem_name": "marqdoTarget_36d89cf628e282b50d0b",
|
||||
"expected_name": "marqdoExpected_36d89cf628e282b50d0b",
|
||||
"model_definitions": []
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"locator": "algebra.mq.md",
|
||||
"module_id": "root:default::algebra.mq.md",
|
||||
"source_digest": "ed9a14ef1e695605743cffac56066dbf8cb13200c0a0537084f2c65157195b22",
|
||||
"analysis_digest": "1a1b1a237a43368284ccc39d01e46ec2789d5ed878b897241c8d402ae541e2f9"
|
||||
}
|
||||
],
|
||||
"environment": {
|
||||
"lean_toolchain": "leanprover/lean4:v4.36.0",
|
||||
"lean_version": "86_64",
|
||||
"mathlib_rev": "fc4f59e577feb1a4956671bc04ac18aaaf8cd842",
|
||||
"lake_manifest_digest": "bb82472009ad8aba44b75c1a1095dfe290dd87319421d55039e02fe57f2e0022",
|
||||
"replay_verifier_digest": "02cbc2c8b00dbdac2c5bcf359b25a62f896372b9964f7578caca4d4346d544c1",
|
||||
"con_leche_version": "con-leche-a6380d68b4fb3641",
|
||||
"formula_compiler": "marqdo-prove-0.1.0",
|
||||
"semantic_mapping": "marqdo-int-exact-v1",
|
||||
"environment_id": "9622d44bfc5540616117b8e4b60b3e06a84122535d4495925739a08acc14877a"
|
||||
},
|
||||
"declared_dependencies": [],
|
||||
"used_dependencies": [],
|
||||
"transitive_dependencies": [
|
||||
"algebra.mq.md#基础代数/非负整数加法"
|
||||
],
|
||||
"axioms": [
|
||||
"Quot.sound",
|
||||
"propext"
|
||||
],
|
||||
"proof": {
|
||||
"file": "proof.ndjson",
|
||||
"bytes": 4204971,
|
||||
"sha256": "22ed9b0ed6615b248f1fd9ae63ae1e3279614d8f17799f662f8859c6329da6e6",
|
||||
"export_format": "lean4export-3.1.0",
|
||||
"target_decl": "marqdoTarget_36d89cf628e282b50d0b",
|
||||
"expected_decl": "marqdoExpected_36d89cf628e282b50d0b"
|
||||
},
|
||||
"cache_key": "98189b31742bf1201623dcd95a43c58c2e4fcf8f4b4c0c5a941fc0b1840b0d3e"
|
||||
}
|
||||
-82691
File diff suppressed because it is too large.
Load diff
-106
@@ -1,106 +0,0 @@
|
||||
{
|
||||
"schema": "marqdo.proof",
|
||||
"schema_version": 1,
|
||||
"tool": {
|
||||
"name": "marqdo-prove",
|
||||
"version": "0.1.0"
|
||||
},
|
||||
"target": {
|
||||
"unit_id": "root:default::arithmetic.mq.md#整数计算/平方函数的非负性",
|
||||
"unit_path": [
|
||||
"整数计算",
|
||||
"平方函数的非负性"
|
||||
],
|
||||
"locator": "arithmetic.mq.md",
|
||||
"scope": "program_model",
|
||||
"outcome": "verified",
|
||||
"statement_literal": "\\forall x\\in\\mathbb{Z},\\quad \\operatorname{square}(x)\\geq0\n",
|
||||
"statement_normalized": "∀ x : ℤ, square(x) ≥ 0",
|
||||
"statement_lean": "∀ mqx0 : Int, ((marqdoModel_bc89da8a98c85c898736 mqx0) ≥ (0 : Int))",
|
||||
"goal_span": {
|
||||
"start": 204,
|
||||
"end": 268
|
||||
},
|
||||
"goal_payload_span": {
|
||||
"start": 207,
|
||||
"end": 266
|
||||
},
|
||||
"goal_digest": "9bf39b6885fd6cdee71b36412c8afb7645a9e621d4e5a4261e4e6886437d8b92",
|
||||
"premises": [],
|
||||
"theorem_name": "marqdoTarget_9f61c8e6f82c16133237",
|
||||
"expected_name": "marqdoExpected_9f61c8e6f82c16133237",
|
||||
"model_definitions": [
|
||||
{
|
||||
"unit_id": "root:default::arithmetic.mq.md#整数计算/square",
|
||||
"locator": "arithmetic.mq.md",
|
||||
"function_id": "root:default::arithmetic.mq.md::整数计算.square",
|
||||
"lean_name": "marqdoModel_bc89da8a98c85c898736",
|
||||
"digest": "e03f9f60e3eb7d6b9b08f2140c12b732ff73541caa6fc8d6940498b9aaa5d217",
|
||||
"module_name": "MarqdoProof.Generated.Model_bc89da8a98c85c898736",
|
||||
"semantics": "exact integer single-frame straight-line model returning Int; not a runtime refinement"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"locator": "algebra.mq.md",
|
||||
"module_id": "root:default::algebra.mq.md",
|
||||
"source_digest": "ed9a14ef1e695605743cffac56066dbf8cb13200c0a0537084f2c65157195b22",
|
||||
"analysis_digest": "1a1b1a237a43368284ccc39d01e46ec2789d5ed878b897241c8d402ae541e2f9"
|
||||
},
|
||||
{
|
||||
"locator": "arithmetic.mq.md",
|
||||
"module_id": "root:default::arithmetic.mq.md",
|
||||
"source_digest": "61b9751ac9ce790a8534fd3d3d045dfe676648c1cfecd8c9d3aefbe32f56dcde",
|
||||
"analysis_digest": "95250c02e98a693974ecc7b6f588f3dce416d209747528fe2e041930396461f2"
|
||||
}
|
||||
],
|
||||
"environment": {
|
||||
"lean_toolchain": "leanprover/lean4:v4.36.0",
|
||||
"lean_version": "86_64",
|
||||
"mathlib_rev": "fc4f59e577feb1a4956671bc04ac18aaaf8cd842",
|
||||
"lake_manifest_digest": "bb82472009ad8aba44b75c1a1095dfe290dd87319421d55039e02fe57f2e0022",
|
||||
"replay_verifier_digest": "02cbc2c8b00dbdac2c5bcf359b25a62f896372b9964f7578caca4d4346d544c1",
|
||||
"con_leche_version": "con-leche-a6380d68b4fb3641",
|
||||
"formula_compiler": "marqdo-prove-0.1.0",
|
||||
"semantic_mapping": "marqdo-int-exact-v1",
|
||||
"environment_id": "9622d44bfc5540616117b8e4b60b3e06a84122535d4495925739a08acc14877a"
|
||||
},
|
||||
"declared_dependencies": [
|
||||
{
|
||||
"kind": "model",
|
||||
"locator": "arithmetic.mq.md#root:default::arithmetic.mq.md#整数计算/square",
|
||||
"unit_id": "root:default::arithmetic.mq.md#整数计算/square",
|
||||
"link_text": "square",
|
||||
"binding": "bc89da8a98c85c898736"
|
||||
},
|
||||
{
|
||||
"kind": "theorem",
|
||||
"locator": "algebra.mq.md#基础代数/整数平方非负性",
|
||||
"unit_id": "root:default::algebra.mq.md#基础代数/整数平方非负性",
|
||||
"link_text": "整数平方非负性",
|
||||
"binding": "marqdoTarget_56304010d2fd7740d17a"
|
||||
}
|
||||
],
|
||||
"used_dependencies": [
|
||||
"arithmetic.mq.md#整数计算/square"
|
||||
],
|
||||
"transitive_dependencies": [
|
||||
"arithmetic.mq.md#整数计算/square",
|
||||
"arithmetic.mq.md#整数计算/平方函数的非负性"
|
||||
],
|
||||
"axioms": [
|
||||
"Classical.choice",
|
||||
"Quot.sound",
|
||||
"propext"
|
||||
],
|
||||
"proof": {
|
||||
"file": "proof.ndjson",
|
||||
"bytes": 4568438,
|
||||
"sha256": "4e0be0c12a56f11a58efcf069123a71497ca72e5a44ddb2d4a3df462e6e677be",
|
||||
"export_format": "lean4export-3.1.0",
|
||||
"target_decl": "marqdoTarget_9f61c8e6f82c16133237",
|
||||
"expected_decl": "marqdoExpected_9f61c8e6f82c16133237"
|
||||
},
|
||||
"cache_key": "ace6c0fcfe559a6f67c3f0b8b98a0ae71d58860893addf6df1fb2ee55bcface8"
|
||||
}
|
||||
-86736
File diff suppressed because it is too large.
Load diff
-98
@@ -1,98 +0,0 @@
|
||||
{
|
||||
"schema": "marqdo.proof",
|
||||
"schema_version": 1,
|
||||
"tool": {
|
||||
"name": "marqdo-prove",
|
||||
"version": "0.1.0"
|
||||
},
|
||||
"target": {
|
||||
"unit_id": "root:default::vector.mq.md#向量数学/平方和非负性",
|
||||
"unit_path": [
|
||||
"向量数学",
|
||||
"平方和非负性"
|
||||
],
|
||||
"locator": "vector.mq.md",
|
||||
"scope": "mathematical",
|
||||
"outcome": "verified",
|
||||
"statement_literal": "\\forall x,y\\in\\mathbb{Z},\\quad x^2+y^2\\geq0\n",
|
||||
"statement_normalized": "∀ x y : ℤ, x^2 + y^2 ≥ 0",
|
||||
"statement_lean": "∀ mqx0 mqx1 : Int, (((mqx0 ^ (2 : Nat)) + (mqx1 ^ (2 : Nat))) ≥ (0 : Int))",
|
||||
"goal_span": {
|
||||
"start": 94,
|
||||
"end": 143
|
||||
},
|
||||
"goal_payload_span": {
|
||||
"start": 97,
|
||||
"end": 141
|
||||
},
|
||||
"goal_digest": "96995d5fb7d68d092e5a349a774f73a65a6384b37a30a15cfc128183067dab8a",
|
||||
"premises": [],
|
||||
"theorem_name": "marqdoTarget_97424ed21bb12c19f758",
|
||||
"expected_name": "marqdoExpected_97424ed21bb12c19f758",
|
||||
"model_definitions": []
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"locator": "algebra.mq.md",
|
||||
"module_id": "root:default::algebra.mq.md",
|
||||
"source_digest": "ed9a14ef1e695605743cffac56066dbf8cb13200c0a0537084f2c65157195b22",
|
||||
"analysis_digest": "1a1b1a237a43368284ccc39d01e46ec2789d5ed878b897241c8d402ae541e2f9"
|
||||
},
|
||||
{
|
||||
"locator": "vector.mq.md",
|
||||
"module_id": "root:default::vector.mq.md",
|
||||
"source_digest": "ddb7f3bdc9c3914c89fc4d0f9c686f8552473cdc576a1992941f3e9850dbb5bb",
|
||||
"analysis_digest": "d1fabe313dbcb35065c969538aa7e2aba8339ea5ad03632c80197fd976a50908"
|
||||
}
|
||||
],
|
||||
"environment": {
|
||||
"lean_toolchain": "leanprover/lean4:v4.36.0",
|
||||
"lean_version": "86_64",
|
||||
"mathlib_rev": "fc4f59e577feb1a4956671bc04ac18aaaf8cd842",
|
||||
"lake_manifest_digest": "bb82472009ad8aba44b75c1a1095dfe290dd87319421d55039e02fe57f2e0022",
|
||||
"replay_verifier_digest": "02cbc2c8b00dbdac2c5bcf359b25a62f896372b9964f7578caca4d4346d544c1",
|
||||
"con_leche_version": "con-leche-a6380d68b4fb3641",
|
||||
"formula_compiler": "marqdo-prove-0.1.0",
|
||||
"semantic_mapping": "marqdo-int-exact-v1",
|
||||
"environment_id": "9622d44bfc5540616117b8e4b60b3e06a84122535d4495925739a08acc14877a"
|
||||
},
|
||||
"declared_dependencies": [
|
||||
{
|
||||
"kind": "theorem",
|
||||
"locator": "algebra.mq.md#基础代数/整数平方非负性",
|
||||
"unit_id": "root:default::algebra.mq.md#基础代数/整数平方非负性",
|
||||
"link_text": "整数平方非负性",
|
||||
"binding": "marqdoTarget_56304010d2fd7740d17a"
|
||||
},
|
||||
{
|
||||
"kind": "theorem",
|
||||
"locator": "algebra.mq.md#基础代数/非负整数加法",
|
||||
"unit_id": "root:default::algebra.mq.md#基础代数/非负整数加法",
|
||||
"link_text": "非负整数加法",
|
||||
"binding": "marqdoTarget_36d89cf628e282b50d0b"
|
||||
}
|
||||
],
|
||||
"used_dependencies": [
|
||||
"algebra.mq.md#基础代数/整数平方非负性",
|
||||
"algebra.mq.md#基础代数/非负整数加法"
|
||||
],
|
||||
"transitive_dependencies": [
|
||||
"algebra.mq.md#基础代数/整数平方非负性",
|
||||
"algebra.mq.md#基础代数/非负整数加法",
|
||||
"vector.mq.md#向量数学/平方和非负性"
|
||||
],
|
||||
"axioms": [
|
||||
"Classical.choice",
|
||||
"Quot.sound",
|
||||
"propext"
|
||||
],
|
||||
"proof": {
|
||||
"file": "proof.ndjson",
|
||||
"bytes": 6086904,
|
||||
"sha256": "ac888cea3eabf926f26324bc01c55c87c5d335d361db19e249e62a33d177fd6a",
|
||||
"export_format": "lean4export-3.1.0",
|
||||
"target_decl": "marqdoTarget_97424ed21bb12c19f758",
|
||||
"expected_decl": "marqdoExpected_97424ed21bb12c19f758"
|
||||
},
|
||||
"cache_key": "de68611d32ac1916e1a810796a176c366a59db621cb7b563dabfc6329d04312a"
|
||||
}
|
||||
-117390
File diff suppressed because it is too large.
Load diff
@@ -212,3 +212,55 @@ fn tampered_payload_is_rejected() {
|
||||
serde_json::from_str(String::from_utf8_lossy(&output.stdout).trim()).expect("json");
|
||||
assert_eq!(report["status"], "failure", "{report}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn goals_outside_the_fixed_strategy_report_unknown() {
|
||||
let (code, report) = check(&repo().join("tests/fixtures/unknown.mq.md"), &[]);
|
||||
assert_eq!(code, 1, "{report}");
|
||||
assert_eq!(report["targets"][0]["outcome"], "unknown", "{report}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn stale_bundle_is_rejected_after_a_source_change() {
|
||||
let directory = work("stale");
|
||||
let project = directory.join("project");
|
||||
std::fs::create_dir_all(&project).expect("project dir");
|
||||
for file in ["algebra.mq.md", "vector.mq.md"] {
|
||||
std::fs::copy(repo().join("examples").join(file), project.join(file)).expect("copy fixture");
|
||||
}
|
||||
let entry = project.join("vector.mq.md");
|
||||
let bundle = directory.join("bundle");
|
||||
let (code, report) = check(&entry, &["--out", bundle.to_str().expect("utf8")]);
|
||||
assert_eq!(code, 0, "{report}");
|
||||
// A prose-only edit still changes the bound source bytes; the old bundle
|
||||
// must not report `current`.
|
||||
let algebra = std::fs::read_to_string(project.join("algebra.mq.md")).expect("read");
|
||||
std::fs::write(
|
||||
project.join("algebra.mq.md"),
|
||||
algebra.replace("任意整数的平方均非负。", "任意整数的平方均非负(解释性修改)。"),
|
||||
)
|
||||
.expect("edit");
|
||||
let output = Command::new(env!("CARGO_BIN_EXE_marqdo-prove"))
|
||||
.args([
|
||||
"replay",
|
||||
entry.to_str().expect("utf8"),
|
||||
bundle.to_str().expect("utf8"),
|
||||
"--json",
|
||||
])
|
||||
.env("MARQDO_BIN", marqdo().expect("MARQDO_BIN"))
|
||||
.env("MARQDO_PROVE_LEAN_ROOT", repo().join("lean"))
|
||||
.output()
|
||||
.expect("run replay");
|
||||
assert_eq!(output.status.code(), Some(1), "{}", String::from_utf8_lossy(&output.stderr));
|
||||
let report: Value =
|
||||
serde_json::from_str(String::from_utf8_lossy(&output.stdout).trim()).expect("json");
|
||||
let diagnostics = report["diagnostics"].as_array().expect("diagnostics");
|
||||
assert!(
|
||||
diagnostics
|
||||
.iter()
|
||||
.any(|diagnostic| diagnostic["code"] == "certificate.stale"),
|
||||
"{report}"
|
||||
);
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
# 未知
|
||||
|
||||
## @knowledge 平方和大于两倍乘积
|
||||
|
||||
$$
|
||||
\forall a,b\in\mathbb{Z},\quad a^2+b^2\geq 2\cdot a\cdot b
|
||||
$$
|
||||
|
||||
### 证明依赖
|
||||
Reference in new issue
Block a user