Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Proven Properties Catalog

All theorems link to their source modules in the API Reference.

Total: 257 compile-time verified theorems across 52 files

All theorems are checked by the Lean 4 kernel at compile time. The codebase is completely sorry-free — every proof obligation is fully discharged.

Algebraic Laws

Monoid/Semigroup Associativity (8, in Base/Data/Newtype.lean)

TheoremModule
Dual.append_assocBase/Data/Newtype
Endo.append_assocBase/Data/Newtype
First.append_assocBase/Data/Newtype
Last.append_assocBase/Data/Newtype
Sum.append_assocBase/Data/Newtype
Product.append_assocBase/Data/Newtype
All.append_assocBase/Data/Newtype
Any.append_assocBase/Data/Newtype

Functor Laws (14)

TheoremModule
Identity.map_idBase/Data/Functor/Identity
Identity.map_compBase/Data/Functor/Identity
Const.map_idBase/Data/Functor/Const
Const.map_compBase/Data/Functor/Const
Const.map_valBase/Data/Functor/Const
Proxy.map_idBase/Data/Proxy
Proxy.map_compBase/Data/Proxy
Either.map_idBase/Data/Either
Either.map_compBase/Data/Either
Compose.map_idBase/Data/Functor/Compose
Compose.map_compBase/Data/Functor/Compose
Product.map_idBase/Data/Functor/Product
Product.map_compBase/Data/Functor/Product
Sum.map_idBase/Data/Functor/Sum
Sum.map_compBase/Data/Functor/Sum

Monad Laws (9)

TheoremModule
Identity.pure_bindBase/Data/Functor/Identity
Identity.bind_pureBase/Data/Functor/Identity
Identity.bind_assocBase/Data/Functor/Identity
Proxy.pure_bindBase/Data/Proxy
Proxy.bind_pureBase/Data/Proxy
Proxy.bind_assocBase/Data/Proxy
Either.pure_bindBase/Data/Either
Either.bind_pureBase/Data/Either
Either.bind_assocBase/Data/Either

Monad Combinators (1)

TheoremModule
join_pureBase/Control/Monad

Data Structure Properties

Either (3)

TheoremModule
swap_swapBase/Data/Either
isLeft_not_isRightBase/Data/Either
partitionEithers_lengthBase/Data/Either

Maybe/Option (8)

TheoremModule
maybe_noneBase/Data/Maybe
maybe_someBase/Data/Maybe
fromMaybe_noneBase/Data/Maybe
fromMaybe_someBase/Data/Maybe
catMaybes_nilBase/Data/Maybe
mapMaybe_nilBase/Data/Maybe
maybeToList_listToMaybeBase/Data/Maybe
catMaybes_eq_mapMaybe_idBase/Data/Maybe

Tuple (7)

TheoremModule
swap_swapBase/Data/Tuple
curry_uncurryBase/Data/Tuple
uncurry_curryBase/Data/Tuple
bimap_idBase/Data/Tuple
bimap_compBase/Data/Tuple
mapFst_eq_bimapBase/Data/Tuple
mapSnd_eq_bimapBase/Data/Tuple

List (4)

TheoremModule
tails_lengthBase/Data/List
inits_lengthBase/Data/List
tails_nilBase/Data/List
inits_nilBase/Data/List

NonEmpty (4)

TheoremModule
toList_ne_nilBase/Data/List/NonEmpty
reverse_lengthBase/Data/List/NonEmpty
toList_lengthBase/Data/List/NonEmpty
map_lengthBase/Data/List/NonEmpty

Ord/Down (2)

TheoremModule
get_mkBase/Data/Ord
compare_reverseBase/Data/Ord

Bool (5)

TheoremModule
bool_falseBase/Data/Bool
bool_trueBase/Data/Bool
guard'_trueBase/Data/Bool
guard'_falseBase/Data/Bool
bool_iteBase/Data/Bool

Void (1)

TheoremModule
eq_absurdBase/Data/Void

Function (5)

TheoremModule
on_applyBase/Data/Function
applyTo_applyBase/Data/Function
const_applyBase/Data/Function
flip_flipBase/Data/Function
flip_applyBase/Data/Function

Foldable (2)

TheoremModule
foldr_nilBase/Data/Foldable
foldl_nilBase/Data/Foldable

String (1)

TheoremModule
unwords_nilBase/Data/String

Char (3)

TheoremModule
isAlphaNum_iffBase/Data/Char
isSpace_eq_isWhitespaceBase/Data/Char
ord_eq_toNatBase/Data/Char

Ix (1)

TheoremModule
Ix.inRange_iff_index_isSome_natBase/Data/Ix

ExitCode (2)

TheoremModule
success_toUInt32Base/System/Exit
isSuccess_iffBase/System/Exit

Numeric Type Properties

Complex (2)

TheoremModule
conjugate_conjugateBase/Data/Complex
add_comm'Base/Data/Complex

Fixed-Point (5)

TheoremModule
scale_posBase/Data/Fixed
add_exactBase/Data/Fixed
sub_exactBase/Data/Fixed
neg_negBase/Data/Fixed
fromInt_zeroBase/Data/Fixed

Time (2)

TheoremModule
fromSeconds_toSecondsTime/Data/Time/Clock
diffUTCTime_selfTime/Data/Time/Clock

Protocol Correctness

HTTP Method Properties (21, in HttpTypes/Network/HTTP/Types/Method.lean)

TheoremWhat it proves
parseMethod_GETParsing “GET” yields .standard .GET
parseMethod_POSTParsing “POST” yields .standard .POST
parseMethod_HEADParsing “HEAD” yields .standard .HEAD
parseMethod_PUTParsing “PUT” yields .standard .PUT
parseMethod_DELETEParsing “DELETE” yields .standard .DELETE
parseMethod_TRACEParsing “TRACE” yields .standard .TRACE
parseMethod_CONNECTParsing “CONNECT” yields .standard .CONNECT
parseMethod_OPTIONSParsing “OPTIONS” yields .standard .OPTIONS
parseMethod_PATCHParsing “PATCH” yields .standard .PATCH
parseMethod_customNon-standard strings yield .custom
Method.get_is_safeGET is a safe method
Method.head_is_safeHEAD is a safe method
Method.options_is_safeOPTIONS is a safe method
Method.trace_is_safeTRACE is a safe method
Method.post_not_safePOST is not safe
Method.patch_not_safePATCH is not safe
Method.put_is_idempotentPUT is idempotent
Method.delete_is_idempotentDELETE is idempotent
Method.post_not_idempotentPOST is not idempotent
Method.patch_not_idempotentPATCH is not idempotent
Method.safe_implies_idempotentAll safe methods are idempotent

HTTP Status Properties (13, in HttpTypes/Network/HTTP/Types/Status.lean)

TheoremWhat it proves
status200_valid200 is in valid range [100, 599]
status404_valid404 is in valid range
status500_valid500 is in valid range
status100_valid100 is in valid range
status301_valid301 is in valid range
status100_no_body100 must not have body
status101_no_body101 must not have body
status204_no_body204 must not have body
status304_no_body304 must not have body
status200_may_have_body200 may have body
status201_may_have_body201 may have body
status404_may_have_body404 may have body
status500_may_have_body500 may have body

HTTP Version Properties (4, in HttpTypes/Network/HTTP/Types/Version.lean)

TheoremWhat it proves
http09_validHTTP/0.9 has major=0, minor=9
http10_validHTTP/1.0 has major=1, minor=0
http11_validHTTP/1.1 has major=1, minor=1
http20_validHTTP/2.0 has major=2, minor=0

Transport Security (3, in Warp/Types.lean)

TheoremWhat it proves
tcp_not_secureTCP is not encrypted
tls_is_secureTLS is always encrypted
quic_is_secureQUIC is always encrypted

Keep-Alive Semantics (2, in Warp/Run.lean)

TheoremWhat it proves
connAction_http10_defaultHTTP/1.0 defaults to close
connAction_http11_defaultHTTP/1.1 defaults to keep-alive

HTTP Version Parsing (5, in Warp/Request.lean)

TheoremWhat it proves
parseHttpVersion_http11“HTTP/1.1” -> http11
parseHttpVersion_http10“HTTP/1.0” -> http10
parseHttpVersion_http09“HTTP/0.9” -> http09
parseHttpVersion_http20“HTTP/2.0” -> http20
parseRequestLine_empty“” -> none

Warp Settings (1, in Warp/Settings.lean)

TheoremWhat it proves
defaultSettings_validDefault timeout > 0 and backlog > 0

Encoding/Decoding Roundtrips

HTTP/2 Frame Types (10, in Http2/Network/HTTP2/Frame/Types.lean)

TheoremFrame Type
fromUInt8_toUInt8_dataDATA
fromUInt8_toUInt8_headersHEADERS
fromUInt8_toUInt8_priorityPRIORITY
fromUInt8_toUInt8_rstStreamRST_STREAM
fromUInt8_toUInt8_settingsSETTINGS
fromUInt8_toUInt8_pushPromisePUSH_PROMISE
fromUInt8_toUInt8_pingPING
fromUInt8_toUInt8_goawayGOAWAY
fromUInt8_toUInt8_windowUpdateWINDOW_UPDATE
fromUInt8_toUInt8_continuationCONTINUATION

HTTP/3 Frame Types (7, in Http3/Network/HTTP3/Frame.lean)

TheoremFrame Type
FrameType.roundtrip_dataDATA
FrameType.roundtrip_headersHEADERS
FrameType.roundtrip_cancelPushCANCEL_PUSH
FrameType.roundtrip_settingsSETTINGS
FrameType.roundtrip_pushPromisePUSH_PROMISE
FrameType.roundtrip_goawayGOAWAY
FrameType.roundtrip_maxPushIdMAX_PUSH_ID

HTTP/3 Error Codes (17, in Http3/Network/HTTP3/Error.lean)

TheoremError Code
H3Error.roundtrip_noErrorH3_NO_ERROR
H3Error.roundtrip_generalProtocolErrorH3_GENERAL_PROTOCOL_ERROR
H3Error.roundtrip_internalErrorH3_INTERNAL_ERROR
H3Error.roundtrip_streamCreationErrorH3_STREAM_CREATION_ERROR
H3Error.roundtrip_closedCriticalStreamH3_CLOSED_CRITICAL_STREAM
H3Error.roundtrip_frameUnexpectedH3_FRAME_UNEXPECTED
H3Error.roundtrip_frameErrorH3_FRAME_ERROR
H3Error.roundtrip_excessiveLoadH3_EXCESSIVE_LOAD
H3Error.roundtrip_idErrorH3_ID_ERROR
H3Error.roundtrip_settingsErrorH3_SETTINGS_ERROR
H3Error.roundtrip_missingSettingsH3_MISSING_SETTINGS
H3Error.roundtrip_requestRejectedH3_REQUEST_REJECTED
H3Error.roundtrip_requestCancelledH3_REQUEST_CANCELLED
H3Error.roundtrip_requestIncompleteH3_REQUEST_INCOMPLETE
H3Error.roundtrip_messageErrorH3_MESSAGE_ERROR
H3Error.roundtrip_connectErrorH3_CONNECT_ERROR
H3Error.roundtrip_versionFallbackH3_VERSION_FALLBACK

WebSocket Opcodes (6, in WebSockets/Types.lean)

TheoremOpcode
opcode_roundtrip_textTEXT
opcode_roundtrip_binaryBINARY
opcode_roundtrip_closeCLOSE
opcode_roundtrip_pingPING
opcode_roundtrip_pongPONG
opcode_roundtrip_continuationCONTINUATION

ByteString Properties

ByteString Invariants (3, in ByteString/Internal.lean)

TheoremWhat it proves
take_validtake result has valid offset/length
drop_validdrop result has valid offset/length
null_iff_length_zeronull bs <-> length bs = 0

Builder Monoid (3, in ByteString/Builder.lean)

TheoremWhat it proves
empty_appendempty ++ b = b (left identity)
append_emptyb ++ empty = b (right identity)
append_assoc(a ++ b) ++ c = a ++ (b ++ c) (associativity)

Short ByteString (1, in ByteString/Short.lean)

TheoremWhat it proves
length_toShorttoShort preserves length

Word8 Properties (4, in Word8/Data/Word8.lean)

TheoremWhat it proves
toLower_idempotenttoLower . toLower = toLower
toUpper_idempotenttoUpper . toUpper = toUpper
isUpper_toLowerUpper -> toLower -> isLower
isLower_toUpperLower -> toUpper -> isUpper

CaseInsensitive (1, in CaseInsensitive/Data/CaseInsensitive.lean)

TheoremWhat it proves
ci_eq_iffCI equality is by foldedCase

Socket State (11, in Network/Socket/Types.lean)

TheoremWhat it proves
SocketState.fresh_ne_boundfresh /= bound
SocketState.fresh_ne_listeningfresh /= listening
SocketState.fresh_ne_connectedfresh /= connected
SocketState.fresh_ne_closedfresh /= closed
SocketState.bound_ne_listeningbound /= listening
SocketState.bound_ne_connectedbound /= connected
SocketState.bound_ne_closedbound /= closed
SocketState.listening_ne_connectedlistening /= connected
SocketState.listening_ne_closedlistening /= closed
SocketState.connected_ne_closedconnected /= closed
SocketState.beq_refls == s = true

Response Lifecycle (1, in WAI/Network/Wai/Internal.lean)

TheoremWhat it proves
ResponseState.pending_ne_sentpending /= sent

Path Safety (4, in WaiAppStatic/Types.lean)

TheoremWhat it proves
empty_piece_validEmpty string is a valid piece
toPiece_rejects_dotDotfiles rejected at construction
toPiece_rejects_slashPath traversal rejected at construction
toPiece_accepts_simpleNormal filenames accepted

WAI Response Laws (11, in WAI/Internal.lean)

TheoremWhat it proves
status_responseBuilderStatus accessor on builder
status_responseFileStatus accessor on file
status_responseStreamStatus accessor on stream
headers_responseBuilderHeaders accessor on builder
headers_responseFileHeaders accessor on file
mapResponseHeaders_id_responseBuildermapHeaders id on builder = id
mapResponseHeaders_id_responseFilemapHeaders id on file = id
mapResponseHeaders_id_responseStreammapHeaders id on stream = id
mapResponseStatus_id_responseBuildermapStatus id on builder = id
mapResponseStatus_id_responseFilemapStatus id on file = id
mapResponseStatus_id_responseStreammapStatus id on stream = id

WAI Middleware Algebra (5, in WAI/Wai.lean)

TheoremWhat it proves
idMiddleware_comp_leftid . m = m
idMiddleware_comp_rightm . id = m
modifyRequest_idmodifyRequest id = id
modifyResponse_idmodifyResponse id = id
ifRequest_falseifRequest (always false) m = id

Middleware Properties (11)

AddHeaders (3, in WaiExtra/AddHeaders.lean)

TheoremWhat it proves
addHeaders_nil_builderEmpty headers on builder = identity
addHeaders_nil_fileEmpty headers on file = identity
addHeaders_nil_streamEmpty headers on stream = identity

StripHeaders (3, in WaiExtra/StripHeaders.lean)

TheoremWhat it proves
stripHeaders_nil_builderEmpty strip list on builder = identity
stripHeaders_nil_fileEmpty strip list on file = identity
stripHeaders_nil_streamEmpty strip list on stream = identity

Select (1, in WaiExtra/Select.lean)

TheoremWhat it proves
select_noneAlways-none = identity

Routed (2, in WaiExtra/Routed.lean)

TheoremWhat it proves
routed_trueAlways-true = apply middleware
routed_falseAlways-false = identity

ForceSSL (1, in WaiExtra/ForceSSL.lean)

TheoremWhat it proves
forceSSL_secureSecure requests pass through

HealthCheck (1, in WaiExtra/HealthCheckEndpoint.lean)

TheoremWhat it proves
healthCheck_passthroughNon-matching paths pass through

ResourceT (1, in ResourceT/Resource.lean)

TheoremWhat it proves
releaseKey_eqa = b <-> a.id = b.id

Involution/Self-Inverse Properties (Summary)

TheoremModule
swap_swap (Tuple)Base/Data/Tuple
swap_swap (Either)Base/Data/Either
conjugate_conjugateBase/Data/Complex
flip_flipBase/Data/Function
curry_uncurryBase/Data/Tuple
neg_neg (Fixed)Base/Data/Fixed
toLower_idempotentWord8/Data/Word8
toUpper_idempotentWord8/Data/Word8

Proof-Carrying Structures (Invariants by Construction)

These are not standalone theorems but proof fields embedded in structures, enforced at construction time and erased at runtime:

StructureProof FieldInvariant
Ratioden_posDenominator > 0
RatiocoprimeNum and den are coprime
Pieceno_dotNo leading dot
Pieceno_slashNo embedded slash
SettingssettingsTimeoutPosTimeout > 0
SettingssettingsBacklogPosBacklog > 0
Socketstate (phantom)Socket state machine