When looking at a piece of code, if it is short, clearly written, with good names and minimal mutation of values, then mentally working through what the code does is a relatively easy task. Equational reasoning lies at the heart of transformationbased software development. His new textbook, which introduces functional programming to students, emphasises fundamental techniques for reasoning mathematically about functional programs. Be able to use a proof assistant to formally verify proofs. For this we introduce a natural generalization of guard expressions to guard qualifiers. The article written in a popular form explains that a number of different algorithmic problems related to herbrands theorem happen to be equivalent. Logic programming is a programming paradigm which is largely based on formal logic. Dependable software through higher order strategic. In various discussions of the merits of functional programming, the phrase referential transparency or equational reasoning is often listed. One being the concept, and the second being the process of applying the concept. Nour hossain department of computer science submitted in partial fulfillment of the requirements for the degree of master of science faculty of mathematics and science, brock university st. The beseme project seeks to integrate the concepts of logic and formal methods from a discrete mathematics curriculum directly with software engineering to verify the properties of programs written in the functional programming language haskel. Introducing the haskell equational reasoning assistant.
Equational reasoning 1,2 is an intermediateadvanced fp technique, that sits at the intersection of programming and mathematics and has many interesting uses. More importantly, though, program transformations provide the means for view transformations mainly from. Inductive programming ip is a special area of automatic programming, covering research from artificial intelligence and programming, which addresses learning of typically declarative logic or functional and often recursive programs from incomplete specifications, such as inputoutput examples or constraints. Be able to prove properties of programs using both equational reasoning and structural induction. Equational reasoning about objectoriented programs core. Major logic programming language families include prolog, answer set programming asp and datalog. They can then verify the correctness of these equations using equational reasoning to. Is there a visual modeling language or style for the functional programming paradigm. By studying the underlying equational laws, the book enables students to apply calculational reasoning to their programs, both to understand their properties and to make them more. Current practice involves simulating an effectful computation as a pure function, and conducting the reasoning on this pure value.
The ultimate goal of the research, being conducted my rex page at the university of oklahoma, is to promote software verification as the only means of. In the early 80s hope language adds algebraic data types for recursion and equational reasoning. The objective of any fp language is to mimic the mathematical functions. Equational reasoning at scale haskell programmers care about the correctness of their software and they specify correctness conditions in the form of equations that their code must satisfy. Deductive and inductive synthesis of equational programs. It has now matured into a fullfledged theorem prover which has been used to solve hard and challenging mathematical problems in automated reasoning literature as well as a. Equational reasoning about programs with general recursion.
Confluent equational reasoning for linking with firstclass primitive modules long version. Typed functional programming and software correctness. Step after step we could replace a term with an equivalent one. The haskell equational reasoning modeltoimplementation tunnel hermit the haskell equational reasoning modeltoimplementation tunnel hermit is a ghc plugin that allows posthoc transformations to be applied to haskell programs, after compilation has started. Help center detailed answers to any questions you might have meta discuss the workings and policies of this site about us learn. Rrl rewrite rule laboratory was originally developed as an environment for experimenting with automated reasoning algorithms for equational logic based on rewrite techniques. Pearls of functional algorithm design will appeal to the aspiring functional programmer, students and teachers interested in the principles of algorithm design, and anyone seeking to master the techniques of reasoning about programs in an equational style. One possible method of supporting the verification process is a programming language that provides powerful abstraction mechanisms combined with intensive reuse of code. Hermit can be used for programspecific optimizations, domainspecific optimizations, or for constructing semiformal. Pdf equational logic programming, actions, and change. For imperative programming languages, hand execution involves simulating the actions of the computer as it obeys the commands in the program. The haskell equational reasoning modeltoimplementation.
It is interesting to see that in all the three approaches to reasoning ab. Hermit can be used for programspecific optimizations, domainspecific optimizations, or for constructing semiformal assurance arguments. Research paper equational reasoning about programs with. Equational reasoning about objectoriented programs. Program veriication works best when programs are written at a high abstraction level and support equational reasoning, while systems programming uses efects and requires lowlevel control of hardware resources.
Newest equationalreasoning questions stack overflow. With referential transparent expressions we are able to replace symbols with their definition in the same way wed solve an algebraic expression to its simplest form. Any program written in a logic programming language is a set of sentences in logical form, expressing facts and rules about some problem domain. Reasoning about haskell differs from reasoning about code in other languages. One about using hermit for equational reasoning, and the other about a monadbased design pattern for remote control that externalizes monadic execution. The example chosen is an abstraction of a real communications problem. Gofer good for equational reasoning is an implementation of the programming language haskell intended for educational purposes and supporting a language based on version 1. Received 5 june 1993 an equational approach to the synthesis of functional and logic program is taken.
Equational reasoning is one of the key features of pure functional languages such as haskell. The haskell equational reasoning modeltoimplementation tunnel hermit is a ghc plugin that allows posthoc transformations to be applied to haskell programs, after compilation has started. We introduce the new, improved version of the haskell equational reasoning assistant, which consists of an ajax application for rewriting haskell fragments in their context, and an api for scripting nontrivial rewrites. Advanced programming techniques for construction of robust, general and evolutionary programs progress in informatics, no. One of the appeals of pure functional programming is that it is so amenable to equational reasoning. We propose three extensions to patterns and pattern matching in haskell. In functional programming there is no need for a separate specification language and an external verification tool. Among these problems are the intuitionistic provability problem for the existential fragment of firstorder logic with equality, the intuitionistic provability problem for the prenex fragment of firstorder with equality, and the simultaneous. Equational reasoning about programs with general recursion and callbyvalue semantics garrinkimmell. Equational reasoning about programs with general recursion and. Two papers from the university of kansas functional programming group have been accepted for publication at haskell15. Gaeblogx arista networks, softwaredefined networking.
That is all great, and this page is not about repeating or elaborating on these things. Still, could it possibly be used to model software meant to be written in the functional programming paradigm. Oxford university computing laboratory programming research group. One of the problems of pure functional programming is that it rules out computational effects. Home about archives categories tags search equational reasoning. Inductive programming ip is a special area of automatic programming, covering research from artificial intelligence and programming, which addresses learning of typically declarative logic or functional and often recursive programs from incomplete specifications, such as inputoutput examples or constraints depending on the programming language used, there are several kinds of inductive. Pattern guards and transformational patterns microsoft.
Introducing the haskell equational reasoning assistant ku ittc. One possible method of supporting the verification process is a programming language that provides powerful abstraction mechanisms combined with intensive reuse. Functional conf 2016 equational reasoning from code to. Part of the problem is due to the lack of good programming language support. Be able to formally specify the syntax and semantics of programming languages. Beseme project software engineering through mathematics. Equational reasoning about objectoriented programs md. How functional programming mattered national science. The first, pattern guards, allows the guards of a guarded equation to match patterns and bind variables, as well as to test boolean condition. Equational reasoning consists in manipulating definitions in referentially transparent code as if.
Based on this observation we developed an equational programming system called cflp constraint functional logic programming system. Dependently typed programming languages provide a mechanism for integrating verification and programming by encoding invariants as types. Formal verification of software can be an enormous task. Symbolic computation 1993 15, 467494 deductive and inductive synthesis of equational programst nachum dershowitz and uday s. Monads as design patterns is equational reasoning overrated. To my mind, the phrase easy to reason about, refers to code that is easy to execute in your head. Functional programming and reactive architecture part 1. It can be used to prove that a piece of code is correct, has specific performance properties. Moggi and wadler showed how to get round this problem by using monads to encapsulate the effects, leading in essence to a phase. The steps in a typical derivation are mostly applications of equational reasoning.
This reasoning is embedded in a typed functional programming language and it is automatically done by a compiler. Equational logic was developed over the years beginning in the early 1980s by researchers in the formal development of programs, who felt a need for an effective style of manipulation, of calculation. Keywords liquid haskell, theorem proving, haskell, equa. Programs in the real world often accumulate technical debt code that is shaped more by its history than. Harrison department of computer science, university of missouri gerard allwein us naval research laboratory, washington, dc abstractthere is a semantic gap between the hardware. In functional programming, equational reasoning can be applied towards reasoning about the correctness of software. Equational reasoning for linking with firstclass primitive modules. The knowledge embodied in an equational theory can capture a wide variety of properties. Equational reasoning about programs with general recursion and callbyvalue semantics article pdf available january 2012 with 15 reads how we measure reads.
Agda norell2007 is a general theorem prover based on dependent type theory. In the year 2004 innovation of functional language scala. However, the basic process of computation is different in functional programming. The haskell equational reasoning modeltoimplementation tunnel. Guidriven equational reasoning theorem prover for unifying theories of programming andrewbutterfieldutp2. This fact brought some software engineers to claim that formal verification is not feasible in practice.
59 935 172 958 706 484 200 1499 820 522 242 633 856 1112 399 1317 821 774 1249 1167 342 1552 468 130 401 269 1402 1010 322 371 647 293 1318 557 1186 935