l3lab/ntp-mathlib huggingface dataset:
theorem adjMatrix_pow_apply_eq_card_walk [DecidableEq V] [Semiring α] (n : ℕ) (u v : V) :
    (G.adjMatrix α ^ n) u v = Fintype.card { p : G.Walk u v | p.length = n } := by
  rw [card_set_walk_length_eq]
  induction' n with n ih generalizing u v
  · obtain rfl | h := eq_or_ne u v <;> 

Proof state:
case zero.inr
V : Type u_1
α : Type u_2
β : Type u_3
G : SimpleGraph V
inst✝³ : DecidableRel G.Adj
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : Semiring α
u v : V
h : u ≠ v
⊢ (adjMatrix α G ^ Nat.zero) u v = ↑(card (finsetWalkLength G Nat.zero u v))

Next tactic:
simp [finsetWalkLength, *]
theorem adjMatrix_pow_apply_eq_card_walk [DecidableEq V] [Semiring α] (n : ℕ) (u v : V) :
    (G.adjMatrix α ^ n) u v = Fintype.card { p : G.Walk u v | p.length = n } := by
  rw [card_set_walk_length_eq]
  induction' n with n ih generalizing u v
  · obtain rfl | h := eq_or_ne u v <;> simp [finsetWalkLength, *]
  · 

Proof state:
case succ
V : Type u_1
α : Type u_2
β : Type u_3
G : SimpleGraph V
inst✝³ : DecidableRel G.Adj
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : Semiring α
n : ℕ
ih : ∀ (u v : V), (adjMatrix α G ^ n) u v = ↑(card (finsetWalkLength G n u v))
u v : V
⊢ (adjMatrix α G ^ Nat.succ n) u v = ↑(card (finsetWalkLength G (Nat.succ n) u v))

Next tactic:
nth_rw 1 [Nat.succ_eq_one_add]
theorem adjMatrix_pow_apply_eq_card_walk [DecidableEq V] [Semiring α] (n : ℕ) (u v : V) :
    (G.adjMatrix α ^ n) u v = Fintype.card { p : G.Walk u v | p.length = n } := by
  rw [card_set_walk_length_eq]
  induction' n with n ih generalizing u v
  · obtain rfl | h := eq_or_ne u v <;> simp [finsetWalkLength, *]
  · nth_rw 1 [Nat.succ_eq_one_add]
    

Proof state:
case succ
V : Type u_1
α : Type u_2
β : Type u_3
G : SimpleGraph V
inst✝³ : DecidableRel G.Adj
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : Semiring α
n : ℕ
ih : ∀ (u v : V), (adjMatrix α G ^ n) u v = ↑(card (finsetWalkLength G n u v))
u v : V
⊢ (adjMatrix α G ^ (1 + n)) u v = ↑(card (finsetWalkLength G (Nat.succ n) u v))

Next tactic:
simp only [pow_add, pow_one, finsetWalkLength, ih, adjMatrix_mul_apply]
theorem adjMatrix_pow_apply_eq_card_walk [DecidableEq V] [Semiring α] (n : ℕ) (u v : V) :
    (G.adjMatrix α ^ n) u v = Fintype.card { p : G.Walk u v | p.length = n } := by
  rw [card_set_walk_length_eq]
  induction' n with n ih generalizing u v
  · obtain rfl | h := eq_or_ne u v <;> simp [finsetWalkLength, *]
  · nth_rw 1 [Nat.succ_eq_one_add]
    simp only [pow_add, pow_one, finsetWalkLength, ih, adjMatrix_mul_apply]
    

Proof state:
case succ
V : Type u_1
α : Type u_2
β : Type u_3
G : SimpleGraph V
inst✝³ : DecidableRel G.Adj
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : Semiring α
n : ℕ
ih : ∀ (u v : V), (adjMatrix α G ^ n) u v = ↑(card (finsetWalkLength G n u v))
u v : V
⊢ ∑ x in neighborFinset G u, ↑(card (finsetWalkLength G n x v)) =
    ↑(card
        (Finset.biUnion univ fun w =>
          Finset.map
            { toFun := fun p => Walk.cons (_ : ↑w ∈ neighborSet G u) p,
              inj' :=
                (_ :
                  ∀ (x x_1 : Walk G (↑w) v),
                    Walk.cons (_ : ↑w ∈ neighborSet G u) x = Walk.cons (_ : ↑w ∈ neighborSet G u) x_1 → x = x_1) }
            (finsetWalkLength G n (↑w) v)))

Next tactic:
rw [Finset.card_biUnion]
theorem adjMatrix_pow_apply_eq_card_walk [DecidableEq V] [Semiring α] (n : ℕ) (u v : V) :
    (G.adjMatrix α ^ n) u v = Fintype.card { p : G.Walk u v | p.length = n } := by
  rw [card_set_walk_length_eq]
  induction' n with n ih generalizing u v
  · obtain rfl | h := eq_or_ne u v <;> simp [finsetWalkLength, *]
  · nth_rw 1 [Nat.succ_eq_one_add]
    simp only [pow_add, pow_one, finsetWalkLength, ih, adjMatrix_mul_apply]
    rw [Finset.card_biUnion]
    · 

Proof state:
case succ
V : Type u_1
α : Type u_2
β : Type u_3
G : SimpleGraph V
inst✝³ : DecidableRel G.Adj
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : Semiring α
n : ℕ
ih : ∀ (u v : V), (adjMatrix α G ^ n) u v = ↑(card (finsetWalkLength G n u v))
u v : V
⊢ ∑ x in neighborFinset G u, ↑(card (finsetWalkLength G n x v)) =
    ↑(∑ u_1 : ↑(neighborSet G u),
        card
          (Finset.map
            { toFun := fun p => Walk.cons (_ : ↑u_1 ∈ neighborSet G u) p,
              inj' :=
                (_ :
                  ∀ (x x_1 : Walk G (↑u_1) v),
                    Walk.cons (_ : ↑u_1 ∈ neighborSet G u) x = Walk.cons (_ : ↑u_1 ∈ neighborSet G u) x_1 → x = x_1) }
            (finsetWalkLength G n (↑u_1) v)))

Next tactic:
norm_cast
theorem adjMatrix_pow_apply_eq_card_walk [DecidableEq V] [Semiring α] (n : ℕ) (u v : V) :
    (G.adjMatrix α ^ n) u v = Fintype.card { p : G.Walk u v | p.length = n } := by
  rw [card_set_walk_length_eq]
  induction' n with n ih generalizing u v
  · obtain rfl | h := eq_or_ne u v <;> simp [finsetWalkLength, *]
  · nth_rw 1 [Nat.succ_eq_one_add]
    simp only [pow_add, pow_one, finsetWalkLength, ih, adjMatrix_mul_apply]
    rw [Finset.card_biUnion]
    · norm_cast
      

Proof state:
case succ
V : Type u_1
α : Type u_2
β : Type u_3
G : SimpleGraph V
inst✝³ : DecidableRel G.Adj
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : Semiring α
n : ℕ
ih : ∀ (u v : V), (adjMatrix α G ^ n) u v = ↑(card (finsetWalkLength G n u v))
u v : V
⊢ ↑(∑ x in neighborFinset G u, card (finsetWalkLength G n x v)) =
    ↑(∑ u_1 : ↑(neighborSet G u),
        card
          (Finset.map
            { toFun := fun p => Walk.cons (_ : ↑u_1 ∈ neighborSet G u) p,
              inj' :=
                (_ :
                  ∀ (x x_1 : Walk G (↑u_1) v),
                    Walk.cons (_ : ↑u_1 ∈ neighborSet G u) x = Walk.cons (_ : ↑u_1 ∈ neighborSet G u) x_1 → x = x_1) }
            (finsetWalkLength G n (↑u_1) v)))

Next tactic:
simp only [Nat.cast_sum, card_map, neighborFinset_def]
theorem adjMatrix_pow_apply_eq_card_walk [DecidableEq V] [Semiring α] (n : ℕ) (u v : V) :
    (G.adjMatrix α ^ n) u v = Fintype.card { p : G.Walk u v | p.length = n } := by
  rw [card_set_walk_length_eq]
  induction' n with n ih generalizing u v
  · obtain rfl | h := eq_or_ne u v <;> simp [finsetWalkLength, *]
  · nth_rw 1 [Nat.succ_eq_one_add]
    simp only [pow_add, pow_one, finsetWalkLength, ih, adjMatrix_mul_apply]
    rw [Finset.card_biUnion]
    · norm_cast
      simp only [Nat.cast_sum, card_map, neighborFinset_def]
      

Proof state:
case succ
V : Type u_1
α : Type u_2
β : Type u_3
G : SimpleGraph V
inst✝³ : DecidableRel G.Adj
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : Semiring α
n : ℕ
ih : ∀ (u v : V), (adjMatrix α G ^ n) u v = ↑(card (finsetWalkLength G n u v))
u v : V
⊢ ∑ x in Set.toFinset (neighborSet G u), ↑(card (finsetWalkLength G n x v)) =
    ∑ x : ↑(neighborSet G u), ↑(card (finsetWalkLength G n (↑x) v))

Next tactic:
apply Finset.sum_toFinset_eq_subtype
theorem adjMatrix_pow_apply_eq_card_walk [DecidableEq V] [Semiring α] (n : ℕ) (u v : V) :
    (G.adjMatrix α ^ n) u v = Fintype.card { p : G.Walk u v | p.length = n } := by
  rw [card_set_walk_length_eq]
  induction' n with n ih generalizing u v
  · obtain rfl | h := eq_or_ne u v <;> simp [finsetWalkLength, *]
  · nth_rw 1 [Nat.succ_eq_one_add]
    simp only [pow_add, pow_one, finsetWalkLength, ih, adjMatrix_mul_apply]
    rw [Finset.card_biUnion]
    · norm_cast
      simp only [Nat.cast_sum, card_map, neighborFinset_def]
      apply Finset.sum_toFinset_eq_subtype
    -- Disjointness for card_bUnion
    · 

Proof state:
case succ
V : Type u_1
α : Type u_2
β : Type u_3
G : SimpleGraph V
inst✝³ : DecidableRel G.Adj
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : Semiring α
n : ℕ
ih : ∀ (u v : V), (adjMatrix α G ^ n) u v = ↑(card (finsetWalkLength G n u v))
u v : V
⊢ ∀ x ∈ univ,
    ∀ y ∈ univ,
      x ≠ y →
        Disjoint
          (Finset.map
            { toFun := fun p => Walk.cons (_ : ↑x ∈ neighborSet G u) p,
              inj' :=
                (_ :
                  ∀ (x_1 x_2 : Walk G (↑x) v),
                    Walk.cons (_ : ↑x ∈ neighborSet G u) x_1 = Walk.cons (_ : ↑x ∈ neighborSet G u) x_2 → x_1 = x_2) }
            (finsetWalkLength G n (↑x) v))
          (Finset.map
            { toFun := fun p => Walk.cons (_ : ↑y ∈ neighborSet G u) p,
              inj' :=
                (_ :
                  ∀ (x x_1 : Walk G (↑y) v),
                    Walk.cons (_ : ↑y ∈ neighborSet G u) x = Walk.cons (_ : ↑y ∈ neighborSet G u) x_1 → x = x_1) }
            (finsetWalkLength G n (↑y) v))

Next tactic:
rintro ⟨x, hx⟩ - ⟨y, hy⟩ - hxy
theorem adjMatrix_pow_apply_eq_card_walk [DecidableEq V] [Semiring α] (n : ℕ) (u v : V) :
    (G.adjMatrix α ^ n) u v = Fintype.card { p : G.Walk u v | p.length = n } := by
  rw [card_set_walk_length_eq]
  induction' n with n ih generalizing u v
  · obtain rfl | h := eq_or_ne u v <;> simp [finsetWalkLength, *]
  · nth_rw 1 [Nat.succ_eq_one_add]
    simp only [pow_add, pow_one, finsetWalkLength, ih, adjMatrix_mul_apply]
    rw [Finset.card_biUnion]
    · norm_cast
      simp only [Nat.cast_sum, card_map, neighborFinset_def]
      apply Finset.sum_toFinset_eq_subtype
    -- Disjointness for card_bUnion
    · rintro ⟨x, hx⟩ - ⟨y, hy⟩ - hxy
      

Proof state:
case succ.mk.mk
V : Type u_1
α : Type u_2
β : Type u_3
G : SimpleGraph V
inst✝³ : DecidableRel G.Adj
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : Semiring α
n : ℕ
ih : ∀ (u v : V), (adjMatrix α G ^ n) u v = ↑(card (finsetWalkLength G n u v))
u v x : V
hx : x ∈ neighborSet G u
y : V
hy : y ∈ neighborSet G u
hxy : { val := x, property := hx } ≠ { val := y, property := hy }
⊢ Disjoint
    (Finset.map
      { toFun := fun p => Walk.cons (_ : ↑{ val := x, property := hx } ∈ neighborSet G u) p,
        inj' :=
          (_ :
            ∀ (x_1 x_2 : Walk G (↑{ val := x, property := hx }) v),
              Walk.cons (_ : ↑{ val := x, property := hx } ∈ neighborSet G u) x_1 =
                  Walk.cons (_ : ↑{ val := x, property := hx } ∈ neighborSet G u) x_2 →
                x_1 = x_2) }
      (finsetWalkLength G n (↑{ val := x, property := hx }) v))
    (Finset.map
      { toFun := fun p => Walk.cons (_ : ↑{ val := y, property := hy } ∈ neighborSet G u) p,
        inj' :=
          (_ :
            ∀ (x x_1 : Walk G (↑{ val := y, property := hy }) v),
              Walk.cons (_ : ↑{ val := y, property := hy } ∈ neighborSet G u) x =
                  Walk.cons (_ : ↑{ val := y, property := hy } ∈ neighborSet G u) x_1 →
                x = x_1) }
      (finsetWalkLength G n (↑{ val := y, property := hy }) v))

Next tactic:
rw [disjoint_iff_inf_le]
theorem adjMatrix_pow_apply_eq_card_walk [DecidableEq V] [Semiring α] (n : ℕ) (u v : V) :
    (G.adjMatrix α ^ n) u v = Fintype.card { p : G.Walk u v | p.length = n } := by
  rw [card_set_walk_length_eq]
  induction' n with n ih generalizing u v
  · obtain rfl | h := eq_or_ne u v <;> simp [finsetWalkLength, *]
  · nth_rw 1 [Nat.succ_eq_one_add]
    simp only [pow_add, pow_one, finsetWalkLength, ih, adjMatrix_mul_apply]
    rw [Finset.card_biUnion]
    · norm_cast
      simp only [Nat.cast_sum, card_map, neighborFinset_def]
      apply Finset.sum_toFinset_eq_subtype
    -- Disjointness for card_bUnion
    · rintro ⟨x, hx⟩ - ⟨y, hy⟩ - hxy
      rw [disjoint_iff_inf_le]
      

Proof state:
case succ.mk.mk
V : Type u_1
α : Type u_2
β : Type u_3
G : SimpleGraph V
inst✝³ : DecidableRel G.Adj
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : Semiring α
n : ℕ
ih : ∀ (u v : V), (adjMatrix α G ^ n) u v = ↑(card (finsetWalkLength G n u v))
u v x : V
hx : x ∈ neighborSet G u
y : V
hy : y ∈ neighborSet G u
hxy : { val := x, property := hx } ≠ { val := y, property := hy }
⊢ Finset.map
        { toFun := fun p => Walk.cons (_ : ↑{ val := x, property := hx } ∈ neighborSet G u) p,
          inj' :=
            (_ :
              ∀ (x_1 x_2 : Walk G (↑{ val := x, property := hx }) v),
                Walk.cons (_ : ↑{ val := x, property := hx } ∈ neighborSet G u) x_1 =
                    Walk.cons (_ : ↑{ val := x, property := hx } ∈ neighborSet G u) x_2 →
                  x_1 = x_2) }
        (finsetWalkLength G n (↑{ val := x, property := hx }) v) ⊓
      Finset.map
        { toFun := fun p => Walk.cons (_ : ↑{ val := y, property := hy } ∈ neighborSet G u) p,
          inj' :=
            (_ :
              ∀ (x x_1 : Walk G (↑{ val := y, property := hy }) v),
                Walk.cons (_ : ↑{ val := y, property := hy } ∈ neighborSet G u) x =
                    Walk.cons (_ : ↑{ val := y, property := hy } ∈ neighborSet G u) x_1 →
                  x = x_1) }
        (finsetWalkLength G n (↑{ val := y, property := hy }) v) ≤
    ⊥

Next tactic:
intro p hp
theorem adjMatrix_pow_apply_eq_card_walk [DecidableEq V] [Semiring α] (n : ℕ) (u v : V) :
    (G.adjMatrix α ^ n) u v = Fintype.card { p : G.Walk u v | p.length = n } := by
  rw [card_set_walk_length_eq]
  induction' n with n ih generalizing u v
  · obtain rfl | h := eq_or_ne u v <;> simp [finsetWalkLength, *]
  · nth_rw 1 [Nat.succ_eq_one_add]
    simp only [pow_add, pow_one, finsetWalkLength, ih, adjMatrix_mul_apply]
    rw [Finset.card_biUnion]
    · norm_cast
      simp only [Nat.cast_sum, card_map, neighborFinset_def]
      apply Finset.sum_toFinset_eq_subtype
    -- Disjointness for card_bUnion
    · rintro ⟨x, hx⟩ - ⟨y, hy⟩ - hxy
      rw [disjoint_iff_inf_le]
      intro p hp
      

Proof state:
case succ.mk.mk
V : Type u_1
α : Type u_2
β : Type u_3
G : SimpleGraph V
inst✝³ : DecidableRel G.Adj
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : Semiring α
n : ℕ
ih : ∀ (u v : V), (adjMatrix α G ^ n) u v = ↑(card (finsetWalkLength G n u v))
u v x : V
hx : x ∈ neighborSet G u
y : V
hy : y ∈ neighborSet G u
hxy : { val := x, property := hx } ≠ { val := y, property := hy }
p : Walk G u v
hp :
  p ∈
    Finset.map
        { toFun := fun p => Walk.cons (_ : ↑{ val := x, property := hx } ∈ neighborSet G u) p,
          inj' :=
            (_ :
              ∀ (x_1 x_2 : Walk G (↑{ val := x, property := hx }) v),
                Walk.cons (_ : ↑{ val := x, property := hx } ∈ neighborSet G u) x_1 =
                    Walk.cons (_ : ↑{ val := x, property := hx } ∈ neighborSet G u) x_2 →
                  x_1 = x_2) }
        (finsetWalkLength G n (↑{ val := x, property := hx }) v) ⊓
      Finset.map
        { toFun := fun p => Walk.cons (_ : ↑{ val := y, property := hy } ∈ neighborSet G u) p,
          inj' :=
            (_ :
              ∀ (x x_1 : Walk G (↑{ val := y, property := hy }) v),
                Walk.cons (_ : ↑{ val := y, property := hy } ∈ neighborSet G u) x =
                    Walk.cons (_ : ↑{ val := y, property := hy } ∈ neighborSet G u) x_1 →
                  x = x_1) }
        (finsetWalkLength G n (↑{ val := y, property := hy }) v)
⊢ p ∈ ⊥

Next tactic:
simp only [inf_eq_inter, mem_inter, mem_map, Function.Embedding.coeFn_mk, exists_prop] at hp
theorem adjMatrix_pow_apply_eq_card_walk [DecidableEq V] [Semiring α] (n : ℕ) (u v : V) :
    (G.adjMatrix α ^ n) u v = Fintype.card { p : G.Walk u v | p.length = n } := by
  rw [card_set_walk_length_eq]
  induction' n with n ih generalizing u v
  · obtain rfl | h := eq_or_ne u v <;> simp [finsetWalkLength, *]
  · nth_rw 1 [Nat.succ_eq_one_add]
    simp only [pow_add, pow_one, finsetWalkLength, ih, adjMatrix_mul_apply]
    rw [Finset.card_biUnion]
    · norm_cast
      simp only [Nat.cast_sum, card_map, neighborFinset_def]
      apply Finset.sum_toFinset_eq_subtype
    -- Disjointness for card_bUnion
    · rintro ⟨x, hx⟩ - ⟨y, hy⟩ - hxy
      rw [disjoint_iff_inf_le]
      intro p hp
      simp only [inf_eq_inter, mem_inter, mem_map, Function.Embedding.coeFn_mk, exists_prop] at hp;
        

Proof state:
case succ.mk.mk
V : Type u_1
α : Type u_2
β : Type u_3
G : SimpleGraph V
inst✝³ : DecidableRel G.Adj
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : Semiring α
n : ℕ
ih : ∀ (u v : V), (adjMatrix α G ^ n) u v = ↑(card (finsetWalkLength G n u v))
u v x : V
hx : x ∈ neighborSet G u
y : V
hy : y ∈ neighborSet G u
hxy : { val := x, property := hx } ≠ { val := y, property := hy }
p : Walk G u v
hp :
  (∃ a ∈ finsetWalkLength G n x v, Walk.cons (_ : ↑{ val := x, property := hx } ∈ neighborSet G u) a = p) ∧
    ∃ a ∈ finsetWalkLength G n y v, Walk.cons (_ : ↑{ val := y, property := hy } ∈ neighborSet G u) a = p
⊢ p ∈ ⊥

Next tactic:
obtain ⟨⟨px, _, rfl⟩, ⟨py, hpy, hp⟩⟩ := hp
theorem adjMatrix_pow_apply_eq_card_walk [DecidableEq V] [Semiring α] (n : ℕ) (u v : V) :
    (G.adjMatrix α ^ n) u v = Fintype.card { p : G.Walk u v | p.length = n } := by
  rw [card_set_walk_length_eq]
  induction' n with n ih generalizing u v
  · obtain rfl | h := eq_or_ne u v <;> simp [finsetWalkLength, *]
  · nth_rw 1 [Nat.succ_eq_one_add]
    simp only [pow_add, pow_one, finsetWalkLength, ih, adjMatrix_mul_apply]
    rw [Finset.card_biUnion]
    · norm_cast
      simp only [Nat.cast_sum, card_map, neighborFinset_def]
      apply Finset.sum_toFinset_eq_subtype
    -- Disjointness for card_bUnion
    · rintro ⟨x, hx⟩ - ⟨y, hy⟩ - hxy
      rw [disjoint_iff_inf_le]
      intro p hp
      simp only [inf_eq_inter, mem_inter, mem_map, Function.Embedding.coeFn_mk, exists_prop] at hp;
        obtain ⟨⟨px, _, rfl⟩, ⟨py, hpy, hp⟩⟩ := hp
      

Proof state:
case succ.mk.mk.intro.intro.intro.intro.intro
V : Type u_1
α : Type u_2
β : Type u_3
G : SimpleGraph V
inst✝³ : DecidableRel G.Adj
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : Semiring α
n : ℕ
ih : ∀ (u v : V), (adjMatrix α G ^ n) u v = ↑(card (finsetWalkLength G n u v))
u v x : V
hx : x ∈ neighborSet G u
y : V
hy : y ∈ neighborSet G u
hxy : { val := x, property := hx } ≠ { val := y, property := hy }
px : Walk G x v
left✝ : px ∈ finsetWalkLength G n x v
py : Walk G y v
hpy : py ∈ finsetWalkLength G n y v
hp :
  Walk.cons (_ : ↑{ val := y, property := hy } ∈ neighborSet G u) py =
    Walk.cons (_ : ↑{ val := x, property := hx } ∈ neighborSet G u) px
⊢ Walk.cons (_ : ↑{ val := x, property := hx } ∈ neighborSet G u) px ∈ ⊥

Next tactic:
cases hp
theorem adjMatrix_pow_apply_eq_card_walk [DecidableEq V] [Semiring α] (n : ℕ) (u v : V) :
    (G.adjMatrix α ^ n) u v = Fintype.card { p : G.Walk u v | p.length = n } := by
  rw [card_set_walk_length_eq]
  induction' n with n ih generalizing u v
  · obtain rfl | h := eq_or_ne u v <;> simp [finsetWalkLength, *]
  · nth_rw 1 [Nat.succ_eq_one_add]
    simp only [pow_add, pow_one, finsetWalkLength, ih, adjMatrix_mul_apply]
    rw [Finset.card_biUnion]
    · norm_cast
      simp only [Nat.cast_sum, card_map, neighborFinset_def]
      apply Finset.sum_toFinset_eq_subtype
    -- Disjointness for card_bUnion
    · rintro ⟨x, hx⟩ - ⟨y, hy⟩ - hxy
      rw [disjoint_iff_inf_le]
      intro p hp
      simp only [inf_eq_inter, mem_inter, mem_map, Function.Embedding.coeFn_mk, exists_prop] at hp;
        obtain ⟨⟨px, _, rfl⟩, ⟨py, hpy, hp⟩⟩ := hp
      cases hp
      

Proof state:
case succ.mk.mk.intro.intro.intro.intro.intro.refl
V : Type u_1
α : Type u_2
β : Type u_3
G : SimpleGraph V
inst✝³ : DecidableRel G.Adj
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : Semiring α
n : ℕ
ih : ∀ (u v : V), (adjMatrix α G ^ n) u v = ↑(card (finsetWalkLength G n u v))
u v x : V
hx : x ∈ neighborSet G u
px : Walk G x v
left✝ : px ∈ finsetWalkLength G n x v
hy : x ∈ neighborSet G u
hxy : { val := x, property := hx } ≠ { val := x, property := hy }
hpy : px ∈ finsetWalkLength G n x v
⊢ Walk.cons (_ : ↑{ val := x, property := hx } ∈ neighborSet G u) px ∈ ⊥

Next tactic:
simp at hxy
/-- If `A` is qualified as an adjacency matrix,
    then the adjacency matrix of the graph induced by `A` is itself. -/
theorem adjMatrix_toGraph_eq [DecidableEq α] : h.toGraph.adjMatrix α = A := by
  

Proof state:
V : Type u_1
α : Type u_2
β : Type u_3
inst✝² : MulZeroOneClass α
inst✝¹ : Nontrivial α
A : Matrix V V α
h : IsAdjMatrix A
inst✝ : DecidableEq α
⊢ adjMatrix α (toGraph h) = A

Next tactic:
ext i j
/-- If `A` is qualified as an adjacency matrix,
    then the adjacency matrix of the graph induced by `A` is itself. -/
theorem adjMatrix_toGraph_eq [DecidableEq α] : h.toGraph.adjMatrix α = A := by
  ext i j
  

Proof state:
case a.h
V : Type u_1
α : Type u_2
β : Type u_3
inst✝² : MulZeroOneClass α
inst✝¹ : Nontrivial α
A : Matrix V V α
h : IsAdjMatrix A
inst✝ : DecidableEq α
i j : V
⊢ adjMatrix α (toGraph h) i j = A i j

Next tactic:
obtain h' | h' := h.zero_or_one i j
/-- If `A` is qualified as an adjacency matrix,
    then the adjacency matrix of the graph induced by `A` is itself. -/
theorem adjMatrix_toGraph_eq [DecidableEq α] : h.toGraph.adjMatrix α = A := by
  ext i j
  obtain h' | h' := h.zero_or_one i j <;> 

Proof state:
case a.h.inl
V : Type u_1
α : Type u_2
β : Type u_3
inst✝² : MulZeroOneClass α
inst✝¹ : Nontrivial α
A : Matrix V V α
h : IsAdjMatrix A
inst✝ : DecidableEq α
i j : V
h' : A i j = 0
⊢ adjMatrix α (toGraph h) i j = A i j

Next tactic:
simp [h']
/-- If `A` is qualified as an adjacency matrix,
    then the adjacency matrix of the graph induced by `A` is itself. -/
theorem adjMatrix_toGraph_eq [DecidableEq α] : h.toGraph.adjMatrix α = A := by
  ext i j
  obtain h' | h' := h.zero_or_one i j <;> 

Proof state:
case a.h.inr
V : Type u_1
α : Type u_2
β : Type u_3
inst✝² : MulZeroOneClass α
inst✝¹ : Nontrivial α
A : Matrix V V α
h : IsAdjMatrix A
inst✝ : DecidableEq α
i j : V
h' : A i j = 1
⊢ adjMatrix α (toGraph h) i j = A i j

Next tactic:
simp [h']
theorem comp_differentiableWithinAt_iff {f : G → E} {s : Set G} {x : G} :
    DifferentiableWithinAt 𝕜 (iso ∘ f) s x ↔ DifferentiableWithinAt 𝕜 f s x := by
  

Proof state:
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f✝ f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x✝ : E
s✝ t : Set E
L L₁ L₂ : Filter E
iso : E ≃L[𝕜] F
f : G → E
s : Set G
x : G
⊢ DifferentiableWithinAt 𝕜 (⇑iso ∘ f) s x ↔ DifferentiableWithinAt 𝕜 f s x

Next tactic:
refine'
    ⟨fun H => _, fun H => iso.differentiable.differentiableAt.comp_differentiableWithinAt x H⟩
theorem comp_differentiableWithinAt_iff {f : G → E} {s : Set G} {x : G} :
    DifferentiableWithinAt 𝕜 (iso ∘ f) s x ↔ DifferentiableWithinAt 𝕜 f s x := by
  refine'
    ⟨fun H => _, fun H => iso.differentiable.differentiableAt.comp_differentiableWithinAt x H⟩
  

Proof state:
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f✝ f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x✝ : E
s✝ t : Set E
L L₁ L₂ : Filter E
iso : E ≃L[𝕜] F
f : G → E
s : Set G
x : G
H : DifferentiableWithinAt 𝕜 (⇑iso ∘ f) s x
⊢ DifferentiableWithinAt 𝕜 f s x

Next tactic:
have : DifferentiableWithinAt 𝕜 (iso.symm ∘ iso ∘ f) s x :=
    iso.symm.differentiable.differentiableAt.comp_differentiableWithinAt x H
theorem comp_differentiableWithinAt_iff {f : G → E} {s : Set G} {x : G} :
    DifferentiableWithinAt 𝕜 (iso ∘ f) s x ↔ DifferentiableWithinAt 𝕜 f s x := by
  refine'
    ⟨fun H => _, fun H => iso.differentiable.differentiableAt.comp_differentiableWithinAt x H⟩
  have : DifferentiableWithinAt 𝕜 (iso.symm ∘ iso ∘ f) s x :=
    iso.symm.differentiable.differentiableAt.comp_differentiableWithinAt x H
  

Proof state:
𝕜 : Type u_1
inst✝⁸ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type u_3
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type u_4
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
G' : Type u_5
inst✝¹ : NormedAddCommGroup G'
inst✝ : NormedSpace 𝕜 G'
f✝ f₀ f₁ g : E → F
f' f₀' f₁' g' e : E →L[𝕜] F
x✝ : E
s✝ t : Set E
L L₁ L₂ : Filter E
iso : E ≃L[𝕜] F
f : G → E
s : Set G
x : G
H : DifferentiableWithinAt 𝕜 (⇑iso ∘ f) s x
this : DifferentiableWithinAt 𝕜 (⇑(ContinuousLinearEquiv.symm iso) ∘ ⇑iso ∘ f) s x
⊢ DifferentiableWithinAt 𝕜 f s x

Next tactic:
rwa [← Function.comp.assoc iso.symm iso f, iso.symm_comp_self] at this