definition h_congr₃ (x₁ x₂ : nat) (e : x₁ = x₂) (H₁ : p x₁) (H₂ : q x₁ H₁) (H₃ : r x₁ H₁ H₂) :
h₂ x₁ H₁ H₂ H₃ = h₂ x₂ (eq.rec_on e H₁) (eq.drec_on e H₂) (eq.drec_on e H₃) :=
begin
congruence,
apply e
end
-- print h_congr₃
-- exit
set_option pp.all true
print h_congr₂
#congr h
exit
set_option pp.all true
print h_congr
#congr h
end
exit
variables g : Π (A : Type) (x y : A) (B : Type) (z : B), x = y → y == z → nat
#congr g
exit
lemma f_congr
(x₁ x₂ : nat) (e₁ : x₁ = x₂)
(y₁ y₂ : nat) (e₂ : y₁ = y₂)
(H₁ : p x₁)
(H₂ : q x₁ y₁) :
f x₁ y₁ H₁ H₂ =
f x₂ y₂ (@eq.rec_on nat x₁ (λ (a : ℕ), p a) x₂ e₁ H₁)
(@eq.rec_on nat x₁ (λ (a : ℕ), q a y₂) x₂ e₁ (@eq.rec_on nat y₁ (λ (a : ℕ), q x₁ a) y₂ e₂ H₂)) :=
let R := (eq.refl (f x₁ y₁ (@eq.rec_on nat x₁ (λ (a : ℕ), p a) x₁ (eq.refl x₁) H₁) (@eq.rec_on nat x₁ (λ (a : ℕ), q a y₁) x₁ (eq.refl x₁) (@eq.rec_on nat y₁ (λ (a : ℕ), q x₁ a) y₁ (eq.refl y₁) H₂)))) in
@eq.drec_on nat x₁
(λ (z : ℕ) (H : x₁ = z),
f x₁ y₁ H₁ H₂ =
f z y₂ (@eq.rec_on nat x₁ (λ a, p a) z H H₁)
(@eq.rec_on nat x₁ (λ a, q a y₂) z H (@eq.rec_on nat y₁ (λ a, q x₁ a) y₂ e₂ H₂)))
x₂ e₁
(@eq.drec_on nat y₁
(λ (z : ℕ) (H : y₁ = z),
f x₁ y₁ H₁ H₂ =
f x₁ z (@eq.rec_on nat x₁ (λ a, p a) x₁ (eq.refl x₁) H₁)
(@eq.rec_on nat x₁ (λ a, q a z) x₁ (eq.refl x₁) (@eq.rec_on nat y₁ (λ a, q x₁ a) z H H₂)))
y₂ e₂ R)
/-
f x₁ y₁ H₁ H₂ =
f x₁ y₂ (@eq.rec_on nat x₁ (λ a, p a) x₁ (eq.refl x₁) H₁)
(@eq.rec_on nat x₁ (λ a, q a y₂) x₁ (eq.refl x₁) (@eq.rec_on nat y₁ (λ a, q x₁ a) y₂ e₂ H₂)))