roseking's picture
Add lean source and binary files (part 121)
f61e547 verified
Raw History Blame Contribute Delete
819 Bytes
import OAI.Probability.FirstPassage.Paths
import Mathlib.Data.List.Count
namespace OAI
namespace PlanarFPP
theorem displacement_counts (ds : List Step) :
(displacement ds).1=(ds.count Step.east : ℤ)-ds.count Step.west ∧
(displacement ds).2=(ds.count Step.north : ℤ)-ds.count Step.south ∧
ds.length=ds.count Step.east+ds.count Step.west+ds.count Step.north+ds.count Step.south := by
induction ds with
| nil => simp
| cons d ds ih =>
cases d <;> simp_all [displacement_cons,Step.delta] <;> omega
theorem closed_walk_up_left_count (ds : List Step) (h : displacement ds=0) :
ds.length=2*(ds.count Step.north+ds.count Step.west) := by
obtain ⟨hx,hy,hl⟩ := displacement_counts ds
rw [h] at hx hy
simp only [Prod.fst_zero,Prod.snd_zero] at hx hy
omega
end PlanarFPP
end OAI