an introduction to nominal sets
play

An Introduction to Nominal Sets Andrew Pi t s Computer Science & - PowerPoint PPT Presentation

An Introduction to Nominal Sets Andrew Pi t s Computer Science & Technology EWSCS 2020 1/70 Lecture 3 36/70 Outline L1 Structural recursion and induction in the presence of name-binding operations. L2 Introducing the category of nominal


  1. An Introduction to Nominal Sets Andrew Pi t s Computer Science & Technology EWSCS 2020 1/70

  2. Lecture 3 36/70

  3. Outline L1 Structural recursion and induction in the presence of name-binding operations. L2 Introducing the category of nominal sets. L3 Nominal algebraic data types and 훼 -structural recursion. L4 Dependently typed 휆 -calculus with locally fresh names and name-abstraction. References: AMP, Nominal Sets: Names and Symmetry in Computer Science , CUP 2013 AMP, Alpha-Structural Recursion and Induction , JACM 53(2006)459-506. AMP, J. Ma t hiesen and J. Derikx, A Dependent Type Theory with Abstractable Names , ENTCS 312(2015)19-50. 37/70

  4. Recall: Alpha-equivalence Smallest binary relation = 훼 on Tr closed under the rules: 푡 1 = 훼 푡 ′ 푡 2 = 훼 푡 ′ 푎 ∈ A 1 2 A ( 푡 1 , 푡 2 ) = 훼 A ( 푡 ′ 1 , 푡 ′ V 푎 = 훼 V 푎 2 ) ( 푎 푏 ) · 푡 = 훼 ( 푎 ′ 푏 ) · 푡 ′ 푏 ∉ { 푎 , 푎 ′ } ∪ var ( 푡 ) ∪ var ( 푡 ′ ) L ( 푎 , 푡 ) = 훼 L ( 푎 ′ , 푡 ′ ) E.g. A ( L ( 푎 , A ( V 푎 , V 푏 )) , V 푐 ) A ( L ( 푐 , A ( V 푐 , V 푏 )) , V 푐 ) = 훼 A ( L ( 푏 , A ( V 푏 , V 푏 )) , V 푐 ) � = 훼 Fact: = 훼 is transitive (and reflexive & symmetric). [Ex. 1] 38/70

  5. Freshness For each nominal set 푋 , we can define a relation # ⊆ A × 푋 of freshness: 푎 # 푥 � 푎 ∉ supp 푥 more constructively, a is fresh for x if there is some finite support set A for x not containing a 39/70

  6. Freshness For each nominal set 푋 , we can define a relation # ⊆ A × 푋 of freshness: 푎 # 푥 � 푎 ∉ supp 푥 ◮ In N , 푎 # 푛 always. ◮ In A , 푎 # 푏 i ff 푎 ≠ 푏 . ◮ In Λ , 푎 # 푡 i ff 푎 ∉ fv 푡 . ◮ In 푋 × 푌 , 푎 # ( 푥 , 푦 ) i ff 푎 # 푥 and 푎 # 푦 . ◮ In 푋 � fs 푌 , 푎 # 푓 can be subtle! (and hence di t o for P fs 푋 ) 39/70

  7. Freshness Q antifier If 휑 ( 푎 ) is a property of atoms 푎 ∈ A , we write N 푎 , 휑 ( 푎 ) to mean: { 푎 ∈ A | ¬ 휑 ( 푎 )} is finite, i.e. 휑 ( 푎 ) holds for all but finitely many 푎 . 40/70

  8. Freshness Q antifier If 휑 ( 푎 ) is a property of atoms 푎 ∈ A , we write N 푎 , 휑 ( 푎 ) to mean: { 푎 ∈ A | ¬ 휑 ( 푎 )} is finite, i.e. 휑 ( 푎 ) holds for all but finitely many 푎 . Theorem. Writing 푆 = { 푎 ∈ A | 휑 ( 푎 )} , then t.f.a.e. (1) N 푎 , 휑 ( 푎 ) (2) 푆 ∈ P fs A and ∃ 푎 ∈ A , 푎 # 푆 ∧ 휑 ( 푎 ) (3) 푆 ∈ P fs A and ∀ 푏 ∈ A , 푏 # 푆 ⇒ 휑 ( 푏 ) So can read N 푎 , 휑 ( 푎 ) as “for some/any fresh 푎 , 휑 ( 푎 ) holds” Proof. 40/70

  9. Freshness Q antifier If 휑 ( 푎 ) is a property of atoms 푎 ∈ A , we write N 푎 , 휑 ( 푎 ) to mean: { 푎 ∈ A | ¬ 휑 ( 푎 )} is finite, i.e. 휑 ( 푎 ) holds for all but finitely many 푎 . Theorem. Writing 푆 = { 푎 ∈ A | 휑 ( 푎 )} , then t.f.a.e. (1) N 푎 , 휑 ( 푎 ) (2) 푆 ∈ P fs A and ∃ 푎 ∈ A , 푎 # 푆 ∧ 휑 ( 푎 ) (3) 푆 ∈ P fs A and ∀ 푏 ∈ A , 푏 # 푆 ⇒ 휑 ( 푏 ) So can read N 푎 , 휑 ( 푎 ) as “for some/any fresh 푎 , 휑 ( 푎 ) holds” Proof. If (1), then 퐴 � A − 푆 is finite and necessarily supports 푆 w.r.t. action of A on subsets of atoms. Since A is infinite and 퐴 finite, there is some 푎 ∈ 푆 = A − 퐴 ; and 푎 # 푆 because 푎 ∉ 퐴 . So (2) holds. 40/70

  10. Freshness Q antifier If 휑 ( 푎 ) is a property of atoms 푎 ∈ A , we write N 푎 , 휑 ( 푎 ) to mean: { 푎 ∈ A | ¬ 휑 ( 푎 )} is finite, i.e. 휑 ( 푎 ) holds for all but finitely many 푎 . Theorem. Writing 푆 = { 푎 ∈ A | 휑 ( 푎 )} , then t.f.a.e. (1) N 푎 , 휑 ( 푎 ) (2) 푆 ∈ P fs A and ∃ 푎 ∈ A , 푎 # 푆 ∧ 휑 ( 푎 ) (3) 푆 ∈ P fs A and ∀ 푏 ∈ A , 푏 # 푆 ⇒ 휑 ( 푏 ) So can read N 푎 , 휑 ( 푎 ) as “for some/any fresh 푎 , 휑 ( 푎 ) holds” Proof. If (2), say 푎 ∈ 푆 and 푎 # 푆 , then for any 푏 with 푏 # 푆 , we have ( 푎 푏 ) · 푆 = 푆 , so 푏 = ( 푎 푏 ) · 푎 ∈ ( 푎 푏 ) · 푆 = 푆 . So (3) holds. 40/70

  11. Freshness Q antifier If 휑 ( 푎 ) is a property of atoms 푎 ∈ A , we write N 푎 , 휑 ( 푎 ) to mean: { 푎 ∈ A | ¬ 휑 ( 푎 )} is finite, i.e. 휑 ( 푎 ) holds for all but finitely many 푎 . Theorem. Writing 푆 = { 푎 ∈ A | 휑 ( 푎 )} , then t.f.a.e. (1) N 푎 , 휑 ( 푎 ) (2) 푆 ∈ P fs A and ∃ 푎 ∈ A , 푎 # 푆 ∧ 휑 ( 푎 ) (3) 푆 ∈ P fs A and ∀ 푏 ∈ A , 푏 # 푆 ⇒ 휑 ( 푏 ) So can read N 푎 , 휑 ( 푎 ) as “for some/any fresh 푎 , 휑 ( 푎 ) holds” Proof. If (3), then there is some finite 퐴 ⊆ A supporting 푆 w.r.t. action of A on subsets of atoms. Since 퐴 is finite, to prove (1) it su ff ices to show A − 푆 ⊆ 퐴 , i.e. A − 퐴 ⊆ 푆 . But if 푏 ∉ 퐴 , then because 퐴 supports 푆 , we have 푏 # 푆 and so by (3) we do have 푏 ∈ 푆 . � 40/70

  12. Name abstraction Each 푋 ∈ Nom yields a nominal set [ A ] 푋 of name-abstractions � 푎 � 푥 are ∼ -equivalence classes of pairs ( 푎 , 푥 ) ∈ A × 푋 , where ( 푎 , 푥 ) ∼ ( 푎 ′ , 푥 ′ ) ⇔ 푏 , ( 푏 푎 ) · 푥 = ( 푏 푎 ′ ) · 푥 ′ N The Perm A -action on [ A ] 푋 is well-defined by 휋 · � 푎 � 푥 = � 휋 ( 푎 ) � ( 휋 · 푥 ) Fact: supp ( � 푎 � 푥 ) = supp 푥 − { 푎 } , so that 푏 # � 푎 � 푥 ⇔ 푏 = 푎 ∨ 푏 # 푥 41/70

  13. Name abstraction Each 푋 ∈ Nom yields a nominal set [ A ] 푋 of name-abstractions � 푎 � 푥 are ∼ -equivalence classes of pairs ( 푎 , 푥 ) ∈ A × 푋 , where ( 푎 , 푥 ) ∼ ( 푎 ′ , 푥 ′ ) ⇔ 푏 , ( 푏 푎 ) · 푥 = ( 푏 푎 ′ ) · 푥 ′ N We get a functor [ A ]( − ) : Nom � Nom sending 푓 ∈ Nom ( 푋 , 푌 ) to [ A ] 푓 ∈ Nom ([ A ] 푋 , [ A ] 푌 ) where [ A ] 푓 ( � 푎 � 푥 ) = � 푎 � ( 푓 푥 ) 41/70

  14. Name abstraction [ A ]( − ) : Nom � Nom is a kind of (a ff ine) function space—it is right adjoint to the functor A ⊗ ( − ) : Nom � Nom sending 푋 to A ⊗ 푋 = {( 푎 , 푥 ) | 푎 # 푥 } . Co-unit of the adjunction is ‘concretion’ of an abstraction : ([ A ] 푋 ) ⊗ A → 푋 @ defined by computation rule: N ∀ 푎 , 푥 , 푏 , ( � 푎 � 푥 ) @ 푏 = ( 푏 푎 ) · 푥 [Ex. 6] 42/70

  15. Name abstraction Generalising concretion, we have the following characterization of morphisms out of [ A ] 푋 Theorem. 푓 ∈ ( A × 푋 ) � fs 푌 factors through the subquotient A × 푋 ⊇ {( 푎 , 푥 ) | 푎 # 푓 } � [ A ] 푋 to give a unique element of 푓 ∈ ([ A ] 푋 ) � fs 푌 satisfying N 푎 , ∀ 푥 , 푓 ( � 푎 � 푥 ) = 푓 ( 푎 , 푥 ) i ff 푓 satisfies: N 푎 , ∀ 푥 , 푎 # 푓 ( 푎 , 푥 ) . 42/70

  16. Initial algebras ◮ [ A ]( − ) has excellent exactness properties. It can be combined with × , + and 푋 � fs ( − ) to give functors T : Nom � Nom that have initial algebras 퐼 : T 퐷 � 퐷 T 퐷 T 푋 for all 퐼 퐹 퐷 푋 43/70

  17. Initial algebras ◮ [ A ]( − ) has excellent exactness properties. It can be combined with × , + and 푋 � fs ( − ) to give functors T : Nom � Nom that have initial algebras 퐼 : T 퐷 � 퐷 T ˆ 퐹 T 퐷 T 푋 퐼 퐹 exists unique 푋 퐷 ˆ 퐹 43/70

  18. Initial algebras ◮ [ A ]( − ) has excellent exactness properties. It can be combined with × , + and 푋 � fs ( − ) to give functors T : Nom � Nom that have initial algebras 퐼 : T 퐷 � 퐷 ◮ For a wide class of such functors (nominal algebraic functors) the initial algebra 퐷 coincides with ASTs/ 훼 -equivalence. E.g. Λ is the initial algebra for T ( − ) � A + ( − × − ) + [ A ]( − ) 43/70

  19. Nominal algebraic signatures ◮ Sorts S :: = N name-sort (here just one, for simplicity) data-sorts | D unit | 1 S , S pairs | N . S name-binding | ◮ Typed operations op : S � D Signature Σ is specified by the stu ff in red. 44/70

  20. Nominal algebraic signatures Example: 휆 -calculus name-sort Var for variables, data-sort Term for terms, and operations V : Var → Term A : Term , Term → Term L : Var . Term → Term 44/70

  21. Nominal algebraic signatures Example: 휋 -calculus name-sort Chan for channel names, data-sorts Proc , Pre and Sum for processes, prefixed processes and summations, and operations S : Sum → Proc Comp : Proc , Proc → Proc Nu : Chan . Proc → Proc ! : Proc → Proc P : Pre → Sum O : 1 → Sum Plus : Sum , Sum → Sum Out : Chan , Chan , Proc → Pre In : Chan , ( Chan . Proc ) → Pre Tau : Proc → Pre Match : Chan , Chan , Pre → Pre 44/70

  22. Nominal algebraic signatures Closely related notions: ◮ binding signatures of Fiore, Plotkin & Turi (LICS 1999) ◮ nominal algebras of Honsell, Miculan & Scagne t o (ICALP 2001) N.B. all these notions of signature restrict a t ention to iterated, but unary name-binding—there are other kinds of lexically scoped binder (e.g. see Po t ier’s C 훼 ml language, or Blanche t e et al POPL 2019.) 44/70

  23. Σ ( S ) = raw terms over Σ of sort S 푡 ∈ Σ ( S ) 푎 ∈ A op : S → D 푎 ∈ Σ ( N ) op 푡 ∈ Σ ( D ) () ∈ Σ ( 1 ) 푡 1 ∈ Σ ( S 1 ) 푡 2 ∈ Σ ( S 2 ) 푡 ∈ Σ ( S ) 푎 ∈ A 푡 1 , 푡 2 ∈ Σ ( S 1 , S 2 ) 푎 . 푡 ∈ Σ ( N . S ) Each Σ ( S ) is a nominal set once equipped with the obvious Perm A -action—any finite set of atoms containing all those occurring in 푡 supports 푡 ∈ Σ ( S ) . 45/70

Recommend


More recommend