fbpx
Wikipedia

KeY

The KeY tool is used in formal verification of Java programs. It accepts specifications written in the Java Modeling Language to Java source files. These are transformed into theorems of dynamic logic and then compared against program semantics that are likewise defined in terms of dynamic logic. KeY is significantly powerful in that it supports both interactive (i.e. by hand) and fully automated correctness proofs. Failed proof attempts can be used for a more efficient debugging or verification-based testing. There have been several extensions to KeY in order to apply it to the verification of C programs or hybrid systems. KeY is jointly developed by Karlsruhe Institute of Technology, Germany; Technische Universität Darmstadt, Germany; and Chalmers University of Technology in Gothenburg, Sweden and is licensed under the GPL.

KeY
Screenshot of KeY 1.4
Developer(s)Karlsruhe Institute of Technology, Technische Universität Darmstadt, Chalmers University of Technology
Stable release
2.10.0 / December 23, 2021 (2021-12-23)[1]
Written inJava
Operating systemLinux, Mac, Windows, Solaris
Available inEnglish
TypeFormal verification
LicenseGPL
Websitewww.key-project.org

Overview Edit

The usual user input to KeY consists of a Java source file with annotations in JML. Both are translated to KeY's internal representation, dynamic logic. From the given specifications, several proof obligations arise which are to be discharged, i.e. a proof has to be found. To this ends, the program is symbolically executed with the resulting changes to program variables stored in so-called updates. Once the program has been processed completely, there remains a first-order logic proof obligation. At the heart of the KeY system lies a first-order theorem prover based on sequent calculus, which is used to close the proof. Interference rules are captured in so called taclets which consist of an own simple language to describe changes to a sequent.

Java Card DL Edit

The theoretical foundation of KeY is a formal logic called Java Card DL. DL stands for Dynamic Logic. It is a version of a first-order dynamic logic tailored to Java Card programs. As such, it for example allows statements (formulas) like  , which intuitively says that the post-condition   must hold in all program states reachable by executing the Java Card program   in any state that satisfies the pre-condition  . This is equivalent to   in Hoare calculus if   and   are purely first order. Dynamic logic, however, extends Hoare logic in that formulas may contain nested program modalities such as  , or that quantification over formulas which contain modalities is possible. There is also a dual modality   which includes termination. This dynamic logic can be seen as a special multi-modal logic (with an infinite number of modalities) where for each Java block   there are modalities   and  .

Deduction component Edit

At the heart of the KeY system lies a first-order theorem prover based on a sequent calculus. A sequent is of the form   where   (assumptions) and   (propositions) are sets of formulas with the intuitive meaning that   holds true. By means of deduction, an initial sequent representing the proof obligation is shown to be constructible from just fundamental first-order axioms (such as equality  ).

Symbolic execution of Java code Edit

During that, program modalities are eliminated by symbolic execution. For instance, the formula   is logically equivalent to  . As this example shows, symbolic execution in dynamic logic is very similar to calculating weakest preconditions. Both   and   essentially denote the same thing – with two exceptions: Firstly,   is a function of some meta-calculus while   really is a formula of the given calculus. Secondly, symbolic execution runs through the program forward just as an actual execution would. To save intermediate results of assignments, KeY introduces a concept called updates, which are similar to substitutions but are only applied once the program modality has been eliminated. Syntactically, updates are consist of parallel (side-effect free) assignments written in curly braces in front of a modality. An example of symbolic execution with updates:   is transformed to   in the first step and to   in the second step. The modality then is empty and "backwards application" of the update to the postcondition yields a precondition where   could take any value.

Example Edit

Suppose one wants to prove that the following method calculates the product of some non-negative integers   and  .

int foo (int x, int y) {  int z = 0;  while (y > 0)  if (y % 2 == 0) {  x = x*2;  y = y/2;  } else {  y = y/2;  z = z+x;  x = x*2;  }  return z; } 

One thus starts the proof with the premise   and the to-be-shown conclusion  . Note that tableaux of sequent calculi are usually written "upside-down", i.e., the starting sequent appears at the bottom and deduction steps go upwards. The proof can be seen in the figure on the right.

 
A resulting proof tree

Additional features Edit

Symbolic Execution Debugger Edit

The Symbolic Execution Debugger visualizes the control flow of a program as a symbolic execution tree that contains all feasible execution paths through the program up to a certain point. It is provided as a plugin to the Eclipse development platform.

Test Case Generator Edit

KeY is usable as a model-based testing tool that can generate unit tests for Java programs. The model from which test data and the test case are derived consists of a formal specification (provided in JML) and a symbolic execution tree of the implementation under test which is computed by the KeY system.

Distribution and Variants of the KeY System Edit

KeY is free software written in Java and licensed under GPL. It can be downloaded from the project website in source; currently there are no pre-compiled binaries available. As another possibility, KeY can be executed directly via Java web start without the need for compilation and installation.

KeY-Hoare Edit

KeY-Hoare is built on top of KeY and features a Hoare calculus with state updates. State updates are a means of describing state transitions in a Kripke structure. This calculus can be seen as a subset to the one that is used in the main branch of KeY. Due to the simplicity of the Hoare calculus, this implementation is essentially meant to exemplify formal methods in undergraduate classes.

KeYmaera/KeYmaeraX Edit

KeYmaera [1] (previously called HyKeY) is a deductive verification tool for hybrid systems based on a calculus for the differential dynamic logic dL [2]. It extends the KeY tool with computer algebra systems like Mathematica and corresponding algorithms and proof strategies such that it can be used for practical verification of hybrid systems.

KeYmaera has been developed at the University of Oldenburg and the Carnegie Mellon University. The name of the tool was chosen as a homophone to Chimera, the hybrid animal from ancient Greek mythology.

KeYmaeraX [3] developed at the Carnegie Mellon University is the successor of KeYmaera. It has been completely rewritten.

KeY for C Edit

KeY for C is an adaption of the KeY System to MISRA C, a subset of the C programming language. This variant is no longer supported.

ASMKeY Edit

There is also an adaptation to use KeY for the symbolic execution of Abstract State Machines, that was developed at ETH Zürich. This variant is no longer supported.

References Edit

  1. ^ "Download – The KeY Project". key-project.org. Retrieved 2021-04-13.

Sources Edit

  • Verification of Object-Oriented Software: The KeY Approach. Bernhard Beckert, Reiner Hähnle, Peter H. Schmitt (Eds.). Springer, 2007. ISBN 978-3-540-68977-5.
  • Deductive Software Verification – The KeY Book: From Theory to Practice. Wolfgang Ahrendt, Bernhard Beckert, Richard Bubel, Reiner Hähnle, Peter H. Schmitt, Mattias Ulbrich (Eds.). Springer, 2016. ISBN 978-3-319-49812-6
  • A comparison of tools for teaching formal software verification. Ingo Feinerer and Gernot Salzer. Springer, 2008
  • Programming With Proofs: Language Based Approaches To Totally Correct Software. Aaron Stump. Verified Software: Theories, Tools, and Experiments, 2005.
  • High Assurance (for Security or Safety) and Free-Libre / Open Source Software (FLOSS). David Wheeler, 2009

External links Edit

  • Home page of the KeY project
  • KeYmaera home page
  • KeYmaeraX home page

this, article, multiple, issues, please, help, improve, discuss, these, issues, talk, page, learn, when, remove, these, template, messages, this, article, includes, list, general, references, lacks, sufficient, corresponding, inline, citations, please, help, i. This article has multiple issues Please help improve it or discuss these issues on the talk page Learn how and when to remove these template messages This article includes a list of general references but it lacks sufficient corresponding inline citations Please help to improve this article by introducing more precise citations August 2016 Learn how and when to remove this template message This article may be too technical for most readers to understand Please help improve it to make it understandable to non experts without removing the technical details March 2019 Learn how and when to remove this template message Learn how and when to remove this template message The KeY tool is used in formal verification of Java programs It accepts specifications written in the Java Modeling Language to Java source files These are transformed into theorems of dynamic logic and then compared against program semantics that are likewise defined in terms of dynamic logic KeY is significantly powerful in that it supports both interactive i e by hand and fully automated correctness proofs Failed proof attempts can be used for a more efficient debugging or verification based testing There have been several extensions to KeY in order to apply it to the verification of C programs or hybrid systems KeY is jointly developed by Karlsruhe Institute of Technology Germany Technische Universitat Darmstadt Germany and Chalmers University of Technology in Gothenburg Sweden and is licensed under the GPL KeYScreenshot of KeY 1 4Developer s Karlsruhe Institute of Technology Technische Universitat Darmstadt Chalmers University of TechnologyStable release2 10 0 December 23 2021 2021 12 23 1 Written inJavaOperating systemLinux Mac Windows SolarisAvailable inEnglishTypeFormal verificationLicenseGPLWebsitewww wbr key project wbr org Contents 1 Overview 2 Java Card DL 3 Deduction component 3 1 Symbolic execution of Java code 3 2 Example 4 Additional features 4 1 Symbolic Execution Debugger 4 2 Test Case Generator 5 Distribution and Variants of the KeY System 5 1 KeY Hoare 5 2 KeYmaera KeYmaeraX 5 3 KeY for C 5 4 ASMKeY 6 References 7 Sources 8 External linksOverview EditThe usual user input to KeY consists of a Java source file with annotations in JML Both are translated to KeY s internal representation dynamic logic From the given specifications several proof obligations arise which are to be discharged i e a proof has to be found To this ends the program is symbolically executed with the resulting changes to program variables stored in so called updates Once the program has been processed completely there remains a first order logic proof obligation At the heart of the KeY system lies a first order theorem prover based on sequent calculus which is used to close the proof Interference rules are captured in so called taclets which consist of an own simple language to describe changes to a sequent Java Card DL EditMain article Java Card The theoretical foundation of KeY is a formal logic called Java Card DL DL stands for Dynamic Logic It is a version of a first order dynamic logic tailored to Java Card programs As such it for example allows statements formulas like ϕ a ps displaystyle phi rightarrow alpha psi nbsp which intuitively says that the post condition ps displaystyle psi nbsp must hold in all program states reachable by executing the Java Card program a displaystyle alpha nbsp in any state that satisfies the pre condition ϕ displaystyle phi nbsp This is equivalent to ϕ a ps displaystyle phi alpha psi nbsp in Hoare calculus if ϕ displaystyle phi nbsp and ps displaystyle psi nbsp are purely first order Dynamic logic however extends Hoare logic in that formulas may contain nested program modalities such as a displaystyle alpha nbsp or that quantification over formulas which contain modalities is possible There is also a dual modality a displaystyle langle alpha rangle nbsp which includes termination This dynamic logic can be seen as a special multi modal logic with an infinite number of modalities where for each Java block a displaystyle alpha nbsp there are modalities a displaystyle alpha nbsp and a displaystyle langle alpha rangle nbsp Deduction component EditAt the heart of the KeY system lies a first order theorem prover based on a sequent calculus A sequent is of the form G D displaystyle Gamma vdash Delta nbsp where G displaystyle Gamma nbsp assumptions and D displaystyle Delta nbsp propositions are sets of formulas with the intuitive meaning that g G g d D d displaystyle bigwedge gamma in Gamma gamma rightarrow bigvee delta in Delta delta nbsp holds true By means of deduction an initial sequent representing the proof obligation is shown to be constructible from just fundamental first order axioms such as equality e e displaystyle e dot e nbsp Symbolic execution of Java code Edit During that program modalities are eliminated by symbolic execution For instance the formula x 0 x x 1 displaystyle x dot 0 rightarrow x x dot 1 nbsp is logically equivalent to x 0 x 0 displaystyle x dot 0 rightarrow x dot 0 nbsp As this example shows symbolic execution in dynamic logic is very similar to calculating weakest preconditions Both a ps displaystyle alpha psi nbsp and w p a ps displaystyle wp alpha psi nbsp essentially denote the same thing with two exceptions Firstly w p displaystyle wp nbsp is a function of some meta calculus while a ps displaystyle alpha psi nbsp really is a formula of the given calculus Secondly symbolic execution runs through the program forward just as an actual execution would To save intermediate results of assignments KeY introduces a concept called updates which are similar to substitutions but are only applied once the program modality has been eliminated Syntactically updates are consist of parallel side effect free assignments written in curly braces in front of a modality An example of symbolic execution with updates x 3 x x 1 x 4 displaystyle x 3 x x 1 x dot 4 nbsp is transformed to x 3 x x 1 x 4 displaystyle x 3 x x 1 x dot 4 nbsp in the first step and to x 4 x 4 displaystyle x 4 x dot 4 nbsp in the second step The modality then is empty and backwards application of the update to the postcondition yields a precondition where x displaystyle x nbsp could take any value Example Edit Suppose one wants to prove that the following method calculates the product of some non negative integers x displaystyle x nbsp and y displaystyle y nbsp int foo int x int y int z 0 while y gt 0 if y 2 0 x x 2 y y 2 else y y 2 z z x x x 2 return z One thus starts the proof with the premise x 0 y 0 displaystyle x geq 0 land y geq 0 nbsp and the to be shown conclusion z x y displaystyle z dot x cdot y nbsp Note that tableaux of sequent calculi are usually written upside down i e the starting sequent appears at the bottom and deduction steps go upwards The proof can be seen in the figure on the right nbsp A resulting proof treeAdditional features EditSymbolic Execution Debugger Edit The Symbolic Execution Debugger visualizes the control flow of a program as a symbolic execution tree that contains all feasible execution paths through the program up to a certain point It is provided as a plugin to the Eclipse development platform Test Case Generator Edit KeY is usable as a model based testing tool that can generate unit tests for Java programs The model from which test data and the test case are derived consists of a formal specification provided in JML and a symbolic execution tree of the implementation under test which is computed by the KeY system Distribution and Variants of the KeY System EditKeY is free software written in Java and licensed under GPL It can be downloaded from the project website in source currently there are no pre compiled binaries available As another possibility KeY can be executed directly via Java web start without the need for compilation and installation KeY Hoare Edit KeY Hoare is built on top of KeY and features a Hoare calculus with state updates State updates are a means of describing state transitions in a Kripke structure This calculus can be seen as a subset to the one that is used in the main branch of KeY Due to the simplicity of the Hoare calculus this implementation is essentially meant to exemplify formal methods in undergraduate classes KeYmaera KeYmaeraX Edit KeYmaera 1 previously called HyKeY is a deductive verification tool for hybrid systems based on a calculus for the differential dynamic logic dL 2 It extends the KeY tool with computer algebra systems like Mathematica and corresponding algorithms and proof strategies such that it can be used for practical verification of hybrid systems KeYmaera has been developed at the University of Oldenburg and the Carnegie Mellon University The name of the tool was chosen as a homophone to Chimera the hybrid animal from ancient Greek mythology KeYmaeraX 3 developed at the Carnegie Mellon University is the successor of KeYmaera It has been completely rewritten KeY for C Edit KeY for C is an adaption of the KeY System to MISRA C a subset of the C programming language This variant is no longer supported ASMKeY Edit There is also an adaptation to use KeY for the symbolic execution of Abstract State Machines that was developed at ETH Zurich This variant is no longer supported References Edit Download The KeY Project key project org Retrieved 2021 04 13 Sources EditVerification of Object Oriented Software The KeY Approach Bernhard Beckert Reiner Hahnle Peter H Schmitt Eds Springer 2007 ISBN 978 3 540 68977 5 Deductive Software Verification The KeY Book From Theory to Practice Wolfgang Ahrendt Bernhard Beckert Richard Bubel Reiner Hahnle Peter H Schmitt Mattias Ulbrich Eds Springer 2016 ISBN 978 3 319 49812 6 A comparison of tools for teaching formal software verification Ingo Feinerer and Gernot Salzer Springer 2008 Programming With Proofs Language Based Approaches To Totally Correct Software Aaron Stump Verified Software Theories Tools and Experiments 2005 High Assurance for Security or Safety and Free Libre Open Source Software FLOSS David Wheeler 2009External links Edit nbsp Wikimedia Commons has media related to KeY program verification tool Home page of the KeY project KeYmaera home page KeYmaeraX home page Retrieved from https en wikipedia org w index php title KeY amp oldid 1153170453, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.