Remix.run Logo
Functional Data Structures and Algorithms: a Proof Assistant Approach(fdsa-book.net)
48 points by SchwKatze 7 hours ago | 6 comments
dwohnitmok 3 hours ago | parent | next [-]

IIRC this book unfortunately only proves correctness directly and not runtime. Its runtime proofs are based off an abstraction of the algorithm suitable for direct manipulation by proofs rather than the actual implementation in code.

Does anybody know of any languages that let you prove properties about the runtime of a function directly implemented in the language?

yuppiemephisto 2 hours ago | parent [-]

https://markushimmel.de/blog/my-first-verified-imperative-pr...

Lean

saithound an hour ago | parent [-]

Verification of "runtimes" in the sense of GP is not mentioned at all in the article you linked.

zkmon 3 hours ago | parent | prev [-]

Some algorithms such as binary search give an incorrect view of the overall cost. The search has a prerequisite of sorting. So, the assumption is, the data is sorted once, and searched several times, making the sorting cost insignificant.

What if the data is used for only a single lookup? For this case, actually a sequential search would have lower cost compared to sorting and binary search. Infact, sequential search may beat sorting and binary search for upto about 100 lookups. So I think it is important to consider overall cost.

fiddlerwoaroof 3 hours ago | parent [-]

But how the data got sorted is irrelevant to the speed of the algorithm: for example, you could use binary search as part of an algorithm to find the insertion point of a new element in an always sorted data structure, meaning that sorting the data is never necessary.

zkmon 2 hours ago | parent [-]

The overall journey matters. For example, for some flight journeys, the flight-time is only a fraction of the overall time taken by the journey, which could makes it faster if you use road or rail transport. Flight speed doesn't matter.