Download e-book for iPad: A Practical Theory of Programming by Eric C.R. Hehner

By Eric C.R. Hehner

ISBN-10: 0387941061

ISBN-13: 9780387941066

ISBN-10: 3540941061

ISBN-13: 9783540941064

There are a number of theories of programming. the 1st usable idea, referred to as ''Hoare's Logic'', continues to be essentially the most widely recognized. In it, a specification is a couple of predicates: a precondition and postcondition (these and all technical phrases might be outlined in due course). one other renowned and heavily similar thought via Dijkstra makes use of the weakest precondition predicate transformer, that is a functionality from courses and postconditions to preconditions. lones's Vienna improvement approach has been used to virtue in a few industries; in it, a specification is a couple of predicates (as in Hoare's Logic), however the moment predicate is a relation. Temporal good judgment is yet one more formalism that introduces a few distinct operators and quantifiers to explain a few features of computation. the idea during this e-book is easier than any of these simply pointed out. In it, a specification is simply a boolean expression. Refinement is simply usual implication. This thought can be extra normal than these simply pointed out, making use of to either terminating and nonterminating computation, to either sequential and parallel computation, to either stand-alone and interactive computation. And it comprises time bounds, either for set of rules category and for tightly restricted real-time purposes

Show description

Read Online or Download A Practical Theory of Programming PDF

Best programming languages books

Download e-book for iPad: Computers & art by Stuart Mealing

Desktops and Art presents insightful views at the use of the pc as a device for artists. The ways taken fluctuate from its historic, philosophical and functional implications to using laptop know-how in artwork perform. The participants comprise an paintings critic, an educator, a practicing artist and a researcher.

Herbert Schildt's C# 3.0: A Beginner's Guide (Beginner's Guide (Osborne PDF

Crucial Skills--Made effortless! enable grasp programmer and bestselling writer Herb Schildt train you the basics of C#, Microsoft's most effective programming language for the . internet Framework. you are going to commence through studying to create, bring together, and run a C# software. Then it truly is directly to info varieties, operators, regulate statements, equipment, periods, and items.

Extra resources for A Practical Theory of Programming

Sample text

E D ⇐ F. A E ⇐ y:= 2×y. x:= 5 F ⇐ x:= x–1. y:= 7 You can reduce the number of refinements by applying the Stepwise Refinement Law. A ⇐ if x=0 then (y:= 1. x:= 3) else (x:= x–1. y:= 7. A. y:= 2×y. x:= 5) You can translate this into a programming language that is available on a computer near you. For example, in C it becomes int x, y; void A (void) {if (x==0) {y = 1; x = 3;} else {x = x–1; y = 7; A ( ); y = 2*y; x = 5;}} You can then test it on a variety of x values. For example, execution of x = 5; A ( ); printf ("%i", y); will print 32 .

If S and R are specifications, then S∧R is a specification that is satisfied by any computation that satisfies both S and R . Similarly, S∨R is a specification that is satisfied by any computation that satisfies either S or R . Similarly, ¬S is a specification that is satisfied by any computation that does not satisfy S . A particularly useful operator is if b then S else R where b is a boolean expression of the initial state; it can be implemented by a computer that evaluates b , and then, depending on the value of b , behaves according to either S or R .

45 4 Program Theory When a compiler translates a program into machine language, it treats each refined specification as just an identifier. For example, the summation program looks like A ⇐ s:= 0. n:= 0. B B ⇐ if n=#L then C else D C ⇐ ok D ⇐ s:= s+Ln. n:= n+1. B to a compiler. Using the Law of Refinement by Steps, a compiler can compile the calls to C and D in-line (macro-expansion) creating B ⇐ if n=#L then ok else (s:= s+Ln. n:= n+1. B) So, for the sake of efficient execution, there is no need for us to put the pieces together, and we needn't worry about the number of refinements we use.

Download PDF sample

A Practical Theory of Programming by Eric C.R. Hehner

by Jeff

Rated 4.47 of 5 – based on 38 votes