Higher-order recognizability Suppose given a set L of simply-typed λ -terms of same type A . Question: When should one consider the set L as a recognizable language? Tentative answer: Use a finite Scott domain interpretation of types. 45
Higher-order recognizability Suppose given a set L of simply-typed λ -terms of same type A . Question: When should one consider the set L as a recognizable language? Tentative answer: Interpret the simple type A as a finite Scott domain. 46
Higher-order recognizability Every finite Scott domain (= ordered set with a least element ⊥ ) = ( D , ≤ ) D induces an interpretation of A as a finite Scott domain: [ [ ♦ ] ] := D [ A × B ] ] × [ [ ] := [ [ A ] [ B ] ] [ [ A ⇒ B ] ] := [ [ A ] ] ⇒ [ [ B ] ] Every λ -term M of type A is interpreted as an element [ [ M ] ] ∈ [ [ A ] ] of the Scott domain [ [ A ] ] . 47
Higher-order recognizability Now, every finite subset ϕ ⊆ [ [ A ] ] induces a set L ϕ = { M | [ [ M ] ] ∈ ϕ } of λ -terms of type A . ] ∈ ϕ . Notation: We write � M : ϕ to mean that [ [ M ] Definition. [ adapted from Salvati 2009 ] A set of λ -terms L is recognizable when it is of the form L ϕ . 48
The Scott semantics of linear logic Well-known principle. Every preorder ( A , ≤ ) induces a Scott domain ( Dom ( A ) , ⊆ ) defined as follows: its elements are the lower sets of the preorder, ⊲ the lower sets are ordered by inclusion. ⊲ Recall that a subset X ⊆ A is a lower set of the preorder ( A , ≤ ) when ∀ a ∈ A, ∀ x ∈ X, a ≤ x ⇒ a ∈ X. 49
The Scott semantics of linear logic Key observation. Suppose that the base type ♦ is interpreted as the domain of lower sets [ [ ♦ ] ] = Dom ( Q , ≤ ) generated by a preorder Q of atomic states . In that case, the interpretation of every type A is a domain of lower sets Dom ( Q A , ≤ A ) [ [ A ] ] := generated by a specific preorder Q A of higher-order states . 50
The Scott semantics of linear logic This induces a family of logical connectives on preorders: A ⊥ A op := A & B := ( A + B , ≤ A + ≤ B ) A ⊗ B ( A × B , ≤ A × ≤ B ) := ! A := ℘ fin ( A ) where the finite sets of elements of A are ordered as: { a 1 , . . . , a p } ≤ ! A { b 1 , . . . , b q } ⇐⇒ ∀ i ∈ { 1 , ..., p } ∃ j ∈ { 1 , ..., q } a i ≤ A b j 51
The Scott semantics of linear logic Given a preorder of atomic states for the base type ♦ = ( Q , ≤ ) Q ♦ the preorder Q A of higher-order states is defined by induction: Q A × B = Q A & Q B = ! Q A ⊸ Q B Q A ⇒ B In particular, a state of the simple type A ⇒ B is of the form { q 1 , . . . , q n } ⊸ q where q 1 , . . . , q n are states of A and q is a state of B . 52
What is a higher-order automaton? Methodological question. Given a simple type A , a finite preorder ( Q, ≤ ) and a subset ϕ ⊆ [ [ A ] ] can we describe the λ -terms of the associated language L ϕ = { M | [ [ M ] ] ∈ ϕ } = { M | � M : ϕ } in a more direct and automata-theoretic fashion ? 53
What is a higher-order automaton? Methodological question. Given a simple type A , a finite preorder ( Q, ≤ ) and an element q ∈ Q A can we describe the λ -terms of the associated language L q = { M | q ∈ [ [ M ] ] } in a more direct and automata-theoretic fashion ? 54
Higher-order alphabet Definition. A higher-order alphabet = a 1 : A 1 , . . . , a n : A n Σ is a finite set Σ of letters equipped with a function Σ : Σ → Type which maps every letter a ∈ Σ to its higher-order arity Σ ( a ) ∈ Type defined as a simple type of the λ -calculus. 55
What is a higher-order automaton? Definition. A higher-order automaton = � Σ , A , Q , δ , q 0 � A consists of: a higher-order alphabet Σ = a 1 : A 1 , . . . , a n : A n ⊲ a simple type A ⊲ a finite preordered set of states Q ⊲ a family of transition functions δ ( a i ) ⊆ Q A i ⊲ q 0 ∈ Q A a higher-order initial state ⊲ where the interpretation of types is induced by the preorder Q o = Q . 56
Run-trees Definition A run-tree R is a derivation tree of the judgement � Σ ⊢ M : A | δ, q � in the deduction system defined by the rules q ′ ∈ δ ( a ) q ≤ A q ′ Variable � Σ , a : A ⊢ a : A | δ, q � � Σ , a : A ⊢ M : B | δ + a �→ { q 1 , . . . , q n } , q � Abstraction � Σ ⊢ λa.M : A ⇒ B | δ , { q 1 , . . . , q n } ⊸ q � � Σ ⊢ M : A ⇒ B | δ, u ⊸ q � � � Σ ⊢ N : A | δ, u � � Application � Σ ⊢ App ( M, N ) : B | δ, q � � Σ ⊢ M : A | δ, q 1 � � Σ ⊢ M : A | δ, q n � . . . Bag � � Σ ⊢ M : A | δ, { q 1 , . . . , q n } � � 57
Illustration The higher-order automaton A = � Σ , A ⇒ B , Q , δ , q � with higher-order state = { q 1 , . . . , q n } ⊸ q 0 ∈ q Q A ⇒ B confronted to the simply-typed λ -term ⊢ λa . M : A ⇒ B Σ becomes the higher-order automaton A ′ = � Σ ∪ { a : A } , Q , δ , a �→ { q 1 , . . . , q n } , q 0 � confronted to the simply-typed λ -term ⊢ Σ , a : A M : B. 58
Illustration of a run-tree { } { } { } { } { } { } q q q q q q q declaration of the letter a λa { } { } { } { } q { } { } q ⌣ ⌢ q q q q q δ a = declaration of the letter b λb { } { } { } q q ⌣ ⌢ q q δ b = declaration of the letter c λc { } q ⌣ c = ⌢ q δ a q q a c q q b q c 59
An adequacy theorem for the λ -calculus Suppose given a finite preorder ( Q , ≤ ) . Adequacy Theorem [ Salvati 2009 ] The interpretation [ [ M ] ] of a simply-typed λ -term M of type A is the set of its accepting states. In other words, for every higher-order state q ∈ Q A , q ∈ [ [ M ] ] ⇐⇒ M is accepted by the automaton � ∅ , Q , A , ∅ , q � 60
Higher-order recursion schemes Moving to an infinitary situation 61
Higher-order recursion schemes The infinite tree a a c a b b c b c is generated by the higher-order recursion scheme �→ S F a b c �→ x ( y z ) ( F x y ( y z )) F x y z 62
Church encoding in the λY -calculus The higher-order recursion scheme �→ S F a b c �→ x ( y z ) ( F x y ( y z )) F x y z may be seen as a λ -term of type ( ♦ ⇒ ♦ ⇒ ♦ ) ⇒ ( ♦ ⇒ ♦ ) ⇒ ♦ ⇒ ♦ in the simply-typed λ -calculus extended with a recursion operator Y . Here, each tree-constructor a , b and c is of type: a : ♦ ⇒ ♦ ⇒ ♦ b : ♦ ⇒ ♦ c : ♦ 63
Church encoding in the λY -calculus The higher-order recursion scheme �→ S F a b c �→ x ( y z ) ( F x y ( y z )) F x y z may be seen as a λ -term of type ( (( ♦ × ♦ ) ⇒ ♦ ) × ( ♦ ⇒ ♦ ) × ♦ ) ⇒ ♦ in the simply-typed λ -calculus extended with a recursion operator Y . Here, each tree-constructor a , b and c is of type: a : ( ♦ × ♦ ) ⇒ ♦ b : ♦ ⇒ ♦ c : ♦ 64
Church encoding in the λY -calculus The higher-order recursion scheme is translated as = ( Y [ λF.λx.λy.λz. x z ( F x y ( y z ) ) ] ) a b c M where the functional F has type ( (( ♦ × ♦ ) ⇒ ♦ ) × ( ♦ ⇒ ♦ ) × ♦ ) ⇒ ♦ Recall that the fixpoint operator Y behaves in the following way: �→ Y M M ( Y M ) . 65
Church encoding in the λY -calculus This alternative (and somewhat simpler) = ( Y [ λF.λz. a z ( F ( b z ) ) ] ) c M produces the infinitary λ -term [ M ] ∞ obtained by plugging the context λz App App App App a z b z into itself, coinductively... 66
R App c λz App S App App App λz z a b z App T App [ M ] ∞ = App App λz z a b z App App λz App App z a z b 67
Generation by infinitary β -rewriting The λ -term [ M ] ∞ is then rewritten by an infinite sequence of β -redexes [ M ] ∞ · · · · · · M 1 M p into the expected infinite tree a a c = N a b b c b c 68
Generation by infinitary β -rewriting The λ -term [ M ] ∞ is then rewritten by an infinite sequence of β -redexes [ M ] ∞ · · · · · · M 1 M p into the expected infinite tree (along the Church encoding) App App App a c = N App a App App c b App a App b App c b 69
R App c λz App S App App App λz z a b z App T App [ M ] ∞ = App App λz z a b z App App λz App App z a z b 70
App App S a c App λz App c b App T App M 1 = App App λz z a b z App App App λz App z a z b 71
App App a c App App a App T c b App λz App M 2 = c b App App App App λz z a z b 72
App App App a c App a App N = App c b App a App b App c b 73
Generation by infinitary β -rewriting The infinitary sequence of β -redexes [ M ] ∞ N which turns [ M ] ∞ into the infinite tree N plays a central role... Key observation: The sequence may be chosen « strongly Cauchy convergent » in the sense of the Dutch school in infinitary rewriting. 74
Invariance theorem More generally, consider an infinite sequence of β -redexes M N which is strongly Cauchy convergent . We establish that for every higher-order automaton A , the following invariance property is satisfied by the rewriting path: Invariance theorem. the ho-automaton A the ho-automaton A recognizes ⇐⇒ recognizes the infinitary λ -term M the infinitary λ -term N . 75
An important message here... This invariance property is apparently easy to establish using the traditional tools of denotational semantics: ⊲ Scott semantics ⊲ continuity ⊲ Böhm trees However, this semantic approach only works for automata with purely inductive acceptance conditions. One thus needs to revisit the foundations entirely for more sophisticated notions of higher-order automata mixing inductive and coinductive acceptance conditions. 76
Higher-order automata Shifting to the infinitary λ -calculus 77
The λY µν -calculus The λY µν -calculus is defined as the simply-typed λ -calculus equipped with a least and greatest fixpoint operators: : ( A ⇒ A ) ⇒ A Y µ : ( A ⇒ A ) ⇒ A. Y ν The two operators behave in the same way syntactically: −→ M ( Y µ M ) Y µ M −→ M ( Y ν M ) Y ν M [ − ] but they are interpreted differently in the Scott semantics [ ] µν . 78
Infinite λ -terms with boundary Definition A boundary Þ of a simply-typed infinitary λ -term M is a set Þ ⊆ ∞ -path ( M ) of infinite paths of M . A simply-typed infinitary λ -term with boundary is a pair ( M, Þ M ) consisting of a simply-typed infinitary λ -term M together with a boundary Þ M . Inspired by the definition of Borelian games in descriptive set theory 79
The adequacy theorem with boundary Suppose given a finite preorder ( Q , ≤ ) . Adequacy Theorem The interpretation [ [ M ] ] µν of a simply-typed λY µν -term M of type A coincides with the set of its accepting states. In other words, for every higher-order state q ∈ Q A , q ∈ [ ⇐⇒ M is accepted by the automaton A = � ∅ , Q , A , ∅ , q � [ M ] ] where the acceptance condition on the run-trees of the automaton A reflects the inductive and coinductive status of the fixpoints. 80
Back to our illustration The translation = ( Y [ λF.λz. a z ( F ( b z ) ) ] ) c M produces the infinitary λ -term [ M ] ∞ obtained by plugging the context into itself λz App App App App z a b z inductively or coinductively depending on the definition of the boundary... 81
Traditional definition of the fixpoint operator Y R App c λz App S App App λz App z a b z [ Y P ] ∞ = App T App λz App App z a b z App App λz App App z a b z 82
Inductive definition of the fixpoint operator Y µ R App c λz App S App App App λz z a b z App [ Y µ P ] ∞ = T App App λz App a z b z App App App λz App z a b z infinite path not in the boundary 83
Coinductive definition of the fixpoint operator Y ν R App c λz App S App λz App App a z z b App [ Y ν P ] ∞ = T App App λz App a z z b App App App App λz z z a b infinite path in the boundary 84
Generation by infinitary β -rewriting The λ -term [ M ] ∞ is then rewritten by an infinite sequence of β -redexes [ M ] ∞ · · · · · · M 1 M p into the expected infinite tree a a c = N a b b c b c 85
Generation by infinitary β -rewriting The λ -term [ M ] ∞ is then rewritten by an infinite sequence of β -redexes [ M ] ∞ · · · · · · M 1 M p into the expected infinite tree (along the Church encoding) App App App a c = N App a App App c b App a App b App c b 86
The need for an invariance theorem Consider an infinite sequence of β -redexes M N which is strongly Cauchy convergent . We establish that for every higher-order automaton A , the following invariance property is satisfied by the rewriting path: Invariance theorem. the ho-automaton A the ho-automaton A recognizes recognizes ⇐⇒ the infinitary λ -term M the infinitary λ -term N with boundary with boundary. 87
A key tool: diffraction patterns Key idea: The occurrence D of a β -redex R is turned into a diffraction pattern E = { D A,i | i ∈ I } ⊸ D B by the reduction of the β -redex: N M D R B App D R −→ β λa P Q D A, D A, D A, P Q Q Q a a a 88
R App D c λz App S App E App App λz z a b z App T App F [ M ] ∞ = App App λz z a b z App App λz App App z a z b 89
D App App D S a c App E λz App D c b App T App M 1 = F App App λz z a b z App App App λz App z a z b 90
D App App D E a c App App E a App D T c b App F E λz M 2 = App D c b App App App App λz z z a b 91
D App E App D App a c F App E a App D N = App c b App F a App E b App D c b 92
A modal translation of higher-order parity games The S4 construction at work 93
A colour modality for Scott domains Suppose given a specific number n of colours. Definition. The colour modality on preorders is defined as A & · · · & A := � A � �������������� �� �������������� � n As a consequence, note that Dom ( � A ) := Dom ( A ) × · · · × Dom ( A ) 94
The colour modality Two observations The modality � defines a comonad. ⊲ : −→ ε A � A A (1 , q ) �→ q −→ : δ A � A � � A �→ ( max ( m 1 , m 2 ) , q ) ( m 1 , ( m 2 , q )) The comonad � commutes with finite products: ⊲ � ( A & B ) � A & � B � � ⊤ ⊤ � 95
A colour modality An important consequence: The composite modality −→ ! � : Scott Scott defines an exponential modality of linear logic. From this follows that the Kleisli category D := Kleisli ( Scott , ! � ) is a cartesian closed category. 96
An inductive-coinductive fixpoint For simplicity, let us assume that the number n of colours is even. Given an infinitary λ -term A n ⇒ M : A one defines the fixpoint as Y ( M ) = νx n . µx n − 1 . νx n − 2 . . . νx 2 . µx 1 . M ( x 1 , · · · , x n ) Theorem. This defines an interpretation in the λY µν -calculus. 97
Conclusion and future works Higher-order automata generalising and explaining higher-order model checking A modal λY µν -calculus with boundaries refining the usual λY -calculus A neat proof of decidability based on: Scott semantics of linear logic in the French style ⊲ infinitary rewriting theory in the Dutch style ⊲ New automata-theoretic foundations to the lambda-calculus New features: higher-order, compositionality, which need to be explored 98
Thank you ! 99
Modal reformulation q m 1 m 2 q 2 q q 1 ⇒ m 2 m 1 q 2 q 1 Collecting colours works in the same way as collecting levels of copies 100
Recommend
More recommend