Module: Mathlib.Combinatorics.Enumerative.DyckWord

Goal state before:
pp: p q : DyckWord
hn : p.IsNested
i : ℕ
h : ↑p ≠ []
l1 : List.take 1 ↑p = [(↑p).head h]
⊢ (↑p).length - 1 = (↑p).length - 1 - 1 + 1

Tactic:
rcases p with - | ⟨s, ⟨- | ⟨t, r⟩⟩⟩

Goal state after:
case nil
q : DyckWord
i : ℕ
count_U_eq_count_D✝ : count U [] = count D []
count_D_le_count_U✝ : ∀ (i : ℕ), count D (List.take i []) ≤ count U (List.take i [])
hn : { toList := [], count_U_eq_count_D := count_U_eq_count_D✝, count_D_le_count_U := count_D_le_count_U✝ }.IsNested
h : ↑{ toList := [], count_U_eq_count_D := count_U_eq_count_D✝, count_D_le_count_U := count_D_le_count_U✝ } ≠ []
l1 :
  List.take 1 ↑{ toList := [], count_U_eq_count_D := count_U_eq_count_D✝, count_D_le_count_U := count_D_le_count_U✝ } =
    [(↑{ toList := [], count_U_eq_count_D := count_U_eq_count_D✝, count_D_le_count_U := count_D_le_count_U✝ }).head h]
⊢ (↑{ toList := [], count_U_eq_count_D := count_U_eq_count_D✝, count_D_le_count_U := count_D_le_count_U✝ }).length - 1 =
    (↑{ toList := [], count_U_eq_count_D := count_U_eq_count_D✝, count_D_le_count_U := count_D_le_count_U✝ }).length -
          1 -
        1 +
      1

case cons.nil
q : DyckWord
i : ℕ
s : DyckStep
count_U_eq_count_D✝ : count U [s] = count D [s]
count_D_le_count_U✝ : ∀ (i : ℕ), count D (List.take i [s]) ≤ count U (List.take i [s])
hn : { toList := [s], count_U_eq_count_D := count_U_eq_count_D✝, count_D_le_count_U := count_D_le_count_U✝ }.IsNested
h : ↑{ toList := [s], count_U_eq_count_D := count_U_eq_count_D✝, count_D_le_count_U := count_D_le_count_U✝ } ≠ []
l1 :
  List.take 1 ↑{ toList := [s], count_U_eq_count_D := count_U_eq_count_D✝, count_D_le_count_U := count_D_le_count_U✝ } =
    [(↑{ toList := [s], count_U_eq_count_D := count_U_eq_count_D✝, count_D_le_count_U := count_D_le_count_U✝ }).head h]
⊢ (↑{ toList := [s], count_U_eq_count_D := count_U_eq_count_D✝, count_D_le_count_U := count_D_le_count_U✝ }).length -
      1 =
    (↑{ toList := [s], count_U_eq_count_D := count_U_eq_count_D✝, count_D_le_count_U := count_D_le_count_U✝ }).length -
          1 -
        1 +
      1

case cons.cons
q : DyckWord
i : ℕ
s head✝ : DyckStep
tail✝ : List DyckStep
count_U_eq_count_D✝ : count U (s :: head✝ :: tail✝) = count D (s :: head✝ :: tail✝)
count_D_le_count_U✝ :
  ∀ (i : ℕ), count D (List.take i (s :: head✝ :: tail✝)) ≤ count U (List.take i (s :: head✝ :: tail✝))
hn :
  { toList := s :: head✝ :: tail✝, count_U_eq_count_D := count_U_eq_count_D✝,
      count_D_le_count_U := count_D_le_count_U✝ }.IsNested
h :
  ↑{ toList := s :: head✝ :: tail✝, count_U_eq_count_D := count_U_eq_count_D✝,
        count_D_le_count_U := count_D_le_count_U✝ } ≠
    []
l1 :
  List.take 1
      ↑{ toList := s :: head✝ :: tail✝, count_U_eq_count_D := count_U_eq_count_D✝,
          count_D_le_count_U := count_D_le_count_U✝ } =
    [(↑{ toList := s :: head✝ :: tail✝, count_U_eq_count_D := count_U_eq_count_D✝,
              count_D_le_count_U := count_D_le_count_U✝ }).head
        h]
⊢ (↑{ toList := s :: head✝ :: tail✝, count_U_eq_count_D := count_U_eq_count_D✝,
            count_D_le_count_U := count_D_le_count_U✝ }).length -
      1 =
    (↑{ toList := s :: head✝ :: tail✝, count_U_eq_count_D := count_U_eq_count_D✝,
                count_D_le_count_U := count_D_le_count_U✝ }).length -
          1 -
        1 +
      1