A standardisation proof for algebraic pattern calculi
نویسندگان
چکیده
ion in this case N must also be an abstraction for both (i) and (ii) and neither N → h R nor N p R for any p,R. application in this case M = M1M2 We prove (i) first, analysing the possible forms of M1 • Assume M1 is not an abstraction In this case IApp1 applies, so we know N = N1N2, M1 int ⊲ N1, and M2 ⊲N2. Since M1 int ⊲ N1, N1 is not an abstraction, then the only applicable rule for N → h R is HApp1, hence R = R1N2 and N1 → h R1. Now we use the IH on M1 int ⊲ N1 → h R1 to get M1 → h N ′ 1 ⊲R1, then we obtain M = M1M2 h N ′ 1M2 by HApp1. Finally we apply DApp to N ′ 1 ⊲R1 and M2 ⊲N2 to get N ′ 1M2 ⊲R1N2 = R, which concludes the proof for this case. • Now assume M1 = λ p.M12 and p 6≪ M2 Since M = (λ p.M12)M2 int ⊲ N, the only rule that applies is IApp2, then N = (λ p.N12)N2, M12 ⊲N12, and M2 int ⊲ p N2. By L. 4.3 we obtain p 6≪ N2, so the only applicable rule in N = (λ p.N12)N2 → h R is HPat, then R = (λ p.N12)R2 and N2 p R2. Now we use the IH (ii) on M2 int ⊲ p N2 p R2, to get M2 p N ′ 2 ⊲R2. We obtain M = (λ p.M12)M2 → h (λ p.M12)N ′ 2 by HPat, then we get (λ p.M12) ⊲ (λ p.N12) by DAbs on M12 ⊲N12, finally we apply DApp to the previous result and N ′ 2 ⊲R2 to obtain (λ p.M12)N ′ 2 ⊲ (λ p.N12)R2 = R which concludes the proof for this case. • Finally, assume M1 = λ p.M12 and p ≪ν M2 Again, the only rule that applies in M = (λ p.M12)M2 int ⊲ N is IApp2, then N = (λ p.N12)N2, M12 ⊲N12, and M2 int ⊲ p N2. Now, by L. 4.2 we obtain p ≪θ N2 for some substitution θ such that ν ◮ θ , then the applied rule in N → h R is HBeta (the case HPat being excluded by L. 4.1), hence R = θN12 It is clear that M → h νM12. By L. 4.6 we obtain νM12 ⊲θN12 = R, which concludes the proof for this case. For (ii) we proceed by a case analysis of p If p ∈Var then there is no R such that N p R for any term N. If p ≪ M then by L. 4.2 p ≪ N, and therefore by L. 4.1 there can be no R such that N p R. 70 Standardisation for constructor based pattern calculi If p = c then p 6≪ M, hence M int ⊲ p N p R implies M int ⊲ N → h R as PConst and PatHead are the only possibilities for this case respectively. We use part (i) to obtain M → h N ′ ⊲R, and M p N ′ by PatHead which concludes the proof for this case. If p = d p2 and M / ∈ DataTerms, then the only possibilities for M int ⊲ p N p R are PNoCData and PatHead respectively, then M int ⊲ N → h R. We use part (i) to obtain M → h N ′ ⊲R, and M p N ′ by PatHead which concludes the proof for this case. Now assume p = d p2, M ∈ DataTerms, and p 6≪ M. We must analyse three possibilities • d 6≪ M1. In this case only PCDataNo1 applies for M int ⊲ p N, therefore N = N1N2 with M1 int ⊲ d N1 and M2⊲N2. By L. 4.3 we know d 6≪ N1 and moreover N1 is a data term (as can be seen by L. 3.2) thus not having head redexes, so the only possible rule for N p R is Pat1, then R = R1N2 with N1 d R1. Now we use the IH on the derivation M1 int ⊲ d N1 d R1 to get M1 d N ′ 1 ⊲R1, therefore M = M1M2 p N ′ 1M2 by Pat1. Moreover as N ′ 1 ⊲R1 and M2 ⊲N2 hence N ′ 1M2 ⊲R1N2 = R, which concludes the proof for this case. • d ≪ M1 and p2 6≪ M2. In this case only PCDataNo2 applies for M int ⊲ p N, therefore N = N1N2 with M1 ⊲N1 and M2 int ⊲ p2 N2. By L. 4.2 and L. 4.3 respectively, we obtain both d ≪ N1 and p2 6≪ N2. Moreover N is a data term (as can be seen by L. 3.2) thus not having head redexes. Hence the only possibility for N p R is Pat2, then R = N1R2 with N2 p2 R2 We now use the IH on M2 int ⊲ p2 N2 p2 R2 to get M2 p2 N ′ 2⊲R2, and by Pat2 M =M1M2 p M1N ′ 2 We also use DApp on M1 ⊲N1 and N ′ 2 ⊲R2 to get M1N ′ 2 ⊲N1R2 = R, which concludes the proof for this case. • d ≪ M1, p2 ≪ M2 and d p2 6≪ M1M2. d ≪ M1 implies (L 2.5:(b)) M1 ∈ DataTerms so that from M = M1M2 int ⊲ p N we can only have N = N1N2 with M1 ⊲N1 and M2 ⊲N2. L. 4.2 gives d ≪ N1 and p2 ≪ N2. L. 3.2:(b) gives N ∈ DataTerms. To show N p R we have three possibilities: PatHead is not possible since N ∈ DataTerms (c.f. L 2.8:(a)), Pat1 is not possible since d ≪ M1 (c.f. L 4.1), Pat2 is not possible since p2 ≪ N2 (c.f. L 4.1). Corollary 6.2 Let M,N,R be terms such that M int ⊲ N → h R. Then ∃N ′ s.t. M → h ∗ N ′ int ⊲ R. Proof Immediate by L. 6.1 and Corollary 5.4. D.Kesner, C.Lombardi & A.Rı́os 71 Now we generalize the h-development concept to a sequence of developments. The name given to Lemma 6.3 was taken from [2]. Lemma 6.3 (Bifurcation) Let M,N be terms such that M ⊲∗ N. Then M → h ∗ R int ⊲∗ N for some term R. Proof Induction on the length of M ⊲∗ N. If M = N the result holds trivially. Assume M ⊲Q ⊲∗ N. By C. 5.4 and IH respectively, we obtain M → h ∗ S int ⊲ Q and Q → h ∗ T int ⊲∗ N for some terms S and T . Now we use Corollary 6.2 (many times) on S int ⊲ Q → h ∗ T to get S → h ∗ R int ⊲ T . Therefore M → h ∗ S → h ∗ R int ⊲ T int ⊲∗ N as we desired. Using the previous results, the standardisation theorem admits a very simple proof. Definition 6.4 (Standard reduction sequence) The standard reduction sequences are the sequences of terms M1; . . . ;Mn which can be generated using the following rules. M2; . . . ;Mk M1 → h M2 StdHead M1; . . . ;Mk M1; . . . ;Mk StdAbs (λ p.M1); . . . ;(λ p.Mk) M1; . . . ;M j N1; . . . ;Nk StdApp (M1 N1); . . . (M j N1);(M j N2); . . . ;(M j Nk) StdVar x Theorem 6.5 (Standardisation) Let M,N be terms such that M ⊲∗ N. Then there exists a standard reduction sequence M; . . . ;N. Proof By L. 6.3 we have M → h ∗ R int ⊲∗ N; we observe that it is enough to obtain a standard reduction sequence R; . . . ;N, because we subsequently apply StdHead many times. Now we proceed by induction on N • N ∈Var; in this case R = N and we are done. • N = λ p.N1; in this case R = λ p.R1 and R1 ⊲∗ N1. By IH we obtain a standard reduction sequence R1; . . . ;N1, then by StdAbs so is R = λ p.R1; . . . ;λ p.N1 = N. • N = N1N2, so R = R1R2 and Ni ⊲∗ Ri. We use the IH on both reductions to get two standard reduction sequences Ni; . . . ;Ri, then we join them using StdApp. 7 Conclusion and further work We have presented an elegant proof of the Standardisation Theorem for constructor-based pattern calculi. We aim to generalize both the concept of standard reduction and the structure of the Standardisation Theorem proof presented here to a large class of pattern calculi, including both open and closed variants as the Pure Pattern Calculus [7]. It would be interesting to have sufficient conditions for a pattern calculus 72 Standardisation for constructor based pattern calculi to enjoy the standardisation property. This will be close in spirit with [8] where an abstract confluence proof for pattern calculi is developed. The kind of calculi we want to deal with imposes challenges that are currently not handled in the present contribution, such as open patterns, reducible (dynamic) patterns, and the possibility of having fail as a decided result of matching. Furthermore, the possibility of decided fail combined with compound patterns leads to the convenience of studying forms of inherently parallel standard reduction strategies. The abstract axiomatic Standardisation Theorem developed in [5] could be useful for our purpose. However, while the axioms of the abstract formulation of standardisation are assumed to hold in the proof of the standardisation result, they need to be defined and verified for each language to be standardised. This could be nontrivial, as in the case of TRS [6, 15], where a meta-level matching operation is involved in the definition of the rewriting framework. We leave this topic as further work.
منابع مشابه
Sound and Complete Bidirectional Typechecking for Higher-Rank Polymorphism and Indexed Types
Bidirectional typechecking, in which terms either synthesize a type or are checked against a known type, has become popular for its scalability, its error reporting, and its ease of implementation. Following principles from proof theory, bidirectional typing can be applied to many type constructs. The principles underlying a bidirectional approach to indexed types (generalized algebraic datatyp...
متن کاملMathematical Structures in Computer Science Higherorder Psicalculi Higher-order Psi-calculi †
In earlier work we explored the expressiveness and algebraic theory Psi-calculi, which form a parametric framework for extensions of the pi-calculus. In the current paper we consider higher-order psi-calculi through a technically surprisingly simple extension of the framework, and show how an arbitrary psi-calculus can be lifted to its higher-order counterpart in a canonical way. We illustrate ...
متن کاملOne-step Heyting Algebras and Hypersequent Calculi with the Bounded Proof Property
We investigate proof-theoretic properties of hypersequent calculi for intermediate logics using algebraic methods. More precisely, we consider a new weakly analytic subformula property (the bounded proof property) of such calculi. Despite being strictly weaker than both cut-elimination and the subformula property this property is sufficient to ensure decidability of finitely axiomatised calculi...
متن کاملExtended pi-Calculi
We demonstrate a general framework for extending the picalculus with data terms. In this we generalise and improve on several related efforts such as the spi calculus and the applied pi-calculus, also including pattern matching and polyadic channels. Our framework uses a single untyped notion of agent, name and scope, an operational semantics without structural equivalence and a simple definiti...
متن کاملThe dynamic pattern calculus as a higher-order pattern rewriting system
We show that Jay and Kesner’s dynamic pattern calculus can be embedded into a higher-order pattern rewriting systems in the sense of Nipkow. Metatheoretical results, such as confluence and standardisation, are shown to hold for the dynamic pattern calculus as a consequence of this embedding. The embedding also opens a way to study the semantics of Jay’s programming language bondi based on patte...
متن کامل