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:
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 :
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: