Skip to content

fix(repl): the refusal names imported modules instead of denying a cause - #299

Merged
the-homeless-god merged 5 commits into
devfrom
a/7080-exact-fractions-run
Oct 4, 2026
Merged

the-homeless-god merged 5 commits into
devfrom
a/7080-exact-fractions-run

Conversation

@the-homeless-god

Copy link
Copy Markdown
Member

Что было не так

Счёт вердикта идёт по замыканию, а поимённая ведомость — по входному
файлу
. На программе, которая ввозит модуль с открытой сеткой, первый счёт
говорил «сетка 2», второй давал ноль пунктов, и последняя строка отказа
объявляла: «ни одного пункта: утверждения доказаны все, и отказ идёт не от
них». Это ложь, и она била почти на любой ввозящей программе — сетка есть у
21 файла библиотеки из 23.

Замер пробы на точных дробях (двоичный 0.7.24):

что спросили ответ
run «не доказано: утверждений 22: доказано 20, сетка 2»
ведомость входного файла пунктов 0
check flang/stdlib/bignum.flang --proof утверждений 9, доказано 7, сетка 2

Оба открытых пункта лежали в flang/stdlib/bignum.flang, который приезжает
через Rationals.

Что сделано

Ветка «список пуст» в unproven_detail больше не отрицает причину: она
обходит источники ведомости и называет ввезённые модули, а дальше одной
командой предлагает спросить каждый поимённо.

не доказано: утверждений 22: доказано 20, сетка 2, на веру 0 — запуск только по явному согласию: --trust
недоказанное — поимённо, словами отчёта о доказательствах:
  в этом файле пунктов нет; недоказанное пришло из ввезённых модулей:
    flang/stdlib/rationals.flang
    flang/stdlib/bignum.flang
  спросить поимённо: flang check <модуль> --proof

Если ни пунктов, ни ввезённых модулей нет — говорится именно это, а не «всё
доказано».

Чисел по модулю здесь нет, и это измерено, а не вкус. Первый вариант
правки спрашивал ведомость о каждом модуле и печатал bignum.flang: утверждений 9, доказано 7, сетка 2 — отказ рос с 19,8 с до 38,3 с, то есть
вдвое. Платить вдвое на каждом отказе за то, что человек спросит одной
командой, нельзя. Числа ушли в новую задачу 2400: там они стоят одного
прохода ведомости, а не второго.

Три контроля на собранном двоичном

контроль что ответил прогон
проба с ввозом называет оба модуля, код 3, 19,70 / 19,80 / 19,83 с (до правки 19,8 с)
программа со своим недоказанным утверждением прежний поимённый список: «1. постусловие «итог чётен» функции «Вдвое» — сетка 1 значение», код 3
доказанная программа «доказано: утверждений 1», 42, код 0, ни одной лишней строки

Чего в ветке нет

Правка живёт в рантайме (flang/src/emit/c/**), поэтому до двоичного она
доезжает быстрым пересевом семени, а не перепечаткой на 2,5 часа.
Отпечаток снят на чистом дереве и называет коммит: --telo и --bystro
зелены, 55 входов, 7 файлов, 44 464 329 байт.

Три числа описи дерева подняты вслед за 48 новыми строками C в каждом из
близнецов flang_repl.c — иначе краснеют prose-numbers-guard и
tree-inventory, и они честно покраснели на первом заходе.

Задача 7080 — статус «сделана с оговоркой». Отдельной строкой в ней записано
то, что стоит помнить: задача 2411 «отказ за недоказанное называет
утверждения» числится done и закрыта честно для того, что умела — называть
утверждения входного файла. Щель была в том, что счёт вердикта шёл по
замыканию. Закрытая задача не значит закрытой щели.

The refusal of `run` on a program with exact fractions counts the whole closure
and explains it from the entry file alone, so its last line says the opposite of
the truth: "all statements are proved and the refusal does not come from them".

Measured with the 0.7.24 binary. `run` on the probe: code 3, "22 statements, 20
proved, 2 on the grid". The probe's own report: claims 0, obligations 2, both
discharged. bignum.flang, which arrives through Rationals: 9 statements, 7
proved, 2 on the grid, 18 obligations. So both grid statements live in the
imported module, not in the probe.

The mechanism, by name: unproven_list in flang/src/emit/c/flang_repl.c looks for
the top-level arrays claims, laws and assumed and returns 0 silently when the
key is absent; it is fed by the ledger of compiler.flang:1070, which is built
from "only what belongs to the file" and "obligations of the entry file". One
count walks the closure, the other one file -- and the last line of the refusal
will lie on every program importing a module with a grid, which is 21 of the 23
files of the library.
The verdict counts the closure, the ledger counts the input file. On a
program that imports a module with open goals the first count said
"grid 2" and the second said zero items, so the last line of the refusal
claimed every claim was proved and the refusal came from somewhere else.
Measured on the exact-fractions probe: run said 22 claims, 20 proved,
grid 2; the input file ledger said 0 items; both open goals sat in
flang/stdlib/bignum.flang, which arrives through Rationals. 21 of 23
library files carry open goals, so the old line lied on nearly every
importing program.

Now that branch walks the sources of the ledger and prints the imported
paths, with one command to ask each of them by name. Only paths, no
per-module numbers: a second question to the ledger per module doubled
the refusal from 19.8 s to 38.3 s on the same probe, so the numbers moved
to task 2400, where one pass of the ledger pays for them.

Three controls on the built binary: the probe names both modules at
19.70/19.80/19.83 s; a program with its own unproved claim still gets the
old by-name list and code 3; a proved program prints 42 with code 0 and
not one extra line.

Runtime source, so the seed carries it by seed:refresh, not a reprint.
Taken on a dirty tree the fingerprint writes "tree edited by hand" and
--bystro is red by design: it is unknown what the seed was printed from.
Re-taken on the clean tree it names 86040ef, and both --telo and
--bystro are green: 55 inputs, 7 files, 44464329 bytes.
The patch adds 48 lines to each twin of flang_repl.c, so three marks in
docs/tree-inventory.md went stale and the gate caught all three: C total
882220 -> 882316, bootstrap 830152 -> 830200, print runtimes 52183 ->
52231. The task also needed an executor named: the ledger refuses a
status that is not "free" with no one behind it.
Moving the branch onto the current trunk changed the sha of the commit
the seed was printed from, not its content. The instrument says so
itself and offers the repair: --perekommit re-finds the commit by the
print inputs, file for file. 86040ef -> ffd09f2, and --bystro is
green with 55 inputs, 7 files, 44464329 bytes.
@the-homeless-god
the-homeless-god force-pushed the a/7080-exact-fractions-run branch from 150f314 to b8523ee Compare October 4, 2026 14:55
@the-homeless-god
the-homeless-god merged commit cc4ed28 into dev Oct 4, 2026
32 checks passed
@the-homeless-god
the-homeless-god deleted the a/7080-exact-fractions-run branch October 4, 2026 15:46
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