File size: 3,086 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import Mathlib.Combinatorics.Matroid.Closure
import Mathlib.Data.Finset.Powerset
import Mathlib.Data.Nat.Choose.Basic
import Mathlib.Order.Interval.Finset.Nat

namespace OAI

namespace MatroidProphet.MarkedPivots

open scoped BigOperators

abbrev Occurrences (r q : β„•) := Fin r βŠ• Fin q

def label {Ξ± : Type*} {r q : β„•} (old : Fin r β†’ Ξ±) (movable : Fin q β†’ Ξ±) :
    Occurrences r q β†’ Ξ± := Sum.elim old movable

def mark {r q : β„•} (oldMark : Fin r β†’ Bool) (movableMark : Fin q β†’ Bool) :
    Occurrences r q β†’ Bool := Sum.elim oldMark movableMark

def OldOrdered {r q : β„•} (time : Occurrences r q β†’ β„•) : Prop :=
  βˆ€ i j : Fin r, i < j β†’ time (Sum.inl i) < time (Sum.inl j)

/-- The label is first spanned at this occurrence, and not before it. -/
def FirstSpans {Ξ± : Type*} {r q : β„•} (M : Matroid Ξ±)
    (labels : Occurrences r q β†’ Ξ±) (time : Occurrences r q β†’ β„•)
    (e : Ξ±) (o : Occurrences r q) : Prop :=
  e ∈ M.closure (labels '' {p | time p ≀ time o}) ∧
    e βˆ‰ M.closure (labels '' {p | time p < time o})

/-- The finite set encodes precisely those test coordinates whose pivot has mark one. -/
def Records {Ξ± : Type*} {r q n : β„•} (M : Matroid Ξ±)
    (old : Fin r β†’ Ξ±) (movable : Fin q β†’ Ξ±) (test : Fin n β†’ Ξ±)
    (time : Occurrences r q β†’ β„•) (oldMark : Fin r β†’ Bool)
    (movableMark : Fin q β†’ Bool) (pattern : Finset (Fin n)) : Prop :=
  βˆ€ f, βˆƒ o, FirstSpans M (label old movable) time (test f) o ∧
    (mark oldMark movableMark o = true ↔ f ∈ pattern)

/-- All actual pivot-mark vectors over all interleavings and all movable marks. -/
noncomputable def patterns {Ξ± : Type*} {r q n : β„•} (M : Matroid Ξ±)
    (old : Fin r β†’ Ξ±) (movable : Fin q β†’ Ξ±) (test : Fin n β†’ Ξ±)
    (oldMark : Fin r β†’ Bool) : Finset (Finset (Fin n)) := by
  classical
  exact Finset.univ.filter fun pattern =>
    βˆƒ time : Occurrences r q β†’ β„•, OldOrdered time ∧ Function.Injective time ∧
      βˆƒ movableMark : Fin q β†’ Bool, Records M old movable test time oldMark movableMark pattern

/-- Full named source obligation, including well-definedness for every interleaving.
The test function is injective because the manuscript tests a set of `n` nonloops.
The conclusion actually remains true without that injectivity assumption. -/
def SourceContract.{u} : Prop :=
  βˆ€ {Ξ± : Type u} [Fintype Ξ±] (M : Matroid Ξ±) (r q n s : β„•)
    (old : Fin r β†’ Ξ±) (movable : Fin q β†’ Ξ±) (test : Fin n β†’ Ξ±)
    (oldMark : Fin r β†’ Bool),
    q ≀ s β†’ (βˆ€ i, old i ∈ M.E) β†’ (βˆ€ i, movable i ∈ M.E) β†’
    M.closure (Set.range old) = M.E β†’ Function.Injective test β†’
    (βˆ€ f, test f ∈ M.E ∧ test f βˆ‰ M.closure βˆ…) β†’
    (patterns M old movable test oldMark).card ≀
      4 ^ s * βˆ‘ k ∈ Finset.Iic s, n.choose k ∧
    βˆ€ (time : Occurrences r q β†’ β„•), OldOrdered time β†’ Function.Injective time β†’
      βˆ€ movableMark : Fin q β†’ Bool,
        βˆƒ! pattern, Records M old movable test time oldMark movableMark pattern

end MatroidProphet.MarkedPivots

end OAI