Skip to content

coq(CorePhi): replace proofs that were never checked by a compiler - #3343

Open
gHashTag wants to merge 2 commits into
masterfrom
w119b2-corephi
Open

coq(CorePhi): replace proofs that were never checked by a compiler#3343
gHashTag wants to merge 2 commits into
masterfrom
w119b2-corephi

Conversation

@gHashTag

@gHashTag gHashTag commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Refs #3328 · stacked on #3342 (the all-files report), which this needs in order to read its own result

The reading

With #3324 and #3326 merged, coqc ran on these files for the first time. With
#3342's report, here is what it says:

=== Coq compile report: 0 of 13 compiled ===
  FAIL      CorePhi.v                  File "./CorePhi.v", line 14, characters 8-24:
  FAIL*     AlphaPhi.v                 File "./AlphaPhi.v", line 7, characters 0-23:
  FAIL*     FormulaEval.v              File "./FormulaEval.v", line 9, characters 0-23:
  ... all twelve fail at their Require Import line

Zero of thirteen. The twelve after CorePhi.v fail at their Require Import
line, so they are cascades — the real state of files 2–13 is still unknown, and
CorePhi.v is what gates it.

CorePhi.v is not one missing lemma

line what is there why it cannot work
4 Require Import Reals.Reals. only lra is used eleven times and Lra is never imported
14 apply Rmult_lt_pos_pos no such lemma — this is the error CI reported, and the least of them
32 field for phi^2 - phi - 1 = 0 sqrt 5 is opaque to field; an identity resting on √5·√5 = 5 is not one it can see
38 apply phi_quadratic; ring applies phi^2 - phi - 1 = 0 to goal phi^2 = phi + 1; apply unifies conclusions, and these do not. The same idiom appears five times (38, 44, 50, 57)
94 apply Rlt_lt_1 does not exist
97 apply sqrt_lt_cancel does not exist

The mathematics is all correct — φ² = φ+1, φ⁻² = 2−φ, φ⁵ = 5√5+8 are true. Essentially none of it is proved.

What this changes

Statements: none. Verified by diffing the sorted Lemma/Definition lines
against master — every original statement is byte-identical, nothing removed, so
no downstream file can break on a missing name.

Proofs: all of them, plus two helpers (sqrt5_sq, sqrt5_nonneg) carrying
the one fact ring and field cannot discover.

Honesty about verification

There is no Coq toolchain on this machine, and installing one would take several
GB on a disk sitting at 99%. These proofs are not verified locally. This PR
runs the workflow on itself (#3324 added the file to its own pull_request
paths), so its own run is the check — and thanks to #3342, a partial success is
still informative: the report names which files got further.

lab added 2 commits September 6, 2026 09:01
…rror

Refs #3328

`coqc ... || exit 1` thirteen times stops at the first failure. One CI run
therefore yields exactly one error, and finding out how many of the 13 files
compile costs one run per file at roughly four minutes each.

That was harmless while the job could not start at all. It became the binding
constraint the moment it could: this workflow had never got past `opam install`,
so coqc had never run on these proofs, and the first thing it said was that file
1 of 13 does not compile. The state of the other twelve was UNKNOWN -- not
passing -- and a stop-at-first-error loop cannot answer that question cheaply or
at all.

The step now attempts every file and prints a table with a count. Failures after
the first are tagged FAIL*, because these compile in dependency order and a
missing .vo cascades: only the first failure is certainly its own defect. The
full coqc output for each failing file goes into a collapsed `::group::` so the
table stays readable and nothing is lost.

Exit behaviour is unchanged -- any failure still fails the job.

Controls, run locally against a stub `coqc`:
  - stub fails on files 1 and 5  -> "11 of 13 compiled", FAIL on CorePhi.v,
                                     FAIL* on Bounds_Mixing.v, exit 1
  - stub passes everything       -> "All files compiled successfully!", exit 0
Checked with `sh -n` as well as `bash -n`: the container runs `sh -e {0}`, so a
bashism would have been a runtime failure and not a syntax error here.
Refs #3328

The first full reading, from the report added in the commit below: 0 of 13 files
compile. The twelve after CorePhi.v all fail at their `Require Import` line, so
they are cascades -- the real state of files 2-13 is still unknown, and
CorePhi.v is what gates it.

CorePhi.v is not one missing lemma. It has never been seen by coqc, and it
shows:

  - `lra` is used eleven times and `Lra` is never imported.
  - `apply Rmult_lt_pos_pos` (line 14) names a lemma that does not exist. This
    is the error the job reported, and it is the least of them.
  - `apply phi_quadratic; ring` (line 38) applies `phi^2 - phi - 1 = 0` to the
    goal `phi^2 = phi + 1`. `apply` unifies conclusions; these do not unify.
    The same idiom appears five times.
  - `Rlt_lt_1` (line 94) and `sqrt_lt_cancel` (line 97) do not exist.
  - `field` (line 32) cannot prove `phi^2 - phi - 1 = 0`: `sqrt 5` is an opaque
    constant to it, so an identity resting on sqrt 5 * sqrt 5 = 5 is not an
    identity it can see.

Every STATEMENT is true and every statement is kept byte-identical -- verified
by diffing the sorted `Lemma`/`Definition` lines against master. Only the proofs
change. Two helper lemmas are added, `sqrt5_sq` and `sqrt5_nonneg`, carrying the
one fact `ring` and `field` cannot discover. Nothing is removed, so no
downstream file can break on a missing name.

Unverified locally: there is no Coq toolchain on this machine and installing one
would take several GB on a disk that is at 99%. This PR runs the workflow on
itself (#3324 added the file to its own `pull_request` paths), so its own run is
the check. If a proof still fails, the report now names which files got further,
which is the reading that was missing.
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-06 02:19:22 UTC

Summary

Status Count
Total Open PRs 16
PRs with Failing Checks 9
PRs with All Checks Green 7
READY 6
FAILING 9
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=ca169bfed429 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

This was referenced Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant