From proof theory to HCI. . . and back again James McKinna Roy - - PowerPoint PPT Presentation

from proof theory to hci and back again
SMART_READER_LITE
LIVE PREVIEW

From proof theory to HCI. . . and back again James McKinna Roy - - PowerPoint PPT Presentation

From proof theory to HCI. . . and back again James McKinna Roy Dyckhoff Celebration St. Andrews 2011-11-19 part I: from proof theory to HCI from Coquand to LEGO/Coq (tactic-driven) from Martin-Lf to ALF (direct-style proof editing)


slide-1
SLIDE 1

From proof theory to HCI. . . and back again

James McKinna Roy Dyckhoff Celebration

  • St. Andrews 2011-11-19
slide-2
SLIDE 2

part I: from proof theory to HCI

◮ from Coquand to LEGO/Coq (tactic-driven) ◮ from Martin-Löf to ALF (direct-style proof editing) ◮ from Gentzen to MacLogic (push button tactics)

insights: Pym, Herbelin, Dyckhoff-Pinto

slide-3
SLIDE 3

MacLogic

MacLogic was developed specifically for the Apple Macintosh, which has consistently had an excellent user interface. If you want a similar tool for another kind of computer, please look elsewhere. http://www.cs.st-andrews.ac.uk/˜rd/logic/mac

slide-4
SLIDE 4

MacLogic

this slide (un)intentionally left blank

slide-5
SLIDE 5

tensions

◮ research problems vs. didactic solutions ◮ research tools vs. teaching tools ◮ difficulty of instrumentation vs. accessibility to users

slide-6
SLIDE 6

proof search

a pervasive theme in Roy’s work

◮ theoretical:

◮ admissibility ◮ termination ◮ completeness

◮ practical: to solve problems to which the user should

remain oblivious

◮ actual: use Maple to find polynomials for termination

  • rderings!
slide-7
SLIDE 7

“we know a proof when we see one” (Kreisel)

fundamental property: explain deduction of a formula A via a typed term calculus Γ ⊢ M : A such that

◮ typing judgment Γ ⊢ M : A is decidable ◮ by reduction to type synthesis Γ ⊢ M ⇒ B ◮ and type conversion Γ ⊢ B ≃ A

idea: to compute B, look at structure of M! modern version: bidirectional typechecking, mixing synthesis and checking Γ ⊢ M ⇐ A

slide-8
SLIDE 8

a perspective on programming

insight via Curry/Howard/deBruijn:

◮ programming (as an activity) is the user’s solution to the

type inhabitation problem Γ ⊢ ? : A

◮ . . . which is just proof search ◮ . . . with certain obvious heuristics (Dowek; Miller)

so: consider HCI of programming from the perspective of proof search, with an eye to HCI of (interactive) theorem proving

slide-9
SLIDE 9

cognitive dimensions (Green et al., 1989 et seq.)

a heuristic framework for evaluating notations (programming languages, but also the language of user interfaces)

◮ theoretical: descriptive “balance of forces”, trade-offs ◮ practical: diagnostic

among others:

◮ premature commitment ◮ viscosity vs. abstraction ◮ hard mental operations (sic)

slide-10
SLIDE 10

proof search in type theory

classical approach to premature commitment in proof search in natural deduction (NJ): use sequent calculus (LJ)!

◮ source of premature commitment: choice of antecedent

formula in →-elim

◮ solution: left-/right rules (LJ), rather than intro-/elim- rules

(NJ)

◮ a calculus for inhabitation of corresponding NJ

formulas-as-types

◮ unification/meta-variables delay choice of term witnesses

to ∀-left instances Lots of literature, esp. now on extensions to dependent types Almost none on using this for programming

slide-11
SLIDE 11

part II: . . . and back again

slide-12
SLIDE 12

basic tenet

to seek a language of interaction more faithful to the human’s (primitive) intentions/actions

◮ abstraction (more generally: right rules) ◮ hypothesis selection (focus) ◮ suitable matching against a goal (unification)

slide-13
SLIDE 13

my interest

◮ a return to the design space of potential DTP

, revisiting Epigram 1 (2004) and PTSC (2006/2011)

◮ some extensions/generalisations:

◮ modest extensions to EPIGRAM 1-style intended to reduce

premature commitment

◮ re-designing type theory in sequent calculus style to

support postponed decisions

slide-14
SLIDE 14

EPIGRAM 1: use the programmer to control search

programmer chooses:

◮ left-hand sides: ‘case analysis’ (⇐) ◮ recursion schemes: identify allowable recursive calls (also

⇐!)

◮ right-hand sides: solutions to ‘leaf’ problems (⇒) ◮ intermediate computation (, not ‘let’ as such)

Each amounts to supplying (sufficient) evidence to solve the corresponding problem. Informal justification by appeal to left-/right-rules in sequent calculus; ‘with’ is cut) Problem every program begins with commitment to some rec!

slide-15
SLIDE 15

Type Theory in Sequent Calculus style (CSL 2006)

a term calculus with two judgment forms:

◮ Γ ⊢ M : A corresponding to Γ ⊢ ? : A ◮ Γ; A ⊢ l : B corresponding to computing argument lists to

“match” A against B Key idea: LJ is too permissive, so tighten up to remove inessential variation (permutation of rules) D− →∗ ΠxA.B Γ ⊢PS M :A Γ | M/xB ⊢PS l :C Πl Γ | D ⊢PS M·l :C Can see this as a rational reconstruction of Refine in LEGO, Apply in COQ

slide-16
SLIDE 16

Adding meta-variables (LMCS 2011)

leads to a calculus in which

◮ Dowek’s complete semi-recursive type inhabitation

procedure can be recovered, hence higher-order unification Challenge extend analysis to datatypes, thereby

◮ making solid the EPIGRAM 1/sequent calculus informal

connection

◮ modernising, to deal with e.g. bidirectional type checking,

. . .

slide-17
SLIDE 17

Rules, I

Γ ⊢ ⊢ ⊢PE M :A | Σ Γ = x1 :A1, . . . , xn :An Γ ⊢ ⊢ ⊢PE α(x1 [], . . . , xn []):C | (Γ ⊢ ⊢ ⊢ α:C) Claimα (x :A) ∈ Γ Γ; A ⊢ ⊢ ⊢PE l :C | Σ Γ ⊢ ⊢ ⊢PE x l :C | Σ Selectx C− →∗Bx ΠxA.B Γ, x :A ⊢ ⊢ ⊢PE M :B | Σ Γ ⊢ ⊢ ⊢PE λxA.M :C | Σ Πr

slide-18
SLIDE 18

Rules, II

Γ; B ⊢ ⊢ ⊢PE l :C | Σ Γ = x1 :A1, . . . , xn :An Γ; D ⊢ ⊢ ⊢PE β(x1 [], . . . , xn []):C | (Γ; D ⊢ ⊢ ⊢ β :C) Claimβ Γ; D ⊢ ⊢ ⊢PE []:C | D Γ = C axiom D− →∗

Bx ΠxA.B

Γ ⊢ ⊢ ⊢PE M :A | Σ1 Γ; M/xB ⊢ ⊢ ⊢PE l :C | Σ2 Γ; D ⊢ ⊢ ⊢PE M·l :C | Σ1, Σ2 Πl

slide-19
SLIDE 19

Rules, III

Σ = ⇒PE σ Γ; B ⊢ ⊢ ⊢PE l :C | Σ′′ Σ, Σ′′, (β → Dom(Γ).l)(Σ′) = ⇒PE σΣ, σΣ′′, σΣ′ Σ, (Γ; B ⊢ ⊢ ⊢ β :C), Σ′ = ⇒PE σΣ, (β → Dom(Γ).(σΣ, σΣ′′)(l)), σΣ′ Solveβ Γ ⊢ ⊢ ⊢PE M :A | Σ′′ Σ, Σ′′, (α → Dom(Γ).M)(Σ′) = ⇒PE σΣ, σΣ′′, σΣ′ Σ, (Γ ⊢ ⊢ ⊢ α:A), Σ′ = ⇒PE σΣ, (α → Dom(Γ).(σΣ, σΣ′′)(M)), σΣ′ Solveα Σ is solved Σ = ⇒PE ∅ Solved

slide-20
SLIDE 20

Advantages for the implementor?

Such calculi combine

◮ explicit substitutions ◮ spine representations

so hopefully better adapted towards

◮ abstract machines for evaluation ◮ ‘internal’ (inferential mode) and ‘external’ (checking mode)

Metavariables and unification/conversion are baked in from the start, so there is no separate ‘program construction’ layer distinct from that of eventually elaborated programs: these are just terms containing no open meta-variables.

slide-21
SLIDE 21

Conclusions/Open problems

◮ dependent type theory as a nice place to study proof-term

enriched presentations of logic

◮ machinery for type-checking/type synthesis/conversion

testing modulo unknowns

◮ unification as a pervasive technology from traditional proof

search

◮ correct-by-construction programming as well . . . which is

type-directed, interactive, proof search

◮ many (?) more places during construction when unknowns

allow progress without over-committing the programmer

◮ outstanding problem: high-level syntax for sufficient

evidence to yield well-typed terms in the underlying theory