Theorem: List.nextOr_mem
File: Mathlib/Data/List/Cycle.lean

tactic: revert hd
state_before: α : Type u_1
inst✝ : DecidableEq α
xs : List α
x d : α
hd : d ∈ xs
⊢ nextOr xs x d ∈ xs

tactic: suffices ∀ (xs' : List α) (_ : ∀ x ∈ xs, x ∈ xs') (_ : d ∈ xs'), nextOr xs x d ∈ xs' by
  exact this xs fun _ => id
state_before: α : Type u_1
inst✝ : DecidableEq α
xs : List α
x d : α
⊢ d ∈ xs → nextOr xs x d ∈ xs

tactic: intro xs' hxs' hd
state_before: α : Type u_1
inst✝ : DecidableEq α
xs : List α
x d : α
⊢ ∀ (xs' : List α), (∀ (x : α), x ∈ xs → x ∈ xs') → d ∈ xs' → nextOr xs x d ∈ xs'

tactic: induction' xs with y ys ih
state_before: α : Type u_1
inst✝ : DecidableEq α
xs : List α
x d : α
xs' : List α
hxs' : ∀ (x : α), x ∈ xs → x ∈ xs'
hd : d ∈ xs'
⊢ nextOr xs x d ∈ xs'

tactic: cases' ys with z zs
state_before: case cons
α : Type u_1
inst✝ : DecidableEq α
xs : List α
x d : α
xs' : List α
hxs'✝ : ∀ (x : α), x ∈ xs → x ∈ xs'
hd : d ∈ xs'
y : α
ys : List α
ih : (∀ (x : α), x ∈ ys → x ∈ xs') → nextOr ys x d ∈ xs'
hxs' : ∀ (x : α), x ∈ y :: ys → x ∈ xs'
⊢ nextOr (y :: ys) x d ∈ xs'

tactic: rw [nextOr]
state_before: case cons.cons
α : Type u_1
inst✝ : DecidableEq α
xs : List α
x d : α
xs' : List α
hxs'✝ : ∀ (x : α), x ∈ xs → x ∈ xs'
hd : d ∈ xs'
y z : α
zs : List α
ih : (∀ (x : α), x ∈ z :: zs → x ∈ xs') → nextOr (z :: zs) x d ∈ xs'
hxs' : ∀ (x : α), x ∈ y :: z :: zs → x ∈ xs'
⊢ nextOr (y :: z :: zs) x d ∈ xs'

tactic: split_ifs with h
state_before: case cons.cons
α : Type u_1
inst✝ : DecidableEq α
xs : List α
x d : α
xs' : List α
hxs'✝ : ∀ (x : α), x ∈ xs → x ∈ xs'
hd : d ∈ xs'
y z : α
zs : List α
ih : (∀ (x : α), x ∈ z :: zs → x ∈ xs') → nextOr (z :: zs) x d ∈ xs'
hxs' : ∀ (x : α), x ∈ y :: z :: zs → x ∈ xs'
⊢ (if x = y then z else nextOr (z :: zs) x d) ∈ xs'

tactic: exact this xs fun _ => id
state_before: α : Type u_1
inst✝ : DecidableEq α
xs : List α
x d : α
this : ∀ (xs' : List α), (∀ (x : α), x ∈ xs → x ∈ xs') → d ∈ xs' → nextOr xs x d ∈ xs'
⊢ d ∈ xs → nextOr xs x d ∈ xs

tactic: exact hd
state_before: case nil
α : Type u_1
inst✝ : DecidableEq α
xs : List α
x d : α
xs' : List α
hxs'✝ : ∀ (x : α), x ∈ xs → x ∈ xs'
hd : d ∈ xs'
hxs' : ∀ (x : α), x ∈ [] → x ∈ xs'
⊢ nextOr [] x d ∈ xs'

tactic: exact hd
state_before: case cons.nil
α : Type u_1
inst✝ : DecidableEq α
xs : List α
x d : α
xs' : List α
hxs'✝ : ∀ (x : α), x ∈ xs → x ∈ xs'
hd : d ∈ xs'
y : α
ih : (∀ (x : α), x ∈ [] → x ∈ xs') → nextOr [] x d ∈ xs'
hxs' : ∀ (x : α), x ∈ [y] → x ∈ xs'
⊢ nextOr [y] x d ∈ xs'

tactic: exact hxs' _ (mem_cons_of_mem _ (mem_cons_self _ _))
state_before: case cons.cons.inl
α : Type u_1
inst✝ : DecidableEq α
xs : List α
x d : α
xs' : List α
hxs'✝ : ∀ (x : α), x ∈ xs → x ∈ xs'
hd : d ∈ xs'
y z : α
zs : List α
ih : (∀ (x : α), x ∈ z :: zs → x ∈ xs') → nextOr (z :: zs) x d ∈ xs'
hxs' : ∀ (x : α), x ∈ y :: z :: zs → x ∈ xs'
h : x = y
⊢ z ∈ xs'

tactic: exact ih fun _ h => hxs' _ (mem_cons_of_mem _ h)
state_before: case cons.cons.inr
α : Type u_1
inst✝ : DecidableEq α
xs : List α
x d : α
xs' : List α
hxs'✝ : ∀ (x : α), x ∈ xs → x ∈ xs'
hd : d ∈ xs'
y z : α
zs : List α
ih : (∀ (x : α), x ∈ z :: zs → x ∈ xs') → nextOr (z :: zs) x d ∈ xs'
hxs' : ∀ (x : α), x ∈ y :: z :: zs → x ∈ xs'
h : ¬x = y
⊢ nextOr (z :: zs) x d ∈ xs'