modular compositional and sound verification of the input
play

Modular, compositional and sound verification of the input/output - PowerPoint PPT Presentation

Modular, compositional and sound verification of the input/output behavior of programs Willem Penninckx, Bart Jacobs, Frank Piessens Department of Computer Science, KU Leuven, Belgium DRADS 2014 Table of Contents Introduction Requirements


  1. Modular, compositional and sound verification of the input/output behavior of programs Willem Penninckx, Bart Jacobs, Frank Piessens Department of Computer Science, KU Leuven, Belgium DRADS 2014

  2. Table of Contents Introduction Requirements Specifying I/O behaviour Wrapping up

  3. Table of Contents Introduction Requirements Specifying I/O behaviour Wrapping up

  4. Popular way to prove software properties ◮ Theorem: ◮ Possible proofs: ◮ When is a proof correct?

  5. Popular way to prove software properties ◮ Theorem: Informal: returns a bigger number ◮ Possible proofs: ◮ When is a proof correct?

  6. Popular way to prove software properties ◮ Theorem: Informal: returns a bigger number Formal: ◮ Possible proofs: ◮ When is a proof correct?

  7. Popular way to prove software properties ◮ Theorem: Informal: returns a bigger number Formal: if x > y then result := x else result := y ◮ Possible proofs: ◮ When is a proof correct?

  8. Popular way to prove software properties ◮ Theorem: Informal: returns a bigger number Formal: if x > y then result := x else result := y { result > = x ∧ result > = y } ◮ Possible proofs: ◮ When is a proof correct?

  9. Popular way to prove software properties ◮ Theorem: Informal: returns a bigger number Formal: {} if x > y then result := x else result := y { result > = x ∧ result > = y } ◮ Possible proofs: ◮ When is a proof correct?

  10. Popular way to prove software properties ◮ Theorem: Informal: returns a bigger number Formal: {} if x > y then result := x else result := y { result > = x ∧ result > = y } ◮ Possible proofs: No time to explain! ◮ When is a proof correct?

  11. Popular way to prove software properties ◮ Theorem: Informal: returns a bigger number Formal: {} if x > y then result := x else result := y { result > = x ∧ result > = y } ◮ Possible proofs: No time to explain! ◮ When is a proof correct? No time to explain!

  12. { x = 2 } x := x + 1 { x = 3 } ◮ � �� � � �� � state before program starts state after program terminates ◮ People added support for... ◮ Concurrency ◮ Dynamic memory allocation ◮ ...

  13. { x = 2 } x := x + 1 { x = 3 } ◮ � �� � � �� � state before program starts state after program terminates ◮ People added support for... ◮ Concurrency ◮ Dynamic memory allocation ◮ ... ◮ Typically verified: (memory) state.

  14. { x = 2 } x := x + 1 { x = 3 } ◮ � �� � � �� � state before program starts state after program terminates ◮ People added support for... ◮ Concurrency ◮ Dynamic memory allocation ◮ ... ◮ Typically verified: (memory) state. ◮ End-users care about: what’s on their screen.

  15. { x = 2 } x := x + 1 { x = 3 } ◮ � �� � � �� � state before program starts state after program terminates ◮ People added support for... ◮ Concurrency ◮ Dynamic memory allocation ◮ ... ◮ Typically verified: (memory) state. ◮ End-users care about: what’s on their screen. ◮ = > Add support to verify Input/Output (I/O)

  16. Table of Contents Introduction Requirements Specifying I/O behaviour Wrapping up

  17. {...} main(){ code; code; code; code; code; code; code; code; ... code; } {...}

  18. {...} {...} {...} {...} main(){ main(){ f1(){ f1(){ code; f1(); f3(); f3(); code; f2(); f4(); f4(); code; } } } code; {...} {...} {...} code; code; {...} {...} code; f2(){ f2(){ code; f4(); f4(); ... f5(); f5(); code; } } } {...} {...} {...}

  19. {...} {...} {...} {...} main(){ main(){ f1(){ f1(){ code; f1(); f3(); f3(); code; f2(); f4(); f4(); code; } } } code; {...} {...} {...} code; code; {...} {...} code; f2(){ f2(){ code; Compositionality f4(); f4(); ... f5(); f5(); code; } } } {...} {...} {...}

  20. {...} {...} {...} {...} main(){ main(){ f1(){ f1(){ code; f1(); f3(); f3(); code; f2(); f4(); f4(); code; } } } code; {...} {...} {...} code; code; di ff erent {...} {...} developers code; f2(){ f2(){ code; f4(); f4(); ... f5(); f5(); Modularity code; } } } {...} {...} {...}

  21. {specs specs specs specs} main(){ ... } { specs specs specs specs}

  22. {specs specs spec1= specs spec3 { spec1 specs} * spec4 * spec2} main(){ main(){ ... ... } } { specs spec2= specs spec4 specs * spec5 specs} .

  23. {specs specs spec1= specs spec3 { spec1 specs} * spec4 * spec2} main(){ main(){ ... ... } } { specs spec2= specs Compositionality spec4 specs * spec5 specs} .

  24. {specs specs spec1= specs spec3 { spec1 specs} * spec4 * spec2} main(){ main(){ ... ... } } { di ff erent developers specs spec2= specs spec4 specs * spec5 Modularity specs} .

  25. Requirements ◮ Compositionality. ◮ e.g. define I/O action download on top of tcp write and file write , etc.

  26. Requirements ◮ Compositionality. ◮ e.g. define I/O action download on top of tcp write and file write , etc. ◮ Modularity ◮ e.g. combine independent I/O action tcp write with file write

  27. Requirements ◮ Compositionality. ◮ e.g. define I/O action download on top of tcp write and file write , etc. ◮ Modularity ◮ e.g. combine independent I/O action tcp write with file write ◮ Non-terminating programs (part WIP) ◮ e.g. {} while true ... { these I/O happened } : postcondition useless

  28. Requirements ◮ Compositionality. ◮ e.g. define I/O action download on top of tcp write and file write , etc. ◮ Modularity ◮ e.g. combine independent I/O action tcp write with file write ◮ Non-terminating programs (part WIP) ◮ e.g. {} while true ... { these I/O happened } : postcondition useless ◮ Actions depend on outcome of actions ◮ e.g. read file containing filenames to read ◮ ...

  29. Table of Contents Introduction Requirements Specifying I/O behaviour Wrapping up

  30. By example

  31. By example ◮ {} ... {} ◮ No I/O allowed

  32. By example ◮ {} ... {} ◮ No I/O allowed ◮ { time ( t 1 ) } ... { time ( t 1 ) } ◮ No I/O allowed ◮ A time like t 1 ≈ a point in time. ◮ Doing I/O “increases” time

  33. By example ◮ {} ... {} ◮ No I/O allowed ◮ { time ( t 1 ) } ... { time ( t 1 ) } ◮ No I/O allowed ◮ A time like t 1 ≈ a point in time. ◮ Doing I/O “increases” time ◮ { time ( t 1 ) ⋆ print io( t 1 , ‘h ′ , t 2 ) } print char(‘h ′ ); { time ( t 2 ) } ◮ Doing print char(‘h’) ◮ requires a permission print io( t 1 , ‘h ′ , t 2 ) ◮ requires a time ( t 1 ) ◮ disposes the permission ◮ “increases” the time to t 2

  34. ◮ { time ( t 1 ) ⋆ print io( t 1 , ‘h ′ , t 2 ) ⋆ print io( t 2 , ‘i ′ , t 3 ) } ... { time ( t 3 ) } ◮ Can print “hi”, “h”, “”. ◮ If terminates: can only print “hi”. ◮ Can not print: “x”, “i”, “ih”, ...

  35. ◮ { time ( t 1 ) ⋆ print io( t 1 , ‘h ′ , t 2 ) ⋆ print io( t 2 , ‘i ′ , t 3 ) } ... { time ( t 3 ) } ◮ Can print “hi”, “h”, “”. ◮ If terminates: can only print “hi”. ◮ Can not print: “x”, “i”, “ih”, ... ◮ { time ( t 1 ) ⋆ print io( t 1 , ‘h ′ , t 2 ) ⋆ print io( t 1 , ‘i ′ , t 2 ) } ... { time ( t 2 ) } ◮ Can print “h”, “i”, “”. ◮ If terminates: has printed either “h” or “i”. ◮ Can not print: “x”, “hi”, ...

  36. Defining new I/O actions ◮ predicate print string io( t 1 , str , t 2 ) = if str = nil then t 1 = t 2 else ( print io( t 1 , head( str ) , t between ) ⋆ print string io( t between , tail( str ) , t 2 ) )

  37. Defining new I/O actions ◮ predicate print string io( t 1 , str , t 2 ) = if str = nil then t 1 = t 2 else ( print io( t 1 , head( str ) , t between ) ⋆ print string io( t between , tail( str ) , t 2 ) ) ◮ Build actions using actions (compositionality)

  38. Defining new I/O actions ◮ predicate print string io( t 1 , str , t 2 ) = if str = nil then t 1 = t 2 else ( print io( t 1 , head( str ) , t between ) ⋆ print string io( t between , tail( str ) , t 2 ) ) ◮ Build actions using actions (compositionality) ◮ { time ( t 1 ) ⋆ print string io( t 1 , “hello world! ′′ , t 2 ) } ... { time ( t 2 ) }

  39. Linking arguments ◮ { time ( t 1 ) ⋆ read string io( t 1 , str , t 2 ) ⋆ print string io( t 2 , str , t 3 ) } ... { time ( t 3 ) }

  40. Unconstrained order/interleaving ◮ { time ( t 2 ) ⋆ time ( t 3 ) ⋆ read string io( t 2 , str , t 4 ) ⋆ print string io( t 3 , str , t 5 ) } ... { time ( t 4 ) ⋆ time ( t 5 ) } ◮ Allows buffering of any size.

  41. Unconstrained order/interleaving ◮ { time ( t 2 ) ⋆ time ( t 3 ) ⋆ read string io( t 2 , str , t 4 ) ⋆ print string io( t 3 , str , t 5 ) } ... { time ( t 4 ) ⋆ time ( t 5 ) } ◮ Allows buffering of any size. ◮ How to get two times ( time ( t 2 ) and time ( t 3 ))?

  42. Unconstrained order/interleaving ◮ { time ( t 1 ) ⋆ split ( t 1 , t 2 , t 3 ) ⋆ read string io( t 2 , str , t 4 ) ⋆ print string io( t 3 , str , t 5 ) ⋆ join ( t 4 , t 5 , t 6 ) } ... { time ( t 4 ) } ◮ split ( t 1 , t 2 , t 3 ) consumes time ( t 1 ) and yields time ( t 2 ) and time ( t 3 ).

  43. Table of Contents Introduction Requirements Specifying I/O behaviour Wrapping up

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend