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

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

case pred_var_
v : VarName
a✝¹ : PredName
a✝ : List VarName
⊢ fastReplaceFree v v (pred_var_ a✝¹ a✝) = pred_var_ a✝¹ a✝

case eq_
v a✝¹ a✝ : VarName
⊢ fastReplaceFree v v (eq_ a✝¹ a✝) = eq_ a✝¹ a✝

case true_
v : VarName
⊢ fastReplaceFree v v true_ = true_

case false_
v : VarName
⊢ fastReplaceFree v v false_ = false_

case not_
v : VarName
a✝ : Formula
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ fastReplaceFree v v a✝.not_ = a✝.not_

case imp_
v : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : fastReplaceFree v v a✝¹ = a✝¹
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ fastReplaceFree v v (a✝¹.imp_ a✝) = a✝¹.imp_ a✝

case and_
v : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : fastReplaceFree v v a✝¹ = a✝¹
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ fastReplaceFree v v (a✝¹.and_ a✝) = a✝¹.and_ a✝

case or_
v : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : fastReplaceFree v v a✝¹ = a✝¹
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ fastReplaceFree v v (a✝¹.or_ a✝) = a✝¹.or_ a✝

case iff_
v : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : fastReplaceFree v v a✝¹ = a✝¹
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ fastReplaceFree v v (a✝¹.iff_ a✝) = a✝¹.iff_ a✝

case forall_
v a✝¹ : VarName
a✝ : Formula
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ fastReplaceFree v v (forall_ a✝¹ a✝) = forall_ a✝¹ a✝

case exists_
v a✝¹ : VarName
a✝ : Formula
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ fastReplaceFree v v (exists_ a✝¹ a✝) = exists_ a✝¹ a✝

case def_
v : VarName
a✝¹ : DefName
a✝ : List VarName
⊢ fastReplaceFree v v (def_ a✝¹ a✝) = def_ a✝¹ a✝

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

case pred_var_
v : VarName
a✝¹ : PredName
a✝ : List VarName
⊢ fastReplaceFree v v (pred_var_ a✝¹ a✝) = pred_var_ a✝¹ a✝

case eq_
v a✝¹ a✝ : VarName
⊢ fastReplaceFree v v (eq_ a✝¹ a✝) = eq_ a✝¹ a✝

case true_
v : VarName
⊢ fastReplaceFree v v true_ = true_

case false_
v : VarName
⊢ fastReplaceFree v v false_ = false_

case not_
v : VarName
a✝ : Formula
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ fastReplaceFree v v a✝.not_ = a✝.not_

case imp_
v : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : fastReplaceFree v v a✝¹ = a✝¹
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ fastReplaceFree v v (a✝¹.imp_ a✝) = a✝¹.imp_ a✝

case and_
v : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : fastReplaceFree v v a✝¹ = a✝¹
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ fastReplaceFree v v (a✝¹.and_ a✝) = a✝¹.and_ a✝

case or_
v : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : fastReplaceFree v v a✝¹ = a✝¹
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ fastReplaceFree v v (a✝¹.or_ a✝) = a✝¹.or_ a✝

case iff_
v : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : fastReplaceFree v v a✝¹ = a✝¹
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ fastReplaceFree v v (a✝¹.iff_ a✝) = a✝¹.iff_ a✝

case forall_
v a✝¹ : VarName
a✝ : Formula
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ fastReplaceFree v v (forall_ a✝¹ a✝) = forall_ a✝¹ a✝

case exists_
v a✝¹ : VarName
a✝ : Formula
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ fastReplaceFree v v (exists_ a✝¹ a✝) = exists_ a✝¹ a✝

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

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

case eq_
v a✝¹ a✝ : VarName
⊢ eq_ (if v = a✝¹ then v else a✝¹) (if v = a✝ then v else a✝) = eq_ a✝¹ a✝

case not_
v : VarName
a✝ : Formula
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ (fastReplaceFree v v a✝).not_ = a✝.not_

case imp_
v : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : fastReplaceFree v v a✝¹ = a✝¹
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ (fastReplaceFree v v a✝¹).imp_ (fastReplaceFree v v a✝) = a✝¹.imp_ a✝

case and_
v : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : fastReplaceFree v v a✝¹ = a✝¹
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ (fastReplaceFree v v a✝¹).and_ (fastReplaceFree v v a✝) = a✝¹.and_ a✝

case or_
v : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : fastReplaceFree v v a✝¹ = a✝¹
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ (fastReplaceFree v v a✝¹).or_ (fastReplaceFree v v a✝) = a✝¹.or_ a✝

case iff_
v : VarName
a✝¹ a✝ : Formula
a_ih✝¹ : fastReplaceFree v v a✝¹ = a✝¹
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ (fastReplaceFree v v a✝¹).iff_ (fastReplaceFree v v a✝) = a✝¹.iff_ a✝

case forall_
v a✝¹ : VarName
a✝ : Formula
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ (if v = a✝¹ then forall_ a✝¹ a✝ else forall_ a✝¹ (fastReplaceFree v v a✝)) = forall_ a✝¹ a✝

case exists_
v a✝¹ : VarName
a✝ : Formula
a_ih✝ : fastReplaceFree v v a✝ = a✝
⊢ (if v = a✝¹ then exists_ a✝¹ a✝ else exists_ a✝¹ (fastReplaceFree v v a✝)) = exists_ a✝¹ a✝

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

State before:
v : VarName
X : DefName
xs : List VarName
⊢ def_ X (List.map (fun x => if v = x then v 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
State after:
no goals

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

State before:
v : VarName
phi : Formula
phi_ih : fastReplaceFree v v phi = phi
⊢ (fastReplaceFree v v phi).not_ = phi.not_
Tactic:
case not_ phi phi_ih =>
  congr!
State after:
no goals

State before:
v : VarName
phi psi : Formula
phi_ih : fastReplaceFree v v phi = phi
psi_ih : fastReplaceFree v v psi = psi
⊢ (fastReplaceFree v v phi).iff_ (fastReplaceFree v v 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 =>
  congr!
State after:
no goals

State before:
v x : VarName
phi : Formula
phi_ih : fastReplaceFree v v phi = phi
⊢ (if v = x then exists_ x phi else exists_ x (fastReplaceFree v v phi)) = exists_ x phi
Tactic:
case forall_ x phi phi_ih | exists_ x phi phi_ih =>
  simp
  intro _
  exact phi_ih
State after:
no goals

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

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

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

State before:
v : VarName
X : DefName
xs : List VarName
⊢ ∀ x ∈ xs, (if v = x then v else x) = x
Tactic:
simp
State after:
no goals

State before:
v x y : VarName
⊢ eq_ (if v = x then v else x) (if v = y then v else y) = eq_ x y
Tactic:
simp
State after:
no goals

State before:
v : VarName
phi : Formula
phi_ih : fastReplaceFree v v phi = phi
⊢ (fastReplaceFree v v phi).not_ = phi.not_
Tactic:
congr!
State after:
no goals

State before:
v : VarName
phi psi : Formula
phi_ih : fastReplaceFree v v phi = phi
psi_ih : fastReplaceFree v v psi = psi
⊢ (fastReplaceFree v v phi).iff_ (fastReplaceFree v v psi) = phi.iff_ psi
Tactic:
congr!
State after:
no goals

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

State before:
v x : VarName
phi : Formula
phi_ih : fastReplaceFree v v phi = phi
⊢ ¬v = x → fastReplaceFree v v phi = phi
Tactic:
intro _
State after:
v x : VarName
phi : Formula
phi_ih : fastReplaceFree v v phi = phi
a✝ : ¬v = x
⊢ fastReplaceFree v v phi = phi

State before:
v x : VarName
phi : Formula
phi_ih : fastReplaceFree v v phi = phi
a✝ : ¬v = x
⊢ fastReplaceFree v v phi = phi
Tactic:
exact phi_ih
State after:
no goals