IBiS company

Legislation and Logic Programming


Legislation is a set of instructions to apply, deductions which may pertain or definitions which are true in particular circumstances. Essentially, it is a series of rules to be applied when appropriate.

The rules can apply to instructions, deductions, or definitions as follows:

instructions

if this applies then do that,

deductions

if this applies then so does this,

definitions

if this applies then it is one of these.


Why are rules suited to Logic Programming ?

The essence of logic is that it is necessarily rule based. Logic programming is also rule based; thus all functionality within a  program is similarly rule based.

There are two main forms of implementation :

backward chaining - proving the truth of a premise depending upon the conditions.
forward chaining - validating all conditions to deduce what may also be true.


Why is complexity well handled in Logic Programming?

Programs in Logic Programming are 'described' top down. This enables complex concepts to be broken down to as many detailed sub-concepts as is necessary to ‘describe’ the problem. This in turn enables us to add further sub-concepts as the problem expands or becomes better understood.


A Legislation Based System - The NHS Pension Scheme

In the NHS Pension Scheme, there are Practitioners (doctors and dentists) and Officers - (all other employees). Doctors are sometimes employed in positions other than as doctors - as Officers.

In some circumstances their service can be converted to Practitioner service. The following extract from the legislation explains this:

Where a practitioner is entitled to reckon less than a year of contributing service otherwise than as a practitioner and where an officer with previous service as a practitioner has less than one year of employment reckonable as service otherwise than as a practitioner, such service otherwise than as a practitioner shall, except where regulation 72 applies, be treated as service as a practitioner


Most of this can be represented in a flex rule (which will 'run' in the application) as follows:

rule officer_service
if the applicant`s title is principal_practitioner
and the applicant`s reckonable_non_practitioner_service is less than 365
and regulation_72_does_not_apply
then the applicant`s nominal_practitioner_service becomes the applicant`s practitioner_service plus the applicant`s non_practitioner_service .

red italics denote frames
red bold plain text are the attributes of the frames.
bold black text denotes system words,
normal black text are values (of the attributes of the frames)
black italic denotes a routine defined elsewhere.