Pedantic comment: this encodes the rules from NHS England's website, which are presumably based on the English legislation. Each of the devolved legislatures have their own set of legislation, so this probably doesn't generalise to the entire UK.
Thank you. I love seeing what different languages choose as the meaning of their primary tokens. For example, Smalltalk uses whitespace to send messages, whereas Haskell uses whitespace to apply functions to arguments.
First of all it's hard to read, not least because you have your semocilons (semicola?) formatted inconsistently: some are at the end of a line, others at the start, so it's different to follow the program flow. More importantly, it's hard to see at a glance whether some "cases" are meant to backtrack on failure or not. Normally, if you wanted to write a Big Hairy, Horrible Case Statement in Prolog then you should at least use the control flow with ->/2 which amounts to a "soft cut" after the first <condition>:
But the recommended thing to make your code easier to read (_and debug_) and less like they do in Java is to use separate clauses to handle different "cases" of your program's logic.
Also, bad idea to interleave messages to user with "business logic" like you do, e.g. in:
lives_with_others(Person),
format(atom(LivingWithPeople), 'anyone living with ~w', Person),
It's possible with a bit of elbow grease to completely separate the I/O of communication with the user from the rules-based logic of your program.
There are actually coding guidelines for Prolog! Here:
I expected some kind of joke about really complex rules requiring an expert system to get right.
I am currently in France, in a kind-of-lockdown. Meaning we can go out in a 10km radius, or 30km, or within your department borders for some activities, but only during the day, with some exceptions. Generally, you need to write a paper where you write your reason for going out, but not during the day if you can show a proof of where you live. And I am not getting into which businesses are allowed to open...
Same in Belgium, where over winter the rules about whether you could see someone or not took into account your age, their age, whether you're indoors or outdoors, how many people you and they have seen that week, whether you are single, whether it's Christmas Eve, what time it is and whether you need assisted care.
Oh, and the rules are different if you want to use their bathroom.
That said, you don’t seem to have looked up what test to release actually is. It’s a scheme for travellers to get out of quarantine early. So no, we aren’t ‘all’ captive to ‘test to release’—we (inhabitants of the UK) are captive to many other regulations though!