Documentation

CslibFrontier.Logics.Propositional.CSP.Occurrence.FlatMap

Literal occurrence positions in concatenated CSP bodies #

Each occurrence in a selected body keeps its argument position and shifts its constraint position by the actual preceding body lengths. Empty bodies and duplicate constraints are retained. This is positional list mathematics, with no equality assumption on variable names.

def Cslib.Logic.PL.CSP.flatMapOccurrence {α : Type u_1} {Rel V : Type} (l : List α) (f : α → CSP Rel V) (i : Fin l.length) (o : (f l[↑i]).Occurrence) :

Place one body's occurrence at its literal position in a flat-mapped CSP.

theorem Cslib.Logic.PL.CSP.flatMapOccurrence_constraint {α : Type u_1} {Rel V : Type} (l : List α) (f : α → CSP Rel V) (i : Fin l.length) (o : (f l[↑i]).Occurrence) :
↑(flatMapOccurrence l f i o).fst = (List.flatMap f (List.take (↑i) l)).length + ↑o.fst

The copied occurrence's actual constraint position includes precisely the preceding listed bodies, with no deduplication or offset determined by a variable name.

theorem Cslib.Logic.PL.CSP.flatMapOccurrence_argument {α : Type u_1} {Rel V : Type} (l : List α) (f : α → CSP Rel V) (i : Fin l.length) (o : (f l[↑i]).Occurrence) :
↑(flatMapOccurrence l f i o).snd = ↑o.snd

The original ordered argument position is unchanged by concatenating bodies.

theorem Cslib.Logic.PL.CSP.var_flatMapOccurrence {α : Type u_1} {Rel V : Type} (l : List α) (f : α → CSP Rel V) (i : Fin l.length) (o : (f l[↑i]).Occurrence) :

The target getter reads the original variable at the actual local occurrence.

theorem Cslib.Logic.PL.CSP.flatMapOccurrence_injective {α : Type u_1} {Rel V : Type} (l : List α) (f : α → CSP Rel V) :
Function.Injective fun (p : (i : Fin l.length) × (f l[↑i]).Occurrence) => flatMapOccurrence l f p.fst p.snd

Distinct copy/local positions remain distinct occurrences, even when constraints and all their variable names coincide.

theorem Cslib.Logic.PL.CSP.exists_flatMapOccurrence {α : Type u_1} {Rel V : Type} (l : List α) (f : α → CSP Rel V) (o : Occurrence (List.flatMap f l)) :
∃ (i : Fin l.length) (p : (f l[↑i]).Occurrence), flatMapOccurrence l f i p = o

Every flat occurrence belongs to one actual source body, including in the presence of arbitrary empty bodies between the selected positions.