Structured program theorem

Structured program theorem

The structured program theorem is a result in programming language theory. It states that every computable function can be implemented in a programming language that combines subprograms in only three specific ways. These three control structures are
#Executing one subprogram, and then another subprogram (sequence)
#Executing one of two subprograms according to the value of a boolean variable (selection)
#Executing a subprogram until a boolean variable is true (iteration)Computer scientists usually credit the theorem to a 1966 paper by Corrado Böhm and Giuseppe Jacopini. However, David Harel traced its origins to the 1946 description of the von Neumann architecture and Stephen Kleene's normal form theorem.

The Böhm-Jacopini proof describes how to construct a structured flow chart from an arbitrary chart, using the bits in an extra integer variable to keep track of information that the original program represents by the program location. This construction was based on Böhm's programming language P′′. The Böhm-Jacopini proof did not settle the question of whether to adopt structured programming for software development, partly because the construction was more likely to obscure a program than to improve it. On the contrary, it signalled the beginning of the debate. Edsger Dijkstra's notorious letter, "Go To Statement Considered Harmful," followed in 1968. Subsequent proofs of the theorem addressed practical shortcomings of the Böhm-Jacopini proof with constructions that maintained or improved the clarity of the original program. [http://www.cse.buffalo.edu/~rapaport/111F04/greatidea3.html]

In the 1980s IBM researcher Harlan Mills oversaw the development of the COBOL Structuring Facility, which applied a structuring algorithm to COBOL code. Mills's transformation involved the following steps for each procedure.

#Identify the basic blocks in the procedure.
#Assign a unique label to each block's entry path, and label each block's exit paths with the labels of the entry paths they connect to. Use 0 for return from the procedure and 1 for the procedure's entry path.
#Break the procedure into its basic blocks.
#For each block that is the destination of only one exit path, reconnect that block to that exit path.
#Declare a new variable in the procedure (called L for reference).
#On each remaining unconnected exit path, add a statement that sets L to the label value on that path.
#Combine the resulting programs into a selection statement that executes the program with the entry path label indicated by L
#Construct a loop that executes this selection statement as long as L is not 0.
#Construct a sequence that initializes L to 1 and executes the loop.

Note that this construction can be improved by converting some cases of the selection statement into subprocedures.

ee also

*Structured programming

References

*cite journal|last=Ashcroft|first=Edward|coauthors=and Zohar Manna|year=1971|title=The translation of go to programs to 'while' programs|journal=Proceedings of IFIP Congress
*cite journal|last=Bohm|first=Corrado|coauthors=and Giuseppe Jacopini|date=May 1966|title=Flow Diagrams, Turing Machines and Languages with Only Two Formation Rules|journal=Communications of the ACM|volume=9|issue=5|pages=366–371|doi=10.1145/355592.365646
*cite journal|last=Harel|first=David|year=1980|title=On Folk Theorems|journal=Communications of the ACM|volume=23|issue=7|pages=379–389|doi=10.1145/358886.358892
*cite journal|last=Dijkstra|first=Edsger|year=1968|title=Go To Statement Considered Harmful|journal=Communications of the ACM|volume=11|issue=3|pages=147–148|doi=10.1145/362929.362947 http://www.acm.org/classics/oct95/


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Structured programming — can be seen as a subset or subdiscipline of procedural programming, one of the major programming paradigms. It is most famous for removing or reducing reliance on the GOTO statement.Historically, several different structuring techniques or… …   Wikipedia

  • Structure theorem — may refer to: * Structured program theorem, a result in programming language theory * Structure theorem for finitely generated modules over a principal ideal domain, a result in abstract algebra (a subject area in mathematics) …   Wikipedia

  • goto — This article is about the programming statement. For other uses, see Goto (disambiguation). goto is a statement found in many computer programming languages. It is a combination of the English words go and to. It performs a one way transfer of… …   Wikipedia

  • Turing completeness — For the usage of this term in the theory of relative computability by oracle machines, see Turing reduction. In computability theory, a system of data manipulation rules (such as an instruction set, a programming language, or a cellular… …   Wikipedia

  • Control flow — Not to be confused with Flow control. In computer science, control flow (or alternatively, flow of control) refers to the order in which the individual statements, instructions, or function calls of an imperative or a declarative program are… …   Wikipedia

  • Control table — This simple control table directs program flow according to the value of the single input variable. Each table entry holds a possible input value to be tested for equality (implied) and a relevant subroutine to perform in the action column. The… …   Wikipedia

  • List of theorems — This is a list of theorems, by Wikipedia page. See also *list of fundamental theorems *list of lemmas *list of conjectures *list of inequalities *list of mathematical proofs *list of misnamed theorems *Existence theorem *Classification of finite… …   Wikipedia

  • List of mathematics articles (S) — NOTOC S S duality S matrix S plane S transform S unit S.O.S. Mathematics SA subgroup Saccheri quadrilateral Sacks spiral Sacred geometry Saddle node bifurcation Saddle point Saddle surface Sadleirian Professor of Pure Mathematics Safe prime Safe… …   Wikipedia

  • P′′ — is a primitive computer programming language created by Corrado Böhm[1][2] in 1964 to describe a family of Turing machines. Contents 1 Definition 1.1 Syntax …   Wikipedia

  • Algorithm — Flow chart of an algorithm (Euclid s algorithm) for calculating the greatest common divisor (g.c.d.) of two numbers a and b in locations named A and B. The algorithm proceeds by successive subtractions in two loops: IF the test B ≤ A yields yes… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”