Documentation

ExistentialRules.ChaseSequence.TriggerList

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 #

@[reducible, inline]
abbrev FiniteTriggerList {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] (obs : ObsolescenceCondition sig) (rules : RuleSet sig) :
Type (max (max u_3 u_2) u_1)

A finite list of origins (as you would expect).

Equations
Instances For
    def FiniteTriggerList.result {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} (start : FactSet sig) :
    FiniteTriggerList obs rules → FactSet sig

    The fact set resulting from applying all triggers from the list one after the other to an initial fact set.

    Equations
    Instances For
      @[simp]
      theorem FiniteTriggerList.result_nil {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} {start : FactSet sig} :
      result start [] = start

      For the empty trigger list, the result is the staring fact set.

      @[simp]
      theorem FiniteTriggerList.result_cons {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} {start : FactSet sig} {hd : ChaseNodeOrigin obs rules} {tl : FiniteTriggerList obs rules} :

      This unfolds the result definition for cons trigger lists.

      @[simp]
      theorem FiniteTriggerList.result_singleton {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} {start : FactSet sig} {orig : ChaseNodeOrigin obs rules} :

      The result of a singleton FiniteTriggerList is the exactly the triggers result (plus the starting facts).

      @[simp]
      theorem FiniteTriggerList.result_append {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} {start : FactSet sig} {l1 l2 : FiniteTriggerList obs rules} :
      result start (l1 ++ l2) = result (result start l1) l2

      The result of an appended FiniteTriggerList can be obtained by computing the result of the second on top of the first's result.

      theorem FiniteTriggerList.start_sub_result {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} {start : FactSet sig} {l : FiniteTriggerList obs rules} :
      start ⊆ result start l

      The result contains the starting fact set.

      theorem FiniteTriggerList.each_trg_result_sub_result {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} {start : FactSet sig} {l : FiniteTriggerList obs rules} (orig : ChaseNodeOrigin obs rules) :

      The result contains each trigger's result.

      def FiniteTriggerList.trigger_property_holds {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} (property : ChaseNodeOrigin obs rules → FactSet sig → Prop) (start : FactSet sig) :
      FiniteTriggerList obs rules → Prop

      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
      Instances For
        theorem FiniteTriggerList.trigger_property_holds_iff {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} {property : ChaseNodeOrigin obs rules → FactSet sig → Prop} {start : FactSet sig} {l : FiniteTriggerList obs rules} :
        trigger_property_holds property start l ↔ ∀ {i : Nat} (lt : i < List.length l), property l[i] (result start (List.take i l))

        We can express trigger_property_holds in terms of list indices.

        def FiniteTriggerList.loaded {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} (start : FactSet sig) (l : FiniteTriggerList obs rules) :

        A trigger list is called loaded if each trigger is loaded with respect to the result of the previous one.

        Equations
        Instances For
          def FiniteTriggerList.active {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} (start : FactSet sig) (l : FiniteTriggerList obs rules) :

          A trigger list is called active if each trigger is active with respect to the result of the previous one.

          Equations
          Instances For
            @[reducible, inline]
            abbrev FiniteNonEmptyTriggerList {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] (obs : ObsolescenceCondition sig) (rules : RuleSet sig) :
            Type (max (max u_3 u_2) u_1)
            Equations
            Instances For

              Infinite Trigger Lists #

              @[reducible, inline]
              abbrev InfiniteTriggerList {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] (obs : ObsolescenceCondition sig) (rules : RuleSet sig) :
              Type (max (max u_3 u_2) u_1)

              A infinite list of origins.

              Equations
              Instances For
                def InfiniteTriggerList.factSet_at {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} (l : InfiniteTriggerList obs rules) (start : FactSet sig) (i : Nat) :

                The fact set at index $i$ is exactly the result of the finite trigger list up until $i$.

                Equations
                Instances For
                  @[simp]
                  theorem InfiniteTriggerList.factSet_at_zero {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} {l : InfiniteTriggerList obs rules} {start : FactSet sig} :
                  l.factSet_at start 0 = start

                  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.

                  def InfiniteTriggerList.to_chaseNode_list {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} (l : InfiniteTriggerList obs rules) (start : FactSet sig) :

                  We can turn the list of triggers into a list of ChaseNodes.

                  Equations
                  Instances For
                    @[simp]
                    theorem InfiniteTriggerList.facts_get_to_ChaseNode_list {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} {l : InfiniteTriggerList obs rules} {start : FactSet sig} {i : Nat} :
                    ((l.to_chaseNode_list start).get i).facts = l.factSet_at start i

                    For to_chaseNode_list, the facts at index i are exactly factSet_at index i.

                    @[simp]

                    For to_chaseNode_list, the origin at index zero is always none.

                    @[simp]

                    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
                    Instances For
                      theorem InfiniteTriggerList.suffix_of_to_regularChaseDerivationSkeleton_implies {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {rules : RuleSet sig} {os : ObsolescenceCondition sig} {l : InfiniteTriggerList os rules} {start : FactSet sig} (cd2 : ChaseDerivationSkeleton (RegularChaseNode os rules) os rules) :
                      cd2 <:+ l.to_regularChaseDerivationSkeleton start → ∃ (i : Nat), cd2.head.facts = l.factSet_at start i ∧ ∀ (next : RegularChaseNode os rules), next ∈ cd2.next → next.facts = l.factSet_at start i.succ ∧ next.origin = some (InfiniteList.get l i)

                      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.

                      def InfiniteTriggerList.trigger_property_holds {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} (property : ChaseNodeOrigin obs rules → FactSet sig → Prop) (start : FactSet sig) (l : InfiniteTriggerList obs rules) :

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

                        def InfiniteTriggerList.loaded {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} (start : FactSet sig) (l : InfiniteTriggerList obs rules) :

                        A trigger list is called loaded if each trigger is loaded with respect to the result of the previous one.

                        Equations
                        Instances For
                          def InfiniteTriggerList.active {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} (start : FactSet sig) (l : InfiniteTriggerList obs rules) :

                          A trigger list is called active if each trigger is active with respect to the result of the previous one.

                          Equations
                          Instances For

                            Constructing an InfiniteTriggerList from an InfiniteList of FiniteTriggerLists #

                            def InfiniteTriggerList.startForFiniteList {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] {obs : ObsolescenceCondition sig} {rules : RuleSet sig} (ls : InfiniteList (FiniteNonEmptyTriggerList obs rules)) (start : FactSet sig) :
                            Nat → FactSet sig

                            For a infinite list of FiniteNonEmptyTriggerList, we can compute the starting fact set for each of the finite lists inductively.

                            Equations
                            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.