From C to Interaction Trees
Specifying, Testing and Verifying a Networked Server
January 14, 2019 (CPP) Nicolas Koh, Yao Li, Yishuai Li, Li-yao Xia Lennart Beringer, Wolf Honoré, William Mansky Benjamin C. Pierce, Steve Zdancewic
1
to Interaction Trees Nicolas Koh, Yao Li, Yishuai Li, Li-yao Xia - - PowerPoint PPT Presentation
Specifying, Testing and Verifying a Networked Server From C to Interaction Trees Nicolas Koh, Yao Li, Yishuai Li, Li-yao Xia Lennart Beringer, Wolf Honor, William Mansky Benjamin C. Pierce, Steve Zdancewic January 14, 2019 (CPP) 1
Specifying, Testing and Verifying a Networked Server
January 14, 2019 (CPP) Nicolas Koh, Yao Li, Yishuai Li, Li-yao Xia Lennart Beringer, Wolf Honoré, William Mansky Benjamin C. Pierce, Steve Zdancewic
1
01011...
2
01011...
3
01011...
4
5
6
7
8
Specification
Observable behavior by clients
Implementation
Observable behavior by clients
*: concepts defined in the paper 9
Written in Coq Written in C
implements validates* refines* network-refines* 10
assumed by
*: concepts defined in the paper
Written in Coq Written in C
implements validates* refines* network-refines* 11 network-refines*
assumed by
*: concepts defined in the paper
Written in Coq Written in C testing Different abstraction levels Different spec. styles
Interaction trees
ReadBit WriteBit 0 ReadBit Ret 1 b2 : bit tt Ret b2 1 Shorthand notation for two or more branches
12 (aka. Free monads) One branch for each possible result Inductive ioE : Type -> Type := | ReadBit : ioE bit | WriteBit : bit -> ioE unit . Type of effects ioE: Result type
13
Effect Continuation
(aka. Free monads)
Type of effects (e.g., ioE) Type of results
implements validates* refines* network-refines* 14 network-refines*
assumed by
*: concepts defined in the paper
Written in Coq Written in C testing Different abstraction levels Different spec. styles
Interaction trees
Simplified version (see paper)
15
implements validates* refines* network-refines* 16 network-refines*
assumed by
*: concepts defined in the paper
Written in Coq Written in C testing
Interaction trees
17
Hoare triple: { pre1 * … * preN } C_program { post1 * … * postN }
Separating conjunction Assertions on C memory
Implementation model (itree) C implementation Interactions allowed by the environment
Simplified triples (see paper)
Example of a networked C program with its implementation model: { ITree(impl_model) * … } C_program { … }
19
{ ITree(impl_model) } C_prog { … }
∪I
20
Scale up: Swap server -> HTTP Server Complete connection Improve proof and testing techniques New library https://github.com/DeepSpec/InteractionTrees Add more interfaces: filesystem, encryption…