Skip to content

Commit a2792e6

Browse files
proof(SafeArchive): DISCHARGE max{CompressionRatio,TotalSize} via Refl (proven#90, #107) (#109)
Per [proven#107](#107) "overly cautious OWED" pattern — Nat-literal-vs-literal variant. \`\`\`idris public export maxCompressionRatioAnchor : maxCompressionRatio = 1000 maxCompressionRatioAnchor = Refl public export maxTotalSizeAnchor : maxTotalSize = 1073741824 maxTotalSizeAnchor = Refl \`\`\` Both `public export` (SafeArchive.idr L64-66 + L77-79). Idris2 compares Nat literals via Integer representation without unary expansion — Refl closes even for large literals like 1073741824. OWED's "Nat literal opacity" only applies to REDUCING the named constant to a SMALLER literal (e.g. for arithmetic). Here both sides are the SAME literal so no reduction is needed. Refs #90 #107 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0576c32 commit a2792e6

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

src/Proven/SafeArchive/Proofs.idr

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,24 @@ entryOKNotNullByteInPath = Refl
107107
-- Spec-anchor constants
108108
--------------------------------------------------------------------------------
109109

110-
||| OWED: `maxCompressionRatio` is exactly 1000:1. Blocked on Nat-literal
111-
||| opacity (standards#128 "Nat literal opacity").
112-
public export
113-
0 maxCompressionRatioAnchor : maxCompressionRatio = 1000
114-
115-
||| OWED: `maxTotalSize` is exactly 1 GiB (2^30 bytes = 1073741824).
116-
||| Idris2 0.8.0 cannot Refl-reduce large `Nat` literals (unary
117-
||| representation, standards#128 "Nat literal opacity"); needs a
118-
||| reflective tactic.
119-
public export
120-
0 maxTotalSizeAnchor : maxTotalSize = 1073741824
110+
||| DISCHARGED: `maxCompressionRatio = 1000`. `maxCompressionRatio` is
111+
||| `public export` with body `1000` (SafeArchive.idr L64-66). Both
112+
||| sides are the same `Nat` literal — Idris2 compares literals as
113+
||| their `Integer` representation without unary expansion, so `Refl`
114+
||| closes regardless of literal magnitude.
115+
public export
116+
maxCompressionRatioAnchor : maxCompressionRatio = 1000
117+
maxCompressionRatioAnchor = Refl
118+
119+
||| DISCHARGED: `maxTotalSize = 1073741824` (1 GiB). Same literal-vs-
120+
||| literal pattern as `maxCompressionRatioAnchor` — `maxTotalSize` is
121+
||| `public export` with body `1073741824` (SafeArchive.idr L77-79).
122+
||| The "Nat literal opacity" blocker only applies to attempts to
123+
||| convert this value to a SMALLER literal — here both sides are the
124+
||| same literal so `Refl` closes.
125+
public export
126+
maxTotalSizeAnchor : maxTotalSize = 1073741824
127+
maxTotalSizeAnchor = Refl
121128

122129
--------------------------------------------------------------------------------
123130
-- `isZipBomb` corner cases (compressedSize = 0)

0 commit comments

Comments
 (0)