Algorithms for Extended Alpha-Equivalence and Complexity Manfred Schmidt-Schauß, Conrad Rau, David Sabel Goethe-University, Frankfurt, Germany RTA 2013, Eindhoven, The Netherlands 1
Motivation GI-Completeness GC Applications π -Calculus Conclusion Motivation Reasoning, deduction, rewriting, program transformation . . . requires to identify expressions Functional core languages have (recursive) bindings , e.g. letrec map = λf, xs. case xs of { [] -> [] ; ( y : ys ) -> ( f y ) : ( map f ys ) } ; square = λx.x ∗ x ; myList = [1 , 2 , 3] in map square myList These bindings are sets , i.e. they are commutable Identify expressions upto extended α -equivalence : α -renaming and commutation of bindings D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 2/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion Questions What is the complexity of deciding extended α -equivalence? Is there a difference for languages with non-recursive let ? Find efficient algorithms for special cases . Complexity of extended α -equivalence in process calculi ? D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 3/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion Extended α -Equivalence for let -languages Abstract language CH with recursive let , where c ∈ Σ s i ∈ L CH ::= x | c ( s 1 , . . . , s ar( c ) ) | λx.s | letrec x 1 = s 1 ; . . . ; x n = s n in s Extended α -Equivalence ≃ α, CH in CH: α ∨ comm , ∗ s ≃ α, CH t iff s ← − − − − − → t where s α − → t is α -renaming C [ letrec . . . ; x i = s i ; . . . , x j = s j ; . . . in s ] comm − − − − → C [ letrec . . . ; x j = s j ; . . . ; x i = s i ; . . . in s ] CHNR: Variant of CH with non-recursive let instead of letrec D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 4/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion Graph Isomorphism Graph Isomorphism Undirected graphs G 1 = ( V 1 , E 1 ) and G 2 = ( V 2 , E 2 ) are isomorphic iff there exists a bijection φ : V 1 → V 2 such that ( v, w ) ∈ E 1 ⇐ ⇒ ( φ ( v ) , φ ( w )) ∈ E 2 Graph Isomorphism Problem ( GI ) Graph-isomorphism ( GI ) is the following problem: Given two finite (unlabelled, undirected) graphs G 1 = ( V 1 , E 1 ) and G 2 = ( V 2 , E 2 ) , are G 1 and G 2 isomorphic? P ⊆ GI ⊆ NP GI is neither known to be in P nor NP -hard A lot of other isomorphism problems on labelled / directed graphs are GI -complete ( see e.g. Booth & Colboum’ 79) D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 5/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion GI -Hardness of Extended α -Equivalence Theorem Deciding ≃ α, CH is GI -hard. Proof: Polytime reduction of the Digraph-Isomorphism-Problem: Digraph G = ( V , E ) is encoded as: enc ( G ) = letrec Env V , Env E in x such that v i ∈ V { v i = a } where a ∈ Σ Env V = � Env E = � ( v i ,v j ) ∈ E { x i,j = c ( v i , v j ) } where c ∈ Σ Verify: G 1 , G 2 are isomorphic ⇐ ⇒ enc ( G 1 ) ≃ α, CH enc ( G 2 ) D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 6/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion Example u 1 u 3 v 1 v 3 u 2 v 2 letrec u 1 = a ; u 2 = a ; u 3 = a ; letrec v 1 = a ; v 2 = a ; v 3 = a ; x 1 , 3 = c ( u 1 , u 3 ); x 1 , 3 = c ( v 1 , v 3 ); x 3 , 2 = c ( u 3 , u 2 ); x 3 , 3 = c ( v 3 , v 3 ); x 2 , 2 = c ( u 2 , u 2 ); x 3 , 2 = c ( v 3 , v 2 ); x 2 , 1 = c ( u 2 , u 1 ); x 2 , 3 = c ( v 2 , v 3 ); x 1 , 2 = c ( u 1 , u 2 ); x 2 , 1 = c ( v 2 , v 1 ) in x in x D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 7/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion Example u 1 u 3 v 1 v 3 u 2 v 2 letrec u 3 = a ; u 1 = a ; u 2 = a ; letrec v 1 = a ; v 2 = a ; v 3 = a ; x 3 , 2 = c ( u 3 , u 2 ); x 1 , 3 = c ( v 1 , v 3 ); x 2 , 2 = c ( u 2 , u 2 ); x 3 , 3 = c ( v 3 , v 3 ); x 2 , 1 = c ( u 2 , u 1 ); x 3 , 2 = c ( v 3 , v 2 ); x 1 , 2 = c ( u 1 , u 2 ); x 2 , 3 = c ( v 2 , v 3 ); x 1 , 3 = c ( u 1 , u 3 ); x 2 , 1 = c ( v 2 , v 1 ) in x in x D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 7/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion Example u 1 u 3 v 1 v 3 u 2 v 2 letrec u 3 = a ; u 1 = a ; u 2 = a ; letrec v 1 = a ; v 2 = a ; v 3 = a ; x 1 , 3 = c ( u 3 , u 2 ); x 1 , 3 = c ( v 1 , v 3 ); x 3 , 3 = c ( u 2 , u 2 ); x 3 , 3 = c ( v 3 , v 3 ); x 3 , 2 = c ( u 2 , u 1 ); x 3 , 2 = c ( v 3 , v 2 ); x 2 , 3 = c ( u 1 , u 2 ); x 2 , 3 = c ( v 2 , v 3 ); x 2 , 1 = c ( u 1 , u 3 ); x 2 , 1 = c ( v 2 , v 1 ) in x in x D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 7/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion Example u 1 u 3 v 1 v 3 u 2 v 2 letrec u 3 = a ; u 1 = a ; u 2 = a ; letrec v 1 = a ; v 2 = a ; v 3 = a ; x 1 , 3 = c ( u 3 , u 2 ); x 1 , 3 = c ( v 1 , v 3 ); x 3 , 3 = c ( u 2 , u 2 ); x 3 , 3 = c ( v 3 , v 3 ); x 3 , 2 = c ( u 2 , u 1 ); x 3 , 2 = c ( v 3 , v 2 ); x 2 , 3 = c ( u 1 , u 2 ); x 2 , 3 = c ( v 2 , v 3 ); x 2 , 1 = c ( u 1 , u 3 ); x 2 , 1 = c ( v 2 , v 1 ) in x in x D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 7/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion Example u 1 u 3 v 1 v 3 u 2 v 2 letrec u 3 = a ; v 2 = a ; u 2 = a ; letrec v 1 = a ; v 2 = a ; v 3 = a ; x 1 , 3 = c ( u 3 , u 2 ); x 1 , 3 = c ( v 1 , v 3 ); x 3 , 3 = c ( u 2 , u 2 ); x 3 , 3 = c ( v 3 , v 3 ); x 3 , 2 = c ( u 2 , v 2 ); x 3 , 2 = c ( v 3 , v 2 ); x 2 , 3 = c ( v 2 , u 2 ); x 2 , 3 = c ( v 2 , v 3 ); x 2 , 1 = c ( v 2 , u 3 ); x 2 , 1 = c ( v 2 , v 1 ) in x in x D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 7/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion Example u 1 u 3 v 1 v 3 u 2 v 2 letrec u 3 = a ; v 2 = a ; u 2 = a ; letrec v 1 = a ; v 2 = a ; v 3 = a ; x 1 , 3 = c ( u 3 , u 2 ); x 1 , 3 = c ( v 1 , v 3 ); x 3 , 3 = c ( u 2 , u 2 ); x 3 , 3 = c ( v 3 , v 3 ); x 3 , 2 = c ( u 2 , v 2 ); x 3 , 2 = c ( v 3 , v 2 ); x 2 , 3 = c ( v 2 , u 2 ); x 2 , 3 = c ( v 2 , v 3 ); x 2 , 1 = c ( v 2 , u 3 ); x 2 , 1 = c ( v 2 , v 1 ) in x in x D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 7/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion Example u 1 u 3 v 1 v 3 u 2 v 2 letrec u 3 = a ; v 2 = a ; v 3 = a ; letrec v 1 = a ; v 2 = a ; v 3 = a ; x 1 , 3 = c ( u 3 , v 3 ); x 1 , 3 = c ( v 1 , v 3 ); x 3 , 3 = c ( v 3 , v 3 ); x 3 , 3 = c ( v 3 , v 3 ); x 3 , 2 = c ( v 3 , v 2 ); x 3 , 2 = c ( v 3 , v 2 ); x 2 , 3 = c ( v 2 , v 3 ); x 2 , 3 = c ( v 2 , v 3 ); x 2 , 1 = c ( v 2 , u 3 ); x 2 , 1 = c ( v 2 , v 1 ) in x in x D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 7/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion Example u 1 u 3 v 1 v 3 u 2 v 2 letrec u 3 = a ; v 2 = a ; v 3 = a ; letrec v 1 = a ; v 2 = a ; v 3 = a ; x 1 , 3 = c ( u 3 , v 3 ); x 1 , 3 = c ( v 1 , v 3 ); x 3 , 3 = c ( v 3 , v 3 ); x 3 , 3 = c ( v 3 , v 3 ); x 3 , 2 = c ( v 3 , v 2 ); x 3 , 2 = c ( v 3 , v 2 ); x 2 , 3 = c ( v 2 , v 3 ); x 2 , 3 = c ( v 2 , v 3 ); x 2 , 1 = c ( v 2 , u 3 ); x 2 , 1 = c ( v 2 , v 1 ) in x in x D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 7/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion Example u 1 u 3 v 1 v 3 u 2 v 2 letrec v 1 = a ; v 2 = a ; v 3 = a ; letrec v 1 = a ; v 2 = a ; v 3 = a ; x 1 , 3 = c ( v 1 , v 3 ); x 1 , 3 = c ( v 1 , v 3 ); x 3 , 3 = c ( v 3 , v 3 ); x 3 , 3 = c ( v 3 , v 3 ); x 3 , 2 = c ( v 3 , v 2 ); x 3 , 2 = c ( v 3 , v 2 ); x 2 , 3 = c ( v 2 , v 3 ); x 2 , 3 = c ( v 2 , v 3 ); x 2 , 1 = c ( v 2 , v 1 ); x 2 , 1 = c ( v 2 , v 1 ) in x in x D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 7/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion Example u 1 u 3 v 1 v 3 u 2 v 2 letrec v 1 = a ; v 2 = a ; v 3 = a ; letrec v 1 = a ; v 2 = a ; v 3 = a ; x 1 , 3 = c ( v 1 , v 3 ); x 1 , 3 = c ( v 1 , v 3 ); x 3 , 3 = c ( v 3 , v 3 ); x 3 , 3 = c ( v 3 , v 3 ); x 3 , 2 = c ( v 3 , v 2 ); x 3 , 2 = c ( v 3 , v 2 ); x 2 , 3 = c ( v 2 , v 3 ); x 2 , 3 = c ( v 2 , v 3 ); x 2 , 1 = c ( v 2 , v 1 ); x 2 , 1 = c ( v 2 , v 1 ) in x in x Isomorphism: { u 1 �→ v 2 , u 2 �→ v 3 , u 3 �→ v 1 } D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 7/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion Easy Variations / Consequences Deciding ≃ α, CH is still GI -hard if expressions are restricted to one-level letrec s (since our encoding uses a one-level letrec ) Non-recursive let : Deciding ≃ α, CHNR is GI -hard: Use enc ( G ) = let Env V in ( let Env E in x ) Hardness also holds for empty signature Σ : replace a by a free variable x a , replace c ( v i , v j ) by let y = v i in v j D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 8/21
Motivation GI-Completeness GC Applications π -Calculus Conclusion GI -Completeness of Extended α -Equivalence We use labelled digraph isomorphism Encode CH-expressions s into a labelled digraph G ( s ) , example: s = letrec x = y ; y = z in x in letrec var var bind bind G ( s ) = z letvar letvar Full encoding is given in the paper Verify: G ( s 1 ) , G ( s 2 ) are isomorphic iff s 1 ≃ α, CH s 2 Theorem Deciding ≃ α, CH is GI -complete. D. Sabel Algorithms for Extended Alpha-Equivalence and Complexity 9/21
Recommend
More recommend