@@ -31,22 +31,22 @@ isValidOutputChar v c = isValidBase64Char v c || isPaddingChar c ||
3131||| Predicate: Output contains only valid Base64 characters
3232public export
3333data ValidBase64Output : Base64Variant -> String -> Type where
34- MkValidBase64Output : (variant : Base64Variant) -> (s : String) ->
34+ postulate MkValidBase64Output : (variant : Base64Variant) -> (s : String) ->
3535 {auto prf : all (isValidOutputChar variant) (unpack s) = True} ->
3636 ValidBase64Output variant s
3737
3838||| Predicate: Encoded length is correct
3939public export
4040data CorrectEncodedLength : Base64Variant -> Nat -> Nat -> Type where
41- MkCorrectEncodedLength : (variant : Base64Variant) ->
41+ postulate MkCorrectEncodedLength : (variant : Base64Variant) ->
4242 (inputLen : Nat ) -> (outputLen : Nat ) ->
4343 {auto prf : outputLen = encodedLength variant inputLen} ->
4444 CorrectEncodedLength variant inputLen outputLen
4545
4646||| Predicate: Decoded length is correct
4747public export
4848data CorrectDecodedLength : Nat -> Nat -> Nat -> Type where
49- MkCorrectDecodedLength : (encodedLen : Nat ) -> (padding : Nat ) -> (outputLen : Nat ) ->
49+ postulate MkCorrectDecodedLength : (encodedLen : Nat ) -> (padding : Nat ) -> (outputLen : Nat ) ->
5050 {auto prf : outputLen = exactDecodedLength encodedLen padding} ->
5151 CorrectDecodedLength encodedLen padding outputLen
5252
@@ -57,7 +57,7 @@ data CorrectDecodedLength : Nat -> Nat -> Nat -> Type where
5757||| Predicate: Encoding is reversible
5858public export
5959data RoundtripSuccess : Base64Variant -> List Bits8 -> Type where
60- MkRoundtripSuccess : (variant : Base64Variant) -> (bytes : List Bits8) ->
60+ postulate MkRoundtripSuccess : (variant : Base64Variant) -> (bytes : List Bits8) ->
6161 {auto prf : decode variant (encodeBytesToString variant bytes) = Ok bytes} ->
6262 RoundtripSuccess variant bytes
6363
@@ -83,7 +83,7 @@ data RoundtripSuccess : Base64Variant -> List Bits8 -> Type where
8383||| reflective tactic for `unpack` is available, or by hand-rolling a
8484||| 64-arm exhaustive case-split over the alphabet (one `Refl` per
8585||| character).
86- 0 standardAlphabetValid : (c : Char) -> c `elem` unpack standardAlphabet = True ->
86+ postulate 0 standardAlphabetValid : (c : Char) -> c `elem` unpack standardAlphabet = True ->
8787 isValidBase64Char Standard c = True
8888
8989||| OWED: every character in the URL-safe Base64 alphabet
@@ -95,7 +95,7 @@ data RoundtripSuccess : Base64Variant -> List Bits8 -> Type where
9595||| `String` at the type level — same FFI-primitive blocker as
9696||| `standardAlphabetValid` above. Discharge by the same mechanism
9797||| (`Data.String` reflective tactic or 64-arm exhaustive case-split).
98- 0 urlSafeAlphabetValid : (c : Char) -> c `elem` unpack urlSafeAlphabet = True ->
98+ postulate 0 urlSafeAlphabetValid : (c : Char) -> c `elem` unpack urlSafeAlphabet = True ->
9999 isValidBase64Char URLSafe c = True
100100
101101||| OWED: the encoder `encodeBytesToString variant bytes` emits only
@@ -115,7 +115,7 @@ data RoundtripSuccess : Base64Variant -> List Bits8 -> Type where
115115||| a `Data.String` `pack`/`unpack` reflective tactic is available, or
116116||| by lifting the proof to the underlying `List Char` produced before
117117||| `pack` (which IS reducible by induction on the 6-bit chunking).
118- 0 encodeOutputValid : (variant : Base64Variant) -> (bytes : List Bits8) ->
118+ postulate 0 encodeOutputValid : (variant : Base64Variant) -> (bytes : List Bits8) ->
119119 ValidBase64Output variant (encodeBytesToString variant bytes)
120120
121121-- ------------------------------------------------------------------------------
@@ -142,7 +142,7 @@ paddedLengthCorrect n = Refl
142142||| product-by-divisor is available, or by direct induction on
143143||| `(n + 2) `div` 3` using the `divides`/`Mod 0` lemmas from
144144||| `Data.Nat.Division`.
145- 0 paddedLengthMultipleOf4 : (variant : Base64Variant) -> usesPadding variant = True ->
145+ postulate 0 paddedLengthMultipleOf4 : (variant : Base64Variant) -> usesPadding variant = True ->
146146 (n : Nat ) -> (encodedLength variant n) `mod` 4 = 0
147147
148148||| OWED: `decodedLength encodedLen <= (encodedLen * 3) `div` 4 + 1`
@@ -159,7 +159,7 @@ paddedLengthCorrect n = Refl
159159||| `Bool`-reflective `lteSucc` is wired up, or by hand-writing
160160||| `decideEq` over the underlying `Nat` to convert the `LTE` proof
161161||| to its `Bool` form.
162- 0 decodedLengthBound : (encodedLen : Nat ) ->
162+ postulate 0 decodedLengthBound : (encodedLen : Nat ) ->
163163 decodedLength encodedLen <= (encodedLen * 3) `div` 4 + 1 = True
164164
165165||| OWED: for non-empty input (`n > 0 = True`), `encodedLength variant
@@ -179,7 +179,7 @@ paddedLengthCorrect n = Refl
179179||| available, or by chained applications of `lteMultRight`/
180180||| `divLteRight` after refactoring `encodedLength` to expose a
181181||| `total` divisor.
182- 0 encodingIncreasesLength : (variant : Base64Variant) -> (n : Nat ) -> n > 0 = True ->
182+ postulate 0 encodingIncreasesLength : (variant : Base64Variant) -> (n : Nat ) -> n > 0 = True ->
183183 encodedLength variant n >= n = True
184184
185185-- ------------------------------------------------------------------------------
@@ -206,7 +206,7 @@ paddedLengthCorrect n = Refl
206206||| `List Bits8 -> List (Fin 64) -> List Char -> List (Fin 64) ->
207207||| List Bits8` decomposition where each leg IS reducible by
208208||| structural induction.
209- 0 roundtripCorrect : (variant : Base64Variant) -> (bytes : List Bits8) ->
209+ postulate 0 roundtripCorrect : (variant : Base64Variant) -> (bytes : List Bits8) ->
210210 decode variant (encodeBytesToString variant bytes) = Ok bytes
211211
212212||| OWED: round-trip on the empty input, `decode variant
@@ -224,7 +224,7 @@ paddedLengthCorrect n = Refl
224224||| the same mechanism, or as a one-off `Refl` once the encoder's
225225||| `pack`/`unpack` wrappers are reduced manually via a `Data.String`
226226||| reflective tactic.
227- 0 roundtripEmpty : (variant : Base64Variant) ->
227+ postulate 0 roundtripEmpty : (variant : Base64Variant) ->
228228 decode variant (encodeBytesToString variant []) = Ok []
229229
230230||| OWED: round-trip on a single byte, `decode variant
@@ -242,7 +242,7 @@ paddedLengthCorrect n = Refl
242242||| as `roundtripCorrect`. Discharge once a `Data.Bits` reflective
243243||| tactic for `shiftL`/`shiftR`/`.&.` is available alongside the
244244||| `Data.String` `pack`/`unpack` tactic.
245- 0 roundtripSingleByte : (variant : Base64Variant) -> (b : Bits8) ->
245+ postulate 0 roundtripSingleByte : (variant : Base64Variant) -> (b : Bits8) ->
246246 decode variant (encodeBytesToString variant [b]) = Ok [b]
247247
248248||| OWED: string-level round-trip, `decodeToString variant
@@ -258,7 +258,7 @@ paddedLengthCorrect n = Refl
258258||| and `SafeHtml.escapePreservesNoLT`. Discharge once a
259259||| `Data.String` reflective tactic exposes `pack (unpack s) = s` and
260260||| `roundtripCorrect` is itself discharged.
261- 0 roundtripString : (variant : Base64Variant) -> (s : String) ->
261+ postulate 0 roundtripString : (variant : Base64Variant) -> (s : String) ->
262262 decodeToString variant (encodeStringToString variant s) = Ok s
263263
264264-- ------------------------------------------------------------------------------
@@ -281,7 +281,7 @@ paddedLengthCorrect n = Refl
281281||| `Data.String` reflective tactic exposes `length (unpack (pack
282282||| xs)) = length xs` (i.e. `pack`/`unpack` preserve length), then
283283||| `Refl` closes against the shared chunking step.
284- 0 variantsEqualLength : (bytes : List Bits8) ->
284+ postulate 0 variantsEqualLength : (bytes : List Bits8) ->
285285 length (unpack (encodeBytesToString Standard bytes)) =
286286 length (unpack (encodeBytesToString URLSafe bytes))
287287
@@ -298,7 +298,7 @@ paddedLengthCorrect n = Refl
298298||| True`. Same blocker family as `decodedLengthBound`. Discharge by
299299||| the same mechanism (`Data.String` `unpack` + `Data.Nat`/`Bool`
300300||| `lte` reflective tactics).
301- 0 noPadShorter : (bytes : List Bits8) ->
301+ postulate 0 noPadShorter : (bytes : List Bits8) ->
302302 let standardLen = length (unpack (encodeBytesToString Standard bytes))
303303 noPadLen = length (unpack (encodeBytesToString URLSafeNoPad bytes))
304304 in noPadLen <= standardLen = True
@@ -326,7 +326,7 @@ paddedLengthCorrect n = Refl
326326||| canonical Idris2 enhancement #2400-series), or by routing the
327327||| scrutinee through a `decideEq`-style helper that returns the
328328||| equation explicitly.
329- 0 decodeNeverCrashes : (variant : Base64Variant) -> (input : String) ->
329+ postulate 0 decodeNeverCrashes : (variant : Base64Variant) -> (input : String) ->
330330 Either (err : Base64Error ** decode variant input = Err err)
331331 (bytes : List Bits8 ** decode variant input = Ok bytes)
332332
@@ -346,7 +346,7 @@ paddedLengthCorrect n = Refl
346346||| reflective tactic for `unpack`/`elem` is available, or by
347347||| refactoring the decoder to return a `Dec`-style witness alongside
348348||| each rejection.
349- 0 invalidCharDetected : (variant : Base64Variant) -> (input : String) ->
349+ postulate 0 invalidCharDetected : (variant : Base64Variant) -> (input : String) ->
350350 (c : Char) -> (pos : Nat ) ->
351351 c `elem` unpack input = True ->
352352 not (isValidBase64Char variant c) = True ->
@@ -374,7 +374,7 @@ index' (S k) (_ :: xs) = index' k xs
374374||| `invalidCharDetected`. Discharge once a `Data.String` reflective
375375||| tactic for `unpack` / `index'` is available, or by refactoring
376376||| `decode` to thread an explicit position-validation `Dec` witness.
377- 0 invalidPaddingDetected : (input : String) ->
377+ postulate 0 invalidPaddingDetected : (input : String) ->
378378 -- Padding not at end
379379 (pos : Nat ) -> pos < (length (unpack input) `minus` 2) = True ->
380380 index' pos (unpack input) = Just '=' ->
@@ -399,7 +399,7 @@ index' (S k) (_ :: xs) = index' k xs
399399||| `length . unpack . pack = length` and a `Data.List1` `split`
400400||| reflective tactic is available, or by inductive proof over the
401401||| encoder's line-wrap loop counter.
402- 0 mimeLineBreaksCorrect : (bytes : List Bits8) ->
402+ postulate 0 mimeLineBreaksCorrect : (bytes : List Bits8) ->
403403 let encoded = encodeBytesToString MIME bytes
404404 lines = forget (split (== ' \n ' ) encoded)
405405 in all (\ l => length (unpack l) <= mimeLineLength + 1 ) lines = True
@@ -423,7 +423,7 @@ stripWhitespace s = pack (filter (not . isBase64Whitespace) (unpack s))
423423||| tactic exposes `pack (filter p (unpack s))` as a `Refl`-able
424424||| operation, or by refactoring `decode MIME` to take the already-
425425||| stripped `String` as an explicit pre-condition.
426- 0 mimeIgnoresWhitespace : (encoded : String) -> (withWs : String) ->
426+ postulate 0 mimeIgnoresWhitespace : (encoded : String) -> (withWs : String) ->
427427 stripWhitespace withWs = encoded ->
428428 decode MIME withWs = decode MIME encoded
429429
@@ -446,7 +446,7 @@ stripWhitespace s = pack (filter (not . isBase64Whitespace) (unpack s))
446446||| tactic for `pack`/`unpack` is available, or by lifting the proof
447447||| to the underlying pre-`pack` `List Char` where the alphabet table
448448||| lookup IS reducible (one `Refl` per Fin 64 index).
449- 0 urlSafeContainsNoUnsafe : (bytes : List Bits8) ->
449+ postulate 0 urlSafeContainsNoUnsafe : (bytes : List Bits8) ->
450450 let encoded = encodeBytesToString URLSafe bytes
451451 in all (\ c => c /= ' +' && c /= ' /' ) (unpack encoded) = True
452452
@@ -467,7 +467,7 @@ stripWhitespace s = pack (filter (not . isBase64Whitespace) (unpack s))
467467||| or by lifting to the pre-`pack` `List (Fin 64)` representation
468468||| and case-splitting on whether `62 \`elem\` indices` or
469469||| `63 \`elem\` indices`.
470- 0 standardMayContainUnsafe : (bytes : List Bits8) ->
470+ postulate 0 standardMayContainUnsafe : (bytes : List Bits8) ->
471471 Either ('+' `elem` unpack (encodeBytesToString Standard bytes) = True)
472472 (Either (' /' `elem` unpack (encodeBytesToString Standard bytes) = True )
473473 (all (\ c => c /= ' +' && c /= ' /' ) (unpack (encodeBytesToString Standard bytes)) = True ))
@@ -494,7 +494,7 @@ stripWhitespace s = pack (filter (not . isBase64Whitespace) (unpack s))
494494||| `Data.Nat.Division` `divides`-elimination lemmas after
495495||| introducing `(k : Nat) ** n = 3 * k` from the `n `mod` 3 = 0`
496496||| hypothesis.
497- 0 threeToFourRatio : (n : Nat ) -> (n `mod` 3 = 0) = True ->
497+ postulate 0 threeToFourRatio : (n : Nat ) -> (n `mod` 3 = 0) = True ->
498498 encodedLength Standard n = (n `div` 3) * 4
499499
500500||| Count padding characters in a string
@@ -520,7 +520,7 @@ countPadding s = length (filter (== '=') (unpack s))
520520||| is available alongside a `Data.Nat` `mod`-elimination tactic, or
521521||| by case-splitting on `n `mod` 3 ∈ {0,1,2}` and lifting to the
522522||| pre-`pack` `List Char` where padding emission IS reducible.
523- 0 paddingMatchesRemainder : (variant : Base64Variant) -> usesPadding variant = True ->
523+ postulate 0 paddingMatchesRemainder : (variant : Base64Variant) -> usesPadding variant = True ->
524524 (n : Nat ) ->
525525 let remainder = n `mod` 3
526526 encoded = encodeBytesToString variant (replicate n 0 )
@@ -544,7 +544,7 @@ countPadding s = length (filter (== '=') (unpack s))
544544||| `roundtripCorrect` is discharged: the proof body is then a pair
545545||| of `roundtripCorrect variant bytes1` and `roundtripCorrect
546546||| variant bytes2`.
547- 0 segmentedRoundtrip : (variant : Base64Variant) -> (bytes1 : List Bits8) -> (bytes2 : List Bits8) ->
547+ postulate 0 segmentedRoundtrip : (variant : Base64Variant) -> (bytes1 : List Bits8) -> (bytes2 : List Bits8) ->
548548 let enc1 = encodeBytesToString variant bytes1
549549 enc2 = encodeBytesToString variant bytes2
550550 in (decode variant enc1 = Ok bytes1,
0 commit comments