Download lean/OAI/Combinatorics/IndependentSets/Expansion/PreprocessingOverlayTables.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
defmaterialize {n d : Nat} {D : Type*}
(G : ConstraintGraph (Fin n) (Fin n ×D) PortTables.Label)
(ports : D ≃ Fin d) : PortTables.Table n d :=
body · 10
lines
PortTables.ofPortGraph
(GraphTransport.reindex (Overlay.originalPortGraph G) (Equiv.refl _) ports)
(fun x a b =>G.accepts (x.1, ports.symm x.2) a b)
(by
intro x a b
simp only [GraphTransport.reindex, Overlay.originalPortGraph,
Equiv.trans_apply, Equiv.prodCongr_apply, Equiv.prodCongr_symm,
Equiv.refl_apply, Equiv.symm_apply_apply, Prod.map]
convert G.reverse_accepts (x.1, ports.symm x.2) a b using1
rfl)
@[simp]theoremaccepts_materialize {n d : Nat} {D : Type*}
(G : ConstraintGraph (Fin n) (Fin n ×D) PortTables.Label)
(ports : D ≃ Fin d) (x : Fin n ×Fin d) (a b : PortTables.Label) :
PortTables.accepts (materialize G ports) x a b =
G.accepts (x.1, ports.symm x.2) a b :=by
theoremconstraintGraph_ext {VEA : Type*} {GH : ConstraintGraphVEA}
(hreverse : ∀ e, G.reverse e = H.reverse e)
(htail : ∀ e, G.tail e = H.tail e)
(haccepts : ∀ e a b, G.accepts e a b = H.accepts e a b) : G = H:=by
proof · 9
lines
rcases Gwith ⟨r, hi, t, p, hp⟩
rcases Hwith ⟨r', hi', t', p', hp'⟩
havehr : r = r' :=Equiv.ext hreverse
cases hr
haveht : t = t' := funext htail
cases ht
haveha : p = p' := funext fun e => funext fun a => funext fun b => haccepts e a b
cases ha
rfl
theoremoverlay_rotation_old {n d e : Nat} (G : PortTables.Table n d)
(H : ExpanderTables.Table n e) (v : Fin n) (i : Fin d) :
PortTables.rotation (overlay GH) (v, overlayPorts d e (Sum.inl i)) =
((PortTables.rotation G (v, i)).1,
overlayPorts d e (Sum.inl (PortTables.rotation G (v, i)).2)) :=by
proof · 1
line
exact rotation_materialize_image _ _ v (Sum.inl i)
theoremoverlay_rotation_expander {n d e : Nat} (G : PortTables.Table n d)
(H : ExpanderTables.Table n e) (v : Fin n) (i : Fin e) :
PortTables.rotation (overlay GH) (v, overlayPorts d e (Sum.inr i)) =
((ExpanderTables.lookup H (v, i)).1,
overlayPorts d e (Sum.inr (ExpanderTables.lookup H (v, i)).2)) :=by
proof · 1
line
exact rotation_materialize_image _ _ v (Sum.inr i)
@[simp]theoremoverlay_accepts_old {n d e : Nat} (G : PortTables.Table n d)
(H : ExpanderTables.Table n e) (v : Fin n) (i : Fin d) (a b : PortTables.Label) :
PortTables.accepts (overlay GH) (v, overlayPorts d e (Sum.inl i)) a b =
PortTables.accepts G (v, i) a b :=by
proof · 2
lines
simp only [overlay, accepts_materialize, Equiv.symm_apply_apply]
rfl
@[simp]theoremoverlay_accepts_expander {n d e : Nat} (G : PortTables.Table n d)
(H : ExpanderTables.Table n e) (v : Fin n) (i : Fin e) (a b : PortTables.Label) :
PortTables.accepts (overlay GH) (v, overlayPorts d e (Sum.inr i)) a b = true:=by
proof · 2
lines
simp only [overlay, accepts_materialize, Equiv.symm_apply_apply]
rfl
theoremlazy_rotation_false {n d : Nat} (G : PortTables.Table n d)
(v : Fin n) (i : Fin d) :
PortTables.rotation (lazy G) (v, lazyPorts d (false, i)) =
(v, lazyPorts d (false, i)) :=by
theoremlazy_rotation_true {n d : Nat} (G : PortTables.Table n d)
(v : Fin n) (i : Fin d) :
PortTables.rotation (lazy G) (v, lazyPorts d (true, i)) =
((PortTables.rotation G (v, i)).1,
lazyPorts d (true, (PortTables.rotation G (v, i)).2)) :=by
@[simp]theoremlazy_accepts_false {n d : Nat} (G : PortTables.Table n d)
(v : Fin n) (i : Fin d) (a b : PortTables.Label) :
PortTables.accepts (lazy G) (v, lazyPorts d (false, i)) a b = true:=by
proof · 2
lines
simp only [lazy, accepts_materialize, Equiv.symm_apply_apply]
rfl
@[simp]theoremlazy_accepts_true {n d : Nat} (G : PortTables.Table n d)
(v : Fin n) (i : Fin d) (a b : PortTables.Label) :
PortTables.accepts (lazy G) (v, lazyPorts d (true, i)) a b =
PortTables.accepts G (v, i) a b :=by
proof · 2
lines
simp only [lazy, accepts_materialize, Equiv.symm_apply_apply]
rfl