Is Prologue's time complexity better than naive brute force?

Is the time complexity of solving something in the (better) Prolog better than implementing the highest bulkhead in the opposite direction?

I speak the Prolog language in general ... I wonder if there is any known algorithm for this, for example, to make "do Prolog" using call / cc return traffic on the Scheme, a bad choice.

EDIT: "permitting anything," I mean all Prolog programs. "Question in question": I wonder about language design: if the full sequel has some practical utility over partial sequels (the main advantages are Prolog-esque, but which are not serious if they cannot compete in time complexity with Prolog) and also if another language can completely absorb Prolog or if optimizations are possible that restrict programs to Prolog forms (similar optimizations are possible in Fortran over C).

EDIT: by temporal complexity, I meant big O, i.e. pruning that could not naively mimic Prolog in a common language.

+4
source share
5 answers

, .

: . , , , , Prolog. , Prolog , , , , . , Prolog ( , Prolog) .

, Prolog , - . - . : .

, , , (1) (2) Prolog . .

: , ? , .

Prolog : . .

+8

, -, , Prolog . , append/3:

append([H|A],B,[H|R]) :-
    append(A,B,R).
append([],L,L).

, -, , . .

, Prolog, , .

+3

, Prolog- Scheme, , Prolog Prolog?

. , , Prolog, , , Prolog. ? Prolog Prolog, . @CommuSoft append/3, Prolog Prolog. . , Prolog , , .

Prolog . , , C Scheme, , , , Scheme ML. , .

, , Scheme: , , . , Prolog, miniKanren, . .

@ahuemmer C Prolog , , . C , . - , Prolog , , . , C, , Prolog. .

, .

+2

Pure Prolog ( "cut" ) : " ". , Prolog . , , , - , .

, .

Prolog , .

+2

, . , , ( "" ) Prolog , e. . C.

, , Prolog (, ), , .

In the end, each programming language ends with the creation of machine code that runs on your CPU to (hopefully) solve your problem. The same machine code can also be issued by other languages ​​or more or less directly by a programmer. Thus, Prolog is a good way to solve some problems, but it may not be the best / quick / only alternative.

0
source

Source: https://habr.com/ru/post/1621496/


All Articles