Download lean/OAI/Combinatorics/IndependentSets/Expansion/PreprocessingPaddingTables.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
theorempaddedGraph_reverse_equiv (table : Table n d) (h : n ≤ m)
(e : (Fin n ⊕ Fin (m - n)) ×Fin d) :
(paddedGraph table h).reverse (dartEquiv h e) =
dartEquiv h ((sumGraph table m).reverse e) :=by
proof · 3
lines
change dartEquiv h ((sumGraph table m).reverse
((dartEquiv h).symm (dartEquiv h e))) = _
rw [Equiv.symm_apply_apply]
theorempaddedGraph_accepts_equiv (table : Table n d) (h : n ≤ m)
(e : (Fin n ⊕ Fin (m - n)) ×Fin d) (a b : Label) :
(paddedGraph table h).accepts (dartEquiv h e) a b =
(sumGraph table m).accepts e a b :=by
proof · 2
lines
change (sumGraph table m).accepts ((dartEquiv h).symm (dartEquiv h e)) a b = _
rw [Equiv.symm_apply_apply]
@[simp]theoremaccepts_pad (table : Table n d) (h : n ≤ m)
(e : Fin m ×Fin d) (a b : Label) :
accepts (pad table h) e a b = (paddedGraph table h).accepts e a b :=by
theorempad_valid (table : Table n d) (h : n ≤ m) :
Function.Involutive (rotation (pad table h)) ∧∀ e a b, accepts (pad table h) (rotation (pad table h) e) b a =
accepts (pad table h) e a b :=
theoremrotation_pad_equiv (table : Table n d) (h : n ≤ m)
(v : Fin n ⊕ Fin (m - n)) (p : Fin d) :
rotation (pad table h) (vertexEquiv h v, p) =
(vertexEquiv h ((sumGraph table m).reverse (v, p)).1,
((sumGraph table m).reverse (v, p)).2) :=by
proof · 2
lines
rw [rotation_pad]
exact paddedGraph_reverse_equiv table h (v, p)
@[simp]theoremrotation_pad_new (table : Table n d) (h : n ≤ m)
(v : Fin (m - n)) (p : Fin d) :
rotation (pad table h) (vertexEquiv h (Sum.inr v), p) =
(vertexEquiv h (Sum.inr v), p) :=by
proof · 2
lines
simpa only [sumGraph, VertexPadding.pad_reverse_inr] using
rotation_pad_equiv table h (Sum.inr v) p
@[simp]theoremaccepts_pad_old (table : Table n d) (h : n ≤ m)
(v : Fin n) (p : Fin d) (a b : Label) :
accepts (pad table h) (v.castLE h, p) a b = accepts table (v, p) a b :=by
proof · 2
lines
rw [accepts_pad]
exact paddedGraph_accepts_equiv table h (Sum.inl v, p) a b
@[simp]theoremaccepts_pad_new (table : Table n d) (h : n ≤ m)
(v : Fin (m - n)) (p : Fin d) (a b : Label) :
accepts (pad table h) (vertexEquiv h (Sum.inr v), p) a b = true:=by
proof · 2
lines
rw [accepts_pad]
exact paddedGraph_accepts_equiv table h (Sum.inr v, p) a b
theoremreverseIndex_pad_old (table : Table n d) (h : n ≤ m)
(v : Fin n) (p : Fin d) :
(pad table h).reverseIndex[rowIndex m d (v.castLE h, p)] =
rowIndex m d ((rotation table (v, p)).1.castLE h, (rotation table (v, p)).2) :=by
theoremreverseIndex_pad_new (table : Table n d) (h : n ≤ m)
(v : Fin (m - n)) (p : Fin d) :
(pad table h).reverseIndex[rowIndex m d (vertexEquiv h (Sum.inr v), p)] =
rowIndex m d (vertexEquiv h (Sum.inr v), p) :=by
theoremrelation_ext {r s : GraphTables.RelationTable}
(h : ∀ a b, GraphTables.relationAt r a b = GraphTables.relationAt s a b) : r = s :=by
proof · 6
lines
apply Vector.ext
intro i hi
simpa only [GraphTables.relationAt, Prod.eta, Equiv.apply_symm_apply,
Fin.getElem_fin] using
h (GraphTables.relationIndex.symm ⟨i, hi⟩).1
(GraphTables.relationIndex.symm ⟨i, hi⟩).2
theoremrelations_pad_old (table : Table n d) (h : n ≤ m)
(v : Fin n) (p : Fin d) :
(pad table h).relations[rowIndex m d (v.castLE h, p)] =
table.relations[rowIndex n d (v, p)] :=by
proof · 3
lines
apply relation_ext
intro a b
exact accepts_pad_old table h v p a b
theoremrelations_pad_new (table : Table n d) (h : n ≤ m)
(v : Fin (m - n)) (p : Fin d) :
(pad table h).relations[rowIndex m d (vertexEquiv h (Sum.inr v), p)] =
Vector.replicate 4096true:=by
proof · 5
lines
apply relation_ext
intro a b
simpa only [PortTables.accepts, GraphTables.relationAt, Fin.getElem_fin,
Vector.getElem_replicate] using
accepts_pad_new table h v p a b
theorempaddedGraph_edgeSatisfied_equiv (table : Table n d) (h : n ≤ m)
(labeling : Fin m →Label) (e : (Fin n ⊕ Fin (m - n)) ×Fin d) :
(paddedGraph table h).edgeSatisfied labeling (dartEquiv h e) =
(sumGraph table m).edgeSatisfied (fun v => labeling (vertexEquiv h v)) e :=by
proof · 8
lines
change (sumGraph table m).accepts ((dartEquiv h).symm (dartEquiv h e))
(labeling (dartEquiv h e).1)
(labeling (dartEquiv h ((sumGraph table m).reverse
((dartEquiv h).symm (dartEquiv h e)))).1) =
(sumGraph table m).accepts e (labeling (vertexEquiv h e.1))
(labeling (vertexEquiv h ((sumGraph table m).reverse e).1))
simp only [Equiv.symm_apply_apply]
rfl
theoremedgeSatisfied_pad_equiv (table : Table n d) (h : n ≤ m)
(labeling : Fin m →Label) (e : (Fin n ⊕ Fin (m - n)) ×Fin d) :
(baseGraph (pad table h)).edgeSatisfied labeling (dartEquiv h e) =
(sumGraph table m).edgeSatisfied (fun v => labeling (vertexEquiv h v)) e :=by
proof · 2
lines
rw [baseGraph_pad]
exact paddedGraph_edgeSatisfied_equiv table h labeling e
@[simp]theoremedgeSatisfied_pad_old (table : Table n d) (h : n ≤ m)
(labeling : Fin m →Label) (v : Fin n) (p : Fin d) :
(baseGraph (pad table h)).edgeSatisfied labeling (v.castLE h, p) =
(baseGraph table).edgeSatisfied (fun v => labeling (v.castLE h)) (v, p) :=by
proof · 3
lines
simpa only [dartEquiv_apply, vertexEquiv_inl, sumGraph,
VertexPadding.edgeSatisfied_inl (baseGraph table) rfl] using
edgeSatisfied_pad_equiv table h labeling (Sum.inl v, p)
@[simp]theoremedgeSatisfied_pad_new (table : Table n d) (h : n ≤ m)
(labeling : Fin m →Label) (v : Fin (m - n)) (p : Fin d) :
(baseGraph (pad table h)).edgeSatisfied labeling (vertexEquiv h (Sum.inr v), p) = true:=by
proof · 2
lines
simpa only [dartEquiv_apply, sumGraph, VertexPadding.edgeSatisfied_inr] using
edgeSatisfied_pad_equiv table h labeling (Sum.inr v, p)
theorempad_labeling_satisfies_iff (table : Table n d) (h : n ≤ m)
(labeling : Fin m →Label) :
(∀ e, (baseGraph (pad table h)).edgeSatisfied labeling e = true) ↔∀ e, (baseGraph table).edgeSatisfied (fun v => labeling (v.castLE h)) e = true:=by
proof · 10
lines
constructor
· intro hs e
simpa only [edgeSatisfied_pad_old] using hs (e.1.castLE h, e.2)
· intro hs e
obtain ⟨v, hv⟩ := (vertexEquiv h).surjective e.1havehe : e = (vertexEquiv h v, e.2) :=Prod.ext hv.symm rfl
rw [he]
cases v with
| inl v => simpa only [vertexEquiv_inl, edgeSatisfied_pad_old] using hs (v, e.2)
| inr v => exact edgeSatisfied_pad_new table h labeling v e.2