Theorem: Composition.disjoint_range
File: Mathlib/Combinatorics/Composition.lean

tactic: classical
  wlog h' : i₁ < i₂
  exact (this c h.symm (h.lt_or_lt.resolve_left h')).symm
  by_contra d
  obtain ⟨x, hx₁, hx₂⟩ :
    ∃ x : Fin n, x ∈ Set.range (c.embedding i₁) ∧ x ∈ Set.range (c.embedding i₂) :=
    Set.not_disjoint_iff.1 d
  have A : (i₁ : ℕ).succ ≤ i₂ := Nat.succ_le_of_lt h'
  apply lt_irrefl (x : ℕ)
  calc
    (x : ℕ) < c.sizeUpTo (i₁ : ℕ).succ := (c.mem_range_embedding_iff.1 hx₁).2
    _ ≤ c.sizeUpTo (i₂ : ℕ) := monotone_sum_take _ A
    _ ≤ x := (c.mem_range_embedding_iff.1 hx₂).1
state_before: n : ℕ
c : Composition n
i₁ i₂ : Fin (length c)
h : i₁ ≠ i₂
⊢ _root_.Disjoint (Set.range ↑(embedding c i₁)) (Set.range ↑(embedding c i₂))

tactic: wlog h' : i₁ < i₂
state_before: n : ℕ
c : Composition n
i₁ i₂ : Fin (length c)
h : i₁ ≠ i₂
⊢ _root_.Disjoint (Set.range ↑(embedding c i₁)) (Set.range ↑(embedding c i₂))

tactic: exact (this c h.symm (h.lt_or_lt.resolve_left h')).symm
state_before: case inr
n : ℕ
c : Composition n
i₁ i₂ : Fin (length c)
h : i₁ ≠ i₂
this :
  ∀ {n : ℕ} (c : Composition n) {i₁ i₂ : Fin (length c)},
    i₁ ≠ i₂ → i₁ < i₂ → _root_.Disjoint (Set.range ↑(embedding c i₁)) (Set.range ↑(embedding c i₂))
h' : ¬i₁ < i₂
⊢ _root_.Disjoint (Set.range ↑(embedding c i₁)) (Set.range ↑(embedding c i₂))

n✝ : ℕ
c✝ : Composition n✝
n : ℕ
c : Composition n
i₁ i₂ : Fin (length c)
h : i₁ ≠ i₂
h' : i₁ < i₂
⊢ _root_.Disjoint (Set.range ↑(embedding c i₁)) (Set.range ↑(embedding c i₂))

tactic: by_contra d
state_before: n✝ : ℕ
c✝ : Composition n✝
n : ℕ
c : Composition n
i₁ i₂ : Fin (length c)
h : i₁ ≠ i₂
h' : i₁ < i₂
⊢ _root_.Disjoint (Set.range ↑(embedding c i₁)) (Set.range ↑(embedding c i₂))

tactic: obtain ⟨x, hx₁, hx₂⟩ :
  ∃ x : Fin n, x ∈ Set.range (c.embedding i₁) ∧ x ∈ Set.range (c.embedding i₂) :=
  Set.not_disjoint_iff.1 d
state_before: n✝ : ℕ
c✝ : Composition n✝
n : ℕ
c : Composition n
i₁ i₂ : Fin (length c)
h : i₁ ≠ i₂
h' : i₁ < i₂
d : ¬_root_.Disjoint (Set.range ↑(embedding c i₁)) (Set.range ↑(embedding c i₂))
⊢ False

tactic: have A : (i₁ : ℕ).succ ≤ i₂ := Nat.succ_le_of_lt h'
state_before: case intro.intro
n✝ : ℕ
c✝ : Composition n✝
n : ℕ
c : Composition n
i₁ i₂ : Fin (length c)
h : i₁ ≠ i₂
h' : i₁ < i₂
d : ¬_root_.Disjoint (Set.range ↑(embedding c i₁)) (Set.range ↑(embedding c i₂))
x : Fin n
hx₁ : x ∈ Set.range ↑(embedding c i₁)
hx₂ : x ∈ Set.range ↑(embedding c i₂)
⊢ False

tactic: apply lt_irrefl (x : ℕ)
state_before: case intro.intro
n✝ : ℕ
c✝ : Composition n✝
n : ℕ
c : Composition n
i₁ i₂ : Fin (length c)
h : i₁ ≠ i₂
h' : i₁ < i₂
d : ¬_root_.Disjoint (Set.range ↑(embedding c i₁)) (Set.range ↑(embedding c i₂))
x : Fin n
hx₁ : x ∈ Set.range ↑(embedding c i₁)
hx₂ : x ∈ Set.range ↑(embedding c i₂)
A : Nat.succ ↑i₁ ≤ ↑i₂
⊢ False

tactic: calc
  (x : ℕ) < c.sizeUpTo (i₁ : ℕ).succ := (c.mem_range_embedding_iff.1 hx₁).2
  _ ≤ c.sizeUpTo (i₂ : ℕ) := monotone_sum_take _ A
  _ ≤ x := (c.mem_range_embedding_iff.1 hx₂).1
state_before: case intro.intro
n✝ : ℕ
c✝ : Composition n✝
n : ℕ
c : Composition n
i₁ i₂ : Fin (length c)
h : i₁ ≠ i₂
h' : i₁ < i₂
d : ¬_root_.Disjoint (Set.range ↑(embedding c i₁)) (Set.range ↑(embedding c i₂))
x : Fin n
hx₁ : x ∈ Set.range ↑(embedding c i₁)
hx₂ : x ∈ Set.range ↑(embedding c i₂)
A : Nat.succ ↑i₁ ≤ ↑i₂
⊢ ↑x < ↑x