Theorem: SlimCheck.InjectiveFunction.applyId_injective
File: Mathlib/Testing/SlimCheck/Functions.lean

tactic: intro x y h
state_before: α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
⊢ Injective (applyId (xs.zip ys))
state_after: α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
⊢ x = y

tactic: by_cases hx : x ∈ xs <;> by_cases hy : y ∈ xs
state_before: α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
⊢ x = y
state_after: case pos
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : x ∈ xs
hy : y ∈ xs
⊢ x = y

case neg
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : x ∈ xs
hy : y ∉ xs
⊢ x = y

case pos
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : x ∉ xs
hy : y ∈ xs
⊢ x = y

case neg
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : x ∉ xs
hy : y ∉ xs
⊢ x = y

tactic: rw [List.mem_iff_getElem?] at hx hy
state_before: case pos
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : x ∈ xs
hy : y ∈ xs
⊢ x = y
state_after: case pos
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : ∃ n, xs[n]? = some x
hy : ∃ n, xs[n]? = some y
⊢ x = y

tactic: cases' hx with i hx
state_before: case pos
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : ∃ n, xs[n]? = some x
hy : ∃ n, xs[n]? = some y
⊢ x = y
state_after: case pos.intro
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hy : ∃ n, xs[n]? = some y
i : ℕ
hx : xs[i]? = some x
⊢ x = y

tactic: cases' hy with j hy
state_before: case pos.intro
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hy : ∃ n, xs[n]? = some y
i : ℕ
hx : xs[i]? = some x
⊢ x = y
state_after: case pos.intro.intro
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
i : ℕ
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
⊢ x = y

tactic: suffices some x = some y by injection this
state_before: case pos.intro.intro
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
i : ℕ
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
⊢ x = y
state_after: case pos.intro.intro
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
i : ℕ
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
⊢ some x = some y

tactic: have h₂ := h₁.length_eq
state_before: case pos.intro.intro
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
i : ℕ
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
⊢ some x = some y
state_after: case pos.intro.intro
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
i : ℕ
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ some x = some y

tactic: rw [List.applyId_zip_eq h₀ h₂ _ _ _ hx] at h
state_before: case pos.intro.intro
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
i : ℕ
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ some x = some y
state_after: case pos.intro.intro
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ some x = some y

tactic: rw [← hx, ← hy]
state_before: case pos.intro.intro
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ some x = some y
state_after: case pos.intro.intro
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ xs[i]? = xs[j]?

tactic: congr
state_before: case pos.intro.intro
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ xs[i]? = xs[j]?
state_after: case pos.intro.intro.e_a
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ i = j

tactic: apply List.getElem?_inj _ (h₁.nodup_iff.1 h₀)
state_before: case pos.intro.intro.e_a
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ i = j
state_after: case pos.intro.intro.e_a
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ ys[i]? = ys[j]?

α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ i < ys.length

tactic: injection this
state_before: α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
i : ℕ
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
this : some x = some y
⊢ x = y
state_after: no goals

tactic: symm
state_before: case pos.intro.intro.e_a
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ ys[i]? = ys[j]?
state_after: case pos.intro.intro.e_a
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ ys[j]? = ys[i]?

tactic: rw [h]
state_before: case pos.intro.intro.e_a
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ ys[j]? = ys[i]?
state_after: case pos.intro.intro.e_a
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ ys[j]? = some (applyId (xs.zip ys) y)

tactic: rw [← List.applyId_zip_eq] <;> assumption
state_before: case pos.intro.intro.e_a
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ ys[j]? = some (applyId (xs.zip ys) y)
state_after: no goals

tactic: rw [← h₁.length_eq]
state_before: α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ i < ys.length
state_after: α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ i < xs.length

tactic: rw [List.getElem?_eq_some] at hx
state_before: α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : xs[i]? = some x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ i < xs.length
state_after: α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : ∃ (h : i < xs.length), xs[i] = x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ i < xs.length

tactic: cases' hx with hx hx'
state_before: α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
hx : ∃ (h : i < xs.length), xs[i] = x
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
⊢ i < xs.length
state_after: case intro
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
hx : i < xs.length
hx' : xs[i] = x
⊢ i < xs.length

tactic: exact hx
state_before: case intro
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
i : ℕ
h : ys[i]? = some (applyId (xs.zip ys) y)
j : ℕ
hy : xs[j]? = some y
h₂ : xs.length = ys.length
hx : i < xs.length
hx' : xs[i] = x
⊢ i < xs.length
state_after: no goals

tactic: rw [← applyId_mem_iff h₀ h₁] at hx hy
state_before: case neg
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : x ∈ xs
hy : y ∉ xs
⊢ x = y
state_after: case neg
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : applyId (xs.zip ys) x ∈ ys
hy : applyId (xs.zip ys) y ∉ ys
⊢ x = y

tactic: rw [h] at hx
state_before: case neg
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : applyId (xs.zip ys) x ∈ ys
hy : applyId (xs.zip ys) y ∉ ys
⊢ x = y
state_after: case neg
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : applyId (xs.zip ys) y ∈ ys
hy : applyId (xs.zip ys) y ∉ ys
⊢ x = y

tactic: contradiction
state_before: case neg
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : applyId (xs.zip ys) y ∈ ys
hy : applyId (xs.zip ys) y ∉ ys
⊢ x = y
state_after: no goals

tactic: rw [← applyId_mem_iff h₀ h₁] at hx hy
state_before: case pos
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : x ∉ xs
hy : y ∈ xs
⊢ x = y
state_after: case pos
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : applyId (xs.zip ys) x ∉ ys
hy : applyId (xs.zip ys) y ∈ ys
⊢ x = y

tactic: rw [h] at hx
state_before: case pos
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : applyId (xs.zip ys) x ∉ ys
hy : applyId (xs.zip ys) y ∈ ys
⊢ x = y
state_after: case pos
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : applyId (xs.zip ys) y ∉ ys
hy : applyId (xs.zip ys) y ∈ ys
⊢ x = y

tactic: contradiction
state_before: case pos
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : applyId (xs.zip ys) y ∉ ys
hy : applyId (xs.zip ys) y ∈ ys
⊢ x = y
state_after: no goals

tactic: rwa [List.applyId_eq_self, List.applyId_eq_self] at h <;> assumption
state_before: case neg
α : Type u
β : Type v
γ : Sort w
inst✝ : DecidableEq α
xs ys : List α
h₀ : xs.Nodup
h₁ : xs ~ ys
x y : α
h : applyId (xs.zip ys) x = applyId (xs.zip ys) y
hx : x ∉ xs
hy : y ∉ xs
⊢ x = y
state_after: no goals