Theorem: PFunctor.M.agree_iff_agree'
File: Mathlib/Data/PFunctor/Univariate/M.lean

tactic: constructor <;> intro h
state_before: F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x y : M F
⊢ Agree (MIntl.approx x n) (MIntl.approx y (n + 1)) ↔ Agree' n x y

tactic: induction' n with _ n_ih generalizing x y
state_before: case mp
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x y : M F
h : Agree (MIntl.approx x n) (MIntl.approx y (n + 1))
⊢ Agree' n x y

tactic: constructor
state_before: case mp.zero
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h✝ : Agree (MIntl.approx x✝ n) (MIntl.approx y✝ (n + 1))
x y : M F
h : Agree (MIntl.approx x zero) (MIntl.approx y (zero + 1))
⊢ Agree' zero x y

case mp.succ
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h✝ : Agree (MIntl.approx x✝ n) (MIntl.approx y✝ (n + 1))
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1)) → Agree' n✝ x y
x y : M F
h : Agree (MIntl.approx x (succ n✝)) (MIntl.approx y (succ n✝ + 1))
⊢ Agree' (succ n✝) x y

tactic: induction x using PFunctor.M.casesOn'
state_before: case mp.succ
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h✝ : Agree (MIntl.approx x✝ n) (MIntl.approx y✝ (n + 1))
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1)) → Agree' n✝ x y
x y : M F
h : Agree (MIntl.approx x (succ n✝)) (MIntl.approx y (succ n✝ + 1))
⊢ Agree' (succ n✝) x y

tactic: induction y using PFunctor.M.casesOn'
state_before: case mp.succ.f
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x y✝ : M F
h✝ : Agree (MIntl.approx x n) (MIntl.approx y✝ (n + 1))
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1)) → Agree' n✝ x y
y : M F
a✝ : F.A
f✝ : B F a✝ → M F
h : Agree (MIntl.approx (M.mk { fst := a✝, snd := f✝ }) (succ n✝)) (MIntl.approx y (succ n✝ + 1))
⊢ Agree' (succ n✝) (M.mk { fst := a✝, snd := f✝ }) y

tactic: simp only [approx_mk] at h
state_before: case mp.succ.f.f
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x y : M F
h✝ : Agree (MIntl.approx x n) (MIntl.approx y (n + 1))
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1)) → Agree' n✝ x y
a✝¹ : F.A
f✝¹ : B F a✝¹ → M F
a✝ : F.A
f✝ : B F a✝ → M F
h :
  Agree (MIntl.approx (M.mk { fst := a✝¹, snd := f✝¹ }) (succ n✝))
    (MIntl.approx (M.mk { fst := a✝, snd := f✝ }) (succ n✝ + 1))
⊢ Agree' (succ n✝) (M.mk { fst := a✝¹, snd := f✝¹ }) (M.mk { fst := a✝, snd := f✝ })

tactic: cases' h with _ _ _ _ _ _ hagree
state_before: case mp.succ.f.f
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x y : M F
h✝ : Agree (MIntl.approx x n) (MIntl.approx y (n + 1))
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1)) → Agree' n✝ x y
a✝¹ : F.A
f✝¹ : B F a✝¹ → M F
a✝ : F.A
f✝ : B F a✝ → M F
h : Agree (CofixA.intro a✝¹ fun j => MIntl.approx (f✝¹ j) n✝) (CofixA.intro a✝ fun j => MIntl.approx (f✝ j) (n✝ + 1))
⊢ Agree' (succ n✝) (M.mk { fst := a✝¹, snd := f✝¹ }) (M.mk { fst := a✝, snd := f✝ })

tactic: constructor <;> try rfl
state_before: case mp.succ.f.f.intro
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x y : M F
h : Agree (MIntl.approx x n) (MIntl.approx y (n + 1))
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1)) → Agree' n✝ x y
a✝ : F.A
f✝¹ f✝ : B F a✝ → M F
hagree : ∀ (i : B F a✝), Agree ((fun j => MIntl.approx (f✝¹ j) n✝) i) ((fun j => MIntl.approx (f✝ j) (n✝ + 1)) i)
⊢ Agree' (succ n✝) (M.mk { fst := a✝, snd := f✝¹ }) (M.mk { fst := a✝, snd := f✝ })

tactic: intro i
state_before: case mp.succ.f.f.intro.a
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x y : M F
h : Agree (MIntl.approx x n) (MIntl.approx y (n + 1))
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1)) → Agree' n✝ x y
a✝ : F.A
f✝¹ f✝ : B F a✝ → M F
hagree : ∀ (i : B F a✝), Agree ((fun j => MIntl.approx (f✝¹ j) n✝) i) ((fun j => MIntl.approx (f✝ j) (n✝ + 1)) i)
⊢ ∀ (i : B F a✝), Agree' n✝ (f✝¹ i) (f✝ i)

tactic: apply n_ih
state_before: case mp.succ.f.f.intro.a
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x y : M F
h : Agree (MIntl.approx x n) (MIntl.approx y (n + 1))
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1)) → Agree' n✝ x y
a✝ : F.A
f✝¹ f✝ : B F a✝ → M F
hagree : ∀ (i : B F a✝), Agree ((fun j => MIntl.approx (f✝¹ j) n✝) i) ((fun j => MIntl.approx (f✝ j) (n✝ + 1)) i)
i : B F a✝
⊢ Agree' n✝ (f✝¹ i) (f✝ i)

tactic: apply hagree
state_before: case mp.succ.f.f.intro.a.h
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x y : M F
h : Agree (MIntl.approx x n) (MIntl.approx y (n + 1))
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1)) → Agree' n✝ x y
a✝ : F.A
f✝¹ f✝ : B F a✝ → M F
hagree : ∀ (i : B F a✝), Agree ((fun j => MIntl.approx (f✝¹ j) n✝) i) ((fun j => MIntl.approx (f✝ j) (n✝ + 1)) i)
i : B F a✝
⊢ Agree (MIntl.approx (f✝¹ i) n✝) (MIntl.approx (f✝ i) (n✝ + 1))

tactic: rfl
state_before: case mp.succ.f.f.intro.a
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x y : M F
h : Agree (MIntl.approx x n) (MIntl.approx y (n + 1))
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1)) → Agree' n✝ x y
a✝ : F.A
f✝¹ f✝ : B F a✝ → M F
hagree : ∀ (i : B F a✝), Agree ((fun j => MIntl.approx (f✝¹ j) n✝) i) ((fun j => MIntl.approx (f✝ j) (n✝ + 1)) i)
⊢ ∀ (i : B F a✝), Agree' n✝ (f✝¹ i) (f✝ i)

tactic: induction' n with _ n_ih generalizing x y
state_before: case mpr
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x y : M F
h : Agree' n x y
⊢ Agree (MIntl.approx x n) (MIntl.approx y (n + 1))

tactic: constructor
state_before: case mpr.zero
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h✝ : Agree' n x✝ y✝
x y : M F
h : Agree' zero x y
⊢ Agree (MIntl.approx x zero) (MIntl.approx y (zero + 1))

case mpr.succ
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h✝ : Agree' n x✝ y✝
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree' n✝ x y → Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1))
x y : M F
h : Agree' (succ n✝) x y
⊢ Agree (MIntl.approx x (succ n✝)) (MIntl.approx y (succ n✝ + 1))

tactic: cases' h with _ _ _ a x' y'
state_before: case mpr.succ
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h✝ : Agree' n x✝ y✝
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree' n✝ x y → Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1))
x y : M F
h : Agree' (succ n✝) x y
⊢ Agree (MIntl.approx x (succ n✝)) (MIntl.approx y (succ n✝ + 1))

tactic: induction' x using PFunctor.M.casesOn' with x_a x_f
state_before: case mpr.succ.step
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h : Agree' n x✝ y✝
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree' n✝ x y → Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1))
x y : M F
a : F.A
x' y' : B F a → M F
a✝² : ∀ (i : B F a), Agree' n✝ (x' i) (y' i)
a✝¹ : x = M.mk { fst := a, snd := x' }
a✝ : y = M.mk { fst := a, snd := y' }
⊢ Agree (MIntl.approx x (succ n✝)) (MIntl.approx y (succ n✝ + 1))

tactic: induction' y using PFunctor.M.casesOn' with y_a y_f
state_before: case mpr.succ.step.f
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h : Agree' n x✝ y✝
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree' n✝ x y → Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1))
x y : M F
a : F.A
x' y' : B F a → M F
a✝³ : ∀ (i : B F a), Agree' n✝ (x' i) (y' i)
a✝² : x = M.mk { fst := a, snd := x' }
a✝¹ : y = M.mk { fst := a, snd := y' }
x_a : F.A
x_f : B F x_a → M F
a✝ : M.mk { fst := x_a, snd := x_f } = M.mk { fst := a, snd := x' }
⊢ Agree (MIntl.approx (M.mk { fst := x_a, snd := x_f }) (succ n✝)) (MIntl.approx y (succ n✝ + 1))

tactic: simp only [approx_mk]
state_before: case mpr.succ.step.f.f
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h : Agree' n x✝ y✝
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree' n✝ x y → Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1))
x y : M F
a : F.A
x' y' : B F a → M F
a✝⁴ : ∀ (i : B F a), Agree' n✝ (x' i) (y' i)
a✝³ : x = M.mk { fst := a, snd := x' }
a✝² : y = M.mk { fst := a, snd := y' }
x_a : F.A
x_f : B F x_a → M F
a✝¹ : M.mk { fst := x_a, snd := x_f } = M.mk { fst := a, snd := x' }
y_a : F.A
y_f : B F y_a → M F
a✝ : M.mk { fst := y_a, snd := y_f } = M.mk { fst := a, snd := y' }
⊢ Agree (MIntl.approx (M.mk { fst := x_a, snd := x_f }) (succ n✝))
    (MIntl.approx (M.mk { fst := y_a, snd := y_f }) (succ n✝ + 1))

tactic: have h_a_1 := mk_inj ‹M.mk ⟨x_a, x_f⟩ = M.mk ⟨a, x'⟩›
state_before: case mpr.succ.step.f.f
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h : Agree' n x✝ y✝
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree' n✝ x y → Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1))
x y : M F
a : F.A
x' y' : B F a → M F
a✝⁴ : ∀ (i : B F a), Agree' n✝ (x' i) (y' i)
a✝³ : x = M.mk { fst := a, snd := x' }
a✝² : y = M.mk { fst := a, snd := y' }
x_a : F.A
x_f : B F x_a → M F
a✝¹ : M.mk { fst := x_a, snd := x_f } = M.mk { fst := a, snd := x' }
y_a : F.A
y_f : B F y_a → M F
a✝ : M.mk { fst := y_a, snd := y_f } = M.mk { fst := a, snd := y' }
⊢ Agree (CofixA.intro x_a fun j => MIntl.approx (x_f j) n✝) (CofixA.intro y_a fun j => MIntl.approx (y_f j) (n✝ + 1))

tactic: cases h_a_1
state_before: case mpr.succ.step.f.f
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h : Agree' n x✝ y✝
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree' n✝ x y → Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1))
x y : M F
a : F.A
x' y' : B F a → M F
a✝⁴ : ∀ (i : B F a), Agree' n✝ (x' i) (y' i)
a✝³ : x = M.mk { fst := a, snd := x' }
a✝² : y = M.mk { fst := a, snd := y' }
x_a : F.A
x_f : B F x_a → M F
a✝¹ : M.mk { fst := x_a, snd := x_f } = M.mk { fst := a, snd := x' }
y_a : F.A
y_f : B F y_a → M F
a✝ : M.mk { fst := y_a, snd := y_f } = M.mk { fst := a, snd := y' }
h_a_1 : { fst := x_a, snd := x_f } = { fst := a, snd := x' }
⊢ Agree (CofixA.intro x_a fun j => MIntl.approx (x_f j) n✝) (CofixA.intro y_a fun j => MIntl.approx (y_f j) (n✝ + 1))

tactic: replace h_a_2 := mk_inj ‹M.mk ⟨y_a, y_f⟩ = M.mk ⟨a, y'⟩›
state_before: case mpr.succ.step.f.f.refl
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h : Agree' n x✝ y✝
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree' n✝ x y → Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1))
x y : M F
a : F.A
x' y' : B F a → M F
a✝⁴ : ∀ (i : B F a), Agree' n✝ (x' i) (y' i)
a✝³ : x = M.mk { fst := a, snd := x' }
a✝² : y = M.mk { fst := a, snd := y' }
y_a : F.A
y_f : B F y_a → M F
a✝¹ : M.mk { fst := y_a, snd := y_f } = M.mk { fst := a, snd := y' }
a✝ : M.mk { fst := a, snd := x' } = M.mk { fst := a, snd := x' }
⊢ Agree (CofixA.intro a fun j => MIntl.approx (x' j) n✝) (CofixA.intro y_a fun j => MIntl.approx (y_f j) (n✝ + 1))

tactic: cases h_a_2
state_before: case mpr.succ.step.f.f.refl
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h : Agree' n x✝ y✝
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree' n✝ x y → Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1))
x y : M F
a : F.A
x' y' : B F a → M F
a✝⁴ : ∀ (i : B F a), Agree' n✝ (x' i) (y' i)
a✝³ : x = M.mk { fst := a, snd := x' }
a✝² : y = M.mk { fst := a, snd := y' }
y_a : F.A
y_f : B F y_a → M F
a✝¹ : M.mk { fst := y_a, snd := y_f } = M.mk { fst := a, snd := y' }
a✝ : M.mk { fst := a, snd := x' } = M.mk { fst := a, snd := x' }
h_a_2 : { fst := y_a, snd := y_f } = { fst := a, snd := y' }
⊢ Agree (CofixA.intro a fun j => MIntl.approx (x' j) n✝) (CofixA.intro y_a fun j => MIntl.approx (y_f j) (n✝ + 1))

tactic: constructor
state_before: case mpr.succ.step.f.f.refl.refl
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h : Agree' n x✝ y✝
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree' n✝ x y → Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1))
x y : M F
a : F.A
x' y' : B F a → M F
a✝⁴ : ∀ (i : B F a), Agree' n✝ (x' i) (y' i)
a✝³ : x = M.mk { fst := a, snd := x' }
a✝² : y = M.mk { fst := a, snd := y' }
a✝¹ : M.mk { fst := a, snd := x' } = M.mk { fst := a, snd := x' }
a✝ : M.mk { fst := a, snd := y' } = M.mk { fst := a, snd := y' }
⊢ Agree (CofixA.intro a fun j => MIntl.approx (x' j) n✝) (CofixA.intro a fun j => MIntl.approx (y' j) (n✝ + 1))

tactic: intro i
state_before: case mpr.succ.step.f.f.refl.refl.a
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h : Agree' n x✝ y✝
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree' n✝ x y → Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1))
x y : M F
a : F.A
x' y' : B F a → M F
a✝⁴ : ∀ (i : B F a), Agree' n✝ (x' i) (y' i)
a✝³ : x = M.mk { fst := a, snd := x' }
a✝² : y = M.mk { fst := a, snd := y' }
a✝¹ : M.mk { fst := a, snd := x' } = M.mk { fst := a, snd := x' }
a✝ : M.mk { fst := a, snd := y' } = M.mk { fst := a, snd := y' }
⊢ ∀ (i : B F a), Agree (MIntl.approx (x' i) n✝) (MIntl.approx (y' i) (n✝ + 1))

tactic: apply n_ih
state_before: case mpr.succ.step.f.f.refl.refl.a
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h : Agree' n x✝ y✝
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree' n✝ x y → Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1))
x y : M F
a : F.A
x' y' : B F a → M F
a✝⁴ : ∀ (i : B F a), Agree' n✝ (x' i) (y' i)
a✝³ : x = M.mk { fst := a, snd := x' }
a✝² : y = M.mk { fst := a, snd := y' }
a✝¹ : M.mk { fst := a, snd := x' } = M.mk { fst := a, snd := x' }
a✝ : M.mk { fst := a, snd := y' } = M.mk { fst := a, snd := y' }
i : B F a
⊢ Agree (MIntl.approx (x' i) n✝) (MIntl.approx (y' i) (n✝ + 1))

tactic: simp [*]
state_before: case mpr.succ.step.f.f.refl.refl.a.h
F : PFunctor
X : Type ?u.17090
f : X → Obj F X
n : ℕ
x✝ y✝ : M F
h : Agree' n x✝ y✝
n✝ : ℕ
n_ih : ∀ (x y : M F), Agree' n✝ x y → Agree (MIntl.approx x n✝) (MIntl.approx y (n✝ + 1))
x y : M F
a : F.A
x' y' : B F a → M F
a✝⁴ : ∀ (i : B F a), Agree' n✝ (x' i) (y' i)
a✝³ : x = M.mk { fst := a, snd := x' }
a✝² : y = M.mk { fst := a, snd := y' }
a✝¹ : M.mk { fst := a, snd := x' } = M.mk { fst := a, snd := x' }
a✝ : M.mk { fst := a, snd := y' } = M.mk { fst := a, snd := y' }
i : B F a
⊢ Agree' n✝ (x' i) (y' i)