blob: 024cd45fae1bb905dcf6a9673c7d0bfcb087c808 [file]
theorem ex2 : ∀ (x : Nat), (if x = 0 ∧ True then x + 1 else 2 + x) = if x = 0 then 1 else x + 2 :=
fun x =>
of_eq_true
(Eq.trans
(congrFun'
(congrArg Eq
(ite_congr (and_true (x = 0)) (fun a => Eq.trans (congrFun' (congrArg HAdd.hAdd a) 1) (Nat.zero_add 1))
fun a => Nat.add_comm 2 x))
(if x = 0 then 1 else x + 2))
(eq_self (if x = 0 then 1 else x + 2)))
theorem ex3 : ∀ (x : Nat), (if h : x = 0 ∧ True then x + 1 else 2 + x) = if h : x = 0 then 1 + x else x + 2 :=
fun x =>
of_eq_true
(Eq.trans
(congr (congrArg Eq (dite_congr (and_true (x = 0)) (fun h => Eq.refl (x + 1)) fun h => Nat.add_comm 2 x))
(dite_congr (Eq.refl (x = 0)) (fun h => Nat.add_comm 1 x) fun h => Eq.refl (x + 2)))
(eq_self (if x = 0 then x + 1 else x + 2)))