# Beginner questions

Sandy Harris sandy.harris at sympatico.ca
Mon Mar 15 16:17:01 AEDT 1999

```I'm interested in Mercury, but floundering a bit. So far
haven't installed or used it.

Some questions occur to me. Apologies if these are too
basic to be on this list:

1):
I've done no logic or functional programming at all. I'm
basically a C hacker, though I've had enough Scheme exposure
to have some understanding of backtracking, higher-order
functions, tail recursion, . . . Looking at your docs, I
feel a moderately urgent need to read an introductory
book on logic programming. There's a fair number of places
where you seem to asume the reader knows some basics, or
even is fairly familar with Prolog.

Can anyone recommend a book? A web site?

2):
>From the Reference manual section on Double Negation:

| after syntax analysis, and before mode analysis is performed,
| the implementation must delete any double negations and must
| replace any negations of conjunctions of negations with
| disjunctions.

Why don't you also replace negatations of dysjunctions of
negations with conjunctions? I think, using C notation with
& | ~ for AND OR NOT, we have two DeMorgan rules:

~(~a & ~b) = a | b
~(~a | ~b) = a & b

Why is one a requirement & not the other? Is it just that you
don't generate the second so you don't worry about it?

3):
My main application for Mercury would be as a tool for trying
to break ciphers. Write a program that takes a set of known
plaintext/ciphertext pairs encrypted under the same key, and
outputs the key.

This is clearly possible in principle, but the cipher designers
work hard to make it difficult in practice. The general form of
the problem is the NP-complete Boolean satisfaction problem,
but I'll be dealing only with specific finite-sized instances.

Is there are data available on how Mercury's resource demands
vary with problem size? I need to determine if my project is
utterly silly before I invest too much effort.

```