24.11.2014 Views

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8. Run-Time Interpretation of KSL 110<br />

Interpretation of KSL Sentences<br />

Under the normal Prolog interpretation of relation calls, arguments are<br />

treated as fixed objects which can only pattern-match with each other. This<br />

interpretation is used wherever a $ symbol appears in a KSL program.<br />

Under the <strong>flex</strong> interpretation of relation calls, however, arguments are<br />

dereferenced immediately before the call is made. Furthermore, KSL objects<br />

can be dereferenced to alternative values. For example, the construct<br />

or([E 1<br />

,…,E k<br />

]) dereferences to some E i<br />

where 1•i•k .<br />

This interpretation means that backtracking can take place not only over<br />

relation calls, but also over the dereferencing mechanism itself. For example,<br />

consider the following call to the built-in predicate member/2.<br />

member( X, [ 123, or([a,b,c]) ] ) .<br />

Under a Prolog interpretation the possible solutions are<br />

X = 123<br />

X = or([a,b,c]) .<br />

But under a <strong>flex</strong> interpretation there are 6 possible solutions :<br />

X = 123<br />

X = 123<br />

X = 123<br />

X = a<br />

X = b<br />

X = c<br />

This is because the <strong>flex</strong> dereferencing mechanism generates three possible<br />

Prolog goals from the original <strong>flex</strong> goal, namely:<br />

member( X , [123,a] ) .<br />

member( X , [123,b] ) .<br />

member( X , [123,c] ) .<br />

Each of these yields two solutions for X.<br />

<strong>flex</strong> toolkit

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!