Theorem: FOL.NV.Sub.Var.One.Rec.not_free_in_fastReplaceFree_self (FOL/NV/Sub/Var/One/Rec/ReplaceFree.lean)

State before:
F : Formula
v t : VarName
h1 : ¬isFreeIn v F
⊢ fastReplaceFree v t F = F
Tactic:
induction F
State after:
case pred_const_
v t : VarName
a✝¹ : PredName
a✝ : List VarName
h1 : ¬isFreeIn v (pred_const_ a✝¹ a✝)
⊢ fastReplaceFree v t (pred_const_ a✝¹ a✝) = pred_const_ a✝¹ a✝

case pred_var_
v t : VarName
a✝¹ : PredName
a✝ : List VarName
h1 : ¬isFreeIn v (pred_var_ a✝¹ a✝)
⊢ fastReplaceFree v t (pred_var_ a✝¹ a✝) = pred_var_ a✝¹ a✝

case eq_
v t a✝¹ a✝ : VarName
h1 : ¬isFreeIn v (eq_ a✝¹ a✝)
⊢ fastReplaceFree v t (eq_ a✝¹ a✝) = eq_ a✝¹ a✝

case true_
v t : VarName
h1 : ¬isFreeIn v true_
⊢ fastReplaceFree v t true_ = true_

case false_
v t : VarName
h1 : ¬isFreeIn v false_
⊢ fastReplaceFree v t false_ = false_

case not_
v t : VarName
a✝ : Formula
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v a✝.not_
⊢ fastReplaceFree v t a✝.not_ = a✝.not_

case imp_
v t : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : ¬isFreeIn v a✝¹ → fastReplaceFree v t a✝¹ = a✝¹
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v (a✝¹.imp_ a✝)
⊢ fastReplaceFree v t (a✝¹.imp_ a✝) = a✝¹.imp_ a✝

case and_
v t : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : ¬isFreeIn v a✝¹ → fastReplaceFree v t a✝¹ = a✝¹
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v (a✝¹.and_ a✝)
⊢ fastReplaceFree v t (a✝¹.and_ a✝) = a✝¹.and_ a✝

case or_
v t : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : ¬isFreeIn v a✝¹ → fastReplaceFree v t a✝¹ = a✝¹
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v (a✝¹.or_ a✝)
⊢ fastReplaceFree v t (a✝¹.or_ a✝) = a✝¹.or_ a✝

case iff_
v t : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : ¬isFreeIn v a✝¹ → fastReplaceFree v t a✝¹ = a✝¹
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v (a✝¹.iff_ a✝)
⊢ fastReplaceFree v t (a✝¹.iff_ a✝) = a✝¹.iff_ a✝

case forall_
v t a✝¹ : VarName
a✝ : Formula
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v (forall_ a✝¹ a✝)
⊢ fastReplaceFree v t (forall_ a✝¹ a✝) = forall_ a✝¹ a✝

case exists_
v t a✝¹ : VarName
a✝ : Formula
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v (exists_ a✝¹ a✝)
⊢ fastReplaceFree v t (exists_ a✝¹ a✝) = exists_ a✝¹ a✝

case def_
v t : VarName
a✝¹ : DefName
a✝ : List VarName
h1 : ¬isFreeIn v (def_ a✝¹ a✝)
⊢ fastReplaceFree v t (def_ a✝¹ a✝) = def_ a✝¹ a✝

State before:
case pred_const_
v t : VarName
a✝¹ : PredName
a✝ : List VarName
h1 : ¬isFreeIn v (pred_const_ a✝¹ a✝)
⊢ fastReplaceFree v t (pred_const_ a✝¹ a✝) = pred_const_ a✝¹ a✝

case pred_var_
v t : VarName
a✝¹ : PredName
a✝ : List VarName
h1 : ¬isFreeIn v (pred_var_ a✝¹ a✝)
⊢ fastReplaceFree v t (pred_var_ a✝¹ a✝) = pred_var_ a✝¹ a✝

case eq_
v t a✝¹ a✝ : VarName
h1 : ¬isFreeIn v (eq_ a✝¹ a✝)
⊢ fastReplaceFree v t (eq_ a✝¹ a✝) = eq_ a✝¹ a✝

case true_
v t : VarName
h1 : ¬isFreeIn v true_
⊢ fastReplaceFree v t true_ = true_

case false_
v t : VarName
h1 : ¬isFreeIn v false_
⊢ fastReplaceFree v t false_ = false_

case not_
v t : VarName
a✝ : Formula
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v a✝.not_
⊢ fastReplaceFree v t a✝.not_ = a✝.not_

case imp_
v t : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : ¬isFreeIn v a✝¹ → fastReplaceFree v t a✝¹ = a✝¹
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v (a✝¹.imp_ a✝)
⊢ fastReplaceFree v t (a✝¹.imp_ a✝) = a✝¹.imp_ a✝

case and_
v t : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : ¬isFreeIn v a✝¹ → fastReplaceFree v t a✝¹ = a✝¹
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v (a✝¹.and_ a✝)
⊢ fastReplaceFree v t (a✝¹.and_ a✝) = a✝¹.and_ a✝

case or_
v t : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : ¬isFreeIn v a✝¹ → fastReplaceFree v t a✝¹ = a✝¹
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v (a✝¹.or_ a✝)
⊢ fastReplaceFree v t (a✝¹.or_ a✝) = a✝¹.or_ a✝

case iff_
v t : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : ¬isFreeIn v a✝¹ → fastReplaceFree v t a✝¹ = a✝¹
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v (a✝¹.iff_ a✝)
⊢ fastReplaceFree v t (a✝¹.iff_ a✝) = a✝¹.iff_ a✝

case forall_
v t a✝¹ : VarName
a✝ : Formula
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v (forall_ a✝¹ a✝)
⊢ fastReplaceFree v t (forall_ a✝¹ a✝) = forall_ a✝¹ a✝

case exists_
v t a✝¹ : VarName
a✝ : Formula
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v (exists_ a✝¹ a✝)
⊢ fastReplaceFree v t (exists_ a✝¹ a✝) = exists_ a✝¹ a✝

case def_
v t : VarName
a✝¹ : DefName
a✝ : List VarName
h1 : ¬isFreeIn v (def_ a✝¹ a✝)
⊢ fastReplaceFree v t (def_ a✝¹ a✝) = def_ a✝¹ a✝
Tactic:
any_goals
  simp only [isFreeIn] at h1
  simp only [fastReplaceFree]
State after:
case pred_const_
v t : VarName
a✝¹ : PredName
a✝ : List VarName
h1 : v ∉ a✝
⊢ pred_const_ a✝¹ (List.map (fun x => if v = x then t else x) a✝) = pred_const_ a✝¹ a✝

case pred_var_
v t : VarName
a✝¹ : PredName
a✝ : List VarName
h1 : v ∉ a✝
⊢ pred_var_ a✝¹ (List.map (fun x => if v = x then t else x) a✝) = pred_var_ a✝¹ a✝

case eq_
v t a✝¹ a✝ : VarName
h1 : ¬(v = a✝¹ ∨ v = a✝)
⊢ eq_ (if v = a✝¹ then t else a✝¹) (if v = a✝ then t else a✝) = eq_ a✝¹ a✝

case not_
v t : VarName
a✝ : Formula
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬isFreeIn v a✝
⊢ (fastReplaceFree v t a✝).not_ = a✝.not_

case imp_
v t : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : ¬isFreeIn v a✝¹ → fastReplaceFree v t a✝¹ = a✝¹
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬(isFreeIn v a✝¹ ∨ isFreeIn v a✝)
⊢ (fastReplaceFree v t a✝¹).imp_ (fastReplaceFree v t a✝) = a✝¹.imp_ a✝

case and_
v t : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : ¬isFreeIn v a✝¹ → fastReplaceFree v t a✝¹ = a✝¹
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬(isFreeIn v a✝¹ ∨ isFreeIn v a✝)
⊢ (fastReplaceFree v t a✝¹).and_ (fastReplaceFree v t a✝) = a✝¹.and_ a✝

case or_
v t : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : ¬isFreeIn v a✝¹ → fastReplaceFree v t a✝¹ = a✝¹
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬(isFreeIn v a✝¹ ∨ isFreeIn v a✝)
⊢ (fastReplaceFree v t a✝¹).or_ (fastReplaceFree v t a✝) = a✝¹.or_ a✝

case iff_
v t : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : ¬isFreeIn v a✝¹ → fastReplaceFree v t a✝¹ = a✝¹
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬(isFreeIn v a✝¹ ∨ isFreeIn v a✝)
⊢ (fastReplaceFree v t a✝¹).iff_ (fastReplaceFree v t a✝) = a✝¹.iff_ a✝

case forall_
v t a✝¹ : VarName
a✝ : Formula
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬(¬v = a✝¹ ∧ isFreeIn v a✝)
⊢ (if v = a✝¹ then forall_ a✝¹ a✝ else forall_ a✝¹ (fastReplaceFree v t a✝)) = forall_ a✝¹ a✝

case exists_
v t a✝¹ : VarName
a✝ : Formula
a_ih✝ : ¬isFreeIn v a✝ → fastReplaceFree v t a✝ = a✝
h1 : ¬(¬v = a✝¹ ∧ isFreeIn v a✝)
⊢ (if v = a✝¹ then exists_ a✝¹ a✝ else exists_ a✝¹ (fastReplaceFree v t a✝)) = exists_ a✝¹ a✝

case def_
v t : VarName
a✝¹ : DefName
a✝ : List VarName
h1 : v ∉ a✝
⊢ def_ a✝¹ (List.map (fun x => if v = x then t else x) a✝) = def_ a✝¹ a✝

State before:
v t : VarName
X : DefName
xs : List VarName
h1 : v ∉ xs
⊢ def_ X (List.map (fun x => if v = x then t else x) xs) = def_ X xs
Tactic:
case pred_const_ X xs | pred_var_ X xs | def_ X xs =>
  simp
  simp only [List.map_eq_self_iff]
  simp
  intro x a1 a2
  subst a2
  contradiction
State after:
no goals

State before:
v t x y : VarName
h1 : ¬(v = x ∨ v = y)
⊢ eq_ (if v = x then t else x) (if v = y then t else y) = eq_ x y
Tactic:
case eq_ x y =>
  simp
  tauto
State after:
no goals

State before:
v t : VarName
phi : Formula
phi_ih : ¬isFreeIn v phi → fastReplaceFree v t phi = phi
h1 : ¬isFreeIn v phi
⊢ (fastReplaceFree v t phi).not_ = phi.not_
Tactic:
case not_ phi phi_ih =>
  tauto
State after:
no goals

State before:
v t : VarName
phi psi : Formula
phi_ih : ¬isFreeIn v phi → fastReplaceFree v t phi = phi
psi_ih : ¬isFreeIn v psi → fastReplaceFree v t psi = psi
h1 : ¬(isFreeIn v phi ∨ isFreeIn v psi)
⊢ (fastReplaceFree v t phi).iff_ (fastReplaceFree v t psi) = phi.iff_ psi
Tactic:
case
    imp_ phi psi phi_ih psi_ih
  | and_ phi psi phi_ih psi_ih
  | or_ phi psi phi_ih psi_ih
  | iff_ phi psi phi_ih psi_ih =>
  simp
  tauto
State after:
no goals

State before:
v t x : VarName
phi : Formula
phi_ih : ¬isFreeIn v phi → fastReplaceFree v t phi = phi
h1 : ¬(¬v = x ∧ isFreeIn v phi)
⊢ (if v = x then exists_ x phi else exists_ x (fastReplaceFree v t phi)) = exists_ x phi
Tactic:
case forall_ x phi phi_ih | exists_ x phi phi_ih =>
  simp
  tauto
State after:
no goals

State before:
case def_
v t : VarName
a✝¹ : DefName
a✝ : List VarName
h1 : ¬isFreeIn v (def_ a✝¹ a✝)
⊢ fastReplaceFree v t (def_ a✝¹ a✝) = def_ a✝¹ a✝
Tactic:
simp only [isFreeIn] at h1
State after:
case def_
v t : VarName
a✝¹ : DefName
a✝ : List VarName
h1 : v ∉ a✝
⊢ fastReplaceFree v t (def_ a✝¹ a✝) = def_ a✝¹ a✝

State before:
case def_
v t : VarName
a✝¹ : DefName
a✝ : List VarName
h1 : v ∉ a✝
⊢ fastReplaceFree v t (def_ a✝¹ a✝) = def_ a✝¹ a✝
Tactic:
simp only [fastReplaceFree]
State after:
case def_
v t : VarName
a✝¹ : DefName
a✝ : List VarName
h1 : v ∉ a✝
⊢ def_ a✝¹ (List.map (fun x => if v = x then t else x) a✝) = def_ a✝¹ a✝

State before:
v t : VarName
X : DefName
xs : List VarName
h1 : v ∉ xs
⊢ def_ X (List.map (fun x => if v = x then t else x) xs) = def_ X xs
Tactic:
simp
State after:
v t : VarName
X : DefName
xs : List VarName
h1 : v ∉ xs
⊢ List.map (fun x => if v = x then t else x) xs = xs

State before:
v t : VarName
X : DefName
xs : List VarName
h1 : v ∉ xs
⊢ List.map (fun x => if v = x then t else x) xs = xs
Tactic:
simp only [List.map_eq_self_iff]
State after:
v t : VarName
X : DefName
xs : List VarName
h1 : v ∉ xs
⊢ ∀ x ∈ xs, (if v = x then t else x) = x

State before:
v t : VarName
X : DefName
xs : List VarName
h1 : v ∉ xs
⊢ ∀ x ∈ xs, (if v = x then t else x) = x
Tactic:
simp
State after:
v t : VarName
X : DefName
xs : List VarName
h1 : v ∉ xs
⊢ ∀ x ∈ xs, v = x → t = x

State before:
v t : VarName
X : DefName
xs : List VarName
h1 : v ∉ xs
⊢ ∀ x ∈ xs, v = x → t = x
Tactic:
intro x a1 a2
State after:
v t : VarName
X : DefName
xs : List VarName
h1 : v ∉ xs
x : VarName
a1 : x ∈ xs
a2 : v = x
⊢ t = x

State before:
v t : VarName
X : DefName
xs : List VarName
h1 : v ∉ xs
x : VarName
a1 : x ∈ xs
a2 : v = x
⊢ t = x
Tactic:
subst a2
State after:
v t : VarName
X : DefName
xs : List VarName
h1 : v ∉ xs
a1 : v ∈ xs
⊢ t = v

State before:
v t : VarName
X : DefName
xs : List VarName
h1 : v ∉ xs
a1 : v ∈ xs
⊢ t = v
Tactic:
contradiction
State after:
no goals

State before:
v t x y : VarName
h1 : ¬(v = x ∨ v = y)
⊢ eq_ (if v = x then t else x) (if v = y then t else y) = eq_ x y
Tactic:
simp
State after:
v t x y : VarName
h1 : ¬(v = x ∨ v = y)
⊢ (v = x → t = x) ∧ (v = y → t = y)

State before:
v t x y : VarName
h1 : ¬(v = x ∨ v = y)
⊢ (v = x → t = x) ∧ (v = y → t = y)
Tactic:
tauto
State after:
no goals

State before:
v t : VarName
phi : Formula
phi_ih : ¬isFreeIn v phi → fastReplaceFree v t phi = phi
h1 : ¬isFreeIn v phi
⊢ (fastReplaceFree v t phi).not_ = phi.not_
Tactic:
tauto
State after:
no goals

State before:
v t : VarName
phi psi : Formula
phi_ih : ¬isFreeIn v phi → fastReplaceFree v t phi = phi
psi_ih : ¬isFreeIn v psi → fastReplaceFree v t psi = psi
h1 : ¬(isFreeIn v phi ∨ isFreeIn v psi)
⊢ (fastReplaceFree v t phi).iff_ (fastReplaceFree v t psi) = phi.iff_ psi
Tactic:
simp
State after:
v t : VarName
phi psi : Formula
phi_ih : ¬isFreeIn v phi → fastReplaceFree v t phi = phi
psi_ih : ¬isFreeIn v psi → fastReplaceFree v t psi = psi
h1 : ¬(isFreeIn v phi ∨ isFreeIn v psi)
⊢ fastReplaceFree v t phi = phi ∧ fastReplaceFree v t psi = psi

State before:
v t : VarName
phi psi : Formula
phi_ih : ¬isFreeIn v phi → fastReplaceFree v t phi = phi
psi_ih : ¬isFreeIn v psi → fastReplaceFree v t psi = psi
h1 : ¬(isFreeIn v phi ∨ isFreeIn v psi)
⊢ fastReplaceFree v t phi = phi ∧ fastReplaceFree v t psi = psi
Tactic:
tauto
State after:
no goals

State before:
v t x : VarName
phi : Formula
phi_ih : ¬isFreeIn v phi → fastReplaceFree v t phi = phi
h1 : ¬(¬v = x ∧ isFreeIn v phi)
⊢ (if v = x then exists_ x phi else exists_ x (fastReplaceFree v t phi)) = exists_ x phi
Tactic:
simp
State after:
v t x : VarName
phi : Formula
phi_ih : ¬isFreeIn v phi → fastReplaceFree v t phi = phi
h1 : ¬(¬v = x ∧ isFreeIn v phi)
⊢ ¬v = x → fastReplaceFree v t phi = phi

State before:
v t x : VarName
phi : Formula
phi_ih : ¬isFreeIn v phi → fastReplaceFree v t phi = phi
h1 : ¬(¬v = x ∧ isFreeIn v phi)
⊢ ¬v = x → fastReplaceFree v t phi = phi
Tactic:
tauto
State after:
no goals