Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/idris2-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
- 'src/**'
- 'tests/**'
- 'scripts/test-totality-regressions.sh'
- 'scripts/census-idris-proof-claims.sh'
- 'scripts/test-idris-proof-census.sh'
- 'proven.ipkg'
- 'tests.ipkg'
- 'scripts/test-critical-remediation.sh'
Expand All @@ -22,6 +24,8 @@ on:
- 'src/**'
- 'tests/**'
- 'scripts/test-totality-regressions.sh'
- 'scripts/census-idris-proof-claims.sh'
- 'scripts/test-idris-proof-census.sh'
- 'proven.ipkg'
- 'tests.ipkg'
- 'scripts/test-critical-remediation.sh'
Expand Down Expand Up @@ -67,6 +71,19 @@ jobs:
make install
- name: Add Idris 2 to PATH
run: echo "$HOME/.idris2/bin" >> $GITHUB_PATH
- name: Generate source-anchored proof claim census (not proof evidence)
run: |
set -euo pipefail
bash scripts/test-idris-proof-census.sh
bash scripts/census-idris-proof-claims.sh src build/proof-census/src.tsv
bash scripts/census-idris-proof-claims.sh tests/properties build/proof-census/tests.tsv
- name: Preserve proof claim census
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: idris-proof-claim-census
path: build/proof-census/
if-no-files-found: error
- name: Check totality repairs against actual source
run: bash scripts/test-totality-regressions.sh
- name: Preserve totality regression evidence
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: MPL-2.0
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0
hooks:
- id: check-merge-conflict
args: [--assume-in-merge]
92 changes: 92 additions & 0 deletions docs/reports/audit/proven-proof-census-2026-11-23.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
= Proven proof-claim census: first source-anchored G0 snapshot (2026-11-23)

Status: *observed lexical census; not theorem verification or proof-grade authority*.

== Source and method

* Source repository: +hyperpolymath/proven+, main baseline +8f131687df3e83dbb8ff94c99739af64a8381ce0+.
* GitHub Actions PR merge checkout: +f012a6e2f6077c0cbd86d12f3c113db59309c063+ (source commit printed inside both TSV reports; PR changes scripts and CI, not +src/+).
* Workflow: https://github.com/hyperpolymath/proven/actions/runs/45156158115[Idris 2 CI run 45156158115].
* Evidence artifact: +idris-proof-claim-census+, artifact 14808447516, uploaded 2026-11-23 at 10:26 UTC.
* Generator: +scripts/census-idris-proof-claims.sh+; the workflow step and artifact upload both completed successfully.
* Population: all +*.idr+ files under +src/+ (386 files) and +tests/properties/+ (31 files). No Rust, Zig, apps or binding source is included in these two figures.
* Method: source-line lexical classification. A label is never converted into a theorem status. The process records file, line and source excerpt; it is *not* an Idris2 parser or a kernel verification of the claimed proposition.

== Observed counts

[cols="2,1,1,3",options="header"]
|===
|Class |+src/+ |+tests/properties/+ |Meaning and limits
|+CLAIMED_DISCHARGED+
|51
|0
|Exact +||| DISCHARGED:+ annotations, across 16 source files; *not* 51 verified theorems
|+CLAIMED_OWED+
|236
|68
|Exact +||| OWED:+ annotations in each population; not all the outstanding work
|+CLAIMED_OWED_AXIOM+
|0
|0
|No exact +||| OWED-AXIOM:+ prefix; an ordinary OWED may still describe an external assumption
|+ERASED_SIGNATURE_CANDIDATE+
|268
|0
|Erased +0 name :+ syntax; it may be a deliberate forward signature or have a proof body, so it is *not* a 268-item bodyless-proof count
|+DEFAULT_COVERING+
|4
|0
|Lexically active +%default covering+ directives
|+ASSERT_SMALLER_ACTIVE+
|2
|0
|Lexically active +assert_smaller+ candidates
|+ASSERT_TOTAL_ACTIVE+
|0
|0
|No active token detected within this lexical scope
|+BELIEVE_ME_ACTIVE+ / +IDRIS_CRASH_ACTIVE+
|0 / 0
|0 / 0
|No active token detected within this lexical scope; independent negative controls in proposed #242
|+ASSUMPTION_ANNOTATION+
|1
|0
|Doc annotation occurrence, not a full trusted-base assumptions audit
|+HOLE_LEXICAL_CANDIDATE+
|0
|0
|No corresponding lexical pattern detected; not an AST-based no-hole proof
|===

The May issue #211's count of 67 +DISCHARGED+ claims and the current count of 51 *cannot be compared as equivalent populations without a line-by-line reconciliation*: source revisions and matching semantics differ. Do not claim that 16 were proved or resolved.

== Proof-companion inclusion in the package gate

The complete repository tree at +8f131687+ contains 93 +src/Proven/**/Proofs.idr+ companion files. +proven.ipkg+ declares 29 of them (307 package module paths overall). The dedicated +proof-check+ job explicitly checks just the proof companions named in that package; its own comment describes the other 64 as deliberately excluded because of build- or environment-blocked and work-in-progress status. This is an *intentional support boundary*, not evidence that its green job missed a module it promised to check.

The 51 claimed-discharge annotations in the current census split into:

* *24 annotations* across 7 source files whose companion proof modules are listed in +proven.ipkg+.
* *27 annotations* across 9 source files whose companion proof modules are **not** in +proven.ipkg+.

These figures identify a verification-coverage question, not 27 false claims. There may be separate checks; the next pass must locate their exact run receipts or mark them not independently checked. In particular, do *not* add the 64 excluded modules wholesale to the package to manufacture CI coverage; first address their build prerequisites and define the supported release envelope.

Largest source annotation concentrations:
- +SafeJson/Proofs.idr+: 13 +CLAIMED_DISCHARGED+ (in package).
- +SafeCron/Proofs.idr+: 10 +CLAIMED_DISCHARGED+ (outside package).
- +SafeCapability/Proofs.idr+: 5 +CLAIMED_DISCHARGED+ (outside package).
- +SafeRegex/Proofs.idr+: 23 +CLAIMED_OWED+ (in package).
- +SafePath/Proofs.idr+: 23 +CLAIMED_OWED+ (in package).
- +SafePassword/Proofs.idr+ and +SafeBase64/Proofs.idr+: 22 +CLAIMED_OWED+ each (in package).

== G0 follow-up order

. Connect every +CLAIMED_DISCHARGED+ annotation to a specific declaration and proof body; check whether the module is in a supported build target and retrieve the exact checker receipt. Until then, mark its evidence +unknown+.
. Crosswalk the historical 67-claim issue #211 and the 51 annotation current inventory by path, declaration and commit. Only explicitly reconciled claims may be closed.
. Classify all 64 excluded proof companions into unsupported/WIP, externally checked, or candidate-to-promote, with dependencies and blockers. No implicit promotion.
. Use the 236 source OWED and 68 property-test OWED annotations as *starting queues*, not as an aggregate "percent complete". Record proofs, implementation contracts, source identity, toolchain pin and assumptions in the established policy forms.
. Preserve the TSV outputs as CI evidence. Never publish a derived Proof Witness Grade for Idris engineering claims, and never send these rows to Mathesis as verified theorems.

Related: https://github.com/hyperpolymath/proven/issues/211[issue #211]; https://github.com/hyperpolymath/proven/issues/119[issue #119]; https://github.com/hyperpolymath/proven/pull/241[mathematical completion UltraPlan].
117 changes: 117 additions & 0 deletions scripts/census-idris-proof-claims.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MPL-2.0
# Inventory source annotations and lexical proof-risk candidates; NOT proof results.
# Usage: bash scripts/census-idris-proof-claims.sh [src-directory] [report.tsv]
set -euo pipefail
root=${1:-src}
output=${2:-build/proof-census/idris-source.tsv}
[[ -d "$root" ]] || { echo "ERROR: missing source directory: $root" >&2; exit 2; }
mapfile -d '' -t sources < <(find "$root" -type f -name '*.idr' -print0 | LC_ALL=C sort -z)
(( ${#sources[@]} > 0 )) || { echo "ERROR: empty Idris source population" >&2; exit 2; }
commit=$(git rev-parse HEAD 2>/dev/null || printf 'unknown')
mkdir -p "$(dirname "$output")"
{
printf '# proven-idris-proof-claims-v1\n'
printf '# commit\t%s\n' "$commit"
printf '# root\t%s\n' "$root"
printf '# files\t%s\n' "${#sources[@]}"
printf '# NOTE: lexical evidence only; claimed DISCHARGED is never proof evidence\n'
printf 'kind\tfile\tline\ttext\n'
} > "$output"
for file in "${sources[@]}"; do
[[ "$file" != *$'\n'* && "$file" != *$'\t'* ]] || { echo 'ERROR: unsupported filename for TSV report' >&2; exit 2; }
awk -v file="$file" '

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve backslashes when passing filenames to awk

When an Idris filename contains a literal awk escape such as \t, the preceding filename guard accepts it, but awk -v file="$file" decodes the escape. A successful scan of a file named evil\tname.idr therefore writes an extra tab into the file field and shifts the remaining TSV columns, corrupting the machine-readable artifact; pass the path without awk assignment escape processing or reject backslashes explicitly.

Useful? React with 👍 / 👎.

function emit(kind, line, x) {
x = line
gsub(/\t/, " ", x)
sub(/\r$/, "", x)
printf "%s\t%s\t%d\t%s\n", kind, file, FNR, substr(x, 1, 220)
}
# Strings and interpolation expressions alternate on a stack that survives newlines.
function code_of(line, i, pair, ch, out, delim, esc, rest, hashes, quotes) {
out = ""
if (!depth && !closing[level] && line ~ /^[[:space:]]*\|\|\|/) return ""
for (i = 1; i <= length(line); i++) {
pair = substr(line, i, 2)
ch = substr(line, i, 1)
if (depth > 0) {
if (pair == "{-") { depth++; i++; continue }
if (pair == "-}") { depth--; i++; continue }
continue
}
if (closing[level]) {
delim = closing[level]
esc = escape_prefix[level]
if (substr(line, i, length(delim)) == delim) {
i += length(delim) - 1
delete closing[level]
delete escape_prefix[level]
level--
out = out " "
} else if (substr(line, i, length(esc)) == esc) {
i += length(esc)
if (substr(line, i, 1) == "{") {
braces[++level] = 1
out = out " "
}
}
continue
}
if (pair == "--") break
if (pair == "{-") { depth++; i++; out = out " "; continue }
if (level && ch == "{") braces[level]++
if (level && ch == "}" && --braces[level] == 0) {
delete braces[level]
level--
out = out " "
continue
}
# A prime attached to an identifier is not a character literal opener.
if (ch == "\047" && (i == 1 || substr(line, i - 1, 1) !~ /[[:alnum:]_\047]/) &&
match(substr(line, i), /^\047([^\047\\]|\\(x[[:xdigit:]]+|o[0-7]+|[0-9]+|[A-Z]{2,3}|.))\047/)) {
i += RLENGTH - 1
out = out " "
continue
}
if ((ch == "\"" || ch == "#") && match(substr(line, i), /^#*"/)) {
hashes = substr(line, i, RLENGTH - 1)
rest = substr(line, i + length(hashes))
quotes = (rest ~ /^"""[[:space:]]*$/) ? "\"\"\"" : "\""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recognize inline triple-quoted string delimiters

When a valid triple-quoted string opens and closes on one line, this condition treats it as a sequence of ordinary quoted strings because it recognizes """ only when the rest of the opening line is whitespace. Consequently, content containing embedded quotes can be scanned as code—for example, json = """{"name":"believe_me"}""" emits a false BELIEVE_ME_ACTIVE row. Fresh evidence beyond the earlier multiline-state issue is the valid inline form already present in benchmarks/SafeJsonBench.idr:16, which the multiline fixture does not cover.

Useful? React with 👍 / 👎.

closing[++level] = quotes hashes
escape_prefix[level] = "\\" hashes
i += length(hashes quotes) - 1
out = out " "
continue
}
out = out ch
}
return out
}
{
# Annotations count only where a line starts in active code: not inside a
# block comment or a string literal carried over from an earlier line.
annotated = (depth == 0 && level == 0)
if (annotated && $0 ~ /^[[:space:]]*\|\|\|[[:space:]]*DISCHARGED[[:space:]]*:/) emit("CLAIMED_DISCHARGED", $0)
if (annotated && $0 ~ /^[[:space:]]*\|\|\|[[:space:]]*OWED-AXIOM[[:space:]]*:/) emit("CLAIMED_OWED_AXIOM", $0)
else if (annotated && $0 ~ /^[[:space:]]*\|\|\|[[:space:]]*OWED[[:space:]]*:/) emit("CLAIMED_OWED", $0)
if (annotated && $0 ~ /^[[:space:]]*\|\|\|.*@[[:space:]]*Assumed[[:space:]]*:/) emit("ASSUMPTION_ANNOTATION", $0)
code = code_of($0)
if (code ~ /^[[:space:]]*0[[:space:]]+[A-Za-z_][[:alnum:]_\047]*[[:space:]]*:/) emit("ERASED_SIGNATURE_CANDIDATE", $0)
if (code ~ /(^|[^[:alnum:]_])assert_total([^[:alnum:]_]|$)/) emit("ASSERT_TOTAL_ACTIVE", $0)
if (code ~ /(^|[^[:alnum:]_])assert_smaller([^[:alnum:]_]|$)/) emit("ASSERT_SMALLER_ACTIVE", $0)
if (code ~ /(^|[^[:alnum:]_])(really_believe_me|believe_me)([^[:alnum:]_]|$)/) emit("BELIEVE_ME_ACTIVE", $0)
if (code ~ /(^|[^[:alnum:]_])idris_crash([^[:alnum:]_]|$)/) emit("IDRIS_CRASH_ACTIVE", $0)
Comment on lines +100 to +103

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat apostrophes as identifier characters in token boundaries

Idris permits apostrophes in identifiers, but these boundary checks exclude only alphanumerics and underscores. A distinct function such as assert_total' is therefore emitted as ASSERT_TOTAL_ACTIVE, and the same false positive occurs for assert_smaller', believe_me', and idris_crash'; include apostrophes on both sides of these token-boundary expressions, as the erased-signature and hole patterns already do.

Useful? React with 👍 / 👎.

if (code ~ /^[[:space:]]*%default[[:space:]]+covering/) emit("DEFAULT_COVERING", $0)
if (code ~ /(^|[^[:alnum:]_])\?[A-Za-z_][[:alnum:]_\047]*/) emit("HOLE_LEXICAL_CANDIDATE", $0)
}
END {
if (depth != 0) {
printf "ERROR: unterminated block comment in %s\n", file > "/dev/stderr"
exit 3
}
}
' "$file" >> "$output"
done
printf 'Census: %s Idris sources, commit %s\n' "${#sources[@]}" "$commit"
awk -F '\t' 'NR > 6 && $1 !~ /^#/ { count[$1]++ } END { for (k in count) printf "%s\t%d\n", k, count[k] }' "$output" | LC_ALL=C sort
printf 'Report: %s\n' "$output"
84 changes: 84 additions & 0 deletions scripts/test-idris-proof-census.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MPL-2.0
set -euo pipefail
here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
work=$(mktemp -d)
trap 'rm -rf -- "$work"' EXIT
mkdir -p "$work/src"
cat > "$work/src/Example.idr" <<'IDR'
module Example
||| DISCHARGED: an annotation is not a proof
ok : 1 = 1
ok = Refl
||| OWED: a missing proof
0 missing : 2 = 2
||| OWED-AXIOM: external dependency
%default covering
IDR
bash "$here/census-idris-proof-claims.sh" "$work/src" "$work/report.tsv" > "$work/report.log"
for marker in CLAIMED_DISCHARGED CLAIMED_OWED CLAIMED_OWED_AXIOM ERASED_SIGNATURE_CANDIDATE DEFAULT_COVERING; do
test "$(awk -F '\t' -v kind="$marker" '$1 == kind {n++} END {print n+0}' "$work/report.tsv")" = 1

Check failure on line 20 in scripts/test-idris-proof-census.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of 'test' command for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_bulletproof-core&issues=AaIH8grxhfpJAUWCA0AD&open=AaIH8grxhfpJAUWCA0AD&pullRequest=243
done
test "$(grep -c '^# NOTE: lexical evidence only' "$work/report.tsv")" = 1

Check failure on line 22 in scripts/test-idris-proof-census.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of 'test' command for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_bulletproof-core&issues=AaIH8grxhfpJAUWCA0AE&open=AaIH8grxhfpJAUWCA0AE&pullRequest=243
rm "$work/src/Example.idr"
cat > "$work/src/Literals.idr" <<'IDR'
module Literals
{-
{- believe_me -}
||| idris_crash -}
afterComment = assert_smaller 2 1
multi = """
assert_total {- " \"" -- idris_crash
||| believe_me
"""
afterMulti = assert_smaller 2 1
raw = ##"""
assert_total """# believe_me -- \{idris_crash}
"""## ++ idris_crash "after the matching delimiter"
interp = "assert_total \{assert_total "believe_me"} idris_crash"
escaped = "\\{assert_total x}"
rawInterp = #"\#{ "idris_crash \{(assert_smaller 2 1)}" } believe_me"#
multilineInterp = """
\{
{- believe_me -} show (the Nat (f {n = 1} (assert_smaller 2 1)))
} assert_total
"""
char = ('"', believe_me 1)
escapedChar = ('\"', believe_me 1)
primed' = assert_smaller 2 1
IDR
bash "$here/census-idris-proof-claims.sh" "$work/src" "$work/report.tsv" > "$work/report.log"
awk -F '\t' 'NR > 6 {print $1, $3}' "$work/report.tsv" > "$work/actual"
diff -u - "$work/actual" <<'EXPECTED'
ASSERT_SMALLER_ACTIVE 5
ASSERT_SMALLER_ACTIVE 10
IDRIS_CRASH_ACTIVE 13
ASSERT_TOTAL_ACTIVE 14
ASSERT_SMALLER_ACTIVE 16
ASSERT_SMALLER_ACTIVE 19
BELIEVE_ME_ACTIVE 22
BELIEVE_ME_ACTIVE 23
ASSERT_SMALLER_ACTIVE 24
EXPECTED
rm "$work/src/Literals.idr"
cat > "$work/src/Inactive.idr" <<'IDR'
module Inactive
{-
||| DISCHARGED: inside a block comment
||| OWED: inside a block comment
||| x @ Assumed: inside a block comment
-}
s = """
||| OWED-AXIOM: inside a string
"""
||| DISCHARGED: this one is active
y = 1
IDR
bash "$here/census-idris-proof-claims.sh" "$work/src" "$work/report.tsv" > "$work/report.log"
awk -F '\t' 'NR > 6 {print $1, $3}' "$work/report.tsv" | diff -u - <(printf 'CLAIMED_DISCHARGED 10\n')
rm "$work/src/Inactive.idr"
if bash "$here/census-idris-proof-claims.sh" "$work/src" "$work/report.tsv" >/dev/null 2>&1; then
echo "FAIL: empty input was accepted" >&2
exit 1
fi
echo "PASS: lexical proof claims census positive and negative controls"
Loading