Invariant-based programming: Difference between revisions

Content deleted Content added
SmackBot (talk | contribs)
m Date/fix the maintenance tags
Uxfifig (talk | contribs)
Added short description
Tags: Mobile edit Mobile app edit Android app edit App suggested edit App description add
 
(16 intermediate revisions by 13 users not shown)
Line 1:
{{Short description|Methodology of programming}}
{{Orphan|date=October 2006}}
'''Invariant -based programming'''<ref>Back, Ralph-Johan: [https://hal.archives-ouvertes.fr/hal-00477903/document Invariant Based Programming: Basic approach and Teaching Experience], Formal Aspects of Computing, 14 February 2008, ISSN 0934-5043 (Print) 1433-299X (Online)</ref> is a programming methodology where [[Formal specification|specifications]] and [[Invariant (computer science)|invariants]] are written before the actual program statements. Writing down the invariants during the programming process has a number of advantages: it requires the programmer to make histheir intentions about the program behavior explicit before actually implementing it, and invariants can be evaluated dynamically during execution to catch common programming errors. Furthermore, if strong enough, invariants can be used to prove the [[Formal verification|correctness]] of the program based on the [[Formal semantics of programming languages|formal semantics]] of program statements. A combined programming and specification language, connected to a powerful formal proof system, will generally be required for full verification of non-trivial programs. In this case a high degree of automation of proofs is also possible.
 
In most existing programming languages the main organizing structures are control flow blocks such as [[For loop|<ttcode>for</ttcode> loops]], [[While loop|<ttcode>while</ttcode> loops]] and [[If statement|<ttcode>if</ttcode> statements]]. Such languages may not be ideal for invariants-first programming, since they force the programmer to make decisions about control flow before writing the invariants. Furthermore, most programming languages do not have good support for writing specifications and invariants, since they lack quantifier operators and one can typically not express higher order properties.
 
The idea of developing the program together with its proof originated from [[Edsger Dijkstra|E.W. Dijkstra]]. Actually writing invariants before program statements has been considered in a number of different forms by M.H. van Emden, [[John C. Reynolds|J.C. Reynolds]] and [[Ralph-Johan Back|R-J Back]].
 
== See also ==
[[Category:Software design patterns]]
* [[Eiffel (programming language)]]
 
== References ==
<references/>
 
[[Category:Formal methods]]
[[Category:Programming paradigms]]