internlm/Lean-Github huggingface dataset:
Theorem: permuted_map_index_in_range
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → first ≤ ↑(p.to_map k) ∧ ↑(p.to_map k) ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n := if k = i then j else if k = j then i else k
ki : ¬k = i
kj : k = j
⊢ first ≤ ↑k' ∧ ↑k' ≤ last
Tactic:
simp [k', ki]
Proof state after:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → first ≤ ↑(p.to_map k) ∧ ↑(p.to_map k) ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n := if k = i then j else if k = j then i else k
ki : ¬k = i
kj : k = j
⊢ first ≤ ↑(if k = j then i else k) ∧ ↑(if k = j then i else k) ≤ last
Theorem: permuted_map_index_in_range
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → first ≤ ↑(p.to_map k) ∧ ↑(p.to_map k) ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n := if k = i then j else if k = j then i else k
ki : ¬k = i
kj : k = j
⊢ first ≤ ↑(if k = j then i else k) ∧ ↑(if k = j then i else k) ≤ last
Tactic:
simp [kj]
Proof state after:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → first ≤ ↑(p.to_map k) ∧ ↑(p.to_map k) ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n := if k = i then j else if k = j then i else k
ki : ¬k = i
kj : k = j
⊢ first ≤ ↑i ∧ ↑i ≤ last
Theorem: permuted_map_index_in_range
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → first ≤ ↑(p.to_map k) ∧ ↑(p.to_map k) ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n := if k = i then j else if k = j then i else k
ki : ¬k = i
kj : k = j
⊢ first ≤ ↑i ∧ ↑i ≤ last
Tactic:
exact ⟨fi, Nat.le_trans ij jl⟩
Proof state after:
no goals
Theorem: permuted_map_index_in_range
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → first ≤ ↑(p.to_map k) ∧ ↑(p.to_map k) ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n := if k = i then j else if k = j then i else k
ki : ¬k = i
kj : ¬k = j
⊢ first ≤ ↑k' ∧ ↑k' ≤ last
Tactic:
simp [k', ki, kj]
Proof state after:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → first ≤ ↑(p.to_map k) ∧ ↑(p.to_map k) ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n := if k = i then j else if k = j then i else k
ki : ¬k = i
kj : ¬k = j
⊢ first ≤ ↑k ∧ ↑k ≤ last
Theorem: permuted_map_index_in_range
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → first ≤ ↑(p.to_map k) ∧ ↑(p.to_map k) ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n := if k = i then j else if k = j then i else k
ki : ¬k = i
kj : ¬k = j
⊢ first ≤ ↑k ∧ ↑k ≤ last
Tactic:
exact ⟨fk, kl⟩
Proof state after:
no goals
Theorem: permuted_map_index_in_range_inv
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 : Vec α✝ n
p : permuted n first last arr1 arr2
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
⊢ ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
Tactic:
induction p generalizing k with
| refl => simp [permuted.to_map, fk, kl]
| step i j fi ij jl p ih =>
  simp [permuted.to_map]
  let ⟨k', ⟨index, fk', kl'⟩⟩ := ih k fk kl
  let k'' := if k' = i then j else if k' = j then i else k'
  exists k''
  have : (if k'' = i then j else if k'' = j then i else k'') = k' := by
    match decEq k' i, decEq k' j with
    | isTrue ki, _ => simp [k'', ki]
    | _, isTrue kj => simp [k'', kj]
    | isFalse ki, isFalse kj => simp [k'',ki, kj]
  rw [this]
  have : first ≤ k''.val ∧ k''.val ≤ last := by
    match decEq k' i, decEq k' j with
    | isTrue ki, _ =>
      simp [k'', ki]
      exact ⟨Nat.le_trans fi ij, jl⟩
    | isFalse ki, isTrue kj =>
      simp [k'', ki]
      simp [kj]
      exact ⟨fi, Nat.le_trans ij jl⟩
    | isFalse ki, isFalse kj =>
      simp [k'', ki, kj]
      exact ⟨fk', kl'⟩
  exact ⟨index, this.1, this.2⟩
Proof state after:
no goals
Theorem: permuted_map_index_in_range_inv
Proof state before:
case refl
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ : Vec α✝ n
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
⊢ ∃ k', permuted.refl.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
Tactic:
simp [permuted.to_map, fk, kl]
Proof state after:
no goals
Theorem: permuted_map_index_in_range_inv
Proof state before:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
⊢ ∃ k', (permuted.step i j fi ij jl p).to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
Tactic:
simp [permuted.to_map]
Proof state after:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
⊢ ∃ k', p.to_map (if k' = i then j else if k' = j then i else k') = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
Theorem: permuted_map_index_in_range_inv
Proof state before:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
⊢ ∃ k', p.to_map (if k' = i then j else if k' = j then i else k') = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
Tactic:
let ⟨k', ⟨index, fk', kl'⟩⟩ := ih k fk kl
Proof state after:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
⊢ ∃ k', p.to_map (if k' = i then j else if k' = j then i else k') = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
Theorem: permuted_map_index_in_range_inv
Proof state before:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
⊢ ∃ k', p.to_map (if k' = i then j else if k' = j then i else k') = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
Tactic:
let k'' := if k' = i then j else if k' = j then i else k'
Proof state after:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
⊢ ∃ k', p.to_map (if k' = i then j else if k' = j then i else k') = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
Theorem: permuted_map_index_in_range_inv
Proof state before:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
⊢ ∃ k', p.to_map (if k' = i then j else if k' = j then i else k') = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
Tactic:
exists k''
Proof state after:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
⊢ p.to_map (if k'' = i then j else if k'' = j then i else k'') = k ∧ first ≤ ↑k'' ∧ ↑k'' ≤ last
Theorem: permuted_map_index_in_range_inv
Proof state before:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
⊢ p.to_map (if k'' = i then j else if k'' = j then i else k'') = k ∧ first ≤ ↑k'' ∧ ↑k'' ≤ last
Tactic:
have : (if k'' = i then j else if k'' = j then i else k'') = k' := by
  match decEq k' i, decEq k' j with
  | isTrue ki, _ => simp [k'', ki]
  | _, isTrue kj => simp [k'', kj]
  | isFalse ki, isFalse kj => simp [k'',ki, kj]
Proof state after:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
⊢ p.to_map (if k'' = i then j else if k'' = j then i else k'') = k ∧ first ≤ ↑k'' ∧ ↑k'' ≤ last
Theorem: permuted_map_index_in_range_inv
Proof state before:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
⊢ p.to_map (if k'' = i then j else if k'' = j then i else k'') = k ∧ first ≤ ↑k'' ∧ ↑k'' ≤ last
Tactic:
rw [this]
Proof state after:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
⊢ p.to_map k' = k ∧ first ≤ ↑k'' ∧ ↑k'' ≤ last
Theorem: permuted_map_index_in_range_inv
Proof state before:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
⊢ p.to_map k' = k ∧ first ≤ ↑k'' ∧ ↑k'' ≤ last
Tactic:
have : first ≤ k''.val ∧ k''.val ≤ last := by
  match decEq k' i, decEq k' j with
  | isTrue ki, _ =>
    simp [k'', ki]
    exact ⟨Nat.le_trans fi ij, jl⟩
  | isFalse ki, isTrue kj =>
    simp [k'', ki]
    simp [kj]
    exact ⟨fi, Nat.le_trans ij jl⟩
  | isFalse ki, isFalse kj =>
    simp [k'', ki, kj]
    exact ⟨fk', kl'⟩
Proof state after:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this✝ : (if k'' = i then j else if k'' = j then i else k'') = k'
this : first ≤ ↑k'' ∧ ↑k'' ≤ last
⊢ p.to_map k' = k ∧ first ≤ ↑k'' ∧ ↑k'' ≤ last
Theorem: permuted_map_index_in_range_inv
Proof state before:
case step
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this✝ : (if k'' = i then j else if k'' = j then i else k'') = k'
this : first ≤ ↑k'' ∧ ↑k'' ≤ last
⊢ p.to_map k' = k ∧ first ≤ ↑k'' ∧ ↑k'' ≤ last
Tactic:
exact ⟨index, this.1, this.2⟩
Proof state after:
no goals
Theorem: permuted_map_index_in_range_inv
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
⊢ (if k'' = i then j else if k'' = j then i else k'') = k'
Tactic:
match decEq k' i, decEq k' j with
| isTrue ki, _ => simp [k'', ki]
| _, isTrue kj => simp [k'', kj]
| isFalse ki, isFalse kj => simp [k'',ki, kj]
Proof state after:
no goals
Theorem: permuted_map_index_in_range_inv
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
ki : k' = i
x✝ : Decidable (k' = j)
⊢ (if k'' = i then j else if k'' = j then i else k'') = k'
Tactic:
simp [k'', ki]
Proof state after:
no goals
Theorem: permuted_map_index_in_range_inv
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
x✝ : Decidable (k' = i)
kj : k' = j
⊢ (if k'' = i then j else if k'' = j then i else k'') = k'
Tactic:
simp [k'', kj]
Proof state after:
no goals
Theorem: permuted_map_index_in_range_inv
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
ki : ¬k' = i
kj : ¬k' = j
⊢ (if k'' = i then j else if k'' = j then i else k'') = k'
Tactic:
simp [k'',ki, kj]
Proof state after:
no goals
Theorem: permuted_map_index_in_range_inv
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
⊢ first ≤ ↑k'' ∧ ↑k'' ≤ last
Tactic:
match decEq k' i, decEq k' j with
| isTrue ki, _ =>
  simp [k'', ki]
  exact ⟨Nat.le_trans fi ij, jl⟩
| isFalse ki, isTrue kj =>
  simp [k'', ki]
  simp [kj]
  exact ⟨fi, Nat.le_trans ij jl⟩
| isFalse ki, isFalse kj =>
  simp [k'', ki, kj]
  exact ⟨fk', kl'⟩
Proof state after:
no goals
Theorem: permuted_map_index_in_range_inv
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
ki : k' = i
x✝ : Decidable (k' = j)
⊢ first ≤ ↑k'' ∧ ↑k'' ≤ last
Tactic:
simp [k'', ki]
Proof state after:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
ki : k' = i
x✝ : Decidable (k' = j)
⊢ first ≤ ↑j ∧ ↑j ≤ last
Theorem: permuted_map_index_in_range_inv
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
ki : k' = i
x✝ : Decidable (k' = j)
⊢ first ≤ ↑j ∧ ↑j ≤ last
Tactic:
exact ⟨Nat.le_trans fi ij, jl⟩
Proof state after:
no goals
Theorem: permuted_map_index_in_range_inv
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
ki : ¬k' = i
kj : k' = j
⊢ first ≤ ↑k'' ∧ ↑k'' ≤ last
Tactic:
simp [k'', ki]
Proof state after:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
ki : ¬k' = i
kj : k' = j
⊢ first ≤ ↑(if k' = j then i else k') ∧ ↑(if k' = j then i else k') ≤ last
Theorem: permuted_map_index_in_range_inv
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
ki : ¬k' = i
kj : k' = j
⊢ first ≤ ↑(if k' = j then i else k') ∧ ↑(if k' = j then i else k') ≤ last
Tactic:
simp [kj]
Proof state after:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
ki : ¬k' = i
kj : k' = j
⊢ first ≤ ↑i ∧ ↑i ≤ last
Theorem: permuted_map_index_in_range_inv
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
ki : ¬k' = i
kj : k' = j
⊢ first ≤ ↑i ∧ ↑i ≤ last
Tactic:
exact ⟨fi, Nat.le_trans ij jl⟩
Proof state after:
no goals
Theorem: permuted_map_index_in_range_inv
Proof state before:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
ki : ¬k' = i
kj : ¬k' = j
⊢ first ≤ ↑k'' ∧ ↑k'' ≤ last
Tactic:
simp [k'', ki, kj]
Proof state after:
n first last : Nat
α✝ : Type
arr1 arr2 arr✝ arr'✝ : Vec α✝ n
i j : Fin n
fi : first ≤ ↑i
ij : i ≤ j
jl : ↑j ≤ last
p : permuted n first last (arr✝.swap i j) arr'✝
ih : ∀ (k : Fin n), first ≤ ↑k → ↑k ≤ last → ∃ k', p.to_map k' = k ∧ first ≤ ↑k' ∧ ↑k' ≤ last
k : Fin n
fk : first ≤ ↑k
kl : ↑k ≤ last
k' : Fin n
index : p.to_map k' = k
fk' : first ≤ ↑k'
kl' : ↑k' ≤ last
k'' : Fin n := if k' = i then j else if k' = j then i else k'
this : (if k'' = i then j else if k'' = j then i else k'') = k'
ki : ¬k' = i
kj : ¬k' = j
⊢ first ≤ ↑k' ∧ ↑k' ≤ last