Computing with relations, functions, and bindings

Separating functional computation from relations

ย  ย The development of the logical foundations of arithmetic generally starts with the first-order logic of relations to which constructors for zero and successor have been added. Various axioms (such as Peanoโ€™s axioms) are then added to that framework in order to define the natural numbers and various relations among them. Of course, it is often natural to think of some computations, such as say, the addition and multiplication of natural numbers, as being functions instead of relations. A common way to introduce functions into the relational setting is to enhance the equality theory. For example, Troelstra in [Tro73, Section I.3] presents an intuitionistic theory of arithmetic in which all primitive recursive functions are treated as black boxes and every one of their instances, for example 23 + 756 = 779, is simply added as an equation. A modern and more structured version of this approach is that of the ฮปฮ -calculus modulo framework proposed by Cousineau & Dowek [CD07]: in that framework, the dependently typed ฮป-calculus (a presentation of intuitionistic predicate logic) is extended with a rich set of terms and rewriting rules on them. When rewriting is confluent, it can be given a functional programming implementation: the Dedukti proof checker [Ass+16] is based on this hybrid approach to treating functions in a relational setting. A predicate can, of course, encode a function. For example, assume that we have a (? + 1)-ary (? โ‰ฅ 0) predicate R for which we can prove that the first ? arguments uniquely determine the value of its last argument. That is, assume that the following formula is provable (here, ฬ„? denotes the list of variables ?1 , โ€ฆ , ??): โˆ€ ฬ„?([โˆƒ?.R( ฬ„?, ?)] โˆง โˆ€?โˆ€?[R( ฬ„?, ?) โŠƒ R( ฬ„?, ?) โŠƒ ? = ?]). In this situation, an ?-ary function ?R exists such that ?R( ฬ„?) = ? if and only if R( ฬ„?, ?). In order to formally describe the function ?R, Hilbert [HB39] and Church [Chu40] evoked choice operators such as ฯต and ฮน which (along with appropriate axioms) are able to take a singleton set and return the unique element in that set. For example, in Churchโ€™s Simple Theory of Types [Chu40], a definition of ?R is provided by the expression ฮป?1 โ€ฆ ฮป??ฮน(ฮป?.R(?1 , โ€ฆ , ??, ?)). In this chapter, we present a different approach to separating functional computations from more general reasoning with relations. We shall not extend the equational theory beyond the minimal equality on terms and we shall not use choice principles.

The โ„ฑโŠƒ calculus

ย  ย The main principle of focusing is to classify inference rules in two groups, invertible ones and non-invertible ones. Then it is possible to organize proofs in an alternation of two phases: the asynchronous phase during which are applied invertible rules only and the synchronous phase when non-invertible rules are applied.
Definition 1.1. We call invertible the rules whose conclusion and premises are equiprovable. Two invertible rules can always be permuted in the tree of inferences. Thus the application order of a series of invertible rules has no impact on the derivability of a formula and such rule applications are guaranteed not to affect the provability of the goal formula. In the two-phases process these sequences of invertible rules, eagerly applied, constitute the asynchronous phase. In Section 2 and Section 3 we will show how invertible phases can provide for a natural treatment of computational behavior. In contrast, the synchronous phases, where non-invertible rules are used, require choices to be made in order to progress in the proof. One example of such a choice is the necessity to exhibit a witness for an existentially quantified formula. When a synchronous phase is entered, the proof is focused on a particular formula which is then used to indicate followup synchronous rules, maintaining focus as long as possible. This drastically reduces the choice points in the proof, since after a focus has been decided the choices are constrained to those relevant to that chosen formula. Connectives whose right introduction rules are invertible will be called negative or asynchronous whereas the others will be called positive or synchronous. We will use the following set of notations in all our focused systems:
Definition 1.2. Notations
– A, B, C denote formulas
– N? and P? respectively range over negatively polarized atoms and positively polarized atoms
– E denotes either a positive formula or a negative atom
– C denotes either a negative formula or a positive atom
– t, u, v denote terms in ฮฒฮท-long normal form
– ฯ„ denotes a term type
– ฮ“ is a multiset of formula
– ฮ˜ is a list of formulas
– ฮฃ is a list of typed term variables, called the signature, which are considered bound over a sequent. To lighten the sequents the signature will be omitted when not necessary.
– ฮ”1 and ฮ”2 are two multisets of formulas such that ฮ”1 โˆช ฮ”2 contains one and unique formula.
– We use dots (โ‹…) to materialize empty zones.

An extension to equivalence classes

ย  ย Equivalence relations play important roles in computation and reasoning. Occasionally, we have a relation that is not functional but all the possible outcomes are equivalent, for some specific equivalence relation. For example, if two lists are considered equivalent when they are permutations of each other, then the equivalence class of lists modulo that relation encodes multisets. Similarly, if two pairs of integers (?, ?) and (?, ?) (where ? and ? are not zero) are considered equivalent when ?? = ?? then equivalence classes encode rational numbers. The ambiguity of singletons can be lifted to computation with equivalence classes in the following sense. Let ฯ be an equivalence relation. The familiar notation [?]ฯ for the ฯ-equivalence class containing ? is just syntactic sugar for ฮป?.?ฯ?. (We define logical equivalence in the usual way: A โ‰ก B is an abbreviation for(A โŠƒ B)โˆง(B โŠƒ A).) Assume that ฯ is an equivalence relation and that the following holds if Q โˆถ ? โ†’ ?.โˆ€?โˆ€?. ? ฯ ? โŠƒ [Q(?) โ‰ก Q(?)] (Note that this theorem is immediate for all Q โˆถ ? โ†’ ? when ฯ is equality.) The following equivalence holds.[โˆ€?. ? โˆˆ [?]ฯโŠƒQ(?)] โ‰ก [โˆƒ?. ? โˆˆ [?]ฯโˆง Q(?)] In a more informal mathematical notation, one might replace either the above existential or universal expression with Q([?]ฯ). While we shall not use this expression (it involves a typing error), it conveys the usual mathematical sense of this ambiguity: if we show that one member of an equivalence class satisfies such a property Q then all members of that equivalence class satisfy Q. Obviously, we can generalize the notion of functional dependency to the following โˆ€ ฬ„?([โˆƒ?.R( ฬ„?, ?)] โˆง โˆ€?โˆ€?[R( ฬ„?, ?) โŠƒ R( ฬ„?, ?) โŠƒ ?ฯ?]),which states that the ?-ary relation is a total function up to ฯ. Thus, during the construction of a proof where one is asked to pick a term ? that makes R(?1, โ€ฆ , ??, ?) true, one can instead compute just any term ?โ€ฒ such that R(?1, โ€ฆ , ??, ?โ€ฒ) (as long as the established property Q is ฯ-invariant). In that setting, we can also extend the phase-abstraction mechanism to exclude border premises that differ up to ฯ.

Proposal: Computation and Suspension

ย  ย Our first proposed extension of Abella is rather simple: the addition of a compute tactic that performs unfolding and subsequent asynchronous steps for assumptions involving predicates with a fully positive definition. Thus, for instance, if we have an assumption H : plus ( s z ) ( s z ) X then the invocation compute H would repeatedly unfold the definition of plus and handle the resulting subgoals eagerly if it can use purely asynchronous steps. In this particular case, the effect will be the removal of H entirely and the instantiation of X with (s (s z)). The compute tactic is allowed to produce multiple branches. For instance, in the following case: H : plus X Y ( s ( s z ) ) the invocation compute H would produce three subgoals, one each for the three ways there are to decompose 2 into a sum of two natural numbers. This kind of feature has long been recognized as an important need in Abella.6 A very common form is encountered in meta-theoretic proofs involving memberships in contexts, which are represented as lists in Abella, where we have an assumption such as: H : member X ( E1 :: E2 :: Rest ) In this case we would like compute H to yield three subgoals (in addition to the assumption): the first with X = E1, the second with X = E2, and the last with member X Rest. A more interesting scenario is when the compute tactic is used on a purely positive predicate that cannot be fully solved. For instance, given: H : nat ( s ( s X ) ) where X is an eigenvariable, it can be asynchronously simplified to (nat X) by just using the second clause of the definition of nat. However, to go further we would need to consider the cases where X = z and the case for X = s X1, and we would be left with a further assumption nat X1. We can repeat this process nowย  with X1 and so on. This eager treatment of nat not only leads to non-terminating search (which will eventually be forcefully terminating because it reaches a depth bound), but may be unwarranted before we know anything else about X. In this case, it would be useful to suspend the eager unfolding of nat. To account for this premature unfolding of definitions when the inductive structure is already a variable, we add a new kind of Suspend declaration that will make Abella stop the asynchronous phase prematurely as we described in Section 2.2. The following declaration declares that (nat X) should not be unfolded if X is a variable;we call this a suspension condition.

Le rapport de stage ou le pfe est un document dโ€™analyse, de synthรจse et dโ€™รฉvaluation de votre apprentissage, cโ€™est pour cela chatpfe.com propose le tรฉlรฉchargement des modรจles complet de projet de fin dโ€™รฉtude, rapport de stage, mรฉmoire, pfe, thรจse, pour connaรฎtre la mรฉthodologie ร  avoir et savoir comment construire les parties dโ€™un projet de fin dโ€™รฉtude.

Table des matiรจres

Introduction
1 The โ„‹ proof system for Heyting arithmeticย 
1 The typed ฮป-calculusย 
1.1 Syntax of terms
1.2 Typing using sequent calculus
1.3 Computing with the ฮป-calculus
2 Terms and formulas for โ„‹
3 The โ„‹ sequent calculusย 
3.1 The logical core of โ„‹
3.2 The arithmetic part of โ„‹
2 Separating functional computation from relationsย 
1 An introduction to focusing
1.1 The โ„ฑโŠƒ calculus
1.2 Polarity and proof search
2 The โ„ฑ calculus for Heyting arithmetic
2.1 Polarities of connectives
2.2 Suspensions
2.3 The complete โ„ฑ calculus
3 Juggling with phases
3.1 Phases as abstractions
3.2 The polarity ambiguity of singleton sets
3.3 An extension to equivalence classes
4 A practical use: automation in Abella
4.1 The ? Logic and the Abella Implementation
4.2 Proposal: Computation and Suspension
4.3 Proposal: Deterministic Computation using Singleton Predicates
4.4 Possible extensions
5 Conclusion and perspectives
3 A functional programming language using ฮป-tree syntaxย 
1 Introduction
1.1 A common example: substitution
1.2 A new language, MLTS
2 The new features of MLTS
3 MLTS examplesย 
3.1 The untyped ฮป-calculus
3.2 Higher-order programming examples
3.3 Normalization by Evaluation (NBE)
3.4 The ฯ€-calculus
4 Types and syntax
4.1 Abstract syntax as untyped ฮป-calculus
4.2 Typing for the concrete syntax
4.3 Typing for the explicit syntax
5 Formalizing the design of MLTS
5.1 Equality modulo ฮฑ, ฮฒ, ฮท conversion
5.2 Pattern unification and matching
No repeated pattern variable occurrences
Restricted use of higher-order pattern variables
All nab-bound variables must have a rigid occurrence
5.3 ฮฒ0 versus ฮฒ
5.4 Match rule quantification
5.5 Nominal abstraction
6 Natural semantic specificationย 
7 Formal properties of MLTSย 
8 Interpreters for MLTSย 
8.1 Nominal-escape checking
8.2 Binder mobility
8.3 Costs of moving binders
8.4 A web frontend for the interpreter
9 Related workย 
9.1 Systems with two arrow type constructors
9.2 Systems with one arrow type constructor
9.3 Systems using nominal logic
9.4 Challenge problems and benchmarks
10 Perspectives for MLTSย 
Conclusion
A A unification algorithm in MLTS
B A prototype implementation for MLTS
1 Terms and types
2 Typing
3 Interpreter

Rapport PFE, mรฉmoire et thรจse PDFTรฉlรฉcharger le rapport complet

Tรฉlรฉcharger aussi :

Laisser un commentaire

Votre adresse e-mail ne sera pas publiรฉe. Les champs obligatoires sont indiquรฉs avec *