Expressing Chase Sequences through Lists of Triggers #
The triggers of a chase structure usually convey enough information to reconstruct the involved fact sets
when given an initial one.
Also, especially when constructing sequences it might be easier to only list the triggers instead of also
constructing the fact sets manually.
Therefore, we dedicate this file to a few auxiliary definitions and results to capture finite and
infinite lists of triggers (origins actually) that can be used to describe chase sequences.
As of now, we only relate these to RegularChaseDerivations.
Finite Trigger Lists #
A finite list of origins (as you would expect).
Equations
- FiniteTriggerList obs rules = List (ChaseNodeOrigin obs rules)
Instances For
The fact set resulting from applying all triggers from the list one after the other to an initial fact set.
Equations
- FiniteTriggerList.result start [] = start
- FiniteTriggerList.result start (hd :: tl) = FiniteTriggerList.result (start ∪ CustomBasicDatastructures.List.toSet hd.result) tl
Instances For
For the empty trigger list, the result is the staring fact set.
This unfolds the result definition for cons trigger lists.
The result of a singleton FiniteTriggerList is the exactly the triggers result (plus the starting facts).
The result of an appended FiniteTriggerList can be obtained by computing the result of the second on top of the first's result.
The result contains the starting fact set.
The result contains each trigger's result.
A trigger property holds for the list if it holds for each trigger with respect to the previous trigger result. (With property we mean things like loaded, active, and obsolete.)
Equations
- One or more equations did not get rendered due to their size.
- FiniteTriggerList.trigger_property_holds property start [] = True
Instances For
We can express trigger_property_holds in terms of list indices.
A trigger list is called loaded if each trigger is loaded with respect to the result of the previous one.
Equations
- FiniteTriggerList.loaded start l = FiniteTriggerList.trigger_property_holds (fun (orig : ChaseNodeOrigin obs rules) => orig.fst.val.loaded) start l
Instances For
A trigger list is called active if each trigger is active with respect to the result of the previous one.
Equations
- FiniteTriggerList.active start l = FiniteTriggerList.trigger_property_holds (fun (orig : ChaseNodeOrigin obs rules) => orig.fst.val.active) start l
Instances For
Equations
- FiniteNonEmptyTriggerList obs rules = CustomBasicDatastructures.NonEmptyList (ChaseNodeOrigin obs rules)
Instances For
Infinite Trigger Lists #
A infinite list of origins.
Equations
- InfiniteTriggerList obs rules = InfiniteList (ChaseNodeOrigin obs rules)
Instances For
The fact set at index $i$ is exactly the result of the finite trigger list up until $i$.
Equations
- l.factSet_at start i = FiniteTriggerList.result start (InfiniteList.take l i)
Instances For
The fact set at index 0 is the starting fact set.
The fact set at index i.succ results from taking the one at index i and addint the result of the trigger at index i.
The fact set at index i.succ results from computing the factSet_at i for the tail when taking the first result as the start.
We can turn the list of triggers into a list of ChaseNodes.
Equations
- l.to_chaseNode_list start Nat.zero = { facts := start, origin := none, facts_contain_origin_result := ⋯ }
- l.to_chaseNode_list start i.succ = { facts := l.factSet_at start i.succ, origin := some (InfiniteList.get l i), facts_contain_origin_result := ⋯ }
Instances For
For to_chaseNode_list, the facts at index i are exactly factSet_at index i.
For to_chaseNode_list, the origin at index zero is always none.
For to_chaseNode_list, the origin at index i.succ is exactly the list element at index i.
Each InfiniteTriggerList can be turned into a RegularChaseDerivationSkeleton via to_chaseNode_list.
Equations
- l.to_regularChaseDerivationSkeleton start = { branch := PossiblyInfiniteList.from_infiniteList (l.to_chaseNode_list start), isSome_head := ⋯, triggers_exist := ⋯ }
Instances For
For any suffix of the derivation generated by to_regularChaseDerivationSkeleton, there is an index such that the head corresponds exactly to the result of the infinite trigger list at that index and the next element features the trigger at this index. This is an auxiliary theorem used in mainly in the CyclicityPrefix construction.
A trigger property holds for the list if it holds for each trigger with respect to the previous trigger result. (With property we mean things like loaded, active, and obsolete.)
Equations
- InfiniteTriggerList.trigger_property_holds property start l = ∀ (i : Nat), property (InfiniteList.get l i) (l.factSet_at start i)
Instances For
Checking a trigger property can be done by splitting off the head, checking the property on it and then checking the property for the tail of the list.
A trigger list is called loaded if each trigger is loaded with respect to the result of the previous one.
Equations
- InfiniteTriggerList.loaded start l = InfiniteTriggerList.trigger_property_holds (fun (orig : ChaseNodeOrigin obs rules) => orig.fst.val.loaded) start l
Instances For
A trigger list is called active if each trigger is active with respect to the result of the previous one.
Equations
- InfiniteTriggerList.active start l = InfiniteTriggerList.trigger_property_holds (fun (orig : ChaseNodeOrigin obs rules) => orig.fst.val.active) start l
Instances For
Constructing an InfiniteTriggerList from an InfiniteList of FiniteTriggerLists #
We convert an infinite list of FiniteNonEmptyTriggerLists into an InfiniteTriggerList by calling InfiniteList.fromNonEmptyLists.
Equations
Instances For
For a infinite list of FiniteNonEmptyTriggerList, we can compute the starting fact set for each of the finite lists inductively.
Equations
- InfiniteTriggerList.startForFiniteList ls start Nat.zero = start
- InfiniteTriggerList.startForFiniteList ls start n.succ = FiniteTriggerList.result (InfiniteTriggerList.startForFiniteList ls start n) (CustomBasicDatastructures.NonEmptyList.toList (ls.get n))
Instances For
The startForFiniteList can equivalently be expressed by combining finitely many of the finite lists into one and then using FiniteTriggerList.result.
If a trigger property holds for each each trigger in each finite list in an infinite list of FiniteNonEmptyTriggerLists,
then the same property holds for the infinite list that we obtain through fromFiniteLists.
By fromFiniteLists_trigger_property_preserved, trigger loadedness is preserved by the fromFiniteLists construction.
By fromFiniteLists_trigger_property_preserved, trigger activeness is preserved by the fromFiniteLists construction.