. - 3GL   - 4GL

- , . .

2.1.

, .
, : " ?"
: " - ?"

, , ,
. ,
. ,
, - ,
. - ,
.

, .

, , . . . , .

2.1.1.

.

, . , , . . .


(), - , . "" [ 1977]. . - (modus operand!) . .

2.1.2.

, ] , . - , , , .

. :

, - . .

2.1.3.

""- "", , . , , (. . 4.3). , , .

. ( ), : (. . 2.3.1), - .

, - , .

2.1.4.

""- "", (. . 6). - .

. , . :

2.1.5.

. . - (http://www.math.spbu.ru/user/tseytin/papers.html). [Hoare, Jifeng 1998].

2.1.6. ,

. .

2.2.

2.2.1.

- , . .

2.2.1.1. ,

- . (. . 6.2.1.1), , .

2.2.1.2.

- . (. . 1.7.3). - . .

2.2.1.3.

. , , ( - ) . - ( " -> ") .

, , .

- - , .

2.2.1.4.

. - , (, , , . .). - , , (, , , . .).


-. . , . , , , . : := " ", | "", * - " ( ) , ". , , .

, , :

<> ::= < > | < >
< > ::= < > | < > | < >
< > ::= < > | < > | < >
< > ::= <> := <>;
< > ::= < ( < >);
< > ::= return [ <> ];
< > ::= begin <>* end
< > ::= if <> then <>* ( elseif
<> then <>*)* [ else <>* ] end
< > ::= while <> do <>* end

, . , , . , , . .

- ( ). . .

, , . , . , , .

2.2.1.5.

, . , Plankalkuel ( plan calculus), 1945-1946 (Konrad Zuse).

, 50- - 70- XX , . 2.1. , 80- 90- . , .

2.2.1.6.

, - . . , . . (, ), , .

, , .

2.2.1.7.

. " . " [, 1991].

2.2.2. -

.
. " "

- - , , , .

2.2.2.1. ,

, ( ""). , - . , , ( ), , . - .

2.2.2.2.

- - . , .

- , . (. . 4.3.2.3).

- . .

2.2.2.3.

- , . , . .

( ). - , . -, , . , , , . .

2.2.2.4.

- . - , . . - , .

- , .


, - . 25 -.


- . . , (. . 1.7.1).

, . . , . , , , .

"" - :

Object :subclass Point :fields { x, };

Point :answer isnew :args { init_x, init_y } :body {

Integer :new x :value { init_x };

Integer :new :value { init_y )

Point :answer getx :args {} :body { ^ };

Point :answer gety :args {} :body { ^ };

Point :answer setx :args {new_x} :body { x :set new_x };

Point :answer sety :args {new_y} :body ( :set new_y };

Point :answer move :args {delta_x, delta_y} :body {

x :add delta_x

:add delta_y

};

Point, , , :

Point :new A :value (0, 0};

A :move [+2, -2};

...

. , , . . - .

, .

, - . , -. , . , . :

2.2.2.5. -

- , , , . - (. 2.2).

2.2.2.6.

. .

2.2.2.7.

- "- C++" [ 1998]. - " - . " [, , , 2001].

2.2.3.

, .
.

- , , - , , - .

2.2.3.1. ,

. -, 30- XX (Alonzo Church). Lisp, (John McCarthy) 50- XX [, 1986]. .

2.2.3.2.

- , , . , , . .

- , . .

- , , ( ). , , ( ) .

2.2.3.3.

. . , .

- .

2.2.3.4.

, , " -".

:

<> ::= < > | < >
< > ::= <> | <>
< > ::= <-> | <> | < > | <>
<-> ::= lambda <> -> <> end
<> ::= (<> <>)
< > ::= let (<> = <>;)* in
<> end
<> ::= if <> then <> (elseif <> then
<>)* else <> end

- , , , . . "". - - "" -. - , , , .

, - . , . .


, ( , , ) . f x ((f ) ).

- , - . "" (, ), (, ), . , - , , , , . - () .

, . , , - . , add = lambda x -> lambda -> + end end number -> number -> number, apply- any(X) .any(Y). (X->Y)->X->Y, any " " , Y .

" " "", , ( 2.1).

2.1.

let

map = fun

(f, [ ]) -> [];

(f, [head | tail]) -> [f(head) |map(f,tail)]

end fun;

square = fun

x -> multiply (x, x)

end fun

in

map(square, [1,2,3])

end let

( "" ), , . " " [, 1993] .

2.2.3.5.

- , , , , - . , , . . . , , . (, ) - , . . , . , .

. 2.3 . 70- - 80- XX . , - Haskell.

- . . 15 . (ML, Haskell) - , , , .

2.2.3.6.

, . , . , , , , .

2.2.3.7.

" " [, 1993] " . " [ 1983]. (Philip Wadler) (http://cm.bell-labs.com/cm/cs/who/wadler/guide.html).

2.2.4.

, , .
( )

, , .
.

- , , .

2.2.4.1. ,

60- XX , (Cordell Green) . (Alain Colmerauer) 1971 . . 80- XX , [ 1988].

2.2.4.2.

.

- .

2.2.4.3.

- .

2.2.4.4.

. . , " " - <= B1& ...& Bn. :

:- b1, ..., bn.

( ) "":

.

, . :

member(X, [|_]).

member(X, [_|T]) :-member(X, ).

: " , , ". - member.

Prolog- . , , . , . .

: " 2 [1,2,3]?" :

?- member(2, [1,2,3]).

Prolog- member, 2 [1,2,3]. . , member, 2 [2,3]. (. . 2 t2,3]), Prolog- :

yes ->

, , . "" ,

Prolog-. member 2, [2,3], , 2 [3]. 2 != 3, , , member(2, []). , member , Prolog- :

no.

Prolog- "" - -< , " , [1,2,3]?": J

?- member(X, [1,2,3]).

:

X=1 ->

=2 ->

=3 ->

.

"" : " , 1 ?":

?- member(1, X).

X = [1|_] ->

X = [_, 1|_] ->

X = [_, _, 1|_] ->

...

, , . Prolog- , 1, "" . "." member(1, X).

Prolog- . - , , , , . , f(x, 2) f(i, ), , Y - , : X=1, Y=2. f (X) . , , . , :- b, c. b . - modus ponens,

( & =>) => .

2.2.4.5.

, , . , . Prolog (. 2.4), .

2.2.4.6.

.

2.2.4.7.

" " [ 1988]. Prolog [, , , 1992].

2.2.5.

,
, .
, . " "

- , , . . , . . , , - .

2.2.5.1. ,

80- XX , , .

2.2.5.2.

, . .

2.2.5.3.

- .

2.2.5.4.

- V = {v[1], ..., v[n]}, () D = {D[1], ..., D[n]}, C = {[1], ..., C[m]}. , "" v[j], j=l..m v. - , C[j].

. , . - , Prolog. : " ". , :

? (X : integer) X>1, member(X, [1,2,3]).

, Prolog- , , 1. , , , , . :

=2 =3.

, . , : integer, x>2, <4 =. X, : integer, X*2=Y X: integer, Y mod 2 = 0.

"", . :

assume X>0.

when X+K10 ?

:

in (0..9).

, .

2.2.5.5.

, . . 80- XX (. 2.5).

, "make".

( ) . [, , 1988]. ( ), .

( 2.2).

2.2.

'

: (I1, I2, I3, U1, U2, U3, R1, R2, R3: ';

' U1 = I1 * R1;

' U2 = I2 * R2;

' U3 = I3 * R3;

' I1 + I2 + I3 = 0);

1:

R1 = 16, R2 = 32, R3 = 5,

U1 = 50, U2 = -28;

'

' 1 ' U3;

2.2.5.6.

- . , . .

2.2.5.7.

" ()" [, , 1988]. (Roman Bartak) (http://kti.mff.cuni.cz/~bartak/constraints/).

2.3.

2.3.1.

- , , , . .

, .

2.3.1.1. ,

. ( , ) [ 1978].

2.3.1.2.

- , . . (. . 1.7.3).

- , . (. . 4.3.4).

- . , . (. . 4.3.3).

2.3.1.3.

(, ) .

, , . , , . 2.1.

2.1. goto


goto

goto

() BLISS, PDL
goto Java, Modula-2
( goto) BASIC
, goto C, Ada

2.3.1.4.

. , , .

2.3.1.5.

"| " [ 1975]. " " [, , 1982]. " + = " [ 1985]. [ 1999].

2.4.

2.4.1.

- , .

2.4.1.1. ,

. , , , . . , (, ).

2.4.1.2.

- . (. . 7.2.2.1).

2.4.1.3.

. , . . , .

2.4.1.4.

. , .

, . , . , " ", " " . .

, , , . :

* - . . (, ). , :

<> ::= < > | <
< > ::= < > | < > | < >
< > ::= < > | < >
< > ::= < > << <>;
< > ::= < > >> <>;
< > ::= <, >
< > ::= seq <>* end
< > ::= par <>* end

, , . , , , . (, ). " ", , . , .

, , , .

2.4.1.5.

. .

. 2.6 , .

2.4.1.6.

. . , , (. . 7.2).

2.4.1.7.

: " " [ 1987] " " [ 1999].

2.4.2.
- , . , . , .
. " "

. :- b, . b , . , b - . - , , , . member (. . 2.2.4.4) , - . - , . , (, () :- (), ().), . ( ) .

2.4.2.1. Concurrent Prolog

Concurrent Prolog, . (Ehud Shapiro), [ 1988]. ( , ). - . , , . - . / , - , - .

Concurrent Prolog - . , - , - . : B1 2 ... Bn. .

Concurrent Prolog - . . - . Concurrent Prolog , . , , . . , .

, , , : () :- q(x, Y), (Y?). Y q r. . , . , , ( ) . , .

.