P′′
   HOME

TheInfoList



OR:

P′′ (P double prime) is a primitive computer
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
created by
Corrado Böhm Corrado Böhm (17 January 1923 – 23 October 2017) was a Professor Emeritus at the University of Rome "La Sapienza" and a computer scientist known especially for his contributions to the theory of structured programming, constructive mathemati ...
Böhm, C.: "On a family of Turing machines and the related programming language", ICC Bull. 3, 185-194, July 1964.Böhm, C. and Jacopini, G.: "Flow diagrams, Turing machines and languages with only two formation rules", CACM 9(5), 1966. (Note: This is the most-cited paper on the
structured program theorem The structured program theorem, also called the Böhm–Jacopini theorem, is a result in programming language theory. It states that a class of control-flow graphs (historically called flowcharts in this context) can compute any computable function ...
.)
in 1964 to describe a family of
Turing machine A Turing machine is a mathematical model of computation describing an abstract machine that manipulates symbols on a strip of tape according to a table of rules. Despite the model's simplicity, it is capable of implementing any computer algori ...
s.


Definition

\mathcal^ (hereinafter written P′′) is formally defined as a set of words on the four-instruction alphabet \, as follows:


Syntax

# R and \lambda are words in P′′. # If q_1 and q_2 are words in P′′, then q_1 q_2 is a word in P′′. # If q is a word in P′′, then (q) is a word in P′′. # Only words derivable from the previous three rules are words in P′′.


Semantics

* \ is the tape-alphabet of a
Turing machine A Turing machine is a mathematical model of computation describing an abstract machine that manipulates symbols on a strip of tape according to a table of rules. Despite the model's simplicity, it is capable of implementing any computer algori ...
with left-infinite tape, \Box being the ''blank'' symbol, equivalent to c_0. * All instructions in P′′ are
permutation In mathematics, a permutation of a set is, loosely speaking, an arrangement of its members into a sequence or linear order, or if the set is already ordered, a rearrangement of its elements. The word "permutation" also refers to the act or proc ...
s of the set X of all possible tape configurations; that is, all possible configurations of both the contents of the tape and the position of the tape-head. * \alpha is a
predicate Predicate or predication may refer to: * Predicate (grammar), in linguistics * Predication (philosophy) * several closely related uses in mathematics and formal logic: **Predicate (mathematical logic) **Propositional function **Finitary relation, o ...
saying that the current symbol is not \Box. It is not an instruction and is not used in programs, but is instead used to help define the language. * R means move the tape-head rightward one cell (if possible). * \lambda means replace the current symbol c_i with c_, and then move the tape-head leftward one cell. * q_1 q_2 means the
function composition In mathematics, function composition is an operation that takes two functions and , and produces a function such that . In this operation, the function is applied to the result of applying the function to . That is, the functions and ...
q_2 \circ q_1. In other words, the instruction q_1 is performed before q_2. * (q) means iterate q in a
while loop In most computer programming languages, a while loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. The ''while'' loop can be thought of as a repeating if statement. Overview The '' ...
, with the condition \alpha.


Relation to other programming languages

* P′′ was the first "
GOTO GoTo (goto, GOTO, GO TO or other case combinations, depending on the programming language) is a statement found in many computer programming languages. It performs a one-way transfer of control to another line of code; in contrast a function ca ...
-less" imperative
structured programming Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by making extensive use of the structured control flow constructs of selection ( if/then/else) and repetition ( ...
language to be proven
Turing-complete In computability theory, a system of data-manipulation rules (such as a computer's instruction set, a programming language, or a cellular automaton) is said to be Turing-complete or computationally universal if it can be used to simulate any Tur ...
* The
Brainfuck Brainfuck is an esoteric programming language created in 1993 by Urban Müller. Notable for its extreme minimalism, the language consists of only eight simple commands, a data pointer and an instruction pointer. While it is fully Turing com ...
language (apart from its I/O commands) is a minor informal variation of P′′. Böhm gives explicit P′′ programs for each of a set of basic functions sufficient to compute any
computable function Computable functions are the basic objects of study in computability theory. Computable functions are the formalized analogue of the intuitive notion of algorithms, in the sense that a function is computable if there exists an algorithm that can do ...
, using only (, ) and the four words r, r^\prime, L, R where r \equiv \lambda R, r^\prime \equiv r^n with r^n denoting the nth
iterate Iteration is the repetition of a process in order to generate a (possibly unbounded) sequence of outcomes. Each repetition of the process is a single iteration, and the outcome of each iteration is then the starting point of the next iteration. ...
of r, and L \equiv r^\prime \lambda. These are the equivalents of the six respective Brainfuck commands , , , , , . Note that since c_ \equiv c_0 \equiv \Box, incrementing the current symbol n times will wrap around so that the result is to "decrement" the symbol in the current cell by one (r^\prime).


Example program

Böhm gives the following program to compute the predecessor (''x''-1) of an integer ''x'' > 0: :R(R)L(r^\prime(L(L))r^\prime L)Rr which translates directly to the equivalent
Brainfuck Brainfuck is an esoteric programming language created in 1993 by Urban Müller. Notable for its extreme minimalism, the language consists of only eight simple commands, a data pointer and an instruction pointer. While it is fully Turing com ...
program: > ˆ’[<[<−<.html"_;"title="[<.html"_;"title="ˆ’[<[<">ˆ’[<[<−<">[<.html"_;"title="ˆ’[<[<">ˆ’[<[<−<+ The_program_expects_an_integer_to_be_represented_in_''bijective_numeration.html" ;"title=".html"_;"title="ˆ’[<[<">ˆ’[<[<−<.html" ;"title="[<.html" ;"title="ˆ’[<[<">ˆ’[<[<−<">[<.html" ;"title="ˆ’[<[<">ˆ’[<[<−<+ The program expects an integer to be represented in ''bijective numeration">bijective base-k'' notation, with c_1, c_2 \ldots, c_k encoding the digits 1, 2, \ldots, k respectively, and to have \Box before and after the digit-string. (E.g., in bijective base-2, the number eight would be encoded as \Box c_1 c_1 c_2 \Box, because 8 in bijective base-2 is 112.) At the beginning and end of the computation, the tape-head is on the \Box preceding the digit-string.


References


Weblinks


''P′′Online interpreter''
Demonstrating the iterative 99 Bottles of Beer song construed in 337568 P′′ instructions.
{{DEFAULTSORT:P Models of computation Academic programming languages Experimental programming languages