450 likes | 563 Vues
Comparing Semantic and Syntactic Methods in Mechanized Proof Frameworks. C.J. Bell, Robert Dockins , Aquinas Hobor , Andrew W. Appel , David Walker. In the last decade, dozens of researchers have been investigating proof-carrying code (PCC) These researchers have split into two camps:
E N D
Comparing Semantic and Syntactic Methods in Mechanized Proof Frameworks C.J. Bell, Robert Dockins, Aquinas Hobor, Andrew W. Appel, David Walker
In the last decade, dozens of researchers have been investigating proof-carrying code (PCC) • These researchers have split into two camps: • those using syntactic proof methods • those using semantic proof methods
List-Machine Benchmark • We want to be able to investigate different proof methodologies, such as syntactic and semantic type systems • The list-machine benchmark is • assembly language • operational semantics • type system specification • two implementaions of a type system • This benchmark is • simple, so that it is easy to understand • modular, so that it is flexible • publically available at • http://www.cs.princeton.edu/~appel/listmachine/2.0
Changes to the List-Machine Benchmark for 2.0 • Implemented only in Coq • Added a semantic type system • Reorganized the framework
Outline • Introduction • Organization of the List-Machine framework • Extend the List Machine with fault tolerance • Semantic and syntactic methods in large systems
Modules Type System Proves: Π⊢blocksΨ→ safe Ψ Typechecking Algorithm check(Π,Ψ) = true Typechecking Algorithm Type System • Type System Specification • type operators • definitions of typing rules • statement of safety • Π⊢blocksΨ→ safe Ψ Typechecker Soundness Proof check(Π,Ψ) = true →Π⊢blocksΨ Type System Specification Typechecker Soundness Proof
Type System Proves: Π⊢blocksΨ→ safe Ψ Typechecking Algorithm check(Π,Ψ) = true • Type System Specification • type operators • definitions of typing rules • statement of safety • Π⊢blocksΨ→ safe Ψ Typechecker Soundness Proof check(Π,Ψ) = true →Π⊢blocksΨ
Syntactic Type System Type System Specification • Type operators defined inductively • Typing rules defined inductively • The type system is proven sound using metatheorems (progress & preservation) using induction over definitions. Syntactic Soundness Proof Π⊢blocksΨ→ safe Ψ
Semantic Type System Type System Specification Semantic Soundness Proof Π⊢blocksΨ→ safe Ψ List Machine Hoare Logic Π⊢blocksΨ Π;Ψ⊢blockι:P Π;Ψ⊢instr P{ι}Q Modal Specification Logic reusable Modal Model Library
Outline • Introduction • Organization of the List-Machine framework • Extend the List Machine with fault tolerance • Semantic and syntactic methods in large systems
Fault Tolerance • Extend the List-Machine framework to provide fault tolerance • Requires non-trivial modifications to the framework • Demonstrates the flexibility of the framework
Fault Model • Single Event Upset • assume a fault will occur at most once • A fault may change just one register’s value to any other value.
Is the modified code fault-tolerant? • Fault tolerance becomes part of the safety property • Type system ensures proper use of colors • Model possible occurrences of faults
Modify the Operational Semantics Branch instructions require green and blue computations to agree
Outline • Introduction • Organization of the List-Machine framework • Extend the List Machine with fault tolerance • Semantic and syntactic methods in large systems
How Semantic and Syntactic Methods Scale Princeton Foundational Proof-Carrying Code (FPCC) Vs. Carnegie Mellon ConCert project FPCC :: Semantic ConCert :: Syntactic
Common Traits • Include a TAL for ML compiled to machine code • Goal: guarantee a memory property for untrusted code • Written in Twelf • Industrial-strength TALs • Large systems
Composition Checker – theorem checker for FPCC and a metatheorem checker for ConCert Machine – SPARC or x86 definitions Logic – example: definition of modular arithmatic Trusted Computing Base Theorems – statement of the safety property Proof T + L + M << P
Token count of TCB components The TCBs are equivalent in size except for the Checker
Interface Safety Requires • updating the policy • moving the type system from Proofto Theorem • now part of the TCB Should the type system be semantic or syntactic?
Scaling Law Semantic: new definition per type constructor Syntactic: new definition per expression constructor Toy systems have few expression constructors…
Real systems have more expression constructors than type constructors. semantic methods require fewer definitions Is the average type definition larger than the average typing rule?
In toy systems, typing rules are simple... |- stmt_prim_lbladd_ADD_imm: judge_stmt (e_prim A (p_lbladd V1 (val_diff L0 Lab I2))) Prog L CCEnv AENV KL Ps Phi L' CCEnv AENV KL Ps' Phi' <- regbind A At Prog <- targetreg At Ar <- regbind_valProg V1 Vt <- realregVtVr <- diff_valueProg (val_diff L0 Lab I2) Vc <- imm13 Vc (c Vimm13) <- valueTyProg KL Phi V1 (offset I1 (int pi= (addr Lab))) <- valueTyProg KL Phi (val_diff L0 Lab I2) (offset I2 (diff L0 Lab)) <- check_lbladd_offset I1 I2 <- num_add I1 I2 I1+I2 <- venv_add\ Prog A (offset I1+I2 (int pi= (addr L0))) Phi Phi' <- decode_list L L' Ps Ps' (instr_ADDVr (inject_imode Vimm13) Ar) = ...
How does this balance in FPCC & ConCert? • FPCC’s semantic definitions are half the size of syntactic definitions for FPCC • This will become even more pronounced according to the scaling law if the compiler wishes to generate more instructions.
Conclusion • Introduction • Organization of the List-Machine framework • Extend the List Machine with fault tolerance • Semantic and syntactic methods in large systems
Modified Operational Semantics w = (n,ρ,a) w = (n,ρ,a,ρ’,κ) • ρ’ – FT register store • κ – color store (and equivalent for the syntactic system)
List-Machine Benchmark 2.0 • Easily extended • Facilitates small scale comparisons between many proof methods (semantic and syntactic).
Princeton’s Foundational Proof Carrying Code (FPCC)vsCarnegie Mellon’s ConCert • Compare how type systems scale between semantic and syntactic proof methods
Type System Specification Type System Specification Typechecker Soundness Proof Typechecker Soundness Proof check(Π,Ψ) = true → Π⊢blocksΨ Typechecking Algorithm Type System Type System Π⊢blocksΨ→ safe Ψ Typechecking Algorithm check(Π,Ψ) = true
Type System Specification • type operators • definitions of typing rules • statement of safety • Π⊢blocksΨ→ safe Ψ Typechecker Soundness Proof check(Π,Ψ) = true →Π⊢blocksΨ Type System Proves: Π⊢blocksΨ→ safe Ψ Typechecking Algorithm check(Π,Ψ) = true