A short proof that adding some permutation rules to beta preserves SN

I show that, if a term is $SN$ for $\beta$, it remains $SN$ when some permutation rules are added.

Authors: Rene David (LAMA)

A short pro of that adding some p erm utation rules to β preserv es S N Ren ´ e Da vid LAMA - Equipe LIMD - Univ ersit ´ e de Chamb ´ ery e-mail : rene.da vid@univ-sa v o ie.fr Octob er 21, 2021 Abstract I sho w that, if a term is S N for β , it remains S N when some permutation rules are added. 1 In tro duc tion Strong normalization (abbreviated as S N ) is a property of rewriting sy s tems that is often desired. Since ab out 1 0 years many r esearchers have considered the following question : If a λ -ter m is S N for the β -reduction, do es it remain S N if so me other reduction rules are added ? They are mainly interested with p ermut ation rules they intro duce to be able to delay s ome β -reductions in, for example, let x = ... in ... constructions or in c alculi with explicit substitutions . Here are some pap ers considering such p ermutations r ules: L . Regnier [7], F Kama reddine [3 ], E. Mog gi [5], R. Dyckhoff and S. Lengrand [2], A. J. Kfoury and J. B. W ells [4], Y. O h ta and M. Hasegaw a [6], J. E sprito Santo [8] and [9]. Most o f these paper s show tha t S N is preserved by the additio n of the p ermuta- tion rule s they intro duce . But these pro ofs a re quite long and co mplicated or need some restr ictions to the rule. F or example the rule ( M ( λx.N P )) ⊲ ( λx. ( M N ) P ) is often restricted to the case when M is an abs traction (in this cas e it is us ua lly called a ssoc ). I g iv e her e a very simple pro of tha t the p ermutations rules pre serve S N when they a r e added all to gether and with no restriction. It is do ne a s follows. I show that every term which is typable in the system (often ca lled system D ) of t y pes built with → a nd ∧ is strongly nor ma lizing for all the rules ( β and the p ermutation rules). Since it is well known that a term is S N for the β - rule iff it is typable in this system, the r esult follows. 2 Definitions and notations Definition 2 . 1 • The set of λ -terms is define d by the fol lowing gr ammar M := x | λx. M | ( M M ) • The set T of typ es is define d by the fol lowing gr ammar wher e A is a set of atomic c onstant s T ::= A | T → T | T ∧ T 1 • The typing rules ar e the fol lowing : Γ , x : A ⊢ x : A Γ ⊢ M : A → B Γ ⊢ N : A Γ ⊢ ( M N ) : B Γ , x : A ⊢ M : B Γ ⊢ λx.M : A → B Γ ⊢ M : A ∧ B Γ ⊢ M : A Γ ⊢ M : A ∧ B Γ ⊢ M : B Γ ⊢ M : A Γ ⊢ M : B Γ ⊢ M : A ∧ B Definition 2 . 2 The re duction rules ar e the fol lowing. • β : ( λx.M N ) ⊲ M [ x := N ] • δ : ( λy .λx.M N ) ⊲ λx. ( λy .M N ) • γ : ( λx.M N P ) ⊲ ( λx. ( M P ) N ) • assoc : ( M ( λx.N P )) ⊲ ( λx. ( M N ) P ) Using Ba rendregt’s conv ention for the names of v ariables, we a s sume tha t, in γ (resp. δ , assoc ), x is not free in P (resp. in N , in M ). The rules δ and γ have been introduced by Reg nier in [7] and are called there the σ -reductio n. It seems that the first fo rm ula tion of asso c app ears in Moggi [5] in the restricted case where M is an abstra ction a nd in a “ let ... in ... ” for m ulatio n. Notation 2.1 • If t is a term, siz e ( t ) denotes its size and ty pe ( t ) the size of its t yp e. If t ∈ S N (i.e. every se qu enc e of r e ductions start ing fr om t is finite), η ( t ) denotes the length of the longest r e duction of t . • L et σ b e a su bstitution. We say that σ is fair if the σ ( x ) for x ∈ dom ( σ ) al l have the same typ e (that wil l b e denote d as ty pe ( σ ) ). We say that σ ∈ S N if, for e ach x ∈ dom ( σ ) , σ ( x ) ∈ S N . • L et σ ∈ S N b e a substitut ion and t b e a t erm. We denote by siz e ( σ, t ) (r esp. η ( σ , t ) ) the sum, over x ∈ dom ( σ ) , of nb ( t, x ) .siz e ( σ ( x )) (r esp. nb ( t, x ) .η ( σ ( x )) ) wher e nb ( t, x ) is the numb er of o c curr enc es of x in t . • If − → M is a se quenc e of terms, l g ( − → M ) denotes its length, M ( i ) denotes the i -th element of the se quenc e and tail ( − → M ) denotes − → M fr om which the first element has b e en delete d. • Assu me t = ( H − → M ) wher e H is an abstr action or a variable and lg ( − → M ) ≥ 1 . – If H is an abstr action (in this c ase we say that t is β - he ad r e ducible), then M (1) wil l b e denote d as Arg [ t ] and ( R ′ tail ( − → M )) wil l b e denote d by B [ t ] wher e R ′ is t he r e duct of the β -r e dex ( H Ar g [ t ]) . – If H = λx.N and l g ( − → M ) ≥ 2 (in t his c ase we say that t is γ -he ad r e ducible), t hen ( λx. ( N M (2)) M (1) M (3) ... M ( l g ( − → M ))) wil l b e denote d by C [ t ] . – If H = λx.λy .N (in this c ase we say that t is δ -he ad r e ducible), then ( λy . ( λx.N M (1)) M (2) ... M ( l g ( − → M ))) wil l b e denote d by D [ t ] . 2 – If M ( i ) = ( λx.N P ) , then the term ( λx. ( H M (1) ... M ( i − 1) N ) P M ( i + 1) ... M ( l g ( − → M ))) wil l b e denote d by A [ t, i ] and we say t hat M ( i ) is the r e dex put in he ad p osition. • Final ly, in a pr o of by induct ion, IH wil l denote t he induction hyp othesis. 3 The theorem Theorem 3.1 L et t b e a term. A ssume t is st r ongly normalizing for β . Then t is str ongly normalizing for β , δ , γ and as s oc . Pro of This follows immedia tely from Theo rem 3.2 and corolla ry 3 .1 b elow.  Theorem 3.2 A term is S N for t he β -ru le iff it is typ able in system D . Pro of This is a classical result. F or the s ak e of completeness I reca ll here the pro of of the only if direction given in [1]. No te that it is the only direction that is used in this pa p er a nd that corolla ry 3.1 b elo w actually gives the other direction. The pro of is by induction on h η ( t ) , siz e ( t ) i . - If t = λx u. This follows immediately from the IH. - If t = ( x v 1 ... v n ). By the IH, for every j , let x : A j , Γ j ⊢ v j : B j . Then x : V A j ∧ ( B 1 , ..., B n → C ) , V Γ j ⊢ t : C where C is any type, for ex a mple a n y atomic type . - If t = ( λx.a b − → c ). By the IH, ( a [ x := b ] − → c ) is typable. If x o ccurs in a , let A 1 ... A n be the types o f the o ccurrences of b in the typing of ( a [ x := b ] − → c ). Then t is typable b y giving to x a nd b the t ype A 1 ∧ ... ∧ A n . Otherwise, by the induction hypothesis b is t ypable of type B and then t is typable by giving to x the type B .  F r om now on, ⊲ denotes the r e duction by one of the rules β , δ , γ and assoc . Lemma 3 .1 1. The system satisfies subje ct re duction i.e. if Γ ⊢ t : A and t ⊲ t ′ then Γ ⊢ t ′ : A . 2. If t ⊲ t ′ then t [ x := u ] ⊲ t ′ [ x := u ] . 3. If t ′ = t [ x := u ] ∈ S N t hen t ∈ S N and η ( t ) ≤ η ( t ′ ) . Pro of Immediate.  Lemma 3 .2 L et t = ( H − → M ) b e such that H is an abstr action or a variab le and l g ( − → M ) ≥ 1 . Ass u me that 1. If t is δ -he ad r e ducible (r esp. γ -he ad r e ducible, β -he ad r e ducible), then D [ t ] ∈ S N (r esp. C [ t ] ∈ S N , Arg [ t ] , B [ t ] ∈ S N ). 2. F or e ach i such t hat M ( i ) is a r e dex, A [ t, i ] ∈ S N , Then t ∈ S N . Pro of By inductio n on η ( H ) + P η ( M ( i )). Show that each re duct of t is in S N .  Lemma 3 .3 If ( t − → u ) ∈ S N then ( λx.t x − → u ) ∈ S N . Pro of This is a sp ecial cas e of the following res ult. If t ∈ S N then so is F ( t ) where F ( t ) is obtaine d in the following wa y: choose a no de on the left branch o f t and r eplace the sub-term u at this no de by ( λx.u x ). The pro of is by induction on h ty pe ( u ) , η ( t ) , s iz e ( t ) i , using Lemma 3.2 . The only non immedia te case s are when the head redex has bee n created by the transforma tion F . The cas e of β is trivia l. F or δ and γ , the res ult follows from the fact that the t yp e o f the sub-term mo dified has decrea sed and there is no thing to prov e for asso c since the the change is in the left br anc h.  3 Theorem 3.3 L et t ∈ S N and σ ∈ S N b e a fair su bstitution. Then σ ( t ) ∈ S N . Pro of By induction on h ty pe ( σ ) , η ( t ) , siz e ( t ) , η ( σ, t ) , siz e ( σ , t ) i . If t is an ab- straction o r a v ariable the r esult is trivial. Thus ass ume t = ( H − → M ) where H is an abstraction or a v ar iable and n = l g ( − → M ) ≥ 1. Let − → N = σ ( − → M ). Claim : Let − → P be a (stric t) initial or a final sub-seq ue nc e of − → N . Then ( z − → P ) ∈ S N . Pr o of : This follows immediately from Lemma 3 .1 and the IH.  W e use Lemma 3.2 to show that σ ( t ) ∈ S N . 1. Assume σ ( t ) is δ -hea d r educible. W e hav e to show that D [ σ ( t )] ∈ S N . There are 3 cases to consider. (a) If t was already δ -head r educible, then D [ σ ( t )] = σ ( D [ t ]) and the result follows from the I H. (b) If H is a v a riable and σ ( H ) = λx.λy .a , then D [ σ ( t )] = t ′ [ z := λy . ( λx.a N (1))] where t ′ = ( z tail ( − → N )). By the cla im, t ′ ∈ S N and since ty pe ( z ) < ty pe ( σ ) it is enough to chec k that λy . ( λx.a N (1)) ∈ S N . But this is λy . ( z ′ N (1))[ z ′ := λx.a ]. But, by the cla im, ( z ′ N (1)) ∈ S N and we conclude by the IH since ty pe ( z ′ ) < ty pe ( σ ). (c) If H = λx.z and σ ( z ) = λy .a , then D [ σ ( t )] = ( λy . ( λx.a N (1)) tail ( − → N )) = τ ( t ′ ) where t ′ = ( z ′ tail ( − → M )) a nd τ is the same as σ o n the v aria bles of tail ( − → M ) and τ ( z ′ ) = λy. ( λx.a N (1)). By the IH, it is enough to show that ( λx.a N (1)) ∈ S N . But this is ( λx.z ′′ N (1))[ z ′′ := a ] and, since ty pe ( a ) < ty pe ( σ ) it is enough to s ho w that u = ( λx.z ′′ N (1)) = σ ′ ( t ′′ ) ∈ S N where t ′′ is a sub- ter m of t (up to the r enaming of z into z ′′ ) and σ ′ is as σ but z ′′ 6∈ dom ( σ ′ ). This follows from the IH since siz e ( σ ′ , t ′′ ) < siz e ( σ, t ). 2. Assume σ ( t ) is γ -head reducible. W e hav e to show that C [ σ ( t )] ∈ S N . There are 4 cases to consider. (a) If H is a n abstra c tion, then C [ σ ( t )] = σ ( C [ t ]) and the r esult fo llows immediately from the IH. (b) H is a v ariable and σ ( H ) = λy .a , then C [ σ ( t )] = ( λy . ( a N (2)) N (1) N (3) ... N ( n )) = ( λy . ( a N (2)) y N (3) ... N ( n ))[ y := N (1)]. Since ty pe ( N (1)) < ty pe ( σ ), it is enough, by the IH, to show ( λy . ( a N (2)) y N (3) ... N ( n )) ∈ S N a nd so, by Lemma 3.3 , that u = ( a N (2) N (3) ... N ( n )) ∈ S N . By the claim, ( z tail ( − → N )) ∈ S N and the res ult follows fro m the IH since u = ( z tai l ( − → N ))[ z := a ] and ty pe ( a ) < ty pe ( σ ). (c) H is a v ariable and σ ( H ) = ( λy .a b ), then C [ σ ( t )] = ( λy . ( a N (1)) b N (2) ... N ( n )) = ( z tail ( − → N ))[ z := ( λy . ( a N (1)) b )]. Since ty pe ( z ) < ty pe ( σ ), b y the IH it is enoug h to show that u = ( λy . ( a N (1)) b ) ∈ S N . W e use Lemma 3.2. - W e first hav e to show that B [ u ] ∈ S N . But this is ( a [ y := b ] N (1)) which is in S N since u 1 = ( a [ y := b ] − → N ) ∈ S N since u 1 = τ ( t 1 ) where t 1 is the sa me a s t but where we hav e given to the v ariable H the fresh name z , τ is the sa me as σ for the v ar iables in dom ( σ ) a nd τ ( z ) = a [ y := b ] and thus we may conclude by the IH since η ( τ , t ) < η ( σ, t ). - W e then have to s ho w that, if b is a redex say ( λz .b 1 b 2 ), then A [ u, 1 ] = ( λz . ( λy .a N (1) b 1 ) b 2 ) ∈ S N . Let u 2 = τ ( t 2 ) where t 2 is the s ame as t but where w e hav e g iv en to the v aria ble H the fresh name z , τ is the same as σ for the v aria bles in dom ( σ ) a nd τ ( z ) = σ ( A [ H, 1]). By the IH, u 2 ∈ S N . 4 But u 2 = ( λz . ( λy .a b 1 ) b 2 − → N ) and thus u 3 = ( λz . ( λy .a b 1 ) b 2 N (1)) ∈ S N . Since u 3 reduces to A [ u, 1] by using t wice b y the γ r ule, it follows that A [ u, 1] ∈ S N . (d) If H is a v ar iable and σ ( H ) is γ -head reducible, then C [ σ ( t )] = τ ( t ′ ) where t ′ is the sa me as t but where we hav e given to the v ar iable H the fresh name z and τ is the same as σ for the v aria bles in dom ( σ ) and τ ( z ) = σ ( C [ H ]). The res ult follows then from the IH. 3. Assume that σ ( t ) is β - head reducible. W e have to show that Arg [ σ ( t )] ∈ S N and that B [ σ ( t )] ∈ S N . T he r e are 3 cases to consider. (a) If H is an abstr action, the r esult follows immediately from the IH s ince then Arg [ σ ( t )] = σ ( Arg [ t ]) and B [ σ ( t )] = σ ( B [ t ]). (b) If H is a v ariable and σ ( H ) = λy .v for some v . Then Ar g [ σ ( t )] = N (1) ∈ S N b y the IH and B [ σ ( t )] = ( v [ y := N (1)] tail ( − → N )) = ( z tai l ( − → N ))[ z := v [ y := N (1)]]. By the cla im, ( z tail ( − → N )) ∈ S N . By the IH, v [ y := N (1)] ∈ S N since ty p e ( N (1)) < ty p e ( σ ). Finally the IH implies that B [ σ ( t )] ∈ S N since ty pe ( v ) < ty pe ( σ ). (c) H is a v a riable a nd σ ( H ) = ( R − → M ′ ) where R is a β -redex. Then Arg [ σ ( t )] = Arg [ σ ( H )] ∈ S N and B [ σ ( t )] = ( R ′ − → M ′ − → N ) where R ′ is the reduct of R . But then B [ σ ( t )] = τ ( t ′ ) and t ′ is the s a me a s t but where we hav e given to the v a riable H the fresh name z and τ is the same as σ for the v a riables in dom ( σ ) and τ ( z ) = ( R ′ − → M ′ ). W e conclude by the IH since η ( τ , t ′ ) < η ( σ , t ). 4. W e, finally , have to show that, for each i , A [ σ ( t ) , i ] ∈ S N . Ther e are a gain 3 cases to c o nsider. (a) If the redex put in head p osition is some N ( j ) and M ( j ) was a lready a redex. Then A [ σ ( t ) , i ] = σ ( A [ t, j ]) and the r esult follows from the IH. (b) If the r edex put in head p osition is some N ( j ) a nd M ( j ) = ( x a ) and σ ( x ) = λy .b then A [ σ ( t ) , i ] = λy . ( σ ( H ) N (1) ... N ( j − 1) b ) σ ( a ) N ( j + 1) ... N ( n )). Since ty pe ( σ ( a )) < ty pe ( σ ) it is enough, by the IH, to show that λy . ( σ ( H ) N (1) ... N ( j − 1 ) b ) y N ( j + 1) ... N ( n )) and so, by Lemma 3.3, tha t ( σ ( H ) N (1) ... N ( j − 1) b N ( j + 1) ... N ( n )) ∈ S N . Since ty pe ( b ) < ty p e ( σ ) it is enough to show u = ( σ ( H ) N (1) ... N ( j − 1) z N ( j + 1) ... N ( n )) ∈ S N . Let t ′ = ( H − → M ′ ) where − → M ′ is defined by M ′ ( k ) = M ( k ), for k 6 = j , M ′ ( j ) = z . Since t = t ′ [ z := ( x a )] and u = σ ( t ′ ) the r esult follows from Lemma 3.1 and the IH. (c) If, finally , H is a v ariable, σ ( H ) = ( H ′ − → M ′ ) and the redex put in head po sition is some M ′ ( j ). Then, A [ σ ( t ) , i ] = τ ( A [ t ′ , j ]) where t ′ is the same as t but wher e we have given to the v aria ble H the fresh v ar iable z a nd τ is the s ame a s σ for the v ariables in dom ( σ ) and τ ( z ) = A [ σ ( H ) , j ]. W e conclude by the IH since η ( τ , t ′ ) < η ( σ , t ).  Corollary 3 . 1 L et t b e a typ able term. Then t is str ongly normalizing. Pro of By inductio n on siz e ( t ) . If t is an abstractio n or a v aria ble the res ult is triv ial. Otherwise t = ( u v ) = ( x y )[ x := u ][ y := v ] and the r e sult follows immediately from Theorem 3.3 and the IH.  5 References [1] R. David. Normalization without re ducibility . AP AL 107 (2001) p 1 21-130 . [2] R. Dyckhoff a nd S. Lengr and. Cal l-by-value λ -c alculus and LJQ . Journa l of Logic and Co mputation, 17:1 109-113 4, 2 007. [3] F. Kamar e ddine. Postp onement, Conservation and Pr eservation of Str ong Nor- malisation for Gener alise d R e duction . Jo urnal of Logic and Computation, vol- ume 10 (5), pag es 721 -738, 20 00 [4] A. J. Kfoury a nd J. B. W ells. New notions of r e du ct ion and n on- semantic pr o ofs of b eta -s t r ong normalization in typ e d lamb da -c alculi . In Pr oc. 10th Ann. IEE E Symp. Logic in Comput. Sci., pag es 311-3 21, 1 995. [5] E. Moggi. Computational lamb da-c alculus and monads . LICS 1 989. [6] Y. Ohta and M. Hasegawa. A terminating and c onfluent line ar lamb da c al- culus . In P r oc. 17 th International Confer ence on Rewr iting T echniques a nd Applications (R T A’06). Springer LNCS 4 0 98, pages 166 -180, 2 006. [7] L Regnier. Une ´ equivalenc e sur les lamb da-termes , in TCS 12 6 (1994). [8] J. E . Sa n to. Delaye d substitutions , in Pro ceedings of R T A 2007 , Lecture Notes in Computer Scie nc e , volume 4533 , pp. 16 9-183, Springer , 2 007, [9] J. E. Sa n to. A ddenda to Delaye d Substitut ions , Man uscript (av a ilable in his web pa ge), July 2008 . 6

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment