l3lab/ntp-mathlib huggingface dataset:
theorem support_takeUntil_subset {u v w : V} (p : G.Walk v w) (h : u ∈ p.support) :
    (p.takeUntil u h).support ⊆ p.support := fun x hx => by
  rw [← take_spec p h, mem_support_append_iff]
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
h : u ∈ support p
x : V
hx : x ∈ support (takeUntil p u h)
⊢ x ∈ support (takeUntil p u h) ∨ x ∈ support (dropUntil p u h)

Next tactic:
exact Or.inl hx
theorem support_dropUntil_subset {u v w : V} (p : G.Walk v w) (h : u ∈ p.support) :
    (p.dropUntil u h).support ⊆ p.support := fun x hx => by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
h : u ∈ support p
x : V
hx : x ∈ support (dropUntil p u h)
⊢ x ∈ support p

Next tactic:
rw [← take_spec p h, mem_support_append_iff]
theorem support_dropUntil_subset {u v w : V} (p : G.Walk v w) (h : u ∈ p.support) :
    (p.dropUntil u h).support ⊆ p.support := fun x hx => by
  rw [← take_spec p h, mem_support_append_iff]
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
h : u ∈ support p
x : V
hx : x ∈ support (dropUntil p u h)
⊢ x ∈ support (takeUntil p u h) ∨ x ∈ support (dropUntil p u h)

Next tactic:
exact Or.inr hx
theorem darts_takeUntil_subset {u v w : V} (p : G.Walk v w) (h : u ∈ p.support) :
    (p.takeUntil u h).darts ⊆ p.darts := fun x hx => by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
h : u ∈ support p
x : Dart G
hx : x ∈ darts (takeUntil p u h)
⊢ x ∈ darts p

Next tactic:
rw [← take_spec p h, darts_append, List.mem_append]
theorem darts_takeUntil_subset {u v w : V} (p : G.Walk v w) (h : u ∈ p.support) :
    (p.takeUntil u h).darts ⊆ p.darts := fun x hx => by
  rw [← take_spec p h, darts_append, List.mem_append]
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
h : u ∈ support p
x : Dart G
hx : x ∈ darts (takeUntil p u h)
⊢ x ∈ darts (takeUntil p u h) ∨ x ∈ darts (dropUntil p u h)

Next tactic:
exact Or.inl hx
theorem darts_dropUntil_subset {u v w : V} (p : G.Walk v w) (h : u ∈ p.support) :
    (p.dropUntil u h).darts ⊆ p.darts := fun x hx => by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
h : u ∈ support p
x : Dart G
hx : x ∈ darts (dropUntil p u h)
⊢ x ∈ darts p

Next tactic:
rw [← take_spec p h, darts_append, List.mem_append]
theorem darts_dropUntil_subset {u v w : V} (p : G.Walk v w) (h : u ∈ p.support) :
    (p.dropUntil u h).darts ⊆ p.darts := fun x hx => by
  rw [← take_spec p h, darts_append, List.mem_append]
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
h : u ∈ support p
x : Dart G
hx : x ∈ darts (dropUntil p u h)
⊢ x ∈ darts (takeUntil p u h) ∨ x ∈ darts (dropUntil p u h)

Next tactic:
exact Or.inr hx
theorem length_takeUntil_le {u v w : V} (p : G.Walk v w) (h : u ∈ p.support) :
    (p.takeUntil u h).length ≤ p.length := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
h : u ∈ support p
⊢ length (takeUntil p u h) ≤ length p

Next tactic:
have := congr_arg Walk.length (p.take_spec h)
theorem length_takeUntil_le {u v w : V} (p : G.Walk v w) (h : u ∈ p.support) :
    (p.takeUntil u h).length ≤ p.length := by
  have := congr_arg Walk.length (p.take_spec h)
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
h : u ∈ support p
this : length (append (takeUntil p u h) (dropUntil p u h)) = length p
⊢ length (takeUntil p u h) ≤ length p

Next tactic:
rw [length_append] at this
theorem length_takeUntil_le {u v w : V} (p : G.Walk v w) (h : u ∈ p.support) :
    (p.takeUntil u h).length ≤ p.length := by
  have := congr_arg Walk.length (p.take_spec h)
  rw [length_append] at this
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
h : u ∈ support p
this : length (takeUntil p u h) + length (dropUntil p u h) = length p
⊢ length (takeUntil p u h) ≤ length p

Next tactic:
exact Nat.le.intro this
theorem length_dropUntil_le {u v w : V} (p : G.Walk v w) (h : u ∈ p.support) :
    (p.dropUntil u h).length ≤ p.length := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
h : u ∈ support p
⊢ length (dropUntil p u h) ≤ length p

Next tactic:
have := congr_arg Walk.length (p.take_spec h)
theorem length_dropUntil_le {u v w : V} (p : G.Walk v w) (h : u ∈ p.support) :
    (p.dropUntil u h).length ≤ p.length := by
  have := congr_arg Walk.length (p.take_spec h)
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
h : u ∈ support p
this : length (append (takeUntil p u h) (dropUntil p u h)) = length p
⊢ length (dropUntil p u h) ≤ length p

Next tactic:
rw [length_append, add_comm] at this
theorem length_dropUntil_le {u v w : V} (p : G.Walk v w) (h : u ∈ p.support) :
    (p.dropUntil u h).length ≤ p.length := by
  have := congr_arg Walk.length (p.take_spec h)
  rw [length_append, add_comm] at this
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
h : u ∈ support p
this : length (dropUntil p u h) + length (takeUntil p u h) = length p
⊢ length (dropUntil p u h) ≤ length p

Next tactic:
exact Nat.le.intro this
protected theorem IsTrail.takeUntil {u v w : V} {p : G.Walk v w} (hc : p.IsTrail)
    (h : u ∈ p.support) : (p.takeUntil u h).IsTrail :=
  IsTrail.of_append_left (by 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
hc : IsTrail p
h : u ∈ support p
⊢ IsTrail (append (takeUntil p u h) (?m.373398 hc h))

Next tactic:
rwa [← take_spec _ h] at hc
protected theorem IsTrail.dropUntil {u v w : V} {p : G.Walk v w} (hc : p.IsTrail)
    (h : u ∈ p.support) : (p.dropUntil u h).IsTrail :=
  IsTrail.of_append_right (by 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
hc : IsTrail p
h : u ∈ support p
⊢ IsTrail (append (?m.373650 hc h) (dropUntil p u h))

Next tactic:
rwa [← take_spec _ h] at hc
protected theorem IsPath.takeUntil {u v w : V} {p : G.Walk v w} (hc : p.IsPath)
    (h : u ∈ p.support) : (p.takeUntil u h).IsPath :=
  IsPath.of_append_left (by 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
hc : IsPath p
h : u ∈ support p
⊢ IsPath (append (takeUntil p u h) (?m.373902 hc h))

Next tactic:
rwa [← take_spec _ h] at hc
protected theorem IsPath.dropUntil {u v w : V} {p : G.Walk v w} (hc : p.IsPath)
    (h : u ∈ p.support) : (p.dropUntil u h).IsPath :=
  IsPath.of_append_right (by 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v w : V
p : Walk G v w
hc : IsPath p
h : u ∈ support p
⊢ IsPath (append (?m.374154 hc h) (dropUntil p u h))

Next tactic:
rwa [← take_spec _ h] at hc
@[simp]
theorem support_rotate {u v : V} (c : G.Walk v v) (h : u ∈ c.support) :
    (c.rotate h).support.tail ~r c.support.tail := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v : V
c : Walk G v v
h : u ∈ support c
⊢ List.tail (support (rotate c h)) ~r List.tail (support c)

Next tactic:
simp only [rotate, tail_support_append]
@[simp]
theorem support_rotate {u v : V} (c : G.Walk v v) (h : u ∈ c.support) :
    (c.rotate h).support.tail ~r c.support.tail := by
  simp only [rotate, tail_support_append]
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v : V
c : Walk G v v
h : u ∈ support c
⊢ (List.tail (support (dropUntil c u h)) ++ List.tail (support (takeUntil c u h))) ~r List.tail (support c)

Next tactic:
apply List.IsRotated.trans List.isRotated_append
@[simp]
theorem support_rotate {u v : V} (c : G.Walk v v) (h : u ∈ c.support) :
    (c.rotate h).support.tail ~r c.support.tail := by
  simp only [rotate, tail_support_append]
  apply List.IsRotated.trans List.isRotated_append
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v : V
c : Walk G v v
h : u ∈ support c
⊢ (List.tail (support (takeUntil c u h)) ++ List.tail (support (dropUntil c u h))) ~r List.tail (support c)

Next tactic:
rw [← tail_support_append, take_spec]
theorem rotate_darts {u v : V} (c : G.Walk v v) (h : u ∈ c.support) :
    (c.rotate h).darts ~r c.darts := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v : V
c : Walk G v v
h : u ∈ support c
⊢ darts (rotate c h) ~r darts c

Next tactic:
simp only [rotate, darts_append]
theorem rotate_darts {u v : V} (c : G.Walk v v) (h : u ∈ c.support) :
    (c.rotate h).darts ~r c.darts := by
  simp only [rotate, darts_append]
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v : V
c : Walk G v v
h : u ∈ support c
⊢ (darts (dropUntil c u h) ++ darts (takeUntil c u h)) ~r darts c

Next tactic:
apply List.IsRotated.trans List.isRotated_append
theorem rotate_darts {u v : V} (c : G.Walk v v) (h : u ∈ c.support) :
    (c.rotate h).darts ~r c.darts := by
  simp only [rotate, darts_append]
  apply List.IsRotated.trans List.isRotated_append
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v : V
c : Walk G v v
h : u ∈ support c
⊢ (darts (takeUntil c u h) ++ darts (dropUntil c u h)) ~r darts c

Next tactic:
rw [← darts_append, take_spec]
protected theorem IsTrail.rotate {u v : V} {c : G.Walk v v} (hc : c.IsTrail) (h : u ∈ c.support) :
    (c.rotate h).IsTrail := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v : V
c : Walk G v v
hc : IsTrail c
h : u ∈ support c
⊢ IsTrail (rotate c h)

Next tactic:
rw [isTrail_def, (c.rotate_edges h).perm.nodup_iff]
protected theorem IsTrail.rotate {u v : V} {c : G.Walk v v} (hc : c.IsTrail) (h : u ∈ c.support) :
    (c.rotate h).IsTrail := by
  rw [isTrail_def, (c.rotate_edges h).perm.nodup_iff]
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v : V
c : Walk G v v
hc : IsTrail c
h : u ∈ support c
⊢ List.Nodup (edges c)

Next tactic:
exact hc.edges_nodup
protected theorem IsCircuit.rotate {u v : V} {c : G.Walk v v} (hc : c.IsCircuit)
    (h : u ∈ c.support) : (c.rotate h).IsCircuit := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v : V
c : Walk G v v
hc : IsCircuit c
h : u ∈ support c
⊢ IsCircuit (rotate c h)

Next tactic:
refine ⟨hc.isTrail.rotate _, ?_⟩
protected theorem IsCircuit.rotate {u v : V} {c : G.Walk v v} (hc : c.IsCircuit)
    (h : u ∈ c.support) : (c.rotate h).IsCircuit := by
  refine ⟨hc.isTrail.rotate _, ?_⟩
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v : V
c : Walk G v v
hc : IsCircuit c
h : u ∈ support c
⊢ rotate c h ≠ nil

Next tactic:
cases c
protected theorem IsCircuit.rotate {u v : V} {c : G.Walk v v} (hc : c.IsCircuit)
    (h : u ∈ c.support) : (c.rotate h).IsCircuit := by
  refine ⟨hc.isTrail.rotate _, ?_⟩
  cases c
  · 

Proof state:
case nil
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v : V
hc : IsCircuit nil
h : u ∈ support nil
⊢ rotate nil h ≠ nil

Next tactic:
exact (hc.ne_nil rfl).elim
protected theorem IsCircuit.rotate {u v : V} {c : G.Walk v v} (hc : c.IsCircuit)
    (h : u ∈ c.support) : (c.rotate h).IsCircuit := by
  refine ⟨hc.isTrail.rotate _, ?_⟩
  cases c
  · exact (hc.ne_nil rfl).elim
  · 

Proof state:
case cons
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v v✝ : V
h✝ : Adj G v v✝
p✝ : Walk G v✝ v
hc : IsCircuit (cons h✝ p✝)
h : u ∈ support (cons h✝ p✝)
⊢ rotate (cons h✝ p✝) h ≠ nil

Next tactic:
intro hn
protected theorem IsCircuit.rotate {u v : V} {c : G.Walk v v} (hc : c.IsCircuit)
    (h : u ∈ c.support) : (c.rotate h).IsCircuit := by
  refine ⟨hc.isTrail.rotate _, ?_⟩
  cases c
  · exact (hc.ne_nil rfl).elim
  · intro hn
    

Proof state:
case cons
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v v✝ : V
h✝ : Adj G v v✝
p✝ : Walk G v✝ v
hc : IsCircuit (cons h✝ p✝)
h : u ∈ support (cons h✝ p✝)
hn : rotate (cons h✝ p✝) h = nil
⊢ False

Next tactic:
have hn' := congr_arg length hn
protected theorem IsCircuit.rotate {u v : V} {c : G.Walk v v} (hc : c.IsCircuit)
    (h : u ∈ c.support) : (c.rotate h).IsCircuit := by
  refine ⟨hc.isTrail.rotate _, ?_⟩
  cases c
  · exact (hc.ne_nil rfl).elim
  · intro hn
    have hn' := congr_arg length hn
    

Proof state:
case cons
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v v✝ : V
h✝ : Adj G v v✝
p✝ : Walk G v✝ v
hc : IsCircuit (cons h✝ p✝)
h : u ∈ support (cons h✝ p✝)
hn : rotate (cons h✝ p✝) h = nil
hn' : length (rotate (cons h✝ p✝) h) = length nil
⊢ False

Next tactic:
rw [rotate, length_append, add_comm, ← length_append, take_spec] at hn'
protected theorem IsCircuit.rotate {u v : V} {c : G.Walk v v} (hc : c.IsCircuit)
    (h : u ∈ c.support) : (c.rotate h).IsCircuit := by
  refine ⟨hc.isTrail.rotate _, ?_⟩
  cases c
  · exact (hc.ne_nil rfl).elim
  · intro hn
    have hn' := congr_arg length hn
    rw [rotate, length_append, add_comm, ← length_append, take_spec] at hn'
    

Proof state:
case cons
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v v✝ : V
h✝ : Adj G v v✝
p✝ : Walk G v✝ v
hc : IsCircuit (cons h✝ p✝)
h : u ∈ support (cons h✝ p✝)
hn : rotate (cons h✝ p✝) h = nil
hn' : length (cons h✝ p✝) = length nil
⊢ False

Next tactic:
simp at hn'
protected theorem IsCycle.rotate {u v : V} {c : G.Walk v v} (hc : c.IsCycle) (h : u ∈ c.support) :
    (c.rotate h).IsCycle := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v : V
c : Walk G v v
hc : IsCycle c
h : u ∈ support c
⊢ IsCycle (rotate c h)

Next tactic:
refine ⟨hc.isCircuit.rotate _, ?_⟩
protected theorem IsCycle.rotate {u v : V} {c : G.Walk v v} (hc : c.IsCycle) (h : u ∈ c.support) :
    (c.rotate h).IsCycle := by
  refine ⟨hc.isCircuit.rotate _, ?_⟩
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v : V
c : Walk G v v
hc : IsCycle c
h : u ∈ support c
⊢ List.Nodup (List.tail (support (rotate c h)))

Next tactic:
rw [List.IsRotated.nodup_iff (support_rotate _ _)]
protected theorem IsCycle.rotate {u v : V} {c : G.Walk v v} (hc : c.IsCycle) (h : u ∈ c.support) :
    (c.rotate h).IsCycle := by
  refine ⟨hc.isCircuit.rotate _, ?_⟩
  rw [List.IsRotated.nodup_iff (support_rotate _ _)]
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v : V
c : Walk G v v
hc : IsCycle c
h : u ∈ support c
⊢ List.Nodup (List.tail (support c))

Next tactic:
exact hc.support_nodup
/-- Given a set `S` and a walk `w` from `u` to `v` such that `u ∈ S` but `v ∉ S`,
there exists a dart in the walk whose start is in `S` but whose end is not. -/
theorem exists_boundary_dart {u v : V} (p : G.Walk u v) (S : Set V) (uS : u ∈ S) (vS : v ∉ S) :
    ∃ d : G.Dart, d ∈ p.darts ∧ d.fst ∈ S ∧ d.snd ∉ S := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
p : Walk G u v
S : Set V
uS : u ∈ S
vS : v ∉ S
⊢ ∃ d ∈ darts p, d.toProd.1 ∈ S ∧ d.toProd.2 ∉ S

Next tactic:
induction' p with _ x y w a p' ih
/-- Given a set `S` and a walk `w` from `u` to `v` such that `u ∈ S` but `v ∉ S`,
there exists a dart in the walk whose start is in `S` but whose end is not. -/
theorem exists_boundary_dart {u v : V} (p : G.Walk u v) (S : Set V) (uS : u ∈ S) (vS : v ∉ S) :
    ∃ d : G.Dart, d ∈ p.darts ∧ d.fst ∈ S ∧ d.snd ∉ S := by
  induction' p with _ x y w a p' ih
  · 

Proof state:
case nil
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
S : Set V
u✝ : V
uS : u✝ ∈ S
vS : u✝ ∉ S
⊢ ∃ d ∈ darts nil, d.toProd.1 ∈ S ∧ d.toProd.2 ∉ S

Next tactic:
cases vS uS
/-- Given a set `S` and a walk `w` from `u` to `v` such that `u ∈ S` but `v ∉ S`,
there exists a dart in the walk whose start is in `S` but whose end is not. -/
theorem exists_boundary_dart {u v : V} (p : G.Walk u v) (S : Set V) (uS : u ∈ S) (vS : v ∉ S) :
    ∃ d : G.Dart, d ∈ p.darts ∧ d.fst ∈ S ∧ d.snd ∉ S := by
  induction' p with _ x y w a p' ih
  · cases vS uS
  · 

Proof state:
case cons
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
S : Set V
x y w : V
a : Adj G x y
p' : Walk G y w
ih : y ∈ S → w ∉ S → ∃ d ∈ darts p', d.toProd.1 ∈ S ∧ d.toProd.2 ∉ S
uS : x ∈ S
vS : w ∉ S
⊢ ∃ d ∈ darts (cons a p'), d.toProd.1 ∈ S ∧ d.toProd.2 ∉ S

Next tactic:
by_cases h : y ∈ S
/-- Given a set `S` and a walk `w` from `u` to `v` such that `u ∈ S` but `v ∉ S`,
there exists a dart in the walk whose start is in `S` but whose end is not. -/
theorem exists_boundary_dart {u v : V} (p : G.Walk u v) (S : Set V) (uS : u ∈ S) (vS : v ∉ S) :
    ∃ d : G.Dart, d ∈ p.darts ∧ d.fst ∈ S ∧ d.snd ∉ S := by
  induction' p with _ x y w a p' ih
  · cases vS uS
  · by_cases h : y ∈ S
    · 

Proof state:
case pos
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
S : Set V
x y w : V
a : Adj G x y
p' : Walk G y w
ih : y ∈ S → w ∉ S → ∃ d ∈ darts p', d.toProd.1 ∈ S ∧ d.toProd.2 ∉ S
uS : x ∈ S
vS : w ∉ S
h : y ∈ S
⊢ ∃ d ∈ darts (cons a p'), d.toProd.1 ∈ S ∧ d.toProd.2 ∉ S

Next tactic:
obtain ⟨d, hd, hcd⟩ := ih h vS
/-- Given a set `S` and a walk `w` from `u` to `v` such that `u ∈ S` but `v ∉ S`,
there exists a dart in the walk whose start is in `S` but whose end is not. -/
theorem exists_boundary_dart {u v : V} (p : G.Walk u v) (S : Set V) (uS : u ∈ S) (vS : v ∉ S) :
    ∃ d : G.Dart, d ∈ p.darts ∧ d.fst ∈ S ∧ d.snd ∉ S := by
  induction' p with _ x y w a p' ih
  · cases vS uS
  · by_cases h : y ∈ S
    · obtain ⟨d, hd, hcd⟩ := ih h vS
      

Proof state:
case pos.intro.intro
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
S : Set V
x y w : V
a : Adj G x y
p' : Walk G y w
ih : y ∈ S → w ∉ S → ∃ d ∈ darts p', d.toProd.1 ∈ S ∧ d.toProd.2 ∉ S
uS : x ∈ S
vS : w ∉ S
h : y ∈ S
d : Dart G
hd : d ∈ darts p'
hcd : d.toProd.1 ∈ S ∧ d.toProd.2 ∉ S
⊢ ∃ d ∈ darts (cons a p'), d.toProd.1 ∈ S ∧ d.toProd.2 ∉ S

Next tactic:
exact ⟨d, List.Mem.tail _ hd, hcd⟩
/-- Given a set `S` and a walk `w` from `u` to `v` such that `u ∈ S` but `v ∉ S`,
there exists a dart in the walk whose start is in `S` but whose end is not. -/
theorem exists_boundary_dart {u v : V} (p : G.Walk u v) (S : Set V) (uS : u ∈ S) (vS : v ∉ S) :
    ∃ d : G.Dart, d ∈ p.darts ∧ d.fst ∈ S ∧ d.snd ∉ S := by
  induction' p with _ x y w a p' ih
  · cases vS uS
  · by_cases h : y ∈ S
    · obtain ⟨d, hd, hcd⟩ := ih h vS
      exact ⟨d, List.Mem.tail _ hd, hcd⟩
    · 

Proof state:
case neg
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
S : Set V
x y w : V
a : Adj G x y
p' : Walk G y w
ih : y ∈ S → w ∉ S → ∃ d ∈ darts p', d.toProd.1 ∈ S ∧ d.toProd.2 ∉ S
uS : x ∈ S
vS : w ∉ S
h : y ∉ S
⊢ ∃ d ∈ darts (cons a p'), d.toProd.1 ∈ S ∧ d.toProd.2 ∉ S

Next tactic:
exact ⟨⟨(x, y), a⟩, List.Mem.head _, uS, h⟩
/-- The length-1 path between a pair of adjacent vertices. -/
@[simps]
def singleton {u v : V} (h : G.Adj u v) : G.Path u v :=
  ⟨Walk.cons h Walk.nil, by 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
h : Adj G u v
⊢ Walk.IsPath (Walk.cons h Walk.nil)

Next tactic:
simp [h.ne]
theorem mk'_mem_edges_singleton {u v : V} (h : G.Adj u v) :
    ⟦(u, v)⟧ ∈ (singleton h : G.Walk u v).edges := by 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
h : Adj G u v
⊢ ⟦(u, v)⟧ ∈ Walk.edges ↑(singleton h)

Next tactic:
simp [singleton]
theorem loop_eq {v : V} (p : G.Path v v) : p = Path.nil := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v : V
p : Path G v v
⊢ p = Path.nil

Next tactic:
obtain ⟨_ | _, h⟩ := p
theorem loop_eq {v : V} (p : G.Path v v) : p = Path.nil := by
  obtain ⟨_ | _, h⟩ := p
  · 

Proof state:
case mk.nil
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v : V
h : Walk.IsPath Walk.nil
⊢ { val := Walk.nil, property := h } = Path.nil

Next tactic:
rfl
theorem loop_eq {v : V} (p : G.Path v v) : p = Path.nil := by
  obtain ⟨_ | _, h⟩ := p
  · rfl
  · 

Proof state:
case mk.cons
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v v✝ : V
h✝ : Adj G v v✝
p✝ : Walk G v✝ v
h : Walk.IsPath (Walk.cons h✝ p✝)
⊢ { val := Walk.cons h✝ p✝, property := h } = Path.nil

Next tactic:
simp at h
theorem not_mem_edges_of_loop {v : V} {e : Sym2 V} {p : G.Path v v} : ¬e ∈ (p : G.Walk v v).edges :=
  by 

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
v : V
e : Sym2 V
p : Path G v v
⊢ e ∉ Walk.edges ↑p

Next tactic:
simp [p.loop_eq]
theorem cons_isCycle {u v : V} (p : G.Path v u) (h : G.Adj u v)
    (he : ¬⟦(u, v)⟧ ∈ (p : G.Walk v u).edges) : (Walk.cons h ↑p).IsCycle := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
u v : V
p : Path G v u
h : Adj G u v
he : ⟦(u, v)⟧ ∉ Walk.edges ↑p
⊢ Walk.IsCycle (Walk.cons h ↑p)

Next tactic:
simp [Walk.isCycle_def, Walk.cons_isTrail_iff, he]
@[simp]
theorem bypass_copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') :
    (p.copy hu hv).bypass = p.bypass.copy hu hv := by
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u v u' v' : V
p : Walk G u v
hu : u = u'
hv : v = v'
⊢ bypass (Walk.copy p hu hv) = Walk.copy (bypass p) hu hv

Next tactic:
subst_vars
@[simp]
theorem bypass_copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') :
    (p.copy hu hv).bypass = p.bypass.copy hu hv := by
  subst_vars
  

Proof state:
V : Type u
V' : Type v
V'' : Type w
G : SimpleGraph V
G' : SimpleGraph V'
G'' : SimpleGraph V''
inst✝ : DecidableEq V
u' v' : V
p : Walk G u' v'
⊢ bypass (Walk.copy p (_ : u' = u') (_ : v' = v')) = Walk.copy (bypass p) (_ : u' = u') (_ : v' = v')

Next tactic:
rfl