Inference rules for programming languages with side effects in expressions

Author(s):  
Paul E. Black ◽  
Phillip J. Windley
2019 ◽  
Vol 7 (1) ◽  
Author(s):  
Jonathan Thaler ◽  
Peer-Olaf Siebers

AbstractWith the decline of Moore’s law and the ever increasing availability of cheap massively parallel hardware, it becomes more and more important to embrace parallel programming methods to implement Agent-Based Simulations (ABS). This has been acknowledged in the field a while ago and numerous research on distributed parallel ABS exists, focusing primarily on Parallel Discrete Event Simulation as the underlying mechanism. However, these concepts and tools are inherently difficult to master and apply and often an excess in case implementers simply want to parallelise their own, custom agent-based model implementation. However, with the established programming languages in the field, Python, Java and C++, it is not easy to address the complexities of parallel programming due to unrestricted side effects and the intricacies of low-level locking semantics. Therefore, in this paper we propose the use of a lock-free approach to parallel ABS using Software Transactional Memory (STM) in conjunction with the pure functional programming language Haskell, which in combination, removes some of the problems and complexities of parallel implementations in imperative approaches. We present two case studies, in which we compare the performance of lock-based and lock-free STM implementations in two different well known Agent-Based Models, where we investigate both the scaling performance under increasing number of CPU cores and the scaling performance under increasing number of agents. We show that the lock-free STM implementations consistently outperform the lock-based ones and scale much better to increasing number of CPU cores both on local hardware and on Amazon EC. Further, by utilizing the pure functional language Haskell we gain the benefits of immutable data and lack of unrestricted side effects guaranteed at compile-time, making validation easier and leading to increased confidence in the correctness of an implementation, something of fundamental importance and benefit in parallel programming in general and scientific computing like ABS in particular.


Author(s):  
Mark D. Flood ◽  
Matthew McCormick ◽  
Nathan Palmer

We present a variation on literate programming (see Knuth: 1984, 1992) targeting multiple simultaneous readerships, both human (e.g., coders, testers, analysts, etc.) and compilers/interpreters (e.g., C++, Python, Fortran, etc.). The technique exploits existing commenting syntax available in all common programming languages to provide inline documentation and other semantic markup, which can then be used in test generation and code translation. To keep the problem manageable, we restrict attention to scientific function libraries (i.e., libraries of numerical routines adhering to the functional programming rule of “no side effects”). We offer a prototype implementation in XSLT and DocBook.


2009 ◽  
Vol 19 (3-4) ◽  
pp. 335-376 ◽  
Author(s):  
ROBERT ATKEY

AbstractMoggi's Computational Monads and Poweret al.'s equivalent notion of Freyd category have captured a large range of computational effects present in programming languages. Examples include non-termination, non-determinism, exceptions, continuations, side effects and input/output. We present generalisations of both computational monads and Freyd categories, which we callparameterisedmonads andparameterisedFreyd categories, that also capture computational effects with parameters. Examples of such are composable continuations, side effects where the type of the state varies and input/output where the range of inputs and outputs varies. By considering structured parameterisation also, we extend the range of effects to cover separated side effects and multiple independent streams of I/O. We also present two typed λ-calculi that soundly and completely model our categorical definitions – with and without symmetric monoidal parameterisation – and act as prototypical languages with parameterised effects.


2004 ◽  
Vol 11 (35) ◽  
Author(s):  
Jørgen Iversen

When writing semantic descriptions of programming languages, it is convenient to have tools for checking the descriptions. With frameworks that use inductively defined semantic functions to map programs to their denotations, we would like to check that the semantic functions result in denotations with certain properties. In this paper we present a type system for a modular style of the action semantic framework that, given signatures of all the semantic functions used in a semantic equation defining a semantic function, performs a soft type check on the action in the semantic equation.<br /> <br />We introduce types for actions that describe different properties of the actions, like the type of data they expect and produce, whether they can fail or have side effects, etc. A type system for actions which uses these new action types is presented. Using the new action types in the signatures of semantic functions, the language describer can assert properties of semantic functions and have the assertions checked by an implementation of the type system.<br /> <br />The type system has been implemented for use in connection with the recently developed formalism ASDF. The formalism supports writing language definitions by combining modules that describe single language constructs. This is possible due to the inherent modularity in ASDF. We show how we manage to preserve the modularity and still perform specialised type checks for each module.


If programming is understood not as the writing of instructions for this or that computing machine but as the design of methods of computation that it is the computer’s duty to execute (a difference that Dijkstra has referred to as the difference between computer science and computing science), then it no longer seems possible to distinguish the discipline of programming from constructive mathematics. This explains why the intuitionistic theory of types (Martin-Lof 1975 In Logic Colloquium 1973 (ed. H. E. Rose & J. C. Shepherdson), pp. 73- 118. Amsterdam: North-Holland), which was originally developed as a symbolism for the precise codification of constructive mathematics, may equally well be viewed as a programming language. As such it provides a precise notation not only, like other programming languages, for the programs themselves but also for the tasks that the programs are supposed to perform. Moreover, the inference rules of the theory of types, which are again completely formal, appear as rules of correct program synthesis. Thus the correctness of a program written in the theory of types is proved formally at the same time as it is being synthesized.


1997 ◽  
Vol 7 (2) ◽  
pp. 129-161 ◽  
Author(s):  
TETSUO IDA ◽  
KOICHI NAKAHARA

We present narrowing calculi that are computation models of functional-logic programming languages. The narrowing calculi are based on the notion of the leftmost outside-in reduction of Huet and Lévy. We note the correspondence between the narrowing and reduction derivations, and define the leftmost outside-in narrowing derivation. We then give a narrowing calculus OINC that generates the leftmost outside-in narrowing derivations. It consists of several inference rules that perform the leftmost outside-in narrowing. We prove the completeness of OINC using an ordering defined over a narrowing derivation space. To use the calculus OINC as a model of computation of functional-logic programming, we extend OINC to incorporate strict equality. The extension results in a new narrowing calculus, s-OINC. We show also that s-OINC enjoys the same completeness property as OINC.


1991 ◽  
Vol 1 (3) ◽  
pp. 245-285 ◽  
Author(s):  
John C. Mitchell

AbstractSubtyping appears in a variety of programming languages, in the form of the ‘automatic coercion’ of integers to reals, Pascal subranges, and subtypes arising from class hierarchies in languages with inheritance. A general framework based on untyped lambda calculus provides a simple semantic model of subtyping and is used to demonstrate that an extension of Curry's type inference rules are semantically complete. An algorithm G for computing the most general typing associated with any given expression, and a restricted, optimized algorithm GA using only atomic subtyping hypotheses are developed. Both algorithms may be extended to insert type conversion functions at compile time or allow polymorphic function declarations as in ML.


1996 ◽  
Vol 25 (510) ◽  
Author(s):  
Flemming Nielson ◽  
Hanne Riis Nielson

Two-level lambda-calculi have been utilised for applications such as partial evalu- ation, abstract interpretation and code generation. Each of these applications pose different demands on the exact details of the two-level structure and the corresponding inference rules. We therefore formulate a number of existing systems in a common framework so as to conceal those differences between the systems that are not essential for the multi-level ideas, and so as to reveal the deeper similarities and differences. The multi-level lambda-calculi defined here allow multi-level structures that are not restricted to the (possibly finit) linear orders found in most of the literature. Finally, we generalise our approach so as to be applicable to a much wider class of programming languages.


Author(s):  
S.K. Aggarwal ◽  
J. San Antonio

Cisplatin (cis-dichlorodiammineplatinum(II)) a potent antitumor agent is now available for the treatment of testicular and ovarian cancers. It is however, not free from its serious side effects including nephrotoxicity, gastro intestinal toxicity, myelosuppression, and ototoxicity. Here we now report that the drug produces peculiar bloating of the stomach in rats and induces acute ulceration.Wistar-derived rats weighing 200-250 g were administered cisplatin(9 mg/kg) ip as a single dose in 0.15 M NaCl. After 3 days the animals were sacrificed by decapitation. The stomachs were removed, the contents analyzed for pepsin and acidity. The inner surface was examined with a dissecting microscope after a moderate stretching for ulcers. Affected areas were fixed and processed for routine electron microscopy and enzyme cytochemistry.The drug treated animals kept on food and water consistently showed bloating and lesions (Fig. 1) with a frequency of 6-70 ulcers in the rumen section of the stomachs.


Author(s):  
J.M. Fadool ◽  
P.J. Boyer ◽  
S.K. Aggarwal

Cisplatin (CDDP) is currently one of the most valuable antineoplastic drugs available. However, it has severe toxic side effects of which nephrotoxicity is the major dose limiting factor in its use. It induces morphological changes in the kidney with hampered urine output. The present study is an effort to determine the influence of the drug on the neurohypophysis for any antidiuretic effects on the kidney.


Sign in / Sign up

Export Citation Format

Share Document