24
Small Proof Witnesses for LF Susmit Sarkar Brigitte Pientka Karl Crary

Small Proof Witnesses for LF

  • Upload
    merlin

  • View
    27

  • Download
    0

Embed Size (px)

DESCRIPTION

Small Proof Witnesses for LF. Susmit Sarkar Brigitte Pientka Karl Crary. Motivation : Untrusted Code. Want : execute untrusted code. Internet. Code Consumer. Code. Solution : Certified Code. Solution : Certificate with Code Proof Carrying Code [Necula]. Internet. - PowerPoint PPT Presentation

Citation preview

Page 1: Small Proof Witnesses for LF

Small Proof Witnesses for LF

Susmit Sarkar

Brigitte Pientka

Karl Crary

Page 2: Small Proof Witnesses for LF

Motivation : Untrusted Code

Want : execute untrusted code

Code

Consumer

Internet

Internet

Code

Page 3: Small Proof Witnesses for LF

Solution : Certified Code

Solution : Certificate with Code

Proof Carrying Code [Necula]

Code

Consumer

Internet

Internet

Code

Certificate

Page 4: Small Proof Witnesses for LF

What is a Certificate? Prove Code is Safe Easily checkable by Code Consumer

First Answer : Proof in a Logic

Page 5: Small Proof Witnesses for LF

Logical Framework (LF) Uniformly represent logics (and proofs) Well-studied properties Used extensively [PCC, FPCC, TALT,…]

Problem : Proofs are BIG!

Page 6: Small Proof Witnesses for LF

Use Proof Search? Ask Code Consumer to search for proof

Caveat : Higher-order Logic Programming

Advantage : Zero proof size Disadvantage : Large time required

Page 7: Small Proof Witnesses for LF

Idea : Proof Search with Guidance Do Proof Search Look at proof to resolve Don’t Know

choices

All we really require are the choices Encode as “oracle” [Necula and Rahul]

Page 8: Small Proof Witnesses for LF

What is a Certificate? … contd. New Answer : Sequence of choices made

(as a position number from available choices)

Can be efficiently encoded Time to check sufficiently low

Page 9: Small Proof Witnesses for LF

Our Contributions Oracles for higher-order logic programming Handle the entire LF language (as

implemented in Twelf) Previous efforts [Necula et al, Wu et al] restricted

to a subset Generic oracle creation/verification for a

variety of logics Efficient Term-Indexing strategies

Page 10: Small Proof Witnesses for LF

Rest of Talk Higher-order Logic Programming

Challenges

Instrumentation to generate / verify oracle Experimental results

Page 11: Small Proof Witnesses for LF

Higher-order Logic Programming Goals may have nested implications and

universal quantifiers

Depth-First Search (like Prolog) New Issues:

Dynamic Assumptions added (Scoping rules) Term language is higher-order (Requires Higher Order

Unification) Efficient Term Indexing strategies needed

Page 12: Small Proof Witnesses for LF

Proof Search (producing proof) Have set of dynamic assumptions Case : Goal is 8 x. G :

Solve G [a/x] in (“a” is new parameter) Get proof M [a/x] for subgoal

Proof for goal is x. M

Page 13: Small Proof Witnesses for LF

Proof Search … contd. Case: Goal is G1 ¾ G2 :

Add clause u:G1 to Solve for G2 under this extended set of

assumptions Get proof M for subgoal

Proof for goal is u. M

Page 14: Small Proof Witnesses for LF

Proof Search … contd.[2] Case : Goal is Atomic

Choose clause C (from program or dynamic assumptions) matching goal

Solve subgoals of clause Get proof M for subgoals

Proof for goal is C . M records C used, and M for rest

Page 15: Small Proof Witnesses for LF

Higher-Order Term Indexing Term Indexing strategy important

Reduction of choices is efficient for oracle size

Our strategy : Higher-order Substitution Trees [Pientka]

Generalize Substitution Trees

Page 16: Small Proof Witnesses for LF

Example: A Natural Deduction Logic alli : prov (forall x. P x) <- ( x. prov (P x)).alle : prov (P T) <- prov (forall x. P x).impi : prov (imp P1 P2) <- (prov P1 -> prov P2).impe : prov P <- prov (imp P1 P) <- prov P1.

Page 17: Small Proof Witnesses for LF

Example Query

` prov (forall y. (imp (forall x. p x) (p y)))

` a. prov (imp (forall x. p x) (p a))

` prov (imp (forall x. p x) (p a))

u:prov (forall x. p x)` prov (p a)

u:prov (forall x. p x) ` prov (forall x. p x)

` prov (forall x. p x) ¾ prov (p a)

alli alle impe

alle impiimpe

alle impeu

(1/3 )

(2/3 )

(1/3 )

Page 18: Small Proof Witnesses for LF

Oracle Generation / Verification Generating Oracle assumes Proof Term

available Verifying Oracle assumes Oracle available

Follow complementary procedures Similar to proof search procedure sketched out

Page 19: Small Proof Witnesses for LF

Instrumented Proof Search Case : Goal is 8 x. G :

Solve [a/x] G No choice to be made

Case : Goal is G1 ¾ G2 : Solve G2 in extended set of dynamic

assumptions No choice to be made

Page 20: Small Proof Witnesses for LF

Atomic Goal … Generation Case : Goal is atomic

Choose clause C. Solve its subgoals During Generation,

Look at proof term (records choice) Count choices available Oracle records number of choice made

Page 21: Small Proof Witnesses for LF

Atomic Goal … Verification Case : Goal is atomic

Choose clause C. Solve its subgoals During Verification,

Look at oracle (records positional number of choice)

Count choices available Take indicated choice

Page 22: Small Proof Witnesses for LF

Results : TimeProof Search

Time (sec)Witness

Checking Time (sec)

Speedup

Refinement Multiplication 5.81 1.10 5.3

Square12.55 1.85 6.8

FPCC Closure12.26 0.47 26.1

Increment11.55 0.70 18.3

Page 23: Small Proof Witnesses for LF

Results : Proof SizeProof Size (bytes)

Witness Size (bytes)

Size Reduction

Refinement Multiplication15,654 169 92.6

Square25,303 242 104.6

FPCC Closure201,910 638 316.5

Increment441,965 703 628.7

Page 24: Small Proof Witnesses for LF

Conclusions Instrumented a proof search procedure to

produce / verify small witnesses Handle all of LF (higher-order logic

programming required) Experimental Study of technique