today i have talk with other friend ,he said he has logic programming skill , so I am very curious about that.
I would take that statement to mean, "I can program if
/then
/else
statements". Or in other words, I would take that statement to mean, "I can't program with any real technology". I would not be impressed.
The wikipedia entry explains it well: while on the surface it seems a redundant terms since all programming uses logic, in practice it's term for a well-defined paradigm, like, say, "functional programming" and "object-oriented programming". Specifically,
logic programming, in the narrower sense in which it is more commonly understood, is the use of logic as both a declarative and procedural representation language. It is based upon the fact that a backwards reasoning theorem-prover applied to declarative sentences in the form of implications:
If B1 and … and Bn then H
treats the implications as goal-reduction procedures:
to show/solve H, show/solve B1 and … and Bn.
The language Prolog
(in some variant or other) is probably still the most popular logic programming language.
I'd usually understand it to mean using prolog. Prolog allows you to define predicates, and truth values. The prolog interpreter can then derive further "truths", using standard logic rules. For example, each of the following lines establish a father_child
and mother_children
relationship between the first and the second parameter (the people mentioned are from the Simpsons).
member(X, [X|_]).
member(X, [_|T]) :- member(X,T).
mother_children(marge, [bart, lisa, maggie]).
mother_children(mona, [homer, jay]).
mother_child(X, Y) :- mother_children(X, C), member(Y, C).
father_child(homer, bart).
father_child(homer, lisa).
father_child(homer, maggie).
father_child(abe, homer).
father_child(abe, herb).
father_child(abe, abbie).
sibling(X, Y) :- parent_child(Z, X), parent_child(Z, Y).
parent_child(X, Y) :- father_child(X, Y).
parent_child(X, Y) :- mother_child(X, Y).
If you fire this program into a prolog interpreter, and then ask it sibling(X,Y)
, it will return to you all the pairs of siblings that exist. What's interesting is that we never explicit say that say, Bart is a sibling to Lisa. We just define father and mother relationships, but by defining further rules, prolog uses normal rules to derive what names fullfill the sibling
rule.
Prolog was more popular in the 80s, in various AI systems and the like. It's a bit out of fashion these days (not that you'd know in universities, where it's still hot shit).