• No results found

P r oof-T heoretic Sem antics o f the Integrated Logical and Functional Program m ing Language LFPL

z i A oTïd eit her

4.6 P r oof-T heoretic Sem antics o f the Integrated Logical and Functional Program m ing Language LFPL

This section defines the semantics of a programming language that integrates logic and func­ tional programming called LFPL. This language may be seen as a language that extends HOPLP with simple definitions (i.e. abbreviations for terms of simple type) and some forms of definitions of dependent type, namely definitions asserting logical properties of functions.

We require the language LFPL to satisfy the following constraints:

1. goals and programs in LFPL should be interpretable as goals and programs in HOPLP; 2. the language LFPL should be conservative w.r.t. HOPLP, i.e. if a goal is achievable w.r.t.

a program in LFPL then the interpretation of the goal into HOPLP should be achievable w.r.t. the interpretation of the program into HOPLP; roughly, there should be no more goals achievable w.r.t. a program in LFPL than there are in HOPLP;

3. the language LFPL should be complete for the means of goal-achievement in HOPLP, i.e., given a goal G and a program E; A in LFPL, for every means of achieving the inter­ pretation of G w.r.t. the interpretation of E; A in HOPLP, there should be a means of achieving G w.r.t. E; A in LFPL.

The semantics of LFPL is defined below by means of the calculus H H ^ ^ f.

D efinition 4.4 A program in LFPL is a pair (E, A), usually written S; A, where S is a signa­ ture and A is a -context; a program E; A is well-formed iff the judgement h E; A basis is derivable in .

A goal in LFPL is a G -formula; G is well-formed w.r.t, a program E; A the judgement

E; A h G igr/ is derivable in .

A goal G is achievable w.r.t. a program E; A iff there exists a proof-term e s.t. the sequent

E; A =r>- e : G is derivable in ; the proof-term e is called a witness for the achievement of G w.r.t E; A.

In Section 3.2, in the context of first-order logic programming, it is argued that a semantics for a logic programming language needs to define what are the different means of goal-achievement. So, in order to complete the definition of LFPL , we must define, given a goal G and a program E; A, what are the different means for the achievement of G w.r.t. E; A.

First is shown that LFPL , as defined so far, meets some of the requirements mentioned above; this is shown by using results presented in Sec. 4.5 relating the calculi H H and H H ^^^.

T h eo rem 4.8 Let E; A o well-formed program in LFPL. Then:

(2) if G is well-formed w.r.t. S; A in LFPL then [V’(A)]G is a well-formed goal w.r.t. the program E; N('^(A)) in HOPLP.

P roof;

(1) By Lemma 4.8, there is a derivation of h E; ^(A ) in HH^^^ . Using arguments similar to those used in proving Lemmas 4.1 and 4.2, that show how to transform a JEf/üT-basis into a

HH-hsiSis, one may show that h E;N(^(A)) basis is derivable in H H .

(2) As above, by using Lemma 4.8, a HH^^^ -derivation of E; ^(A ) h G may be obtained, and from such derivation it may be shown that E h [^(A)]G is derivable in H H .

Theorem 4.8 shows an interpretation of goals and programs in LFPL as goals and programs in HOPLP, respectively; thus, constraint 1 imposed on the language LFPL is satisfied.

T h eo rem 4.9 Let G be achievable w.r.t. E; A in LFPL. Then, [i^(A)]G is achievable w.r.t.

E;N(^(A)) in HOPLP.

P roof; If G is achievable w.r.t. E; A in LFPL then there exists a proof-term e s.t. the sequent E; A e : G is derivable in H H ^^^. So, by Corollary 4.1, the sequent

E;K(^(A)) => cwi([V>(A)]t/(A, e)) : [^(A)]G

is derivable in H H . Thus, cu£([‘0(A)]t/(A, e)) is a witness for the achievement of [^(A)]G w.r.t.

E;X(^(A)) in HOPLP. □

The proof of Theorem 4.9 shows how to interpret witnesses in LFPL as witnesses in HOPLP. Given a witness e for the achievement of G w.r.t. E; A in LFPL, cut(["^(A)]i/(A, e)) is a witness for the achievement of [■0(A)]G w.r.t. E;I^(^(A)) in HOPLP. For the remainder of this thesis, this interpretation of witnesses is taken as the standard interpretation of witnesses in LFPL as witnesses in HOPLP. Theorem 4.9 shows that constraint 2 imposed on the language LFPL is satisfied.

By Corollary 4.2, if e is a witness for the achievement of [V>(A)]G w.r.t. E; K('0(A)) in HOPLP then there exists a witness for the achievement of G w.r.t. E; A in LFPL; thus showing that constraint 3 imposed on LFPL is satisfied, i.e. LFPL is complete for witnesses w.r.t. HOPLP. However, constraint 3 is satisfied in an excessive way, since, under the standard interpretation, several witnesses in LFPL may be interpreted as the same witness of a complete set of witnesses in HOPLP.

Recall that a complete set of witnesses for goal-achievement in HOPLP is a maximal set w.r.t. the conditions: its members are uniform linear focused witnesses of the goal w.r.t. the program and no two members of the set are A-convertible. Recall also that the notation ulf{e)

stands for the uniform linear focused form of e. Below we define the concepts of complete and

any complete and non-redundant set of witnesses for the achievement of G w.r.t. E; A in LFPL is in 1-1 correspondence with any complete set of witnesses for the achievement of [^(A)]G w.r.t. E;R(^(A)) in HOPLP.

D efinition 4.5 Let E; A h G <7/ be derivable in LFPL.

A set S of witnesses for the achievement of G w.r.t. E; A is complete iff for every uniform linear focused proof-term s.t. E; N(^(A)) => cw/ : ['^(A)]G is derivable in H H there exists a witness e in S s.t. E; A e : G is derivable in H H ^^^ and ulf{cut{[ilj{A)]u{A, e))) = e^if.

A set S of witnesses for the achievement of G w.r.t. E; A is non-redundant iff there are no two witnesses eI, e2 in S s.t. ui/(cut(['0(A)]i/(A, ei))) w//(cuf([^(A)]t/(A, 62))).

D efinition 4.6 An implementation of LFPL is any method that given a goal G well-formed w.r.t. a program E; A in LFPL finds a complete set of witnesses for the achievement of G w.r.t.

E; A in LFPL; it is called excessive if the complete set of witnesses is redundant.

The relation between HOPLP and LFPL may be described as follows. Suppose there is a problem that may be formulated as a LFPL program and goal. Such problem could also be formulated in HOPLP, since there is an interpretation of LFPL by means of HOPLP. However, the problem in LFPL may have a more natural formulation, since there are definition mechan­ isms provided in LFPL that are not provided in HOPLP. Having the problem formulated both in LFPL and HOPLP the forms of achieving the goal w.r.t. the program in both languages may be very different. In HOPLP, only the canonical form of reasoning, corresponding to uniform linear focused derivations, is allowed for goal-achievement. In LFPL other forms of reasoning are allowed, namely those corresponding to cut rules. These forms of reasoning are interpretable into the canonical form of reasoning, but often the canonical forms correspond to much longer derivations.