Proof Theory and Its Role in Programming Language Research - - PowerPoint PPT Presentation

proof theory and its role in programming language research
SMART_READER_LITE
LIVE PREVIEW

Proof Theory and Its Role in Programming Language Research - - PowerPoint PPT Presentation

Proof Theory and Its Role in Programming Language Research Frank Pfenning Carnegie Mellon University January 14, 2015 PLMW 2015, Mumbai 1 How Do


slide-1
SLIDE 1

Proof ¡Theory ¡and ¡Its ¡Role ¡in ¡ Programming ¡Language ¡Research ¡

Frank ¡Pfenning ¡ Carnegie ¡Mellon ¡University ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 1 ¡

slide-2
SLIDE 2

How ¡Do ¡We ¡Write ¡Correct ¡Programs ¡

  • We ¡rarely ¡do, ¡but ¡… ¡
  • In ¡pracLce, ¡programming ¡and ¡informal ¡

reasoning ¡go ¡hand ¡in ¡hand ¡

– OperaLonal: ¡how ¡does ¡the ¡program ¡execute ¡ – Logical: ¡what ¡does ¡it ¡accomplish ¡

  • Decompose ¡into ¡parts ¡(e.g., ¡funcLons, ¡

modules) ¡so ¡we ¡can ¡reason ¡locally ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 2 ¡

slide-3
SLIDE 3

Coherence ¡

  • OperaLonal ¡and ¡logical ¡views ¡should ¡be ¡

coherent ¡

  • And ¡both ¡should ¡be ¡as ¡simple ¡as ¡possible ¡
  • Composed ¡of ¡parts ¡we ¡can ¡reason ¡about ¡

separately ¡as ¡much ¡as ¡possible ¡

– Not ¡just ¡for ¡programs, ¡but ¡for ¡the ¡language ¡itself ¡

  • Logic ¡is ¡inevitable ¡— ¡why ¡wait? ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 3 ¡

slide-4
SLIDE 4

Codesign ¡of ¡ComputaLon ¡and ¡Logic ¡

  • Fortunately, ¡logic ¡is ¡computaLonal ¡
  • Key: ¡creaLng ¡a ¡mutual ¡fit ¡— ¡requires ¡considerable ¡

ingenuity, ¡persistence, ¡luck ¡

– RunLme ¡code ¡generaLon ¡and ¡?? ¡ – ParLal ¡evaluaLon ¡and ¡?? ¡ – Dead ¡code ¡eliminaLon ¡and ¡?? ¡ – Distributed ¡computaLon ¡and ¡?? ¡ – Message-­‑passing ¡concurrency ¡and ¡?? ¡ – ?? ¡and ¡lax ¡logic ¡ – ?? ¡and ¡temporal ¡logic ¡ – ?? ¡and ¡epistemic ¡logic ¡ – ?? ¡and ¡ordered ¡logic ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 4 ¡

slide-5
SLIDE 5

Key ¡Ingredients ¡

  • Judgments, ¡leading ¡to ¡proposiLons ¡
  • Basic ¡style ¡of ¡proof ¡system ¡

– Natural ¡deducLon ¡ – Sequent ¡calculus ¡ – AxiomaLc ¡proof ¡system ¡ – Binary ¡entailment ¡

  • Proof ¡reducLon ¡and ¡equality ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 5 ¡

slide-6
SLIDE 6

Example: ¡HypotheLcal ¡Judgments ¡

  • Basic ¡judgment: ¡A ¡true, ¡for ¡a ¡proposiLon ¡A ¡
  • HypotheLcal ¡judgment ¡
  • Defined ¡via ¡subsLtuLon ¡property ¡(not ¡rule) ¡
  • Which ¡entails ¡hypothesis ¡rule ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 6 ¡

slide-7
SLIDE 7

With ¡Proof ¡Terms ¡

  • Basic ¡judgment: ¡ ¡M ¡: ¡A ¡ ¡
  • HypotheLcal ¡judgment ¡= ¡typing ¡judgment ¡
  • Defined ¡via ¡subsLtuLon ¡property ¡(dashed ¡

line), ¡which ¡entails ¡the ¡hypothesis ¡rule ¡ ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 7 ¡

slide-8
SLIDE 8

Internalize ¡HypotheLcal ¡Judgment ¡

  • Form ¡a ¡proposiLon ¡whose ¡definiLon ¡(via ¡an ¡

introducLon ¡rule) ¡reflects ¡the ¡judgment ¡

  • Use ¡the ¡definiLon ¡of ¡the ¡judgment, ¡to ¡

determine ¡the ¡eliminaLon ¡rule ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 8 ¡

slide-9
SLIDE 9

Terms ¡Construct ¡and ¡Apply ¡FuncLons ¡

  • Logical ¡rules ¡become ¡familiar ¡typing ¡rules ¡
  • IntroducLon ¡rules ¡construct ¡terms ¡
  • EliminaLon ¡rules ¡destruct ¡term ¡
  • ComputaLon ¡arises ¡when ¡a ¡destructor ¡is ¡

applied ¡to ¡a ¡constructor ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 9 ¡

slide-10
SLIDE 10

Harmony ¡in ¡Natural ¡DeducLon ¡

  • IntroducLon ¡rules ¡construct ¡proofs ¡that ¡verify ¡
  • EliminaLon ¡rules ¡construct ¡proof ¡that ¡use ¡
  • Harmony ¡between ¡intro ¡and ¡elim ¡rules ¡

– Any ¡introducLon ¡of ¡A ¡followed ¡an ¡eliminaLon ¡of ¡A ¡ can ¡be ¡reduced ¡(local ¡reducLon) ¡ – Any ¡proposiLon ¡A ¡can ¡be ¡proved ¡by ¡an ¡ introducLon ¡(local ¡expansion) ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 10 ¡

slide-11
SLIDE 11

Proof ¡ReducLon ¡is ¡ComputaLon ¡

  • On ¡proofs ¡
  • On ¡proof ¡terms ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 11 ¡

slide-12
SLIDE 12

Example: ¡RunLme ¡Code ¡GeneraLon ¡

  • Key ¡computaLonal ¡idea: ¡we ¡have ¡a ¡quoted ¡

source ¡expression ¡available ¡at ¡runLme ¡

  • DisLnguish ¡

– Ordinary ¡variables, ¡bound ¡to ¡values ¡ – Expression ¡variables, ¡bound ¡to ¡source ¡code ¡

  • Need ¡to ¡quote ¡and ¡evaluate ¡expressions ¡

– In ¡a ¡logically ¡correct ¡way ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 12 ¡

slide-13
SLIDE 13

Categorical ¡Judgment ¡

  • Judgment ¡form, ¡with ¡variables ¡
  • We ¡can ¡only ¡subsLtute ¡an ¡expression ¡without ¡

reference ¡to ¡value ¡vars ¡for ¡an ¡expression ¡var ¡ ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 13 ¡

slide-14
SLIDE 14

QuotaLon ¡ConLnued ¡

  • We ¡also ¡have ¡a ¡new ¡hypothesis ¡rule ¡
  • We ¡would ¡like ¡to ¡internalize ¡“A ¡stands ¡for ¡a ¡

source ¡expression” ¡as ¡a ¡proposiLon ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 14 ¡

slide-15
SLIDE 15

Internalizing ¡a ¡Categorical ¡Judgment ¡

  • Judgment ¡u:A ¡means ¡A ¡is ¡valid ¡
  • One ¡can ¡check ¡harmony ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 15 ¡

slide-16
SLIDE 16

Which ¡Logic ¡is ¡This? ¡

  • AxiomaLcally, ¡we ¡find ¡
  • This ¡defines ¡the ¡intuiLonisLc ¡modal ¡logic ¡S4 ¡
  • ConservaLvely ¡extends ¡intuiLonisLc ¡logic ¡
  • We ¡can ¡have ¡a ¡type ¡theory ¡with ¡quote/eval ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 16 ¡

slide-17
SLIDE 17

Validity ¡and ¡Necessity ¡

  • Expression ¡variables ¡correspond ¡to ¡

assumpLons ¡of ¡validity ¡(u:A ¡⟺ ¡A ¡valid) ¡

  • The ¡box ¡modality ¡internalizes ¡this ¡as ¡a ¡

proposiLon ¡(A ¡valid ¡⟺ ¡☐A ¡true) ¡

  • Judgmentally, ¡we ¡only ¡need ¡hypotheLcal ¡and ¡

categorical ¡judgments ¡

– Natural ¡deducLon ¡and ¡harmony ¡do ¡the ¡rest ¡ – Generally, ¡very ¡limle ¡“new” ¡is ¡needed ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 17 ¡

slide-18
SLIDE 18

Codesign ¡Revisited ¡

  • RunLme ¡code ¡generaLon ¡and ¡IS4 ¡(A ¡valid) ¡
  • ParLal ¡evaluaLon ¡and ¡temporal ¡logic ¡(A ¡@ ¡t) ¡
  • Dead ¡code ¡eliminaLon ¡and ¡modal ¡logic ¡IT ¡(A ¡irr) ¡
  • Distributed ¡computaLon ¡and ¡IS5 ¡(A ¡@ ¡w) ¡
  • Concurrency ¡and ¡(intuiLonisLc) ¡linear ¡logic ¡(linear ¡

hypotheLcal ¡judgment) ¡

  • Generic ¡effects ¡and ¡lax ¡logic ¡(A ¡lax) ¡
  • ?? ¡and ¡epistemic ¡logic ¡(K ¡knows ¡A) ¡
  • ?? ¡and ¡ordered ¡logic ¡(ordered ¡hyp. ¡Judgment) ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 18 ¡

slide-19
SLIDE 19

Summary ¡

  • Codesign ¡of ¡programming ¡language ¡and ¡its ¡

logic ¡can ¡be ¡powerful ¡

– You’ll ¡know ¡when ¡it ¡is ¡right ¡ – But ¡it ¡is ¡hard ¡

  • There ¡are ¡many ¡parameters ¡

– Style ¡of ¡system ¡(ND, ¡SEQ, ¡HIL, ¡…) ¡ – Judgments ¡(hypotheLcal, ¡categorical, ¡linear, ¡…) ¡ – RelaLng ¡proof ¡reducLon ¡to ¡computaLon ¡ – Equality, ¡for ¡a ¡full ¡type ¡theory ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 19 ¡

slide-20
SLIDE 20

Some ¡Advice ¡

  • Focus ¡on ¡what ¡you ¡can ¡express, ¡not ¡what ¡you ¡

can’t ¡

  • Measure ¡success ¡by ¡the ¡constructs ¡omimed, ¡not ¡

those ¡included ¡

  • Design, ¡program ¡and ¡reason, ¡iterate ¡
  • Syntax ¡is ¡important ¡
  • SemanLcs ¡is ¡even ¡more ¡important, ¡both ¡
  • peraLonal ¡and ¡logical ¡
  • Know ¡when ¡to ¡give ¡up ¡

January ¡14, ¡2015 ¡ PLMW ¡2015, ¡Mumbai ¡ 20 ¡