strictness analysis galois connection based abstract
play

Strictness analysis GALOIS CONNECTION BASED ABSTRACT - PowerPoint PPT Presentation

Strictness analysis GALOIS CONNECTION BASED ABSTRACT INTERPRETATIONS Strictness analysis Myc is an abstract interpretation due to Alan Mycroft for determining statically which callby FOR STRICTNESS ANALYSIS need parameters


  1. Strictness analysis GALOIS CONNECTION BASED ABSTRACT INTERPRETATIONS Strictness analysis �Myc��� is an abstract interpretation� due to Alan Mycroft� for determining statically which call�by� FOR STRICTNESS ANALYSIS need parameters of lazy functional programs can be replaced by call�by�value � Patrick COUSOT � Traditional example �addition�� Ecole Normale Sup� erieure f�x� y� � ��x � �� � y� �� � f�x � �� y��� and � x is always evaluated on �rst call� hence x can be passed by� Radhia COUSOT value� � Ecole Polytechnique � y is evaluated on �nal call or f does not terminate� hence y can be passed by�value� � � � Abstract Interpretation � � � Abstract Interpretation �CC��� CC��� is method for con� Strictness analysis by abstract interpretation structing conservative approximations of the semantics of pro� gramming languages� The traditional abstract interpretation framework using� Abstract Interpretation is used to� � An operational�based collecting semantics� � Specify hierarchies of semantics of programming languages � Fixpoints of monotone operators on complete lattices� at di�erent levels of abstraction� � Galois connections� � Design program proof methods� was considered di�cult to apply to strictness analysis because � Specify automatic program analyzers �by interpretation one had to use denotational semantics to take non�termination of programs in abstract domains�� into account �MN��� Nie���� � Etc� P� Cousot � R� Cousot � � � � � � FMPA���

  2. Critique of the denotational theory Plan of abstract interpretation �� Relational semantics� The simplicity of the original abstract interpretation is lost� �� The Galois connection�based abstract interpretation frame� � CPOs�powerdomains are more complicated than powersets�� work� complete lattices� �� Application to Mycroft�s strictness analysis algorithm� � Analysis inversion is lost� denotational semantics is well�suited �� Principle of Johnson�s algorithm� for forward analyses but present di�culties for backward anal� yses� �� Using widening operators as a compromise between the pre� cision of Mycroft�s algorithm and the e�ciency of Johnson�s � Logical relations are weaker than Galois connections� the con� algorithm� structive aspect of the original abstract interpretation frame� work is lost �only safeness veri�cation remains�� � � � � � � Objectives Relational semantics � Objective of the paper� Show that the Galois connection�based abstract interpretation � Represent a computation by a relation between initial and �nal framework is applicable to strictness analysis� states �� for run�time errors� � for non�termination�� � Next objectives� � Rule�based presentation using �iterated well�founded systems Use this abstract interpretation framework to compare the strict� of bi�inductive de�nitions� �CC��d�� ness analysis algorithms known in the literature with Mycroft�s � Equivalent presentation based upon �xpoints of monotonic op� method� erators on complete lattices� � Forward and backward analyses are isomorphic� � � Projection analysis is a very simple variant� � P� Cousot � R� Cousot � � � � � � FMPA���

  3. A lazy first�order functional language Relational semantics Syntax of expressions � The semantics f � of a function f is a relation between the values of its actual parameters and the corresponding result� e ��� k constant j variable �formal parameter� � These values and results may include run�time errors � and v j basic operation non�termination � � b� e j function call f� e � Fonctions may be non�deterministic �for example j � e � � e � � e � � conditional f �� � ���� v ��� � v � � � � � � v n � tuple of formal parameters � e ��� � e � � � � � � e n � tuple of actual arguments � returns a random natural number�� � �� � � � � Semantic domains Syntax of programs � values of variables def � � � � � f � g values or errors Y v � � F � f � f� def � � � � � f�g values or non�termination f�� f def is a shorthand for� � � � � � f � � �g values� errors or non�termination � � f � � v � � � � � � v n � � � e � D � def � � � values of expressions � � � � � � def D � D � � Q values of tuples of expressions f k � v � � � � � � v n k � � e k � v�� v where the body � D � � D � � � � � � F � f i � � e i of function f i depends on the parame� def F � values of functions ters � v � � v � � � � � � v i � � and may call other functions f j � j � � � � � � � k � �The semantics f � of a function f is a relation between the values � � of its actual parameters and the corresponding result f � � � ��� P� Cousot � R� Cousot � �� � � �� � FMPA���

  4. � � � Fixpoint presentation of the relational semantics � � � � � are� F � � f � The trans�nite iterates � � � � � � Z � � � f�g � � � fh� � �i � h � � � i � h � � � ig � fh x� �i j x � � � g f � of the program� The relational semantics � � � � fh� � �i � h � � � ig � fh x� � i j x � � g � Y v � � F � f � � f� fh x� �i j x � � � x � � g f�� f � � � is the least �xpoint� n � fh� � �i � h � � � ig � fh x� � i j x � n g � � � � v � � � f � def F � � lfp fh x� �i j x � � � x � n g � � � � � of a monotonic operator� � � fh� � �i � h � � � ig � fh x� � i j x � Z g � fh x� �i j x � � g � m � F � � � � v � � � � � � Y � F � F � F � def F � f � � � � �� � fh� � �i � h � � � ig � fh x� � i j x � Z g �� � �� � � � � � � f�� � �� � � f � �� � on a complete lattice� proving that the program returns � for all integer parameters� � � � � � � � � t � � � u � � F � � � � � � � v � �� � Computational ordering � �� � Example of fixpoint presentation of the relational semantics � Initially� non termination is assumed for all actual parameters� � � � � def � � � � f�g For the program� � Terminating functions are a subset of� � � � � def � � � � � � f�x� � �x � � � �� �x � � � f������ f�x � ���� the �xpoint equation is� � Each iterate introduces new possible �nite behaviors and elim� inates previous in�nite behaviors now shown to be impossible� � � � F � � f �� � � � � � � � v � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � def where� � Passing to the limits collects the possible �nite behaviors and � F � � f �� � � � � � � fh� � �i � h � � � i � h � � � ig the in�nite behaviors which are not impossible� � fh x� y i j x � � � � n � � � h n� y i � � � � f � g G � � � def i � � � � i � � � � � i � � � � i � � � � i � � � i � � fh x� y i j x � � � h x � � � y i � � � � f � g P� Cousot � R� Cousot � �� � � �� � FMPA���

Recommend


More recommend