Advances in Active Libraries and Generic Programming Methods , Techniques , and Language Features

Interpretation of Predicates In this section we give an example of the abstract interpretation of a predicate which has a conjunction. The predicate tests if the parameters S and R which both naturally carry the structure ordered set actually both carry the structure ring. The predicate is: 2The source of the code is found in the file “EXPR2.spad” in OpenAxiom [Ope09] 5.4. ABSTRACT INTERPRETATION OF CATEGORIES 59 R has Ring and S has Ring The abstract store Φ for at the program point for the predicate has the value: Φ = { 〈S has Ring 7→ 1/2〉, 〈R has Ring 7→ 1〉, ... } The evaluation of the predicate in Φ is: Φ(R has Ring and S has Ring) = Φ(R has Ring) andK Φ(R has Ring) = 1 andK 1/2 = 1/2 The abstract interpretation of the predicate is shown below: JR has Ring and S has RingK = JR has RingK t JS has RingK =  〈R has Ring 7→ 1〉, 〈R has Group 7→ 1〉, · · ·  t  〈S has Ring 7→ 1〉, 〈S has Group 7→ 1〉, · · ·  =  〈R has Ring 7→ 1〉, 〈R has Group 7→ 1〉, 〈S has Ring 7→ 1〉, 〈S has Group 7→ 1〉, · · ·  Implementation of hascat in the Prototype The implementation of “hascat” is a function that takes three arguments: the syntactic representation of a domain D, the syntactic representation of an instantiated category C, and the current abstract store Φ of the category being abstractly interpreted. The function uses the Spad domain Table(Key, Entry) (a mapping from keys Key to entries Entry), where the function: key?:(Key,Table(Key,Entry)) →Boolean is analogous to the function “find” from the operational semantics defined in Section 5.2.4. We thus implement hascat as: hascat(D, C, Φ) == 2 key?(MakeHasCat(‘%,C), Application(D, Rename(Proj(Φ, D)), args(D), parms(C))) First, we call the function Application for the domain D, which returns a Spad Table containing facts which are expressed in terms of the symbol ‘% about D. Then we build the representation of a has-predicate with a call to MakeHasCat over ‘% and C, and look for that predicate in the table. The function hascat then relies heavily on the implementation of the function Application, described in the next section. Implementation of Application. The function Application takes the representation of an instantiated category ICat and an abstract store Phi representing the assumptions passed from the calling program point. Pseudo-code based on our prototype is shown below. Application(ICat, Phi) == 2 arity0? ICat ⇒ interpret(getDef(name(ICat)), Phi) instCatDef := getDef(name(ICat)) 4 for idx in 1..#args(ICat) repeat 60 CHAPTER 5. LOCAL SPECIALIZATION Phi’ := Application(args(ICat).idx, Phi) 6 Phi’ := Rename(Phi’, ‘%, parms(instCatDef).idx) Phi := join(Phi, Phi’) 8 Phi’’ := interpret(instCatDef, Phi) for idx in 1..args(ICat) repeat 10 Phi’’ := Rename(Phi’, args(ICat).idx, parms(instCatDef).idx) 12 Phi’’ If the instantiated category is a constant, a variable, or functor with arity = 0 it is just re-interpreted directly, with the interpret function. If arity > 0, then each argument args(ICat).idx of the instantiated category is recursively re-interpreted by a call to Application. The result is an abstract store with facts in terms of “%” about the argument; all facts about “%” are renamed to be facts about the argument parms(instCatDef).idx. All the abstract stores of the arguments are joined together into an abstract store called Phi’. The abstract store Phi’ is then used as assumptions for the re-interpretation of the instantiated category ICat. The syntactic representation for the category ICat is instCatDef which is acquired by a call to the global repository of syntactic representations getDef using the name of the category name(ICat). The syntactic representation is then re-interpreted, giving a new set of facts Phi’’. The facts in Phi’’ are in terms of the names of the formal parameters of the instantiated category, and are renamed to be in terms of the names of the actual arguments.

[1]  David S. Wise,et al.  Generic support of algorithmic and structural recursion for scientific computing , 2009, Int. J. Parallel Emergent Distributed Syst..

[2]  Mads Torgersen,et al.  The c# programming language, third edition , 2008 .

[3]  Robert A. van de Geijn,et al.  Anatomy of high-performance matrix multiplication , 2008, TOMS.

[4]  Jaakko Järvi,et al.  Library composition and adaptation using c++ concepts , 2007, GPCE '07.

[5]  Jaakko Järvi,et al.  Algorithmic differentiation in Axiom , 2007, ISSAC '07.

[6]  Jaakko Järvi,et al.  An extended comparative study of language support for generic programming , 2007, Journal of Functional Programming.

[7]  Charles Consel,et al.  Generative Programming and Component Engineering, 6th International Conference, GPCE 2007, Salzburg, Austria, October 1-3, 2007, Proceedings , 2007, International Conference on Generative Programming: Concepts and Experiences.

[8]  Douglas Gregor,et al.  Proposed Wording for Concepts (Revision 3) , 2007 .

[9]  Jaakko Järvi,et al.  Runtime Polymorphic Generic Programming — Mixing Objects and Concepts in ConceptC + + , 2007 .

[10]  Ralf Lämmel,et al.  Software extension and integration with type classes , 2006, GPCE '06.

[11]  Bjarne Stroustrup,et al.  Concepts: linguistic support for generic programming in C++ , 2006, OOPSLA '06.

[12]  Jaakko Järvi,et al.  Algorithm specialization in generic programming: challenges of constrained generics in C++ , 2006, PLDI '06.

[13]  Andrew Lumsdaine,et al.  Effecting parallel graph eigensolvers through library composition , 2006, Proceedings 20th IEEE International Parallel & Distributed Processing Symposium.

[14]  Gale S. Rhodes Crystallography Made Crystal Clear, Third Edition: A Guide for Users of Macromolecular Models , 2006 .

[15]  Andrew Lumsdaine,et al.  Lifting sequential graph algorithms for distributed-memory parallel computation , 2005, OOPSLA '05.

[16]  Simon L. Peyton Jones,et al.  Associated type synonyms , 2005, ICFP '05.

[17]  Jacob N. Smith,et al.  TEXTAL™: Automated Crystallographic Protein Structure Determination , 2005, AAAI.

[18]  Simon L. Peyton Jones,et al.  Associated types with class , 2005, POPL '05.

[19]  N. Mitchell,et al.  The Diary of a Datum: An Approach to Modeling Runtime Complexity in Framework-Based Applications , 2005 .

[20]  David Abrahams,et al.  C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond (C++ In-Depth Series) , 2004 .

[21]  T. Lindvall ON A ROUTING PROBLEM , 2004, Probability in the Engineering and Informational Sciences.

[22]  Todd L. Veldhuizen,et al.  Active libraries and universal languages , 2004 .

[23]  Jaakko Järvi,et al.  Concept-Controlled Polymorphism , 2003, GPCE.

[24]  Thomas R Ioerger,et al.  TEXTAL system: artificial intelligence techniques for automated protein model building. , 2003, Methods in enzymology.

[25]  Randy J Read,et al.  Electronic Reprint Biological Crystallography Phenix: Building New Software for Automated Crystallographic Structure Determination Biological Crystallography Phenix: Building New Software for Automated Crystallographic Structure Determination , 2022 .

[26]  Nicholas K. Sauter,et al.  The Computational Crystallography Toolbox: crystallographic algorithms in a reusable software framework , 2002 .

[27]  Jeremy G. Siek,et al.  The Boost Graph Library - User Guide and Reference Manual , 2001, C++ in-depth series.

[28]  Benjamin C. Pierce,et al.  Types and programming languages: the next generation , 2003, 18th Annual IEEE Symposium of Logic in Computer Science, 2003. Proceedings..

[29]  Gerald Baumgartner,et al.  Half & Half: Multiple Dispatch and Retroactive Abstraction for Java TM† , 2002 .

[30]  Mark A. Williams,et al.  The Bioinformatics Template Library—generic Components for Biocomputing , 2001 .

[31]  Nancy M. Amato,et al.  STAPL: An Adaptive, Generic Parallel C++ Library , 2001, LCPC.

[32]  William G. Griswold,et al.  An Overview of AspectJ , 2001, ECOOP.

[33]  Mark P. Jones,et al.  Type Classes with Functional Dependencies , 2000, ESOP.

[34]  Andreas Griewank,et al.  Evaluating derivatives - principles and techniques of algorithmic differentiation, Second Edition , 2000, Frontiers in applied mathematics.

[35]  Geert-Jan Giezeman,et al.  On the design of CGAL a computational geometry algorithms library , 2000, Softw. Pract. Exp..

[36]  Jeremy G. Siek,et al.  Concept Checking: Binding Parametric Polymorphism in C++ , 2000 .

[37]  Gerald Baumgartner,et al.  Safe Structural Conformance for Java , 2000, Comput. J..

[38]  Yannis Smaragdakis,et al.  Static interfaces in C , 2000 .

[39]  Jeremy G. Siek,et al.  The Matrix Template Library: generic components for high-performance scientific computing , 1999, Comput. Sci. Eng..

[40]  Jan Bosch,et al.  Framework integration problems, causes, solutions , 1999, CACM.

[41]  Thomas R. Ioerger,et al.  TEXTAL: A Pattern Recognition System for Interpreting Electron Density Maps , 1999, ISMB.

[42]  Reinhard Wilhelm,et al.  Parametric shape analysis via 3-valued logic , 1999, POPL '99.

[43]  Clemens A. Szyperski,et al.  Component software - beyond object-oriented programming , 2002 .

[44]  Todd L. Veldhuizen,et al.  Arrays in Blitz++ , 1998, ISCOPE.

[45]  Jack J. Dongarra,et al.  Automatically Tuned Linear Algebra Software , 1998, Proceedings of the IEEE/ACM SC98 Conference.

[46]  Dennis Gannon,et al.  Active Libraries: Rethinking the roles of compilers and libraries , 1998, ArXiv.

[47]  Karl Crary,et al.  Intensional polymorphism in type-erasure semantics , 1998, ICFP '98.

[48]  V. Litvinov Constraint-based polymorphism in Cecil: towards a practical and static type system , 1998, OOPSLA Addendum.

[49]  Todd L. Veldhuizen,et al.  Will C++ Be Faster than Fortran? , 1997, ISCOPE.

[50]  Jitendra Malik,et al.  Normalized cuts and image segmentation , 1997, Proceedings of IEEE Computer Society Conference on Computer Vision and Pattern Recognition.

[51]  Simon Peyton Jones,et al.  Type classes: an exploration of the design space , 1997 .

[52]  Philip S. Santas,et al.  Conditional Categories and Domains , 1996, DISCO.

[53]  Nathan Myers,et al.  A new and useful template technique: “traits” , 1996 .

[54]  Michael J. Vilot,et al.  Standard template library , 1996 .

[55]  Todd L. Veldhuizen,et al.  Expression templates , 1996 .

[56]  Peter Lee,et al.  The TIL/ML Compiler: Performance and Safety through Types , 1996 .

[57]  Robert Harper,et al.  Compiling polymorphism using intensional type analysis , 1995, POPL '95.

[58]  Kurt Mehlhorn,et al.  LEDA: a platform for combinatorial and geometric computing , 1997, CACM.

[59]  Martin Odersky,et al.  Polymorphic type inference and abstract data types , 1994, TOPL.

[60]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[61]  Richard D. Jenks,et al.  AXIOM: the scientific computation system , 1992 .

[62]  Axel T. Brunger,et al.  X-PLOR Version 3.1: A System for X-ray Crystallography and NMR , 1992 .

[63]  James H. Davenport,et al.  Scratchpad's view of algebra II: A categorical view of factorization , 1991, ISSAC '91.

[64]  James H. Davenport,et al.  Scratchpad's View of Algebra I: Basic Commutative Algebra , 1990, DISCO.

[65]  Philip Wadler,et al.  How to make ad-hoc polymorphism less ad hoc , 1989, POPL '89.

[66]  Alexander A. Stepanov,et al.  Generic Programming , 1988, ISSAC.

[67]  T. Hahn,et al.  International Tables for Crystallography: Volume A: Space-Group Symmetry , 1987 .

[68]  Uri Shani,et al.  Filling regions in binary raster images: A graph-theoretic approach , 1980, SIGGRAPH '80.

[69]  Charles L. Lawson,et al.  Basic Linear Algebra Subprograms for Fortran Usage , 1979, TOMS.

[70]  Patrick Cousot,et al.  Systematic design of program analysis frameworks , 1979, POPL.

[71]  Patrick Cousot,et al.  Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints , 1977, POPL.

[72]  S. C. Kleene,et al.  Introduction to Metamathematics , 1952 .