| nil (v : V) : Walk v v
| forward {v : V} (e : E) (p : Walk v (G.tail e)) : Walk v (G.head e)
| backward {v : V} (e : E) (p : Walk v (G.head e)) : Walk v (G.tail e)
carrier := {c | ∃f : V→ℝ, ∀ e, c e = f (G.head e) - f (G.tail e)}
zero_mem' := ⟨0, by intro e; simp⟩
add_mem' :=by
rintro c d ⟨f, hf⟩ ⟨g, hg⟩
refine ⟨f + g, ?_⟩
intro e
change c e + d e = (f (G.head e) + g (G.head e)) -
(f (G.tail e) + g (G.tail e))
rw [hf e, hg e]
ring
smul_mem' :=by
rintro r c ⟨f, hf⟩
refine ⟨r • f, ?_⟩
intro e
change r * c e = r * f (G.head e) - r * f (G.tail e)
rw [hf e, mul_sub]
theoremWalk.integral_gradient {G : OrientedGraphVE} {c : ℓ²(E, ℝ)} {f : V→ℝ}
(hf : ∀ e, c e = f (G.head e) - f (G.tail e)) {v w : V}
(p : G.Walk v w) : p.integral c = f w - f v :=by
proof · 10
lines
induction p with
| nil => simp [Walk.integral]
| forward e p ih =>
change p.integral c + c e = f (G.head e) - f v
rw [ih, hf e]
ring
| backward e p ih =>
change p.integral c - c e = f (G.tail e) - f v
rw [ih, hf e]
ring
theoremeq_of_zero_differences (hG : G.Connected) {f : V→ℝ}
(hf : ∀ e, f (G.head e) = f (G.tail e)) (v w : V) : f v = f w :=by
proof · 5
lines
havehgrad : ∀ e, (0 : ℓ²(E, ℝ)) e = f (G.head e) - f (G.tail e) :=by
intro e
simp [hf e]
have h := (Classical.choice (hG v w)).integral_gradient hgrad
simpa only [map_zero, eq_comm, sub_eq_zero] using h.symm
theorempotential_unique (hG : G.Connected) (o : V) {f g : V→ℝ}
(hedges : ∀ e, f (G.head e) - f (G.tail e) = g (G.head e) - g (G.tail e))
(ho : f o = g o) : f = g :=by
proof · 9
lines
funext v
havehzero : ∀ e, (f - g) (G.head e) = (f - g) (G.tail e) :=by
intro e
have:= hedges e
dsimp
linarith
have h :=G.eq_of_zero_differences hG hzero o v
dsimp at h
linarith
theoremnormalizedPotential_gradient (hG : G.Connected) (o v : V)
{c : ℓ²(E, ℝ)} {f : V→ℝ}
(hf : ∀ e, c e = f (G.head e) - f (G.tail e)) :
G.normalizedPotential hG o v c = f v - f o :=
theoremmem_gradients_iff_normalized (hG : G.Connected) (o : V) (c : ℓ²(E, ℝ)) :
c ∈G.gradients ↔∀ e,
c e = G.normalizedPotential hG o (G.head e) c -
G.normalizedPotential hG o (G.tail e) c :=by
proof · 7
lines
constructor
· rintro ⟨f, hf⟩ e
rw [G.normalizedPotential_gradient hG o (G.head e) hf,
G.normalizedPotential_gradient hG o (G.tail e) hf, hf e]
ring
· intro hc
exact ⟨fun v =>G.normalizedPotential hG o v c, hc⟩
theoremisClosed_gradients (hG : G.Connected) (o : V) :
IsClosed (G.gradients : Set (ℓ²(E, ℝ))) :=by
proof · 13
lines
havehset : (G.gradients : Set (ℓ²(E, ℝ))) =
⋂ e : E, {c : ℓ²(E, ℝ) | c e =
G.normalizedPotential hG o (G.head e) c -
G.normalizedPotential hG o (G.tail e) c} :=by
ext c
simp only [SetLike.mem_coe, Set.mem_iInter, Set.mem_ofPred,
G.mem_gradients_iff_normalized hG o c]
rw [hset]
apply isClosed_iInter
intro e
exact isClosed_eq (lp.evalCLM ℝ (fun_ : E=>ℝ) 2 e).continuous
((G.normalizedPotential hG o (G.head e)).continuous.sub
(G.normalizedPotential hG o (G.tail e)).continuous)
deffiniteSupportGradients : Submoduleℝ (ℓ²(E, ℝ)) where
body · 16
lines
carrier := {c | ∃f : V→₀ ℝ, ∀ e, c e = f (G.head e) - f (G.tail e)}
zero_mem' := ⟨0, by intro e; simp⟩
add_mem' :=by
rintro c d ⟨f, hf⟩ ⟨g, hg⟩
refine ⟨f + g, ?_⟩
intro e
change c e + d e = (f (G.head e) + g (G.head e)) -
(f (G.tail e) + g (G.tail e))
rw [hf e, hg e]
ring
smul_mem' :=by
rintro r c ⟨f, hf⟩
refine ⟨r • f, ?_⟩
intro e
change r * c e = r * f (G.head e) - r * f (G.tail e)
rw [hf e, mul_sub]
theoremhasFiniteSupport_differential (hG : G.LocallyFinite) (f : V→₀ ℝ) :
(Function.support (fun e => f (G.head e) - f (G.tail e))).Finite:=by
proof · 14
lines
classical
havehfinite : (⋃ v ∈ (f.support : SetV),
{e : E | G.tail e = v ∨G.head e = v}).Finite:=
f.support.finite_toSet.biUnion (fun v _ => hG v)
apply hfinite.subset
intro e he
change f (G.head e) - f (G.tail e) ≠0 at he
havehside : G.head e ∈ f.support ∨G.tail e ∈ f.support :=by
by_contra h
push Not at h
simp [Finsupp.notMem_support_iff.mp h.1, Finsupp.notMem_support_iff.mp h.2] at he
rcases hside with hh | ht
· exact Set.mem_iUnion₂.mpr ⟨G.head e, hh, Or.inr rfl⟩
· exact Set.mem_iUnion₂.mpr ⟨G.tail e, ht, Or.inl rfl⟩
toFun f := ⟨fun e => f (G.head e) - f (G.tail e),
(memℓp_zero (G.hasFiniteSupport_differential hG f)).of_exponent_ge (by positivity)⟩
map_add' f g :=by
apply lp.ext
funext e
change f (G.head e) + g (G.head e) - (f (G.tail e) + g (G.tail e)) =
(f (G.head e) - f (G.tail e)) + (g (G.head e) - g (G.tail e))
ring
map_smul' r f :=by
apply lp.ext
funext e
exact mul_sub r (f (G.head e)) (f (G.tail e)) |>.symm