File: Mathlib/Combinatorics/Enumerative/Catalan.lean

full_name: catalan
code: /-- The recursive definition of the sequence of Catalan numbers:
`catalan (n + 1) = ∑ i : Fin n.succ, catalan i * catalan (n - i)` -/
def catalan : ℕ → ℕ
  
goal: ℕ → ℕ

full_name: catalan_zero
code: @[simp]
theorem catalan_zero : catalan 0 = 1 
goal: catalan 0 = 1

full_name: catalan_succ
code: theorem catalan_succ (n : ℕ) : catalan (n + 1) = ∑ i : Fin n.succ, catalan i * catalan (n - i) 
goal: catalan (n + 1) = ∑ i : Fin n.succ, catalan ↑i * catalan (n - ↑i)

full_name: catalan_succ'
code: theorem catalan_succ' (n : ℕ) :
    catalan (n + 1) = ∑ ij ∈ antidiagonal n, catalan ij.1 * catalan ij.2 
goal: catalan (n + 1) = ∑ ij ∈ Finset.antidiagonal n, catalan ij.1 * catalan ij.2

full_name: catalan_one
code: @[simp]
theorem catalan_one : catalan 1 = 1 
goal: catalan 1 = 1

full_name: _private.Mathlib.Combinatorics.Enumerative.Catalan.0.gosperCatalan
code: /-- A helper sequence that can be used to prove the equality of the recursive and the explicit
definition using a telescoping sum argument. -/
private def gosperCatalan (n j : ℕ) : ℚ 
goal: ℚ

full_name: _private.Mathlib.Combinatorics.Enumerative.Catalan.0.gosper_trick
code: private theorem gosper_trick {n i : ℕ} (h : i ≤ n) :
    gosperCatalan (n + 1) (i + 1) - gosperCatalan (n + 1) i =
      Nat.centralBinom i / (i + 1) * Nat.centralBinom (n - i) / (n - i + 1) 
goal: gosperCatalan (n + 1) (i + 1) - gosperCatalan (n + 1) i =
  ↑i.centralBinom / (↑i + 1) * ↑(n - i).centralBinom / (↑n - ↑i + 1)

full_name: _private.Mathlib.Combinatorics.Enumerative.Catalan.0.gosper_catalan_sub_eq_central_binom_div
code: private theorem gosper_catalan_sub_eq_central_binom_div (n : ℕ) : gosperCatalan (n + 1) (n + 1) -
    gosperCatalan (n + 1) 0 = Nat.centralBinom (n + 1) / (n + 2) 
goal: gosperCatalan (n + 1) (n + 1) - gosperCatalan (n + 1) 0 = ↑(n + 1).centralBinom / (↑n + 2)

full_name: catalan_eq_centralBinom_div
code: theorem catalan_eq_centralBinom_div (n : ℕ) : catalan n = n.centralBinom / (n + 1) 
goal: catalan n = n.centralBinom / (n + 1)

full_name: succ_mul_catalan_eq_centralBinom
code: theorem succ_mul_catalan_eq_centralBinom (n : ℕ) : (n + 1) * catalan n = n.centralBinom 
goal: (n + 1) * catalan n = n.centralBinom

full_name: catalan_two
code: theorem catalan_two : catalan 2 = 2 
goal: catalan 2 = 2

full_name: catalan_three
code: theorem catalan_three : catalan 3 = 5 
goal: catalan 3 = 5

full_name: Tree.pairwiseNode
code: /-- Given two finsets, find all trees that can be formed with
  left child in `a` and right child in `b` -/
abbrev pairwiseNode (a b : Finset (Tree Unit)) : Finset (Tree Unit) 
goal: Finset (Tree Unit)

full_name: Tree.treesOfNumNodesEq
code: /-- A Finset of all trees with `n` nodes. See `mem_treesOfNodesEq` -/
def treesOfNumNodesEq : ℕ → Finset (Tree Unit)
  
goal: ℕ → Finset (Tree Unit)

full_name: Tree.treesOfNumNodesEq_zero
code: @[simp]
theorem treesOfNumNodesEq_zero : treesOfNumNodesEq 0 = {nil} 
goal: Tree.treesOfNumNodesEq 0 = {Tree.nil}

full_name: Tree.treesOfNumNodesEq_succ
code: theorem treesOfNumNodesEq_succ (n : ℕ) :
    treesOfNumNodesEq (n + 1) =
      (antidiagonal n).biUnion fun ij =>
        pairwiseNode (treesOfNumNodesEq ij.1) (treesOfNumNodesEq ij.2) 
goal: Tree.treesOfNumNodesEq (n + 1) =
  (Finset.antidiagonal n).biUnion fun ij =>
    Tree.pairwiseNode (Tree.treesOfNumNodesEq ij.1) (Tree.treesOfNumNodesEq ij.2)

full_name: Tree.mem_treesOfNumNodesEq
code: @[simp]
theorem mem_treesOfNumNodesEq {x : Tree Unit} {n : ℕ} :
    x ∈ treesOfNumNodesEq n ↔ x.numNodes = n 
goal: x ∈ Tree.treesOfNumNodesEq n ↔ x.numNodes = n

full_name: Tree.mem_treesOfNumNodesEq_numNodes
code: theorem mem_treesOfNumNodesEq_numNodes (x : Tree Unit) : x ∈ treesOfNumNodesEq x.numNodes 
goal: x ∈ Tree.treesOfNumNodesEq x.numNodes

full_name: Tree.coe_treesOfNumNodesEq
code: @[simp, norm_cast]
theorem coe_treesOfNumNodesEq (n : ℕ) :
    ↑(treesOfNumNodesEq n) = { x : Tree Unit | x.numNodes = n } 
goal: ↑(Tree.treesOfNumNodesEq n) = {x | x.numNodes = n}

full_name: Tree.treesOfNumNodesEq_card_eq_catalan
code: theorem treesOfNumNodesEq_card_eq_catalan (n : ℕ) : (treesOfNumNodesEq n).card = catalan n 
goal: (Tree.treesOfNumNodesEq n).card = catalan n