Semantics-Based Analysis and Transformation of Logic Programs. Søndergaard, H. Ph.D. Thesis, University of Copenhagen, Denmark, 1989. Also available as: Technical Report 89/21, Department of Computer Science, The University of Melbourne, 1990, DIKU Report 89/22, Department of Computer Science, University of Copenhagen, 1990, and Technical Report #12, Key Center for Knowledge Based Systems, RMIT and the University of Melbourne, 1990
abstract   bibtex   
Dataflow analysis is an essential component of many programming tools. One use of dataflow information is to identify errors in a program, as done by program ``debuggers'' and type checkers. Another is in compilers and other program transformers, where the analysis may guide various optimisations. The correctness of a programming tool's dataflow analysis component is usually of paramount importance. The theory of abstract interpretation, originally developed by P. and R. Cousot aims at providing a framework for the development of correct analysis tools. In this theory, dataflow analysis is viewed as ``non-standard'' semantics, and abstract interpretation prescribes certain relations between standard and non-standard semantics, in order to guarantee the correctness of the non-standard semantics with respect to the standard semantics. The increasing acceptance of Prolog as a practical programming language has motivated widespread interest in dataflow analysis of logic programs and especially in abstract interpretation. Logic programmming languages are attractive from a semantical point of view, but dataflow analysis of logic programs is more complex than that of more traditional programming languages, since dataflow is bi-directional (owing to unification) and control flow is in terms of backtracking. The present thesis is concerned with semantics-based dataflow analysis of logic programs. We first set up a theory for dataflow analysis which is basically that of abstract interpretation as introduced by P. and R. Cousot. We do, however, relax the classical theory of abstract interpretation somewhat, by giving up the demand for (unique) best approximations. Two different kinds of analysis of logic programs are then identified: a bottom-up analysis yields an approximation to the success set (and possibly the failure set) of a program, whereas a top-down analysis yields an approximation to the call patterns that would appear during an execution based on SLD resolution. We investigate some of the uses of the two kinds of analysis. In the bottom-up case, we pay special attention to (bottom-up) type inference and its use in program specialisation. In the top-down case, we present a generic ``dataflow semantics'' that encompasses many useful dataflow analyses. As an instance of the generic semantics, a groundness analysis is detailed, and a series of other applications are mentioned. We finally present a transformation technique, based on top-down analysis, for introducing difference-lists in a list-manipulating program, without changing the program's semantics. This may lead to substantial improvement in a program's execution time.
@Phdthesis{Son_phd89,
  author    = {Harald S{\o}ndergaard},
  title	    = {Semantics-Based Analysis and Transformation of Logic Programs},
  school    = {University of Copenhagen, Denmark},
  year	    = {1989},
  note	    = {Also available as: Technical Report 89/21,
		Department of Computer Science, 
		The University of Melbourne, 1990,
		DIKU Report 89/22, Department of Computer Science, 
		University of Copenhagen, 1990,
		and Technical Report \#12,
		Key Center for Knowledge Based Systems,
		RMIT and the University of Melbourne, 1990},
  abstract  = {Dataflow analysis is an essential component of many programming 
		tools. One use of dataflow information is to identify errors in
		a program, as done by program ``debuggers'' and type checkers.
		Another is in compilers and other program transformers, where 
		the analysis may guide various optimisations.

		The correctness of a programming tool's dataflow analysis 
		component is usually of paramount importance. The theory of 
		abstract interpretation, originally developed by P. and R. 
		Cousot aims at providing a framework for the development of 
		correct analysis tools. In this theory, dataflow analysis is 
		viewed as ``non-standard'' semantics, and abstract 
		interpretation prescribes certain relations between standard
		and non-standard semantics, in order to guarantee the 
		correctness of the non-standard semantics with respect to the 
		standard semantics.

		The increasing acceptance of Prolog as a practical programming 
		language has motivated widespread interest in dataflow analysis
		of logic programs and especially in abstract interpretation.
		Logic programmming languages are attractive from a semantical 
		point of view, but dataflow analysis of logic programs is more 
		complex than that of more traditional programming languages, 
		since dataflow is bi-directional (owing to unification) and 
		control flow is in terms of backtracking.

		The present thesis is concerned with semantics-based dataflow 
		analysis of logic programs. We first set up a theory for 
		dataflow analysis which is basically that of abstract 
		interpretation as introduced by P. and R. Cousot. We do, 
		however, relax the classical theory of abstract interpretation
		somewhat, by giving up the demand for (unique) <i>best</i> 
		approximations.

		Two different kinds of analysis of logic programs are then 
		identified: a <i>bottom-up</i> analysis yields an approximation
		to the success set (and possibly the failure set) of a program,
		whereas a <i>top-down</i> analysis yields an approximation to 
		the call patterns that would appear during an execution based 
		on SLD resolution. We investigate some of the uses of the two 
		kinds of analysis. In the bottom-up case, we pay special 
		attention to (bottom-up) type inference and its use in program 
		specialisation. In the top-down case, we present a generic 
		``dataflow semantics'' that encompasses many useful dataflow 
		analyses. As an instance of the generic semantics, a groundness
		analysis is detailed, and a series of other applications are 
		mentioned.

		We finally present a transformation technique, based on 
		top-down analysis, for introducing difference-lists in a 
		list-manipulating program, without changing the program's 
		semantics. This may lead to substantial improvement in a 
		program's execution time.},
  keywords  = {Abstract interpretation, Abstract domains, Logic programming, Semantics, Many-valued logic, Unification, Groundness analysis, Program transformation},
}

Downloads: 0