a linear logical a linear logical a linear logical
play

A Linear Logical A Linear Logical A Linear Logical Framework - PDF document

A Linear Logical A Linear Logical A Linear Logical Framework Framework Framework Iliano Cervesato - Frank Pfenning Department of Computer Science Carnegie Mellon University 11 th IEEE Symposium on Logic in Computer Science New


  1. A Linear Logical A Linear Logical A Linear Logical Framework Framework Framework Iliano Cervesato - Frank Pfenning Department of Computer Science Carnegie Mellon University 11 th IEEE Symposium on Logic in Computer Science New Brunswick, NJ, July 28 th , 1996 I. Cervesato, F. Pfenning - A Linear Logical Framework 1

  2. Overview Overview Overview • Logical frameworks – definition – applications – examples ( LF ) – limitations • The linear logical framework LLF – introduction – the linear type theory λ Π -o & T – main properties – meta-representation in LLF • An example: ML ref – syntax – typing and evaluation – type preservation • Related work and conclusions I. Cervesato, F. Pfenning - A Linear Logical Framework 2

  3. Logical frameworks Logical frameworks Logical frameworks Formalisms specially designed to provide effective meta-representations of formal systems • Formal systems: – logics – programming languages – ... • Meta-representation: – syntax – semantics – meta-theory – ... • Effectiveness: – immediacy – executability I. Cervesato, F. Pfenning - A Linear Logical Framework 3

  4. Applications Applications Applications • Traditional logic and type theory – cut elimination – Church-Rosser property – soundness and completeness proofs – ... • Pure logic and functional programming languages – interpretation – compilation – correctness of program transformations – representation of properties ⋅ type preservation, value soundness, ... ( Mini-ML ) ⋅ completeness of uniform provability, resolution, ... (Horn clauses) – ... • ... I. Cervesato, F. Pfenning - A Linear Logical Framework 4

  5. Structure of a Structure of a Structure of a logical framework logical framework logical framework Logical framework = meta-representation language + meta-representation methodology I. Cervesato, F. Pfenning - A Linear Logical Framework 5

  6. Meta-representation Meta-representation Meta-representation languages languages languages Logics – Horn clauses ( Prolog ) – Higher-order hereditary Harrop formulas ( λ Prolog , Isabelle ) – Classical linear logic ( Forum ) – ... Type theories – λ Π ( Elf ) LF – CIC ( Coq , Lego ) – Martin-Löf's type theories ( ALF , NuPrl ) – ... I. Cervesato, F. Pfenning - A Linear Logical Framework 6

  7. The type theory λ The type theory λ Π Π The type theory λ Π K ::= type | Π x:A. K Kinds Type families P ::= a | P M A ::= P | Π x:A 1 . A 2 Types M ::= x | c | λ x:A. M | M 1 M 2 Objects Object proof-term Type Γ |- Σ M : A " M has type A in Γ and Σ " Context Signature x:A, ... a:K, ... c:A, ... Principal properties – Type checking and type synthesis are decidable – Can be implemented as a logic programming language ( Elf ) – Proof-terms record the inference rules used in proving the inhabitance of a type I. Cervesato, F. Pfenning - A Linear Logical Framework 7

  8. Meta-representation Meta-representation Meta-representation methodology methodology methodology T = M Context!!! ∆ → e : τ x i : τ i ,... • Term-based representation ⋅ |- Σ M : ofe ∆ e τ We must encode explicitly – context operations (lookup, insertion, ...) – context-related properties (weakening, exchange, ...) • Exploitation of the meta-language context LF ∆ |- Σ M : ofe e τ where, for each x i : τ i in ∆ , x i : τ i = x i : exp , t i : ofe x i τ i – context operations reduce to meta-level primitives – meta-theoretic properties are inherited from the meta-language I. Cervesato, F. Pfenning - A Linear Logical Framework 8

  9. Aspects of a Aspects of a Aspects of a meta-representation meta-representation meta-representation Meta-representation = program + adequacy theorems I. Cervesato, F. Pfenning - A Linear Logical Framework 9

  10. Meta-representation in Meta-representation in Meta-representation in : signature LF : signature LF LF : signature Example : e ::= x | ... | lam x. e | e 1 e 2 | ... τ ::= ... | τ 1 → τ 2 | ... exp : type. lam : (exp -> exp) -> exp. app : exp -> exp -> exp. ∆ , x: τ 1 |- e : τ 2 ∆ |- e 1 : τ 2 → τ 1 ∆ |- e 2 : τ 2 ∆ |- lam x. e : τ 1 → τ 2 ∆ |- e 1 e 2 : τ 1 ofe : exp -> tp -> type. of_lam : ofe (lam E) (T1 => T2) <- ({x:exp} ofe x T1 -> ofe (E x) T2). of_app : ofe (app E1 E2) T1 <- ofe E1 (T2 => T1) <- ofe E2 T2. I. Cervesato, F. Pfenning - A Linear Logical Framework 10

  11. Meta-representation in Meta-representation in Meta-representation in : adequacy LF : adequacy LF LF : adequacy Adequacy theorem ( typing of expressions ) Given a context ∆ = (x 1 : τ 1 , ..., x n : τ n ), an expression e and a type τ , there is a compos- itional bijection between derivations T of ∆ → e : τ and canonical LLF objects M such that ∆ |- Σ M : ofe e τ is derivable, where x 1 : exp , t 1 : ofe x 1 τ 1 ∆ = . . . x 1 : exp , t n : ofe x n τ n I. Cervesato, F. Pfenning - A Linear Logical Framework 11

  12. Limitations Limitations Limitations The context-based representation methodology does not handle satisfactorilly: – linearity (affine, relevant, linear logics, ...) – state (imperative programming languages, planning, games, ...) – modality (modal logics, ...) The representation of these problems involves complex encodings: – adequacy is difficult to prove – the meta-theory is not manageable Exception Forum I. Cervesato, F. Pfenning - A Linear Logical Framework 12

  13. The problem The problem The problem E = M S |- K; e ⇒ a Store!!! c i =v i ,... • Term-based representation ⋅ |- Σ M : eval S K e a ... as before • Context-based representation S |- Σ M : eval K e a This does not work! – S is subject to destructive operations (e.g. assignment) – current logical frameworks do not allow removing assumptions from the context I. Cervesato, F. Pfenning - A Linear Logical Framework 13

  14. Goal Goal Goal Design a logical framework that – permits a direct representation of linearity/state/... – is conservative over LF ⋅ language ( λ Π ) ⋅ meta-representation methodology ⋅ examples – has usable operational properties I. Cervesato, F. Pfenning - A Linear Logical Framework 14

  15. Beyond intuitionism Beyond intuitionism Beyond intuitionism Linearity/state/... are problematic because intuitionistic context management is monotonic The above problems require instead a non- monotonic management of the context Linear logic permits non-monotonic context management I. Cervesato, F. Pfenning - A Linear Logical Framework 15

  16. Choice of the operators Choice of the operators Choice of the operators Desiderata – model arbitrary non-monotonic context operations – conservative extension of the operators of λ Π – existence of unique canonical forms – completeness of uniform proof search Π -o & T as type constructors . The corresponding object operators are extracted from their natural deduction style inference rules. This is the type-theoretic version of the language of linear higher-order hereditary Harrop formulas , where A → B ( ≡ !A -o B) Π x:A. B ∀ x. B We are within intuitionistic linear logic I. Cervesato, F. Pfenning - A Linear Logical Framework 16

  17. The linear type theory The linear type theory The linear type theory λ Π -o & T λ Π -o & T λ Π -o & T K ::= type | Π x:A. K Kinds Type families P ::= a | P M A ::= P | Π x:A 1 . A 2 Types | A 1 -o A 2 | A 1 & A 2 | T Objects M ::= x | c | λ x:A. M | M 1 M 2 | λ x^A. M | M 1 ^ M 2 | <M 1 , M 2 > | fst M | snd M | <> Object (proof-term) Type Ψ |- Σ M : A " M has type A in Ψ and Σ " Context Signature x:A, ... a:K, ... x^A, ... c:A, ... λ Π -o & T is the largest propositional linear extension of λ Π admitting unique canonical forms I. Cervesato, F. Pfenning - A Linear Logical Framework 17

  18. More λ More λ Π -o & T Π -o & T More λ Π -o & T Type Ψ |- Σ A : type " A is a type in Ψ and Σ " Signature Intuitionistic context x:A, ... Types and kinds are linearly closed : no linear dependencies I. Cervesato, F. Pfenning - A Linear Logical Framework 18

  19. Properties of λ Properties of λ Π -o & T Π -o & T Properties of λ Π -o & T We restricted the semantics of λ Π -o & T to terms that are in η -long form : Ψ |- Σ U ⇑ V − simpler − sufficient • Church-Rosser property If U' ≡ U", there exists a term V such that U' → * V and U" → * V • Strong normalization If Ψ |- Σ U ⇑ V is derivable, then U is strongly normalizing • Decidability of type checking and type synthesis It can be recursively decided whether there exists a derivation and a term V for the judgment Ψ |- Σ U ⇑ V • Conservativity over LF If Ψ, Σ , U and V do not mention linear constructs, then Ψ |- Σ U ⇑ V is derivable in LLF iff Ψ |- Σ LF U ⇑ V is derivable in LF I. Cervesato, F. Pfenning - A Linear Logical Framework 19

Recommend


More recommend