From 768437fad77a2b62a724e6cafe7b33896d7545a1 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Mon, 23 Nov 2026 10:23:45 +0000 Subject: [PATCH 1/7] audit(proofs): inventory claims and escape candidates without asserting proof status --- scripts/census-idris-proof-claims.sh | 78 ++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 scripts/census-idris-proof-claims.sh diff --git a/scripts/census-idris-proof-claims.sh b/scripts/census-idris-proof-claims.sh new file mode 100644 index 00000000..cf1f2725 --- /dev/null +++ b/scripts/census-idris-proof-claims.sh @@ -0,0 +1,78 @@ +#!/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" ' + 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) + } + function code_of(line, i, pair, ch, out, quote, escaped) { + out = ""; quote = 0; escaped = 0 + if (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 (quote) { + if (escaped) { escaped = 0; continue } + if (ch == "\\") { escaped = 1; continue } + if (ch == "\"") { quote = 0; continue } + continue + } + if (pair == "--") break + if (pair == "{-") { depth++; i++; continue } + if (ch == "\"") { quote = 1; continue } + out = out ch + } + return out + } + { + if ($0 ~ /^[[:space:]]*\|\|\|[[:space:]]*DISCHARGED[[:space:]]*:/) emit("CLAIMED_DISCHARGED", $0) + if ($0 ~ /^[[:space:]]*\|\|\|[[:space:]]*OWED-AXIOM[[:space:]]*:/) emit("CLAIMED_OWED_AXIOM", $0) + else if ($0 ~ /^[[:space:]]*\|\|\|[[:space:]]*OWED[[:space:]]*:/) emit("CLAIMED_OWED", $0) + if ($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) + 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" From 5ac9f5b1a45bf5168d703def00a1f0e853078477 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Mon, 23 Nov 2026 10:26:12 +0000 Subject: [PATCH 2/7] test(proofs): check lexical evidence classes and reject empty census --- scripts/test-idris-proof-census.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 scripts/test-idris-proof-census.sh diff --git a/scripts/test-idris-proof-census.sh b/scripts/test-idris-proof-census.sh new file mode 100644 index 00000000..35eba104 --- /dev/null +++ b/scripts/test-idris-proof-census.sh @@ -0,0 +1,28 @@ +#!/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 +done +test "$(grep -c '^# NOTE: lexical evidence only' "$work/report.tsv")" = 1 +rm "$work/src/Example.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" From 137cfb3e8d774d91dcff3e891725106dbbce59ef Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Mon, 23 Nov 2026 10:26:24 +0000 Subject: [PATCH 3/7] ci(proofs): collect per-source claim census as evidence artifact --- .github/workflows/idris2-ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/idris2-ci.yml b/.github/workflows/idris2-ci.yml index 90b07bfb..359746fb 100644 --- a/.github/workflows/idris2-ci.yml +++ b/.github/workflows/idris2-ci.yml @@ -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' - '.github/workflows/idris2-ci.yml' @@ -21,6 +23,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' - '.github/workflows/idris2-ci.yml' @@ -65,6 +69,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 From d4eb59031de2af1cfdeac7a446b66ecdee91d122 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Mon, 23 Nov 2026 10:29:34 +0000 Subject: [PATCH 4/7] docs(audit): record observed G0 claim census and package proof-check boundary --- .../audit/proven-proof-census-2026-11-23.adoc | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 docs/reports/audit/proven-proof-census-2026-11-23.adoc diff --git a/docs/reports/audit/proven-proof-census-2026-11-23.adoc b/docs/reports/audit/proven-proof-census-2026-11-23.adoc new file mode 100644 index 00000000..3e2f46dc --- /dev/null +++ b/docs/reports/audit/proven-proof-census-2026-11-23.adoc @@ -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]. From e54378ea5efc103740c52577fb63e4041cc6a26f Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 09:10:15 +0000 Subject: [PATCH 5/7] fix(proofs): handle Idris literals and interpolation in the proof census --- scripts/census-idris-proof-claims.sh | 54 +++++++++++++++++++++++----- scripts/test-idris-proof-census.sh | 40 +++++++++++++++++++++ 2 files changed, 85 insertions(+), 9 deletions(-) diff --git a/scripts/census-idris-proof-claims.sh b/scripts/census-idris-proof-claims.sh index cf1f2725..82f93eb3 100644 --- a/scripts/census-idris-proof-claims.sh +++ b/scripts/census-idris-proof-claims.sh @@ -27,9 +27,10 @@ for file in "${sources[@]}"; do sub(/\r$/, "", x) printf "%s\t%s\t%d\t%s\n", kind, file, FNR, substr(x, 1, 220) } - function code_of(line, i, pair, ch, out, quote, escaped) { - out = ""; quote = 0; escaped = 0 - if (line ~ /^[[:space:]]*\|\|\|/) return "" + # 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) @@ -38,15 +39,50 @@ for file in "${sources[@]}"; do if (pair == "-}") { depth--; i++; continue } continue } - if (quote) { - if (escaped) { escaped = 0; continue } - if (ch == "\\") { escaped = 1; continue } - if (ch == "\"") { quote = 0; 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++; continue } - if (ch == "\"") { quote = 1; continue } + 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:]]*$/) ? "\"\"\"" : "\"" + closing[++level] = quotes hashes + escape_prefix[level] = "\\" hashes + i += length(hashes quotes) - 1 + out = out " " + continue + } out = out ch } return out diff --git a/scripts/test-idris-proof-census.sh b/scripts/test-idris-proof-census.sh index 35eba104..926393e9 100644 --- a/scripts/test-idris-proof-census.sh +++ b/scripts/test-idris-proof-census.sh @@ -21,6 +21,46 @@ for marker in CLAIMED_DISCHARGED CLAIMED_OWED CLAIMED_OWED_AXIOM ERASED_SIGNATUR done test "$(grep -c '^# NOTE: lexical evidence only' "$work/report.tsv")" = 1 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" 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 From a8a32c86fd7caa46aa9336045450aaeca1dbe997 Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 09:10:37 +0000 Subject: [PATCH 6/7] chore(pre-commit): Add a merge conflict marker check for all commits --- .pre-commit-config.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..099984c6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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] From d5a938dcd0ac085792d9ec76bf8c887b35e45068 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 11:34:37 +0000 Subject: [PATCH 7/7] fix(census): ignore proof annotations inside block comments and strings Annotation matching now requires the line to start in active code, with a planted control for a block comment and a multiline string. --- scripts/census-idris-proof-claims.sh | 11 +++++++---- scripts/test-idris-proof-census.sh | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/scripts/census-idris-proof-claims.sh b/scripts/census-idris-proof-claims.sh index 82f93eb3..3f18064c 100644 --- a/scripts/census-idris-proof-claims.sh +++ b/scripts/census-idris-proof-claims.sh @@ -88,10 +88,13 @@ for file in "${sources[@]}"; do return out } { - if ($0 ~ /^[[:space:]]*\|\|\|[[:space:]]*DISCHARGED[[:space:]]*:/) emit("CLAIMED_DISCHARGED", $0) - if ($0 ~ /^[[:space:]]*\|\|\|[[:space:]]*OWED-AXIOM[[:space:]]*:/) emit("CLAIMED_OWED_AXIOM", $0) - else if ($0 ~ /^[[:space:]]*\|\|\|[[:space:]]*OWED[[:space:]]*:/) emit("CLAIMED_OWED", $0) - if ($0 ~ /^[[:space:]]*\|\|\|.*@[[:space:]]*Assumed[[:space:]]*:/) emit("ASSUMPTION_ANNOTATION", $0) + # 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) diff --git a/scripts/test-idris-proof-census.sh b/scripts/test-idris-proof-census.sh index 926393e9..548e48a8 100644 --- a/scripts/test-idris-proof-census.sh +++ b/scripts/test-idris-proof-census.sh @@ -61,6 +61,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