rd workshop on the rewriting calculus a ... - rho.loria.fr · 3rdworkshop on the rewriting calculus...
TRANSCRIPT
3rd Workshop on the Rewriting Calculus
London, Kings College, October 23-24, 2006
A Framework for Defining Logical Frameworks
Luigi Liquori (INRIA Sophia-Antipolis, France)
joint work with
Furio Honsell (Università di Udine, Italia)Marina Lenisa (Università di Udine, Italia)
dedicated to Gordon D. Plotkin,on the occasion of his 60th birthday
1
The Problem’s Setting
• 40 years on, it is unchallenged that: rigorous certification is necessary to improvesoftware certification , and this calls for the use of Formal Methods and hence For-mal Systems
• Logic as Applied Mathematics
BUT
• The Ultimate Formal System , i.e. the system which provides in all situations trans-parent encodings, thus allowing to reason both naturally and formally, does not appearto exist
• We live in a world where new Formal Systems are constantly emerging and often arequickly forgotten before they are fully understood - nevertheless the approach works,at least locally !
• Logic s as Applied Mathematics
2
Systems
• Separation Logics
• Temporal Logics
• Digraphs for modeling space and time
• Logics for artificial biochemistry
• Logics for global and concurrent computing
• Logics for access control
• Logics for data update
• ...
3
The Problem
• There do exist concepts which are sensitive to encoding in the metalanguage
• In order to carry out complex reasoning, we need to move from one Formal System toanother
• The Ultimate Formal System (UFS) might not exist, but we can hope that, at themetalevel, the Ultimate Logical Framework (ULF) might exist
• Does UFS exist? if not, does the ULF exist?
• FOL could do, but it does provide a heavy encoding overhead
4
A little History - I
• Exactly 20 years on Gordon Plotkin, was experimenting with Typed λ-calculi andCurry-Howard’s Proposition-as-types paradigm in order to build a general logic
• Proposition-as-types = typed λ-terms correspond to the (constructive) proofs of theproposition represented by the type
And a number of things fell into place in the Summer and Fall of 1986
• Martin-Löf introduced the notion of Judgment, Coquand and Huet the Calculus of Con-structions, Meyer and Rheingold the Π-calculus
• The Laboratory for the Foundations of Computer Science LFCS was founded inEdinburgh - many RA’s were hired, including Bob Harper and Furio Honsell - to workon a Generic Proof Editor
• Generic proof editor = should factor out as much as possible, so that one should notrestart form scratch every time one wanted to build a semi-automatic proof assistantfor a given logic. The template was the LCF environment
5
A little History - II
"A Framework for Defining Logics" by Harper, Honsell, Plotkin, submitted December 1986to LICS (published in JACM in 1993) put forward
• LF, a simple dependent typed λ-calculus, as a Generic Logic of Judgments , andhence as a Logic Specification Language
– the higher order nature of the system provides a natural setting for representingreasoning under assumptions , i.e. logics in natural deduction style, or usinglemma
– higher order dependent types naturally enforce side conditions related to gener-ality and locality of free variables
– hence types represent hypothetico general Judgments
– object language variables and substitution are modeled by the correspondingmeta-language notions
• the Judgments-as-Types paradigm i.e. a Judgment is provable if and only if thecorresponding type is inhabited
6
The LF paradigm for encoding a Logic L
• LF types encode the syntactic categories as well as the Judgments of the logic L
• Well typed ground LF terms represent wff in the logic as well as proofs of judgments
• Well typed higher order LF terms represent both binding operators and rule schemata
• So, substitution and instantiation are just λ-application
7
The features of LF
• MORAL: typed λ-calculus naturally captures all notions, machinery and pragmat-ics of logic specification and interactive proof development
• Decidability of type checking in LF expresses the decidability of proof correctness
• LF is logically normative
• LF is self encoding
• LF provides an excellent analysis of derivable and admissible rules
Feferman, Constable, Paulson, Pfenning showed that the LF game could be played also intheir systems viz Recursion Theory, NUPRL, Isabelle, ELF, TWELF, HOL, in as much theywere based on λ-calculus. The Nancy School plays this game with the typed ρ-calculus .
8
An example: the Signature for Propositional Logic à la Hilbert
Propositional Connectives
o : Type ⊃: o→ o→ o ¬ : o→ o
Judgment
True : o→ Type
Propositional Axioms
A1 : Πφo. Πψo. Trueφ ⊃ (ψ ⊃ φ)
A2 : Πφo. Πψo. Πθo. True(φ ⊃ (ψ ⊃ θ)) ⊃ (φ ⊃ ψ) ⊃ (φ ⊃ θ)
A3 : Πφo. Πψo. True(¬ψ ⊃ ¬φ) ⊃ (¬ψ ⊃ φ) ⊃ ψ
Rule
MP : Πφo. Πψo. Trueφ ⊃ True(φ ⊃ ψ) → Trueψ
9
Case studies over the years
• FOL, HOL, Type Theories, various λ-calculi
• Modal Logics
• Program Logics: Hoare’s and Dynamic
• π-calculus and Nominal Calculi
• ρ-calculus and Lambda+Rewriting
10
Critical issues
So what do you do with a system once you have it? If you are a natural philosopher andyou love knowledge, you try to break it ! And go and look for peculiar systems
• Encodings of Modal Logics are not so natural after all. Side conditions such as inrules of proof , (i.e. can be applied only when they depend on no assumptions) or inrules of derivation , (i.e. can be applied only if all assumptions are boxed ) can beencoded only indirectly
• Similarly for Program Logics which feature certain rules which can be applied only inspecial contexts (e.g. at top level)
One would like to be able to express syntactic conditions on terms, such as being closed ,not having any variable whose type contains certain constants, linearity, . . .
11
20 years later: The General Logical Framework
The idea of a Framework for Defining Logical Frameworks grew out of the need
• to extend the class of syntactical conditions on proof terms which can be expressednaturally
• To incorporate in LF, term rewriting systems and pattern-matching features like inthe Typed Rewriting Calculus à la Cirstea-Kirchner-Liquori (FOSSACS-01, TYPES-03, POPL-03)
• Jouannaud et al. share our enthusiasm and goal using a different “rewriting spirit”
incorporate→ cohabit
12
20 years later: The General Logical Framework GLF
• The solution arrived when we realized that: sometimes less is more (who said thatfirst?) and we removed a blind spot in the LF’s type system
Γ `M : Πx:σ.τ Γ ` N : σΓ `M N : τ [N/x]
Γ `M : Πx:σ.τ Γ ` N : σΓ `M N : (λx:σ.τ)N
• We replacedλx:σ.M and Πx:σ.τ by a new form ofλ and Π abstractionλP:∆.M and ΠP:∆.τ
• The predicate P is completely general at this stage, and
∆ 4= x1:σ1, . . . , xn:σn
denotes the bound variables by Π and λ in ΠP:∆.τ and λP:∆.M , and
(λP:∆.M)N reduces to MP(N) if P(N) holds
• P(N) is a substitution on Dom(∆), otherwise it gets stuck, until possible furthersubstitutions will make it fire
13
Hat and Bar (Postpone?)
In order to instantiate GLF, we need to specify P . This amounts to defining a typabilityprecondition and a substitution
1. Let ¯ : [L → [C → GLF]] be a function taking a predicate P and a context ∆, andproducing a term whose free variables are in Dom(∆). Informally, ¯ gives the termsubexpressions of the predicate . It will be made clear in the typing rules
2. Let : [L → [C → [GLF → Sub]⊥]] be a function taking a P and a ∆, and producinga partial function that takes a term M and produces a substitution over Dom(∆),provided M satisfies P . It will be used in reductions
14
GLF’s Syntax and Judgments
Σ ::= ∅ | Σ, a:K | Σ, f :σ Signatures
Γ ::= ∅ | Γ, x:σ Contexts
K ::= Type | ΠP:∆.K | λP:∆.K | KM Kinds
σ ::= a | ΠP:∆.σ | λP:∆.σ | σM Types (Families)
M ::= f | x | λP:∆.M |M N Terms (Objects)
Σ sig `Σ Γ Γ `Σ K Γ ` σ : K Γ `Σ M : σ
15
GLF’s Reductions (top level)
(βP−Terms) (λP:∆.M)N →βP M P(N)
(βP−Types) (λP:∆.σ)N →βP σ P(N)
(βP−Kinds) (λP:∆.K)N →βP K P(N)
Let : [L → [C → [GLF → Sub]⊥]] be a function taking a P and a ∆, and producing apartial function that takes a term M and produces a substitution over Dom(∆), providedM satisfies P . We denote P(∆) simply by P
16
Signature and Context Rules
∅ sig(S·Empty)
Σ sig `Σ K a 6∈ Dom(Σ)Σ, a:K sig
(S·Kind)
Σ sig `Σ σ : Type f 6∈ Dom(Σ)Σ, f :σ sig
(S·Type)
Σ sig
`Σ ∅(C·Empty)
`Σ Γ Γ `Σ σ : Type x 6∈ Dom(Γ)`Σ Γ, x:σ
(C·Type)
17
Kind Rules
Let ¯: [L → [C → GLF]] be a function taking a predicate P and a context ∆, and producing
a term whose free variables are in Dom(∆). Informally,¯gives the term subexpressions
of the predicate . We denote P(∆) simply by P
Γ,∆ `Σ P : σ Γ,∆ `Σ K
Γ `Σ ΠP:∆.K(K·Pi)
Γ,∆ `Σ P : σ Γ,∆ `Σ K
Γ `Σ λP:∆.K(K·Abs)
Γ `Σ ΠP:∆.K Γ,∆ `Σ P : σ Γ `Σ N : σ
Γ `Σ (λP:∆.K)N︸ ︷︷ ︸redex?
(K·Appl)
18
Family Rules
`Σ Γ a:K ∈ ΣΓ `Σ a : K
(F·Var)
Γ,∆ `Σ P : σ Γ,∆ `Σ τ : Type
Γ `Σ ΠP:∆.τ : Type(F·Pi)
Γ,∆ `Σ P : σ Γ,∆ `Σ τ : KΓ `Σ λP:∆.τ : ΠP:∆.K
(F·Abs)
Γ `Σ σ : ΠP:∆.K Γ `Σ M : τ
Γ `Σ σM : (λP:∆.K)M︸ ︷︷ ︸redex?
(F·Appl)
Γ `Σ σ : K′ Γ `Σ K Γ `Σ K =βP K′
Γ `Σ σ : K(F·Conv)
19
Object Rules
`Σ Γ f :σ ∈ ΣΓ `Σ f : σ
(O·Const)`Σ Γ x:σ ∈ Γ
Γ `Σ x : σ(O·Var)
Γ,∆ `Σ P : σ Γ,∆ `Σ M : τΓ `Σ λP:∆.M : ΠP:∆.τ
(O·Abs)
Γ `Σ M : ΠP:∆.τ Γ,∆ `Σ P : σ Γ `Σ N : σ
Γ `Σ M N : (λP:∆.τ)N︸ ︷︷ ︸redex?
(O·Appl)
Γ `Σ M : σ Γ `Σ τ : Type Γ `Σ σ =βP τ
Γ `Σ M : τ(O·Conv)
20
GLF’s Equality
Γ `Σ K =βP K′ K and K′ are equal kinds in Γ and Σ
Γ `Σ σ =βP τ σ and τ are equal types in Γ and Σ
Γ `Σ M =βP N M and N are equal terms in Γ and Σ
21
Type Equality Rule
∀yi ∈ Dom(P(M)). [ Γ,∆ `Σ P(M)(yi) : ∆(yi) ]
Γ,∆ `Σ P : σ Γ `Σ M : σ
Γ `Σ (λP:∆.τ)M =βP τ P(M)
22
A Galleria of Desired Properties to get the Meta-Paradise ...
Subderivation Property
• Any derivation of Γ `Σ α has subderivations of Σ sig and `Σ Γ;
• Any derivation of Σ, a:K sig has a subderivation of `Σ K;
• Any derivation of Σ, f :σ sig has a subderivation of `Σ σ : Type;
• Any derivation of `Σ Γ, x:σ has a subderivation of Γ `Σ σ : Type;
• Given a derivation of Γ `Σ α and any subterm occurring in the subject of thejudgment, there exists a derivation of a smaller length of a judgment having thatsubterm as a subject;
• If Γ `Σ σ : K, then Γ `Σ K;
• If Γ `Σ M : σ, then Γ `Σ σ : Type.
Derivability of Weakening and PermutationIf Γ and ∆ are valid contexts, and every declaration occurring in Γ also occurs in ∆,then Γ `Σ α implies ∆ `Σ α.
23
Unicity of Types and Kinds
• If Γ `Σ M : σ and Γ `Σ M : τ , then Γ ` σ =βP τ ;
• If Γ `Σ σ : K and Γ `Σ σ : K′, then Γ `Σ K =βP K′.
Transitivity or CutIf Γ, x:σ,∆ `Σ α and Γ `Σ M : σ, then Γ,∆[M/x] `Σ α[M/x].
Confluence
• If K1 7→→βP K2 and K1 7→→βP K3, then there exists K4 such that K2 7→→βP K4 andK3 7→→βP K4;
• If σ1 7→→βP σ2 and σ1 7→→βP σ3, then there exists σ4 such that σ2 7→→βP σ4 and σ3 7→→βP σ4;
• If M1 7→→βPM2 and M1 7→→βPM3, then there exists M4 such that M2 7→→βPM4 andM3 7→→βPM4.
Abstraction Typing
• If Γ `Σ λP:∆.τ : ΠP:∆′.K, then Dom(∆) ≡ Dom(∆′), and forall x ∈ Dom(∆),we have Γ,∆ `Σ ∆(x) =βP ∆′(x);
• If Γ `Σ λP:∆.M : ΠP:∆′.τ , then Dom(∆) ≡ Dom(∆′), and forall x ∈ Dom(∆),we have Γ,∆ `Σ ∆(x) =βP ∆′(x);
• If Γ `Σ λP:∆.τ : ΠP:∆.K, then Γ,∆ `Σ P : σ and Γ,∆ `Σ τ : K;
• If Γ `Σ λP:∆.M : ΠP:∆.τ , then Γ,∆ `Σ P : σ and Γ,∆ `Σ M : τ .
Subject Reduction
• If Γ `Σ K and K →βP K′, then Γ `Σ K′;
• If Γ `Σ σ : K and σ →βP τ , then Γ `Σ τ : K;
• If Γ `Σ M : σ and M →βP N , then Γ `Σ N : σ.
Strong Normalization
• If Γ `Σ K, then K is strongly normalizing;
• If Γ `Σ σ : K, then σ is strongly normalizing;
• If Γ `Σ M : σ, then M is strongly normalizing.
Judgments decidabilityIt is decidable whether Γ `Σ α is derivable.
24
Back to the Earth ...
The following is about the most that one could prove for a General Logical Framework atthis stage of generality.
1. The Subderivation Property is valid in GLF;
2. Derivability of Weakening and Permutation is valid in GLF;
3. Unicity of Types and Kinds is valid in GLF;
4. If Abstraction Typing is valid, then Subject Reduction is valid in GLF.
25
First Example - The Closed Logical Framework CLF
CLF is an instance of GLF obtained by considering the following two unary predicates andcorresponding Hat and Bar functions:
True(M)4= true (∀M)
Closed(M)4=
true if Fv(M) = ∅false otherwise
True, 〈x:A〉 = Closed, 〈x:A〉 = x
True, 〈x:A〉, N = Closed, 〈x:A〉, N = [N/x]
One can easily see that λTrue:〈x:A〉.M corresponds to the standard LF term λx:A.M .We will write λClosed:〈x:A〉.M simply as λ∅x:A.M .
Hence CLF features the following two notions of β-reduction:
1. standard β-reduction: (λx:A.M)N →β M [N/x]
2. closed β-reduction: (λ∅x:A.M)N →β M [N/x] if Fv(N) = ∅
26
The Properties of CLF
Standard β-reduction and closed β-reduction nicely combine, in the sense that a potentialclosed β-reduction is preserved under application of any substitution (coming from another,possibly standard reduction), and vice versa:
Lemma 1 (Closure under Reduction and Substitution) If M ∈ Λ∅, then, for any substi-tution θ, Nθ ∈ Λ∅. Moreover, for any M and N , and for any θ such that x 6∈ CoDom(θ), wehave N [M/x]θ ≡ Nθ[Mθ/x].
This is the basis for proving
Theorem 1 ( Confluence ) The relation 7→β is confluent. 2
Proof. Using a suitable notion of parallel reduction.
Strong Normalization follows from strong normalization of LF
Subject Reduction , and Typing Decidability also hold
27
Application: ΣS4for classic S4 modal logic in Hilbert style in CLF
Propositional Connectives and Judgment
o : Type ⊃: o3 ¬ : o2 2 : o2 True : o→ Type
Propositional Axioms
A1 : Πφo. Πψo. Trueφ ⊃ (ψ ⊃ φ)
A2 : Πφo. Πψo. Πθo. True(φ ⊃ (ψ ⊃ θ)) ⊃ (φ ⊃ ψ) ⊃ (φ ⊃ θ)
A3 : Πφo. Πψo. True(¬ψ ⊃ ¬φ) ⊃ ((¬ψ ⊃ φ) ⊃ ψ
Modal Axioms
K : Πφo. Πψo. True2(φ ⊃ ψ) ⊃ (¬φ ⊃ ¬ψ)
4 : Πφo. True2φ ⊃ 22φ
> : Πφo. True2φ ⊃ φ
Rules
MP : Πφo. Πψo. Trueφ ⊃ True(φ ⊃ ψ) → Trueψ
NEC : Πφo. Π∅x:Trueφ. True2φ
28
Second Example - The Pattern Logical Framework
Terms
Σ ::= ∅ | Σ, a:K | Σ, f :A Signatures
Γ,∆ ::= ∅ | Γ, x:A Contexts
K ::= Type | ΠP :∆.K | λP :∆.K | KM Kinds
A,B,C ::= a | ΠP :∆.A | λP :∆.A | AM Families
M,N,Q ::= f | x | λP :∆.M |MM Objects
where P ∈ OP ⊆ O and OP is a set of patterns to be defined.
Safe terms : the free variables occurring in patterns are precisely the variables declared inthe corresponding context.
29
β-reduction
The pattern-matching algorithm can either fire a substitution , or keep the computation
stuck , unless further substitutions are provided.
E.g., for an algebraic constant f of type a→ a,
M ≡ (λ(f y):[y:a].y)x
is stuck, but
(λ(f x):[x:a].M) (f (f 3)) 7→→β 3
In general,
(λP :∆.M)N 7→β Mθ if θ = Alg(P ;N)
where Alg (omitted in this talk, simplification of POPL03) is such that,
if θ = Alg(P ;N), then Pθ ≡ N
30
PLF - Critical design issues: Shape of Patterns
Let OP be the set of patterns defined by
OP 4=
P ∈ NfO | LPC(P ; Fv(P )) = true ∧
APC(P ; Fv(P )) = false
LPC expresses the linear pattern condition, APC expresses the active pattern condition.Why so complicated?
31
PLF - Critical design issue 1
• Variables in functional position. It is well known since van Ostroom ’90, that allowing
variables in functional position breaks confluence.
M 4= (λ(x y):[x:a→a, y:a].x) (I z)
where
I 4= λx:a.x
Namely,
M 7→β (λ(x y):[x:a→a, y:a].x) z
by reducing the argument, while
M 7→β I
by reducing the outermost redex.
32
PLF - Critical design issue 2
• Linearity condition. It is also well-known since Klop ’80, that if we abandon the linear-ity condition in patterns, we loose confluence of raw terms. Namely, let
– Y 4= (λy:?.λx:?.(x (y y x))) (λy:?.λx:?.(x (y y x))) be the (hopefully
untypable) fix-point combinator
– D 4= λ(f z z):[z:a].e be a term with a non-linear pattern
– C 4= Y (λy:?.λx:?.D (f x (y x)))
– A 4= Y C
Then, we have: A 7→→β C e and A 7→→β e. Thus the system is not confluent. How-ever, one can check that the fix-point operator Y is not typable. Hence the abovecounterexample does not apply to the case of well-typed (strongly normalizing) terms
33
PLF - Critical design issue 3
• Substitution-stuck redexes. The reason for allowing in patterns only substitution-
stuck redexes, and not simply stuck redexes, is that, in this way, patterns can match only
arguments where the corresponding redexes will never fire. Otherwise, if we include
patterns of the shape (λP1:∆.P2)P3~P ′, where only Alg(P1;P3) = fail, i.e.
only the present reduction is stuck, we loose confluence. A counterexample
M 4= (λ((λI:∅.I)x):[x:a→a].x) ((λI:∅.I) I)
Reducing the outermost redex, we getM 7→β I; reducing inside the argument,
M 7→β (λ((λI:∅.I)x):[x:a→a].x) I
34
PLF - Critical design issue 4
• Exact Pattern Condition. We consider only terms where the variables occurring in
patterns are precisely the variables declared in the corresponding contexts.
Fv(P ) = Dom(∆)
On the other hand, one could think of having Dom(∆) ⊆ Fv(P ), i.e. patterns can
contain free variables, which can be bound outside, and hence they can be substituted
during reductions (a.k.a. dynamic patterns ), as the variable y in the following term
(λy:a.λ(f x y):[x:a].y) z 7→β λ(f x z):[x:a].z
But this causes problems when combined with untypable fix-points (see the encodingof the Klop counter example in the nice Wack Ph.D. 06), since non-linear terms can bemimicked via dynamic patterns, even under the linearity pattern condition
35
PLF - Critical design issue 5
• Pattern reductions. The counterexample in issue 3 above also shows that extend-ing the class of patterns beyond normal forms, by allowing reductions in patterns ispotentially dangerous.
In this perspective, in order to preserve confluence when reductions in patterns arepermitted, a possible solution is that of allowing reductions to fire only when the patternis a normal form.
This corresponds to partially fixing a reduction strategy.
However, K-reductions in patterns deserve special discussion.
36
PLF - Critical design issue 6
• K-reductions in patterns. A K-redex is a redex (λP :∆.M)N , where λP :∆.M
is a K-abstraction, i.e.
Fv(M) ⊂ Fv(P )
When a K-redex is reduced, (parts of) the argument is erased. As a consequence, the
Exact Pattern Condition is violated, and bound variables may become free. Example:
M 4= (λ ((λx:a.y) z)︸ ︷︷ ︸
P
:[y:a→a, z:a].y z) ((λx:a.f) g)︸ ︷︷ ︸N
Then, by reducing the pattern P and the argumentN , and then reducing the outermost
redex, we get
M 7→→β(λy:[y:a→a, z:a].y z) f 7→β f z
i.e. z comes out of its scope!
37
PLF - Still Critical design issue 6
To avoid this problem, we could simply block K-reductions in patterns , but then we alsoneed to block pattern matching when the pattern contains a K-redex . Otherwise, weloose confluence, the termM 4
= (λ ((λx:a.y) z)︸ ︷︷ ︸P
:[y:a→a, z:a].y z) ((λx:a.f) g)︸ ︷︷ ︸N
above being a counterexample.
Namely, by reducing the outermost redex,
M 7→β f g
while, by reducing the argumentN , we get
M 7→β (λ((λx:a.y) z):[y:a→a, z:a].y z) f
which is not reducible anymore
38
PLF - Results
ConfluenceThe relation 7→β is confluent.
Subject Reduction
1. IfΓ `Σ A:K andA 7→β B, thenΓ `Σ B:K;
2. If Γ `Σ M : A and M 7→β N , then Γ `Σ N : A.
Strong Normalization
1. If Γ `Σ K, then K ∈ SNK;
2. If Γ `Σ A : K, then A ∈ SNF ;
3. If Γ `Σ M : A, then M ∈ SNO.
Judgments decidabilityIt is decidable whether the PLF judgment Γ `Σ α is derivable.
PLF is particularly suitable as a Logical Framework for encoding case analysis39
Applications: Σv for Plotkin’s λv-calculus in PLF
Syntactic Categories
o : Type
Constructors and Judgments
! : o2 Lam : Πf :[Π!xo.o]. o App : o3 = : o→ o→ Type
Axioms and Rules
Eqrefl : Πxo. x = x
Eqsymm : Πxo. Πyo. (x = y) → (y = x)
Eqtrans : Πxo. Πyo. Πzo. (x = y) → (y = z) → (x = z)
Eqctx : Πxo. Πyo. Πzo. Πwo. (x = y) → (z = w) → (App x z = App y w)
Betav : Πf :[Π!xo.o]. Πyo. App (!(Lam f)) (!y) = f (!y)
Xiv : Πf :[Π!xo.o]. Πg:[Π!xo.o].
(Πzo. f (!z) = g (!z) → (!(Lam f) = !(Lam g))
Etav : Πxo. !(Lam (λ(!yo).App (!x) (!y))) = !x
40
Questions and future work
• Is there a semantics for λP:∆.M? Using monads?
• Are there interesting Curry-Howard isomorphisms for GLF or more specifically forsystems blending rewriting facilities and higher order calculi, such as PLF?
• Extend existing proof assistants based on dependent type systems, e.g. Coq, with pat-tern matching facilities as in PLF, and more generally with GLF.
• Instantiate GLF in order to give sharp encodings of relevance and linear logics?
• We have seen that here is no strong notion of pattern reduction. Still, can we allowreductions in patterns under specific strategies?
• Can the linearity restriction in patterns be relaxed, still preserving confluence and strongnormalization over well typed patterns?
• Our results should scale up to all the systems of rho-cube à la Cirstea-Kirchner-Liquori(FOSSACS-01,POPL-03), i.e. to systems corresponding to the full Calculus of Con-structions and Pure Pattern Type Systems.
• Formalize the notion of predicate P , still preserving generality.
41
• Confluence and Strong Normalization should hold for a generic predicate calculus,provided that the various notions of reductions nicely combine, in the sense that 7→Pi-reductions are preserved both under 7→Pj-reductions of the argument and applicationto the argument of any substitution coming from other reductions.
• Case analysis in PLF should be compared with that of inductive types in Coq.
• Instantiate GLF so as to provide a more natural encoding of the Natural Deduction 2-introduction rule of Prawitz:
2Γ ` φ2Γ ` 2φ
(2-Intro)
E.g. if we introduce a new predicate Occursx4= “x is a term whose free variables
occur only in subterms of type True2ψ for some ψ”, then 2-Intro becomes:
2-I : Πφ:o. ΠOccursx:[x:Trueφ]. True2φ.
Rewriting Calculus Statistics
• New syntax and New Operational Semantics in 2001 (RTA) almost constant since 2006(modulo symbol choices and one redundant-innocuous one-step rule (σ)
• Type systems for Rho set up in 2001 (FOSSACS) and almost constant since 2006(modulo some symbol choices)
• Syntax Restrictions on Patterns vary since 1998!
• Dynamic Patterns in 2003 (POPL)
• Strong Normalization conjectured in 2001, achieved in 2004 for the simply types with“minipatterns” (à la Wack) via compilation to Fω, achieved in 2006 using Tait & Löf
• 20 trip to Nancy, Sophia, Udine, Edinburgh, 1 PhD, 5 diff. techniques, 2 rejection, circa300 CVS commit, 5-7 people involved, circa 1000 expressos, etc.
• In one sentence: The most expensive proof of my 15YY academic life!!
42
How to get a copy of this paper
• In Gordon Plotkin’s Festschrift, ENTCS
• Now on hal.inria.fr , the INRIA’s open archive
43
Comp Sets
• Let CompO be the set of object computability candidates defined as follows.
N ∈ CompO if and only if N satisfies:
(c1) N ⊆ SNO;
(c2) ∀ ~N ∈ SNO. x ~N , and f ~N ∈ N ;
(c3) N is closed under the rule
Q 7→→βQ′ Alg(P ;Q′) = θ (Mθ) ~N ∈ N CoDom(∆), Q ∈ SN
(λP :∆.M)Q ~N ∈ N
(c4) N is closed under the rule
∀Q′. [Q 7→→βQ′ ⇒ Alg(P ;Q′) = fail] CoDom(∆),M,Q, ~N ∈ SN
(λP :∆.M)Q ~N ∈ N
• Let CompF be the set of family computability candidates defined as follows.
44
N ∈ CompF if and only if N satisfies:
(c1) N ⊆ SNF ;
(c2) ∀ ~N ∈ SNF . a ~N ∈ N ;
(c3) N is closed under the rule
Q 7→→βQ′ Alg(P ;Q′) = θ (Aθ) ~N ∈ N CoDom(∆), Q ∈ SN
(λP :∆.A)Q ~N ∈ N
(c4) N is closed under the rule
∀Q′. [Q 7→→βQ′ ⇒ Alg(P ;Q′) = fail] CoDom(∆), A,Q, ~N ∈ SN
(λP :∆.A)Q ~N ∈ N
Type and Kind Interpretation
• Let J− KF be the family interpretation function defined by induction on families as fol-lows.J a ~N KF = SNO
J XP :∆:B.A KF =M∣∣∣∣∣∣Q ∈ JB KF =⇒ M Q ∈
SNO if P 6v Q⋃JAθ KF | Q 7→→βQ
′ ∧ θ = Alg(P ;Q′) otherwise
J (λP :∆.A)M ~N KF =
SNO if P 6vM⋃J (Aθ) ~N KF |M 7→→βM
′ ∧ θ = Alg(P ;M ′) otherwise
• Let J− KK be the family interpretation function defined by induction on kinds as follows.J Type ~N KK = SNF
J XP :∆:B.K KK =A∣∣∣∣∣∣Q ∈ JB KK =⇒ AQ ∈
SNF if P 6v Q⋃JKθ KK | Q 7→→βQ
′ ∧ θ = Alg(P ;Q′) otherwise
J (λP :∆.K)M ~N KK =
SNF if P 6vM⋃J (Kθ) ~N KK |M 7→→βM
′ ∧ θ = Alg(P ;M ′) otherwise
45
Klop’s Counter Example in Barry’s Pattern Calculus
Ω 4= [y]y → [x]x→ (x (y y x))
Y 4= ΩΩ
D 4= [x, y](d x y) → ([ ]x→ e) Morally [x](d x x) → e
E 4= ([y]y → [x]x→ D (d x (y x)))
C 4= Y E Reduces to ⇒ E C ⇒ [x]x→ D (d x (C x))
A 4= Y C
A⇒ C A ⇒ D (dA (C A)) ⇒ D (d (C A) (C A))⇓ ⇓C e e
46