Obsoleteness (Conditions) #
For the chase, we need to be able to define when a trigger should not be applied even though it might be loaded.
In such a case (even when not loaded), we say that the trigger is "obsolete".
We make this decision based on a given PreTrigger and a FactSet.
Different chase variants use different notions of obsoleteness.
For example the restricted (aka. standard) chase says that a trigger is obsolete when it is satisfied.
On the other hand, the Skolem chase says that a trigger is obsolete when its excat result is already present.
We aim to capture both of these notions and everything in-between using a generic ObsoletenessCondition
that conveys the necessary properties.
The condition itself is a function taking a PreTrigger and a FactSet returning a Prop indicating if the trigger is obsolete for the fact set or not.
Then, we require 4 conditions:
- The condition is subset monotone. That is, if a trigger is obsolete for a fact set, it is also obsolete for all supersets.
- If a trigger is obsolete then it is also satisfied.
- If the exact trigger result already occurs in the fact set, then the trigger is obsolete.
- Equivalent triggers are obsolete on exactly the same fact sets.
RestrictedObsoleteness and SkolemObsoleteness are the two extremes of what is allowed according to these conditions, SkolemObsoleteness being the most liberal and RestrictedObsoleteness being, quite expectedly, the most restricted.
LaxObsoletenessCondition is a more liberal version of ObsoletenessCondition enforcing only subset monotonicity (i.e. condition 1 above). We use such a more liberal condition for MFA later. For the most part, you can completely ignore that this exists and only consider ObsoletenessConditions instead.
- cond : PreTrigger sig → FactSet sig → Prop
Instances For
An ObsoletenessCondition is a function from PreTrigger and FactSet into Prop with the 4 conditions mentioned above.
- cond : PreTrigger sig → FactSet sig → Prop
- cond_implies_trg_is_satisfied {trg : PreTrigger sig} {fs : FactSet sig} : self.cond trg fs → trg.satisfied fs
- contains_trg_result_implies_cond {trg : PreTrigger sig} {fs : Set (Fact sig)} (disj_index : Fin trg.mapped_head.length) : trg.mapped_head[↑disj_index].toSet ⊆ fs → self.cond trg fs
Instances For
Equations
- instCoeObsoletenessConditionLaxObsoletenessCondition = { coe := fun (obs : ObsoletenessCondition sig) => { cond := obs.cond, monotone := ⋯ } }
SpecificConditions #
We briefly define the ObsoletenessConditions for Skolem and restricted chase to show that these indeed have the 4 necessary properties. However, most definitions are still expressed in terms of the generic ObsoletenessCondition so the specific ones are rarely used throughout the code; only when results indeed do not hold for the generic case but only specific obsoleteness conditions.
Obsoleteness for the Skolem chase is indeed a ObsoletenessCondition, i.e. it has all 4 properties. According to this condition, a trigger is obsolete if its exact result, for one of the head disjuncts, already occurs in the fact set.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Obsoleteness for the restricted chase is indeed a ObsoletenessCondition, i.e. it has all 4 properties. According to this condition, a trigger is obsolete if it is satisfied.
Equations
- One or more equations did not get rendered due to their size.
Instances For
(Proper) Triggers #
A Trigger is a PreTrigger that has a fixed obsoleteness condition.
We say that a Trigger is active if it is loaded and not obsolete.
SkolemTrigger and RestrictedTrigger are just defined as examples.
- subs : GroundSubstitution sig
Instances For
Equations
- SkolemTrigger = Trigger { cond := (SkolemObsoleteness sig).cond, monotone := ⋯ }
Instances For
Equations
- RestrictedTrigger = Trigger { cond := (RestrictedObsoleteness sig).cond, monotone := ⋯ }
Instances For
Equations
- instCoeOutTriggerPreTrigger = { coe := fun (trigger : Trigger obs) => trigger.toPreTrigger }