Abstract
Characterising a problem in terms of a system of equations is common to many branches of science and engineering. Due to their size, such systems are often described in a modular fashion by composition of individual equation system fragments. Checking the balance between the number of variables (unknowns) and equations is a common approach to early detection of mistakes that might render such a system unsolvable. However, current approaches to modular balance checking have a number of limitations. This paper investigates a more flexible approach that makes it possible to treat equation system fragments as true first-class entities. Furthermore, the approach handles so-called structurally dynamic systems, systems whose behaviour changes discretely and abruptly over time. The central idea is to record balance information in the type of an equation fragment. This information can then be used to determine if individual fragments are well formed, and if composing fragments preserves this property. The type system presented in this paper is developed in the context of Functional Hybrid Modelling (FHM). However, the key ideas are in no way specific to FHM, but should be applicable to any language featuring a notion of modular systems of equations, including systems with first-class components and structural dynamism.
Similar content being viewed by others
References
Accellera Organization: Verilog-AMS language reference manual—analog & mixed-signal extensions to Verilog HDL. version 2.3.1 (2009)
Aho, A.V.: The C Programming Language (1988)
Barbeau, E.J.: Pell’s Equation. Problem Books in Mathematics. Springer, Berlin (2003)
Broman, D., Nyström, K., Fritzson, P.: Determining over- and under-constrained systems of equations using structural constraint delta. In: GPCE ’06: Proceedings of the 5th International Conference on Generative Programming and Component Engineering, pp. 151–160. ACM, Portland (2006)
Bunus, P., Fritzson, P.: A debugging scheme for declarative equation based modeling languages. In: Proceedings of the 4th International Symposium on Practical Aspects of Declarative Languages (PADL 2002), OR, USA. Lecture Notes in Computer Science, vol. 2257, pp. 280–298. Springer, Berlin (2002)
Capper, J.J.: Source code repository. www.cs.nott.ac.uk/~jjc
Capper, J.J., Nilsson, H.: Static balance checking for first-class modular systems of equations. In: Proceedings of the 11th Symposium on Trends in Functional Programming, Oklahoma, USA (2010)
Capper, J.J., Nilsson, H.: Towards a formal semantics for structurally dynamic non-causal modelling languages. In: Types in Language Design and Implementation, Philadelphia, Pennsylvania, USA (2012)
Cellier, F.E.: Object-oriented modelling: means for dealing with system complexity. In: Proceedings of the 15th Benelux Meeting on Systems and Control, Mierlo, The Netherlands, pp. 53–64 (1996)
Cellier, F.E., Kofman, E.: Continuous System Simulation. Springer, Berlin (2006)
Collins, G.E.: Quantifier elimination for real closed fields by cylindrical algebraic decomposition. In: Proceedings Second GI Conference on Automata Theory and Formal Languages. Lecture Notes in Computer Science, vol. 33, pp. 134–183. Springer, Berlin (1975)
Elliott, C., Hudak, P.: Functional reactive animation. In: Proceedings of ICFP’97: International Conference on Functional Programming, pp. 163–173 (1997)
Furic, S.: Enforcing model composability in Modelica. In: Casella, F. (ed.) Proceedings of the 7th International Modelica Conference, Como, Italy, 20–22 September 2009. Linköping Electronic Conference Proceedings, vol. 43, pp. 868–879. Linköping University Electronic Press, Linköping (2009)
Giorgidze, G., Nilsson, H.: Higher-order non-causal modelling and simulation of structurally dynamic systems. In: Casella, F. (ed.) Proceedings of the 7th International Modelica Conference, Como, Italy, 20–22 September 2009. Linköping Electronic Conference Proceedings, vol. 43, pp. 208–218. Linköping University Electronic Press, Linköping (2009)
Giorgidze, G., Nilsson, H.: Mixed-level embedding and JIT compilation for an iteratively staged DSL. In: Mariño, J. (ed.) Proceedings of the 19th Workshop on Functional and (Constraint) Logic Programming (WFLP 2010). Lecture Notes in Computer Science, vol. 6559, pp. 48–65. Springer, Berlin (2011)
IEEE Std 1076.1-2007: IEEE Standard VHDL Analog and Mixed-Signal Extensions. IEEE Press, New York (2007)
Jones, S.P., et al.: Haskell 98—a non-strict, purely functional language (1999). http://www.haskell.org/onlinereport
Kirchhoff’s circuit laws. Wikipedia. http://en.wikipedia.org/wiki/Kirchhoff’s_circuit_laws. Accessed October 2012
McKinna, J., Altenkirch, T., McBride, C.: Why dependent types matter. ACM SIGPLAN Not. 41(1)
Milner, R.: A theory of type polymorphism in programming. J. Comput. Syst. Sci. 17, 348–375 (1978)
Modelica Association: Modelica—A Unified Object-Oriented Language for Systems Modelling; Language Specification Version 3.3 (2012). http://www.modelica.org
Nilsson, H.: Type-based structural analysis for modular systems of equations. In: Fritzson, P., Cellier, F., Broman, D. (eds.) Proceedings of the 2nd International Workshop on Equation-Based Object-Oriented Languages and Tools, Paphos, Cyprus. Linköping Electronic Conference Proceedings, vol. 29, pp. 71–81. Linköping University Electronic Press, Linköping (2008)
Nilsson, H., Courtney, A., Peterson, J.: Functional reactive programming, continued. In: Proceedings of the 2002 ACM SIGPLAN Haskell Workshop (Haskell’02), pp. 51–64. ACM, Pittsburgh (2002)
Nilsson, H., Giorgidze, G.: Exploiting structural dynamism in Functional Hybrid Modelling for simulation of ideal diodes. In: Proceedings of the 7th EUROSIM Congress on Modelling and Simulation. Czech Technical University Publishing House, Prague (2010)
Nilsson, H., Peterson, J., Hudak, P.: Functional hybrid modeling. In: Proceedings of PADL’03: 5th International Workshop on Practical Aspects of Declarative Languages, New Orleans, Lousiana, USA. Lecture Notes in Computer Science, vol. 2562, pp. 376–390. Springer, Berlin (2003)
Norell, U.: Towards a practical programming language based on dependent type theory. Technical report, Chalmers University of Technology (2007)
Nytsch-Geusen, C., Ernst, T., Nordwig, A., Schwarz, P., Schneider, P., Vetter, M., Wittwer, C., Nouidui, T., Holm, A., Leopold, J., Schmidt, G., Mattes, A., Doll, U.: MOSILAB: development of a Modelica-based generic simulation tool supporting model structural dynamics. In: Proceedings of the 4th International Modelica Conference, Hamburg, Germany, pp. 527–535 (2005)
Pierce, B.: Types and Programming Languages. MIT Press, Cambridge (2002)
Plotkin, G.: A structural approach to operational semantics. Technical Report DAIMI FN-19, Department of Computer Science, Aarhus University, Denmark (1981)
Pugh, W.: The Omega Test: a fast and practical integer programming algorithm for dependence analysis. In: Supercomputing, vol. 91 (1991)
Wan, Z., Hudak, P.: Functional reactive programming from first principles. In: Proceedings of PLDI’01: Symposium on Programming Language Design and Implementation, pp. 242–252 (2000)
Zimmer, D.: Equation-based modeling of variable-structure systems. Ph.D. thesis, Swiss Federal Institute of Technology, Zürich (2010)
Acknowledgements
We would like to thank the anonymous reviewers of this paper and the preceding TFP paper [7] for many insightful comments and valuable suggestions.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Capper, J., Nilsson, H. Structural types for systems of equations. Higher-Order Symb Comput 25, 275–310 (2012). https://doi.org/10.1007/s10990-013-9099-6
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10990-013-9099-6