File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -338,19 +338,10 @@ public export
338338data ValidPort : Nat -> Type where
339339 MkValidPort : (p : Nat ) -> (0 _ : LTE p 65535) -> ValidPort p
340340
341- ||| OWED: Runtime comparison `p <= 65535 = True` implies the `LTE p
342- ||| 65535` proof witness. Operationally this is the well-known
343- ||| reflective lemma `Data.Nat.lteReflectsLTE : (n, m : Nat) -> n <= m
344- ||| = True -> LTE n m`. Held back by Idris2 0.8.0's `Data.Nat` not
345- ||| exposing this as a definitional/`%reducible` rewrite — the stdlib
346- ||| proof exists (`Decidable.Order.fromLte`-family) but the chain
347- ||| through `Ord Nat`'s `<=` implementation does not reduce via `Refl`
348- ||| for an abstract `p`. Discharge by importing the existing stdlib
349- ||| lemma and rewriting (this is a stdlib-plumbing OWED, not a
350- ||| fundamental gap). Consumed by `validatePort` to construct
351- ||| `MkValidPort`'s erased proof argument.
341+ ||| DISCHARGED via `Data.Nat.lteReflectsLTE` stdlib lemma.
352342export
353- 0 lteFrom65535Check : (p : Nat ) -> (p <= 65535 = True) -> LTE p 65535
343+ lteFrom65535Check : (p : Nat ) -> (p <= 65535 = True) -> LTE p 65535
344+ lteFrom65535Check _ prf = Data . Nat . lteReflectsLTE p 65535 prf
354345
355346||| Validate port is in range
356347public export
You can’t perform that action at this time.
0 commit comments