Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
article

Removing redundant arguments automatically

Published: 01 January 2007 Publication History
  • Get Citation Alerts
  • Abstract

    The application of automatic transformation processes during the formal development and optimization of programs can introduce encumbrances in the generated code that programmers usually (or presumably) do not write. An example is the introduction of redundant arguments in the functions defined in the program. Redundancy of a parameter means that replacing it by any expression does not change the result. In this work, we provide methods for the analysis and elimination of redundant arguments in term rewriting systems as a model for the programs that can be written in more sophisticated languages. On the basis of the uselessness of redundant arguments, we also propose an erasure procedure which may avoid wasteful computations while still preserving the semantics (under ascertained conditions). A prototype implementation of these methods has been undertaken, which demonstrates the practicality of our approach.

    References

    [1]
    AHO, A., SETHI, R. AND ULLMAN, J. 1986. Compilers, Principles Techniques and Tools. Addison-Wesley, Reading, MA.
    [2]
    ALPUENTE, M., ECHAHED, R., ESCOBAR, S. AND LUCAS, S. 2002a. Redundancy of Arguments Reduced to Induction. In Proc. of the 11th Int'l Workshop on Functional and (Constraint) Logic Programming WFLP'02, M. Comini and M. Falaschi, Eds. Electronic Notes in Theoretical Computer Science, vol. 76. Elsevier Sciences Publisher, 100-200.
    [3]
    ALPUENTE, M., ESCOBAR, S. AND LUCAS, S. 2002b. Removing Redundant Arguments of Functions. In 9th International Conference on Algebraic Methodology And Software Technology, AMAST 2002, H. Kirchner and C. Ringeissen, Eds. Lecture Notes in Computer Science, vol. 2422. Springer-Verlag, Berlin, 117-131.
    [4]
    ALPUENTE, M., ESCOBAR, S. AND LUCAS, S. 2006. Removing Redundant Arguments Automatically. CoRR cs.PL/0601039. Available at http://arxiv.org/abs/cs.PL/0601039.
    [5]
    ALPUENTE, M., FALASCHI, M., JULIÁN, P. AND VIDAL, G. 1997. Specialization of Lazy Functional Logic Programs. In Proc. of the ACM SIGPLAN Conf. on Partial Evaluation and Semantics-Based Program Manipulation, PEPM'97. ACM Sigplan Notices, vol. 32, number 12. ACM Press, New York, 151-162.
    [6]
    ALPUENTE, M., FALASCHI, M. AND VIDAL, G. 1998. Partial Evaluation of Functional Logic Programs. ACM Transactions on Programming Languages and Systems 20, 4, 768-844.
    [7]
    ALPUENTE, M., HANUS, M., LUCAS, S. AND VIDAL, G. 1999. Specialization of Inductively Sequential Functional Logic Programs. In Proc. of the ACM SIGPLAN Conf. on Functional Programming, ICFP'99, P. Lee, Ed. ACM Sigplan Notices, vol. 34, number 9. ACM Press, New York, 273-283.
    [8]
    ARTS, T. AND GIESL, J. 2001. A collection of examples for termination of term rewriting using dependency pairs. Tech. Rep. AIB-2001-09, RWTH Aachen, Germany.
    [9]
    BAADER, F. AND NIPKOW, T. 1998. Term Rewriting and All That. Cambridge University Press.
    [10]
    BERARDI, S., COPPO, M., DAMIANI, F. AND GIANNINI, P. 2000. Type-based useless-code elimination for functional programs. In Proceedings of SAIG 2000. Lecture Notes in Computer Science, vol. 1924. Springer-Verlag, Berlin, 172-189.
    [11]
    BERT, D., ECHAHED, R. AND ØSTVOLD, B. 1993. Abstract Rewriting. In Proc. of Third Int'l Workshop on Static Analysis, WSA'93. Lecture Notes in Computer Science, vol. 724. Springer-Verlag, Berlin, 178-192.
    [12]
    BURN, G. 1991. Lazy Functional Languages: Abstract Interpretation and Compilation. Pitman, London.
    [13]
    BURN, G. L., HANKIN, C. L. AND ABRAMSKY, S. 1986. The Theory of Strictness Analysis for Higher Order Functions. In Programs as Data Objects. Lecture Notes in Computer Science, vol. 217. Springer-Verlag, Berlin, 42-62.
    [14]
    COMON, H. 2000. Sequentiality, second order monadic logic, and tree automata. Information and Computation 157, 25-51.
    [15]
    CONTEJEAN E., MARCHÉ C., MONATE B. AND URBAIN X. 2003. Proving termination of rewriting with CiME. . In A. Rubio, editor, Proc. of 6th International Workshop on Termination, WST'03, pages 71-73, Technical Report DSIC II/15/03, Valencia, Spain, 2003. Available at http://cime.lri.fr.
    [16]
    COUSOT, P. AND COUSOT, R. 1994. Higher-order abstract interpretation (and application to comportment analysis generalizing strictness, termination, projection and PER analysis of functional languages), invited paper. In Proceedings of the 1994 International Conference on Computer Languages, ICCL'94. IEEE Computer Society Press, Los Alamitos, California, Toulouse, France, 95-112.
    [17]
    DAUCHET, M., HEUILLARD, T., LESCANNE, P. AND TISON, S. 1987. Decidability of the Confluence of Finite Ground Term Rewrite Systems and of Other Related Term Rewrite Systems. Proc. of Second IEEE Symp. on Logic In Computer Science, 353-359.
    [18]
    DAUCHET, M., HEUILLARD, T., LESCANNE, P. AND TISON, S. 1990. Decidability of the Confluence of Ground Term Rewriting Systems. In Information and Computation. 88. Academic Press, New York, 187-201.
    [19]
    DURAND, I. AND MIDDELDORP, A. 1997. Decidable Call by Need Computations in Term Rewriting. In Proc. of CADE'97, W. McCune, Ed. Lecture Notes in Artificial Intelligence, vol. 1249. Springer-Verlag, Berlin, 4-18.
    [20]
    GALLAGHER, J. 1993. Tutorial on Specialisation of Logic Programs. In Proc. of Partial Evaluation and Semantics-Based Program Manipulation, Copenhagen, Denmark, June 1993. ACM, New York, 88-98.
    [21]
    GALLIER, J. AND BOOK, R. 1985. Reductions on tree replacement systems. Theoretical Computer Science 37, 2, 123-150.
    [22]
    GIESL J., THIEMANN, R., SCHNEIDER-KAMP, P. AND FALKE, S. 2004. Automated Termination Proofs with AProVE. In V. van Oostrom, editor, Proc. of 15h International Conference on Rewriting Techniques and Applications, RTA'04, LNCS 3091:210-220, Springer-Verlag, Berlin, 2004. Available at http://www-i2.informatik.rwth-aachen.de/AProVE.
    [23]
    GLÜCK, R. AND SØRENSEN, M. 1994. Partial Deduction and Driving are Equivalent. In Proc. of PLILP'94. Lecture Notes in Computer Science, vol. 844. Springer-Verlag, Berlin, 165-181.
    [24]
    GODOY, G. AND TIWARI, A. 2004. Deciding Fundamental Properties of Right-(Ground or Variable) Rewrite Systems by Rewrite Closure. In D. Basin and M. Rusinowitch, editors, International Joint Conference on Automated Deduction, IJCAR'04, LNAI 3097:91-106, Springer-Verlag, Berlin, 2004.
    [25]
    GOURANTON, V. 1998. Deriving Analysers by Folding/Unfolding of Natural Semantics and a Case Study: Slicing. In Proc. of the 5th International Static Analysis Symposium, SAS'98. Lecture Notes in Computer Science, vol. 1503. Springer-Verlag, Berlin, 115-133.
    [26]
    GRAMLICH, B. 2001. On interreduction of semi-complete term rewriting systems. Theoretical Computer Science 258, 1-2, 435-451.
    [27]
    HANUS, M. 1994. The Integration of Functions into Logic Programming: From Theory to Practice. Journal of Logic Programming 19&20, 583-628.
    [28]
    HANUS, M., ANTOY, S., ENGELKE, M., HÖPPNER, K., KOJ, J., NIEDERAU, P., SADRE, R. AND STEINER, F. 2003a. PAKCS 1.5.0: The Portland Aachen Kiel Curry System User Manual. Tech. rep., University of Kiel, Germany.
    [29]
    HANUS, M., ANTOY, S., KUCHEN, H., LÓPEZ-FRAGUAS, F., LUX, W., MORENO NAVARRO, J., AND STEINER, F. 2003b. Curry: An Integrated Functional Logic Language (version 0.8). Available at http://www.informatik.uni-kiel.de/ curry.
    [30]
    M. HANUS AND S. LUCAS. 2001. An Evaluation Semantics for Narrowing-Based Functional Logic Languages. Journal of Functional and Logic Programming, 2001(2):1-43.
    [31]
    HENDRIX J., CLAVEL M. AND MESEGUER J. 2005. A Sufficient Completeness Reasoning Tool for Partial Specifications. In Jürgen Giesl, editor, Proc. of 16h International Conference on Rewriting Techniques and Applications, RTA'05, LNCS 3467:165-174, Springer-Verlag, Berlin, 2005. Available at http://maude.cs.uiuc.edu/tools/scc.
    [32]
    HOFBAUER, D. 2003. An upper bound on the derivational complexity of Knuth-Bendix orderings. Information and Computation 183(1):43-56.
    [33]
    HUET, G. AND LÉVY, J.-J. 1991. Computations in Orthogonal Term Rewriting Systems, Part I + II. In Computational logic: Essays in honour of J. Alan Robinson. The MIT Press, Cambridge, MA, 395-414 and 415-443.
    [34]
    HUGHES, J. 1988. Backwards Analysis of Functional Programs. In IFIP Workshop on Partial Evaluation and Mixed Computation (Amsterdam), D. Bjørner, A. Ershov, and N. Jones, Eds. 187-208.
    [35]
    JACQUEMARD, F. 1996. Decidable approximations to term rewriting systems. In Proc. of 7th International Conference on Rewriting Techniques and Applications, RTA'96, H. Ganzinger, Ed. Lecture Notes in Computer Science, vol. 1103. Springer-Verlag, Berlin, 362-376.
    [36]
    JENSEN, T. P. 1991. Strictness Analysis in Logical Form. In Proc of International Conference on Functional Programming Languages and Computer Architecture, R. J. M. Hughes, Ed. Lecture Notes in Computer Science, vol. 523. Springer-Verlag, Berlin, 352-366.
    [37]
    JONES, S. B. AND MÉTAYER, D. L. 1989. Compile-time garbage collection by sharing analysis. In Proc of International Conference on Functional Programming Languages and Computer Architecture. ACM Press, New York, 54-74.
    [38]
    KAPUR, D., NARENDRAN, P. AND ZHANG, Z. 1987. On sufficient-completeness and related properties of term rewriting systems. Acta Informatica 24, 395-416.
    [39]
    KAPUR, D., NARENDRAN, P., ROSENKRANTZ, D.J. AND ZHANG, Z. 1991. Sufficient-completeness, ground-reducibility, and their complexity. Acta Informatica 28, 311-350.
    [40]
    KENNAWAY, R., VAN OOSTROM, V. AND DE VRIES, F. 1996. Meaningless terms in rewriting. In Proceedings of the ALP'96. Lecture Notes in Artificial Intelligence, vol. 1139. Springer-Verlag, 254-268.
    [41]
    KLOP, J. 1992. Term Rewriting Systems. In Handbook of Logic in Computer Science, S. Abramsky, D. Gabbay, and T. Maibaum, Eds. Vol. 3. Oxford University Press, Oxford, 1-116.
    [42]
    KNOOP, J., RÜTHING, O. AND STEFFEN, B. 1994. Partial Dead Code Elimination. Proceedings of the International Conference on Programming Language Design and Implementation (PLDI'94) 29, 6, 147-158.
    [43]
    KOBAYASHI, N. 2000. Type-based useless variable elimination. In Proceedings of PEPM-00. ACM Press, New York, 84-93.
    [44]
    KOUNALIS, E. 1985. Completeness in data type specifications. In Proc. of European Conference on Computer Algebra, EUROCAL'85, B. Caviness, Ed. Lecture Notes in Computer Science, vol. 204. Springer-Verlag, Berlin, 348-362.
    [45]
    KUPER, J. 1994. Partiality in logic and computation. aspects of undefinedness. Ph.D. thesis, Universiteit Twente.
    [46]
    LEUSCHEL, M. 1998. On the Power of Homeomorphic Embedding for Online Termination. In Proc. of the 5th International Static Analysis Symposium, SAS'98, G. Levi, Ed. Lecture Notes in Computer Science, vol. 1503. Springer-Verlag, Berlin, 230-245.
    [47]
    LEUSCHEL, M. AND MARTENS, B. 1995. Partial Deduction of the Ground Representation and Its Application to Integrity Checking. Tech. Rep. CW 210DSIC-II/8/02, K.U. Leuven.
    [48]
    LEUSCHEL, M. AND SøRENSEN, M. H. 1996. Redundant Argument Filtering of Logic Programs. In Proceedings of the 6th International Workshop on Logic Program Synthesis and Transformation (LOPSTR'96), J. Gallager, Ed. Lecture Notes in Computer Science, vol. 1207. Springer-Verlag, Berlin, Stockholm, Sweden, 83-103.
    [49]
    LIU, Y. A. AND STOLLER, S. D. 2002. Eliminating dead code on recursive data. Science of Computer Programming.
    [50]
    LUCAS, S. 2001. Transfinite Rewriting Semantics for Term Rewriting Systems. In Proc. of 12th Int'l Conf. on Rewriting Techniques and Applications, RTA'01, A. Middeldorp, Ed. Lecture Notes in Computer Science, vol. 2051. Springer-Verlag, Berlin, 216-230.
    [51]
    MITSUHASHI, I. AND OYAMAGUCHI, M. AND OHTA, Y. AND YAMADA, T. 2004. The Joinability and Unification Problems for Confluent Semi-constructor TRSs. In Proc. of 15th Int'l Conf. Rewriting Techniques and Applications, RTA'04, V. van Oostrom, Ed. Lecture Notes in Computer Science, vol. 3091. Springer-Verlag, Berlin, 285-300.
    [52]
    MYCROFT, A. 1980. The theory and practice of transforming call by need into call by value. In 4th International Symposium on Programming, B. Robinet, Ed. Lecture Notes in Computer Science, vol. 83. Springer-Verlag, Berlin, 269-281.
    [53]
    MYCROFT, A. AND NORMAN, A. 1992. Optimising compilation. Part ii: lazy functional languages. In XIX Seminar on Current Trends in Theory and Practice of Informatics, SOFSEM'92 , ¿diar, Czechoslovakia. Available at http://www.cl.cam.ac.uk/~am/papers/ sofsem92b.ps.gz.
    [54]
    OYAMAGUCHI, M. 1986. The reachability problems for quasi-ground for term rewriting systems. Journal of Information Processing 9, 4, 232-236.
    [55]
    OYAMAGUCHI, M. 1990. The reachability and joinability problems for right-ground term rewriting systems. Journal of Information Processing 13, 3, 347-354.
    [56]
    PADAWITZ, P. 1988. Computing in Horn Clause Theories. EATCS Monographs on Theoretical Computer Science, vol. 16. Springer-Verlag, Berlin.
    [57]
    PARK, Y. G. AND GOLDBERG, B. 1992. Escape Analysis on Lists. Proceedings of the International Conference on Programming Language Design and Implementation (PLDI'92) 27, 7, 116-127.
    [58]
    PETTOROSSI, A. AND PROIETTI, M. 1994. Transformation of Logic Programs: Foundations and Techniques. Journal of Logic Programming 19, 20, 261-320.
    [59]
    PETTOROSSI, A. AND PROIETTI, M. 1996a. A Comparative Revisitation of Some Program Transformation Techniques. In Proc. of the 1996 Dagstuhl Seminar on Partial Evaluation. Lecture Notes in Computer Science, vol. 1110. Springer-Verlag, Berlin, 355-385.
    [60]
    PETTOROSSI, A. AND PROIETTI, M. 1996b. Rules and Strategies for Transforming Functional and Logic Programs. ACM Computing Surveys 28, 2, 360-414.
    [61]
    PLASMEIJER, R. AND VAN EEKELEN, M. 1993. Functional Programming and Parallel Graph Rewriting. Addison Wesley.
    [62]
    RABIN, M. O. 1969. Decidability of second-order theories and automata on infinite trees. Transactions of the American Mathematical Society 141, 1-35.
    [63]
    REPS, T. AND TURNIDGE, T. 1996. Program Specialization via Program Slicing. In Partial Evaluation, Int'l Seminar, Dagstuhl Castle, Germany, O. Danvy, R. Glück, and P. Thiemann, Eds. Lecture Notes in Computer Science, vol. 1110. Springer-Verlag, Berlin, 409- 429.
    [64]
    SCHOENIG, S. AND DUCASSE, M. 1996. A Backward Slicing Algorithm for Prolog. In Proc. of the 3rd International Static Analysis Symposium, SAS'96. Lecture Notes in Computer Science, vol. 1145. Springer-Verlag, Berlin, 317-331.
    [65]
    SEKAR, R., PAWAGI, S. AND RAMAKRISHNAN, I. 1990. Small domains spell fast strictness analysis. In 16th Annual ACM Symposium on Principles of Programming Languages, POPL'89. ACM Press, New York, 169-183.
    [66]
    SZILAGYI, G., GYIMOTHY, T., AND MALUSZYNSKI, J. 2002. Static and Dynamic Slicing of Constraint Logic Programs. Journal of Automated Software Engineering 9, 1, 41-65.
    [67]
    TERESE, Ed. 2003. Term Rewriting Systems. Cambridge University Press, Cambridge.
    [68]
    THATCHER, J. W. AND WRIGHT, J. B. 1968. Generalized finite automata with an application to a decision problem of second-order logic. Math. Systems Theory 2, 57-82.
    [69]
    THOMAS, W. 1990. Automata on infinite objects. In Handbook of Theoretical Computer Science, J. van Leeuwen, Ed. Vol. B: Formal Models and Semantics. Elsevier, Amsterdam and The MIT Press, Cambridge, Mass, 133-191.
    [70]
    TIP, F. 1995. A Survey of Program Slicing Techniques. Journal of Programming Languages 3, 121-189.
    [71]
    VERMA, M.-R. 2002, Algorithms and Reductions for Rewriting Problems II. Information Processing Letters 84(4):227-233.
    [72]
    WADLER, P. AND HUGHES, R. 1987. Projections for Strictness Analysis. In Proc of International Conference on Functional Programming Languages and Computer Architecture. Lecture Notes in Computer Science, vol. 274. Springer-Verlag, Berlin, 385-407.
    [73]
    WAND, M. AND SIVERONI, I. 1999. Constraint systems for useless variable elimination. In Proceedings of the 26th ACM SIGPLAN-SIGACT symposium on Principles of programming languages (POPL'99). ACM Press, New York, 291-302.
    [74]
    WEISER, M. 1984. Program Slicing. IEEE Transactions on Software Engineering 10, 4, 352-357.

    Cited By

    View all
    • (2018)From hidden to visibleTheoretical Computer Science10.1016/j.tcs.2018.01.006722:C(52-75)Online publication date: 25-Apr-2018
    • (2017)Verifying Procedural Programs via Constrained Rewriting InductionACM Transactions on Computational Logic10.1145/306014318:2(1-50)Online publication date: 2-Jun-2017
    • (2017)Analyzing Program Termination and Complexity Automatically with AProVEJournal of Automated Reasoning10.1007/s10817-016-9388-y58:1(3-31)Online publication date: 1-Jan-2017

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image Theory and Practice of Logic Programming
    Theory and Practice of Logic Programming  Volume 7, Issue 1-2
    January 2007
    241 pages

    Publisher

    Cambridge University Press

    United States

    Publication History

    Published: 01 January 2007

    Author Tags

    1. analysis and optimization
    2. redundant arguments in functions
    3. semantics-preserving program transformation
    4. term rewriting

    Qualifiers

    • Article

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)0
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 27 Jul 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2018)From hidden to visibleTheoretical Computer Science10.1016/j.tcs.2018.01.006722:C(52-75)Online publication date: 25-Apr-2018
    • (2017)Verifying Procedural Programs via Constrained Rewriting InductionACM Transactions on Computational Logic10.1145/306014318:2(1-50)Online publication date: 2-Jun-2017
    • (2017)Analyzing Program Termination and Complexity Automatically with AProVEJournal of Automated Reasoning10.1007/s10817-016-9388-y58:1(3-31)Online publication date: 1-Jan-2017

    View Options

    View options

    Get Access

    Login options

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media