Documentation

CslibFrontier.Algorithms.Lean.EdgeCSP.Forest.Terminal

Partial scans and terminal forest graphs #

Lemma 34 of [KKR18], arXiv:1602.03124v6, printed pp. 15–16, including a scan before saturation and the graph obtained by pruning every outgoing arc of the terminal copy. Certificates below are derived from the executable scan and run. They impose no even-delta-matroid assumption: incidence uniqueness, the old scans' saturation, and validity of the reference labeling suffice.

Main results #

theorem Cslib.Logic.PL.CSP.Forest.Log.sameParent_of_mem_outgoing {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] {es : Log F} (hn : es.children.Nodup) {o : F.Occurrence} (ho : o ∈ es.outgoing) :

With unique discovery variables, every outgoing port identifies its actual parent. The original constraint position, rather than the timestamp, is tested in step 4b.

theorem Cslib.Logic.PL.CSP.Forest.Grown.not_partner_of_unused {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] {sem : Rel → List Bool → Bool} {f : F.OccurrenceLabeling Bool} {rs : List V} {es : Log F} (hg : Grown sem f rs es) (hF : F.EdgeInstance) {a : DAG.Arc F} (ha : a ∈ es.arcs) (hi : a.incoming = true) {b : F.Occurrence} (hu : b ∉ es.used) (hc : a.occurrence.fst = b.fst) :

A fresh port cannot be a feasible partner of an older incoming port. Saturation of the older scan, including step-4b skips, is the essential reason.

structure Cslib.Logic.PL.CSP.Forest.Partial {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] (sem : Rel → List Bool → Bool) (f : F.OccurrenceLabeling Bool) (rs : List V) (es : Log F) (e : Expansion F) :

Local facts about the current expansion before its scan is complete. In contrast to Grown, no saturation condition on the current copy is asserted.

Instances For
    theorem Cslib.Logic.PL.CSP.Forest.Partial.port_unused {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] {sem : Rel → List Bool → Bool} {f : F.OccurrenceLabeling Bool} {rs : List V} {es : Log F} {e : Expansion F} (h : Partial sem f rs es e) {o : F.Occurrence} (ho : o = e.input ∨ o ∈ e.outputs) :
    o ∉ es.used

    The new ports of a partial expansion are all unused in the older log.

    theorem Cslib.Logic.PL.CSP.Forest.Partial.used_nodup {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] {sem : Rel → List Bool → Bool} {f : F.OccurrenceLabeling Bool} {rs : List V} {es : Log F} {e : Expansion F} (h : Partial sem f rs es e) :
    (Log.used (e :: es)).Nodup

    Partial scans preserve uniqueness of used positional incidences.

    theorem Cslib.Logic.PL.CSP.Forest.Partial.children_nodup {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] {sem : Rel → List Bool → Bool} {f : F.OccurrenceLabeling Bool} {rs : List V} {es : Log F} {e : Expansion F} (h : Partial sem f rs es e) :

    Partial scans preserve unique discovery variables.

    theorem Cslib.Logic.PL.CSP.Forest.Partial.isFDAG {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] {sem : Rel → List Bool → Bool} {f : F.OccurrenceLabeling Bool} {rs : List V} {es : Log F} {e : Expansion F} (h : Partial sem f rs es e) (hF : F.EdgeInstance) (hf : ValidLabeling sem f) :
    DAG.IsFDAG sem f (Log.toDAG rs (e :: es))

    Every partial scan satisfies all six f-DAG conditions. The current copy need not yet be saturated, and the local relations need not be even delta-matroids.

    theorem Cslib.Logic.PL.CSP.Forest.scan_isFDAG {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] {sem : Rel → List Bool → Bool} {f : F.OccurrenceLabeling Bool} (hF : F.EdgeInstance) (hf : ValidLabeling sem f) {rs : List V} {es : Log F} (hg : Grown sem f rs es) {input : F.Occurrence} (hv : Log.Visited rs es input.var) (hu : input ∉ es.used) (bs : List F.Occurrence) (hb : bs ⊆ partners sem f input) :
    DAG.IsFDAG sem f (Log.toDAG rs ({ input := input, outputs := (scan rs es input [] bs).outputs } :: es))

    Lemma 34 during an actual scan, including every scanned prefix of the candidate list. The scan may have continued or stopped at its first meeting.

    theorem Cslib.Logic.PL.CSP.Forest.scan_meeting_spec {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] (rs : List V) (es : Log F) (input : F.Occurrence) (bs os : List F.Occurrence) {out : List F.Occurrence} {b : F.Occurrence} (hs : scan rs es input os bs = ScanResult.meeting out b) :
    b ∈ bs ∧ Log.Visited rs ({ input := input, outputs := out } :: es) b.var ∧ ¬Log.SameParent ({ input := input, outputs := out } :: es) b.var input.fst

    Exact stopping conditions at the first meeting of an actual scan.

    structure Cslib.Logic.PL.CSP.Forest.Meeting.Trace {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] (sem : Rel → List Bool → Bool) (f : F.OccurrenceLabeling Bool) (m : Meeting F) :

    Local execution evidence for a terminal record. No graph invariant or event-correctness conclusion is a field; these facts follow from the actual partner scan.

    Instances For
      theorem Cslib.Logic.PL.CSP.Forest.Meeting.Trace.old_visited {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] {sem : Rel → List Bool → Bool} {f : F.OccurrenceLabeling Bool} {m : Meeting F} (h : Trace sem f m) :

      A terminal partner cannot be a child just inserted at the current copy: its predecessor would have this original constraint position, triggering source step 4b.

      theorem Cslib.Logic.PL.CSP.Forest.Meeting.Trace.output_unused {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] {sem : Rel → List Bool → Bool} {f : F.OccurrenceLabeling Bool} {m : Meeting F} (h : Trace sem f m) :
      m.output ∉ m.older.used

      The second incoming port is fresh even if its variable was visited long ago. Old outgoing ports trigger step 4b; old incoming ports contradict saturation and current-input freshness.

      theorem Cslib.Logic.PL.CSP.Forest.Meeting.Trace.pruned_arcs {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] {sem : Rel → List Bool → Bool} {f : F.OccurrenceLabeling Bool} {m : Meeting F} (h : Trace sem f m) :
      m.prunedDAG.arcs = insert { occurrence := m.output, time := List.length m.older, incoming := true } (insert { occurrence := m.current.input, time := List.length m.older, incoming := true } m.older.arcs.toFinset)

      After pruning, exactly the two incoming arcs remain at the terminal copy. All older arcs survive, and the supported variables include the pruned, now isolated children.

      theorem Cslib.Logic.PL.CSP.Forest.Meeting.Trace.pruned_isFDAG {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] {sem : Rel → List Bool → Bool} {f : F.OccurrenceLabeling Bool} {m : Meeting F} (h : Trace sem f m) (hF : F.EdgeInstance) (hf : ValidLabeling sem f) :

      The terminal graph of Lemma 34's moreover clause is an f-DAG. This proves the claim for the executable pruning operation, including its retained isolated child support.

      def Cslib.Logic.PL.CSP.Forest.Result.Events {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} (P : Meeting F → Prop) :
      Result F → Prop

      A property of every terminal event, vacuous for exhaustion.

      Instances For
        theorem Cslib.Logic.PL.CSP.Forest.run_trace {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] (sem : Rel → List Bool → Bool) (f : F.OccurrenceLabeling Bool) (hF : F.EdgeInstance) (es : Log F) (remaining : List F.Occurrence) (hg : Grown sem f (roots f) es) (hu : ∀ o ∈ remaining, o ∉ es.used) :
        Result.Events (Meeting.Trace sem f) (run sem f (roots f) es remaining)

        Execution derives terminal scan evidence, independently of graph and event correctness.

        theorem Cslib.Logic.PL.CSP.Forest.search_trace {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] (sem : Rel → List Bool → Bool) (f : F.OccurrenceLabeling Bool) (hF : F.EdgeInstance) :

        Every terminal event in a fresh run has evidence obtained from its real scans.

        theorem Cslib.Logic.PL.CSP.Forest.search_terminal_isFDAG {Rel : Type u_1} {V : Type u_2} {F : CSP Rel V} [DecidableEq V] (sem : Rel → List Bool → Bool) (f : F.OccurrenceLabeling Bool) (hF : F.EdgeInstance) (hf : ValidLabeling sem f) :
        Result.Events (fun (m : Meeting F) => DAG.IsFDAG sem f m.toDAG ∧ DAG.IsFDAG sem f m.prunedDAG) (search sem f)

        Lemma 34 for both terminal graphs actually returned by a fresh search. No event or forest-correctness premise and no even-delta-matroid hypothesis is required.