[comp.lang.misc] func & logic langs

psanders@btnix.UUCP (Chameleon) (03/10/88)

If we assume that the following definitions are valid:

1. Functional and logic language programs consist of assertions, and the 
computation proceeds by a process of deduction from these assertions.

1. In Functional programming the assertions consist of equations

2. In logic programming the assertions consist of material implications

3. For functional programming the subject of discourse is functions and for 
logic programming it is relations

then is functional programming a subclass of logic programming ?

From these definitions, I'd say they were, but from a purely practical view
I'd say they weren't.

Any views, definitive comments etc.?

Paul.

---
Paul Sanders.
E-mail (UUCP)	PSanders@axion.bt.co.uk (...!ukc!btnix!psanders)
Organisation	British Telecom Research Laboratories, Ipswich UK.

"This mime of mortal life, in which we are apportioned roles we misinterpret..."

csnjr@its63b.ed.ac.uk (Nick Rothwell) (03/11/88)

In article <698@btnix.UUCP> psanders@btnix.UUCP (Chameleon) writes:
>>If we assume that the following definitions are valid:
>
>1. Functional and logic language programs consist of assertions, and the 
>computation proceeds by a process of deduction from these assertions.

In a functional language, programs are built from a set of data
objects, some of which just happen to be functions, and can therefore
be applied to other objects...

>1. In Functional programming the assertions consist of equations

A function is a partial mapping from data objects to data objects. I view
the "equational" feature of functional languages as simply specifying
the domain of a function. An important point is that, since functions only
have to map from a domain (i.e. they aren't relations), you get higher-order
functions naturally (once you've decided on the semantics for environments
and closures) - you don't have to worry about the relational aspect.

>3. For functional programming the subject of discourse is functions and for 
>logic programming it is relations

As I said above - functional languages (I admit, I'm thinking of ML here...)
provide a variety of data objects, some of which happen to be functions.
Admittedly, interesting things can't happen unless you use functions...

>then is functional programming a subclass of logic programming ?

I think they have some things in common, but not very much, since there are
serious theoretical points concerning the features which make sense in
either domain (e.g. higher-order functions, negation, equality, decidability,
unification, backtracking, termination, ...).

>Paul Sanders.
>E-mail (UUCP)	PSanders@axion.bt.co.uk (...!ukc!btnix!psanders)
>Organisation	British Telecom Research Laboratories, Ipswich UK.


-- 
Nick Rothwell,	Laboratory for Foundations of Computer Science, Edinburgh.
		nick%lfcs.ed.ac.uk@nss.cs.ucl.ac.uk
		<Atlantic Ocean>!mcvax!ukc!lfcs!nick
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
...while the builders of the cages sleep with bullets, bars and stone,
they do not see your road to freedom that you build with flesh and bone.

shebs%defun.utah.edu.uucp@utah-cs.UUCP (Stanley T. Shebs) (03/14/88)

In article <698@btnix.UUCP> psanders@btnix.UUCP (Chameleon) writes:

>[...] is functional programming a subclass of logic programming ?

Yes, if "logic programing" includes higher-order predicates.

>[...] from a purely practical view I'd say they weren't.

My view is that this reflects our current state of ignorance in
implementing both functional and logic languages, not to mention
the existence of various religious camps that continually call each
other bad names.  Exercise for the reader: find five examples in
archival journals.  1/2 :-)

There has been a considerable amount of work recently on the
merging of functional and logical paradigms.  See "Logic Programming:
Functions, Relations, and Equation" eds. DeGroot and Lindstrom
(Prentice-Hall, 1986), and various papers in recent functional
programming and logic programming conferences (too many to cite
here).

						stan shebs
						shebs@cs.utah.edu