Skip to content

Commit 71d6dd6

Browse files
proofs: make the repo's own modules pass the strict flag set (#355)
## Summary This PR fixes the four echo-types sites that failed the strict Agda flag set. No theorem statements change. These are clause splits plus one stdlib rename. The strict set: - In each file's `OPTIONS` pragma: `--safe --without-K --cubical-compatible --exact-split --no-sized-types --no-guardedness`. - On the command line: `--double-check -W error -W noUnsupportedIndexedMatch`. | File | Flag | Fix | |---|---|---| | `EchoExampleParser.agda` (`parses-aux`) | `--exact-split` | Move the `LP` clause first so the case tree splits on the token first. | | `EchoExampleParser.agda` (`second-token`) | `--exact-split` | Replace the catch-all with explicit `[]` and `(_ ∷ [])` clauses. This site was hidden behind the `parses-aux` failure. | | `EchoTropical.agda` (`_⊕_`) | `--exact-split` | `m ⊕ zero = m` becomes `suc m ⊕ zero = suc m`. | | `EchoBitNarrowingNumeric.agda` | `-W error` | Replace the deprecated stdlib `≤-step` with `m≤n⇒m≤1+n`. | ## Verification (Agda 2.6.3, stdlib 2.3) - `agda proofs/agda/All.agda` and `agda proofs/agda/Smoke.agda` both exit 0 under the repo's current flags. - `scripts/kernel-guard.sh` PASS. `tools/check-guardrails.sh` OK (137 modules). - Strict sweep, every module compiled on its own with the strict set: 2 sites remain, both outside this repo: - `EchoCNOBridge.agda:35` - `EchoThermodynamicsArbitrary.agda:76` Both import absolute-zero's `CNO`, which does not declare `--cubical-compatible`. That flag is coinfective: a module using it can only import modules that also use it. So the fix belongs in absolute-zero, not here. This PR does not add the strict pragmas to the repo's files. It only makes the code compatible with them. --- _Generated by [Claude Code](https://claude.ai/code/session_01MF5GeeBBDF6sUzr6pZTjWV)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3582c9b commit 71d6dd6

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎proofs/agda/EchoBitNarrowingNumeric.agda‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
module EchoBitNarrowingNumeric where
88

99
open import Data.Nat.Base using (ℕ; zero; suc; _+_; _*_; _^_; _<_; _≤_; z≤n; s≤s)
10-
open import Data.Nat.Properties using (+-suc; +-identityʳ; *-assoc; ≤-step)
10+
open import Data.Nat.Properties using (+-suc; +-identityʳ; *-assoc; m≤n⇒m≤1+n)
1111
open import Data.Vec.Base using (Vec; []; _∷_)
1212
open import Relation.Binary.PropositionalEquality
1313
using (_≡_; refl; cong; sym; trans; subst; module ≡-Reasoning)
@@ -48,7 +48,7 @@ private
4848
double-mono (s≤s p) = s≤s (s≤s (double-mono p))
4949

5050
join-bound : ∀ {m n} → m < n → ∀ b → joinBit m b < double n
51-
join-bound (s≤s p) O = s≤s (≤-step (double-mono p))
51+
join-bound (s≤s p) O = s≤s (m≤n⇒m≤1+n (double-mono p))
5252
join-bound (s≤s p) I = s≤s (s≤s (double-mono p))
5353

5454
-- The bit-vector reconstruction has the exact arithmetic shape of the API.

‎proofs/agda/EchoExampleParser.agda‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,14 @@ paren-pair = LP ∷ RP ∷ LP ∷ RP ∷ []
7878
-- The auxiliary's signature `ℕ → List Token → Bool` mirrors a state
7979
-- machine. We pattern-match on the token first (Agda-friendly recursion
8080
-- shape) and on the depth only in the RP case (the abort condition).
81+
-- The LP clause comes first so the case tree splits on the token
82+
-- before the depth: every clause then holds definitionally, which
83+
-- `--exact-split` requires.
8184

8285
parses-aux : ℕ → List Token → Bool
86+
parses-aux d (LP ∷ ts) = parses-aux (suc d) ts
8387
parses-aux zero [] = true
8488
parses-aux (suc _) [] = false
85-
parses-aux d (LP ∷ ts) = parses-aux (suc d) ts
8689
parses-aux zero (RP ∷ _) = false
8790
parses-aux (suc d) (RP ∷ ts) = parses-aux d ts
8891

@@ -111,7 +114,8 @@ paren-nested≢paren-pair p =
111114
where
112115
second-token : List Token → Token
113116
second-token (_ ∷ t ∷ _) = t
114-
second-token _ = LP -- default; never reached for these inputs
117+
second-token [] = LP -- default; never reached for these inputs
118+
second-token (_ ∷ []) = LP
115119

116120
paren-empty≢paren-nested : paren-empty ≢ paren-nested
117121
paren-empty≢paren-nested p =

‎proofs/agda/EchoTropical.agda‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ infixl 6 _⊕_
2424

2525
_⊕_ : ℕ → ℕ → ℕ
2626
zero ⊕ n = n
27-
m ⊕ zero = m
27+
suc m ⊕ zero = suc m
2828
suc m ⊕ suc n = suc (m ⊕ n)
2929

3030
-- Basic tropical properties (simplified for bridge purposes)

0 commit comments

Comments
 (0)