Linear Contextual Modal Type Theory Anders Schack-Nielsen Carsten Schurmann¨ IT University of Copenhagen IT University of Copenhagen Copenhagen, Denmark Copenhagen, Denmark [email protected] [email protected] Abstract where we write F for the logic variable, x; y for the two resources that need to be consumed exactly once, c for con- When one develops, implements, and studies type theo- stant symbols, and b for linear application. If b were ries based on linear logic, for example, in the context of the- intuitionistic application then any instantiation of F with a orem proving, logic programming, and formal reasoning, constant function is a solution. In the multiplicative frag- one is immediately confronted with questions about their ment of linear logic, the problem is not solvable because equational theory and how to deal with logic variables. In any instantiation of F will need to mention x and y exactly this paper, we propose linear contextual modal type theory once on two different rigid paths. Thus the left hand side that gives a mathematical account of the nature of logic and the right hand side of the equation above will differ in variables. Our type theory is conservative over intuition- these two places. If we were to work in linear logic with istic contextual modal type theory proposed by Nanevski, >, the problem is also solvable by choosing the constant Pfenning, and Pientka. As a technical contribution we pro- 0 function F = λxb : λyb : F b hi where we write λb for linear vide a proof of soundness, and, as a justification for its use- functional abstraction and hi for the proof term of >. fulness, we shed some light on the difficulties working with This little example illustrates the complex nature of logic logic variables in linear logics that contain >. variables in linear logic and their role in higher-order linear unification. In the >-free case, every linear resource needs to be consumed by the same term on either side of the equa- 1 Introduction tion. If this is impossible, unification fails. In the presence of > this is no longer the case. Therefore, without a clear Over recent years, linear logic has become increasingly understanding of the nature of logic variables from a mathe- popular as a logic for concurrency, stateful computation, matical point of view, it seems hopeless to try to devise and and even security. So far, the idea of resource awareness design algorithms for equality in linear logic. has had far reaching consequences for the design and imple- In this paper we provide such an understanding by the mentation of logics and logical frameworks; LLF [CP96], means of linear contextual modal type theory that gives a CLF [CPWW02] and even separation logic [Rey02] use precise mathematical meaning to logic variables for linear ideas borrowed from linear logic at their cores. There are logic, building on ideas from contextual modal type theory implementations of theorem provers, logic programming by Nanevski, Pfenning, and Pientka [NPP08]. In their paper languages, and proof assistants that do implement linear they work out a modal explanation of contextual validity, logic, as for example, Lolli [HM94], and Celf [SNS08]. which accounts for the contexts that are usually associated All of these implementations depend crucially on the with logic variables in the intuitionistic setting [DHKP96]. choice of fragment of linear logic and the choice of logic In this paper we define a contextual modal type theory for variable. Logic variables stand for still to be proven leaves linear logic, which accounts for (in part at least) the defini- in a derivation tree or simply holes in a term that is to be tion of logic variables used for Cervesato’s and Pfenning’s instantiated via unification. It is a widely accepted fact that linear preunification algorithm [CP97]. multiplicative connectives are better behaved than, for ex- The underlying philosophical basis for this work is pro- ample, their additive siblings. It is also widely accepted vided by Martin-Lof’s¨ view of logical truth in form of judg- that logic variables are useful. ments and evidence in form of axioms and inference rules. As a motivating example consider the unification prob- Using his technique we construct the meaning of availabil- lem ity, which corresponds to the multiplicative fragment of lin- c b (F b x b y) = c b (F b y b x) ear logic with ( as the main connective, truth, which cor- 1 responds to truth in intuitionistic logic with ! as the main 2 Linear Contextual Modal Logic connective, and contextual validity, which corresponds to the logic of logic variables with [Γ; ∆]! as the main con- The central idea in linear logic [Gir87] is that of a re- nective (pronounced box arrow Γ, ∆). If we know that source. Linear assumptions play the role of a fixed set of A [Γ; ∆]! B is true, then a proof of B may mention a logic available resources that must be consumed (exactly once) in variable of type [Γ; ∆]A, which may refer arbitrarily many a derivation. Therefore, available resources form the philo- times to assumptions in Γ and exactly once to assumptions sophical foundation of linear contextual modal logic. The in ∆. The justification of this construction can be found in idea of linear logic as a resource oriented logic has rendered Section 2. it attractive to many application areas. In Petri nets, tokens Next we show the soundness of linear contextual modal can be modeled as resources, in programming language the- logic in Section 3. To this end we give a sound and complete ory it is state, and in security simply messages that are being proof theoretical account of availability, truth, and contex- created and consumed. tual validity in form of a sequent calculus. Next we prove Traditionally one recovers intuitionistic logic from linear the admissibility of cut, which guarantees the existence of logic by singling out those resources that can be constructed canonical proofs in linear contextual modal logic. The cut- from no other resources. They can be used as often as de- elimination result of this section is formalized and machine- sired, and thus, constructively speaking, they are true. checked in Twelf [PS99]. Finally, we introduce the judgment of contextual valid- Our logic is a bit non-standard because we do not explic- ity, which will ultimately serve as the logical justification itly internalize the judgments for truth and linear contextual of the existence of logic variables. Usually we say a propo- validity. That this is not a loss is argued in Section 4, where sition is valid if it is true in all contexts. But here we re- we define an equivalent logic in terms of a ! modality that re- fine this idea one step further and refer to the validity of a stores the intuitionistic implication A ! B = !A ( B and proposition in a context Γ; ∆, where Γ is a collection of true a linear contextual modality [Γ; ∆] that restores the modal propositions, and ∆ is a collection of available resources. box implication A [Γ; ∆]! B = [Γ; ∆]A ( B. In ad- These three judgments can be defined by a set of infer- dition, this discussion justifies why linear contextual modal ence rules and axioms following the ideas of the judgmental logic is in fact a modal logic. reconstruction of modal logic that goes back to Davies and In Section 5 we introduce a Curry-Howard correspon- Pfenning [DP01]. dence. Every proof rule is endowed with a proof term in the spirit of Bierman [Bie94]. In this section we define all basic Linear Judgments In linear logic, resources are con- operations on logic variables including abstraction, instanti- structed from other resources, all of which are necessarily ation, and substitution application. The choice of canonical consumed during the process. We call judgments of this proofs induces the equational theory based on β reduction form linear judgments. If A is constructed using each lin- and η expansion. We show that every term is equivalent to ear resource among A1 :::An exactly once, we write a β-normal η-long form. Finally, in Section 6 we describe how we use linear con- x1 : A1 avail; : : : ; xn : An avail ` A avail textual modal type theory to help us understand the role of The list of linear resources to the left of the ` symbol enjoys the additive unit hi : >. Consider the following unification among the three structural properties only exchange (and equation, where F and G are logic variables: neither weakening nor contraction) and will be abbreviated in the remainder of this paper by the aforementioned ∆. In c hi (F x) = c hi (d G) b b b b b b the remainder of the paper we refer to xi : Ai avail as a This time, there is only one resource x. On the left the re- linear assumption and to Ai as a resource. source x needs to be consumed by the F , but on the right the In our formulation of the rules that define introduction second argument of c cannot consume x, and it must there- and elimination forms for the linear implication connective fore be consumed by the first argument, the hi. But now, af- (, we use the ` symbol as a notational convenience for ac- ter decomposition the two resulting unification problems are counting all resources consumed by the derivation A avail. no longer well-typed! The resource x must to be consumed lhypx on the right but not on the left in the first and vice versa in x:A avail ` A avail the second. Thus we would expect that there is no solution (∆; x:A avail) ` B avail and wrong again.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages11 Page
-
File Size-