Theorem: PFunctor.M.iselect_eq_default
File: Mathlib/Data/PFunctor/Univariate/M.lean

tactic: induction' ps with ps_hd ps_tail ps_ih generalizing x
state_before: F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x : M F
h : ¬IsPath ps x
⊢ iselect ps x = head default

tactic: exfalso
state_before: case nil
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝ : ¬IsPath ps x✝
x : M F
h : ¬IsPath [] x
⊢ iselect [] x = head default

tactic: apply h
state_before: case nil.h
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝ : ¬IsPath ps x✝
x : M F
h : ¬IsPath [] x
⊢ False

tactic: constructor
state_before: case nil.h
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝ : ¬IsPath ps x✝
x : M F
h : ¬IsPath [] x
⊢ IsPath [] x

tactic: cases' ps_hd with a i
state_before: case cons
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝ : ¬IsPath ps x✝
ps_hd : IdxCat F
ps_tail : List (IdxCat F)
ps_ih : ∀ (x : M F), ¬IsPath ps_tail x → iselect ps_tail x = head default
x : M F
h : ¬IsPath (ps_hd :: ps_tail) x
⊢ iselect (ps_hd :: ps_tail) x = head default

tactic: induction' x using PFunctor.M.casesOn' with x_a x_f
state_before: case cons.mk
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝ : ¬IsPath ps x✝
ps_tail : List (IdxCat F)
ps_ih : ∀ (x : M F), ¬IsPath ps_tail x → iselect ps_tail x = head default
x : M F
a : F.A
i : B F a
h : ¬IsPath ({ fst := a, snd := i } :: ps_tail) x
⊢ iselect ({ fst := a, snd := i } :: ps_tail) x = head default

tactic: simp only [iselect, isubtree] at ps_ih⊢
state_before: case cons.mk.f
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝¹ : ¬IsPath ps x✝
ps_tail : List (IdxCat F)
ps_ih : ∀ (x : M F), ¬IsPath ps_tail x → iselect ps_tail x = head default
x : M F
a : F.A
i : B F a
h✝ : ¬IsPath ({ fst := a, snd := i } :: ps_tail) x
x_a : F.A
x_f : B F x_a → M F
h : ¬IsPath ({ fst := a, snd := i } :: ps_tail) (M.mk { fst := x_a, snd := x_f })
⊢ iselect ({ fst := a, snd := i } :: ps_tail) (M.mk { fst := x_a, snd := x_f }) = head default

tactic: by_cases h'' : a = x_a
state_before: case cons.mk.f
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝¹ : ¬IsPath ps x✝
ps_tail : List (IdxCat F)
ps_ih : ∀ (x : M F), ¬IsPath ps_tail x → head (isubtree ps_tail x) = head default
x : M F
a : F.A
i : B F a
h✝ : ¬IsPath ({ fst := a, snd := i } :: ps_tail) x
x_a : F.A
x_f : B F x_a → M F
h : ¬IsPath ({ fst := a, snd := i } :: ps_tail) (M.mk { fst := x_a, snd := x_f })
⊢ head
      (M.casesOn' (M.mk { fst := x_a, snd := x_f }) fun a' f =>
        if h : a = a' then isubtree ps_tail (f (cast (_ : B F a = B F a') i)) else default) =
    head default

tactic: subst x_a
state_before: case pos
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝¹ : ¬IsPath ps x✝
ps_tail : List (IdxCat F)
ps_ih : ∀ (x : M F), ¬IsPath ps_tail x → head (isubtree ps_tail x) = head default
x : M F
a : F.A
i : B F a
h✝ : ¬IsPath ({ fst := a, snd := i } :: ps_tail) x
x_a : F.A
x_f : B F x_a → M F
h : ¬IsPath ({ fst := a, snd := i } :: ps_tail) (M.mk { fst := x_a, snd := x_f })
h'' : a = x_a
⊢ head
      (M.casesOn' (M.mk { fst := x_a, snd := x_f }) fun a' f =>
        if h : a = a' then isubtree ps_tail (f (cast (_ : B F a = B F a') i)) else default) =
    head default

case neg
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝¹ : ¬IsPath ps x✝
ps_tail : List (IdxCat F)
ps_ih : ∀ (x : M F), ¬IsPath ps_tail x → head (isubtree ps_tail x) = head default
x : M F
a : F.A
i : B F a
h✝ : ¬IsPath ({ fst := a, snd := i } :: ps_tail) x
x_a : F.A
x_f : B F x_a → M F
h : ¬IsPath ({ fst := a, snd := i } :: ps_tail) (M.mk { fst := x_a, snd := x_f })
h'' : ¬a = x_a
⊢ head
      (M.casesOn' (M.mk { fst := x_a, snd := x_f }) fun a' f =>
        if h : a = a' then isubtree ps_tail (f (cast (_ : B F a = B F a') i)) else default) =
    head default

tactic: simp only [dif_pos, eq_self_iff_true, casesOn_mk']
state_before: case pos
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝¹ : ¬IsPath ps x✝
ps_tail : List (IdxCat F)
ps_ih : ∀ (x : M F), ¬IsPath ps_tail x → head (isubtree ps_tail x) = head default
x : M F
a : F.A
i : B F a
h✝ : ¬IsPath ({ fst := a, snd := i } :: ps_tail) x
x_f : B F a → M F
h : ¬IsPath ({ fst := a, snd := i } :: ps_tail) (M.mk { fst := a, snd := x_f })
⊢ head
      (M.casesOn' (M.mk { fst := a, snd := x_f }) fun a' f =>
        if h : a = a' then isubtree ps_tail (f (cast (_ : B F a = B F a') i)) else default) =
    head default

tactic: rw [ps_ih]
state_before: case pos
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝¹ : ¬IsPath ps x✝
ps_tail : List (IdxCat F)
ps_ih : ∀ (x : M F), ¬IsPath ps_tail x → head (isubtree ps_tail x) = head default
x : M F
a : F.A
i : B F a
h✝ : ¬IsPath ({ fst := a, snd := i } :: ps_tail) x
x_f : B F a → M F
h : ¬IsPath ({ fst := a, snd := i } :: ps_tail) (M.mk { fst := a, snd := x_f })
⊢ head (isubtree ps_tail (x_f (cast (_ : B F a = B F a) i))) = head default

tactic: intro h'
state_before: case pos.h
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝¹ : ¬IsPath ps x✝
ps_tail : List (IdxCat F)
ps_ih : ∀ (x : M F), ¬IsPath ps_tail x → head (isubtree ps_tail x) = head default
x : M F
a : F.A
i : B F a
h✝ : ¬IsPath ({ fst := a, snd := i } :: ps_tail) x
x_f : B F a → M F
h : ¬IsPath ({ fst := a, snd := i } :: ps_tail) (M.mk { fst := a, snd := x_f })
⊢ ¬IsPath ps_tail (x_f (cast (_ : B F a = B F a) i))

tactic: apply h
state_before: case pos.h
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝¹ : ¬IsPath ps x✝
ps_tail : List (IdxCat F)
ps_ih : ∀ (x : M F), ¬IsPath ps_tail x → head (isubtree ps_tail x) = head default
x : M F
a : F.A
i : B F a
h✝ : ¬IsPath ({ fst := a, snd := i } :: ps_tail) x
x_f : B F a → M F
h : ¬IsPath ({ fst := a, snd := i } :: ps_tail) (M.mk { fst := a, snd := x_f })
h' : IsPath ps_tail (x_f (cast (_ : B F a = B F a) i))
⊢ False

tactic: constructor <;> try rfl
state_before: case pos.h
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝¹ : ¬IsPath ps x✝
ps_tail : List (IdxCat F)
ps_ih : ∀ (x : M F), ¬IsPath ps_tail x → head (isubtree ps_tail x) = head default
x : M F
a : F.A
i : B F a
h✝ : ¬IsPath ({ fst := a, snd := i } :: ps_tail) x
x_f : B F a → M F
h : ¬IsPath ({ fst := a, snd := i } :: ps_tail) (M.mk { fst := a, snd := x_f })
h' : IsPath ps_tail (x_f (cast (_ : B F a = B F a) i))
⊢ IsPath ({ fst := a, snd := i } :: ps_tail) (M.mk { fst := a, snd := x_f })

tactic: apply h'
state_before: case pos.h.a
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝¹ : ¬IsPath ps x✝
ps_tail : List (IdxCat F)
ps_ih : ∀ (x : M F), ¬IsPath ps_tail x → head (isubtree ps_tail x) = head default
x : M F
a : F.A
i : B F a
h✝ : ¬IsPath ({ fst := a, snd := i } :: ps_tail) x
x_f : B F a → M F
h : ¬IsPath ({ fst := a, snd := i } :: ps_tail) (M.mk { fst := a, snd := x_f })
h' : IsPath ps_tail (x_f (cast (_ : B F a = B F a) i))
⊢ IsPath ps_tail (x_f i)

tactic: rfl
state_before: case pos.h.a
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝¹ : ¬IsPath ps x✝
ps_tail : List (IdxCat F)
ps_ih : ∀ (x : M F), ¬IsPath ps_tail x → head (isubtree ps_tail x) = head default
x : M F
a : F.A
i : B F a
h✝ : ¬IsPath ({ fst := a, snd := i } :: ps_tail) x
x_f : B F a → M F
h : ¬IsPath ({ fst := a, snd := i } :: ps_tail) (M.mk { fst := a, snd := x_f })
h' : IsPath ps_tail (x_f (cast (_ : B F a = B F a) i))
⊢ IsPath ps_tail (x_f i)

tactic: simp [*]
state_before: case neg
F : PFunctor
X : Type ?u.22988
f : X → Obj F X
inst✝¹ : DecidableEq F.A
inst✝ : Inhabited (M F)
ps : Path F
x✝ : M F
h✝¹ : ¬IsPath ps x✝
ps_tail : List (IdxCat F)
ps_ih : ∀ (x : M F), ¬IsPath ps_tail x → head (isubtree ps_tail x) = head default
x : M F
a : F.A
i : B F a
h✝ : ¬IsPath ({ fst := a, snd := i } :: ps_tail) x
x_a : F.A
x_f : B F x_a → M F
h : ¬IsPath ({ fst := a, snd := i } :: ps_tail) (M.mk { fst := x_a, snd := x_f })
h'' : ¬a = x_a
⊢ head
      (M.casesOn' (M.mk { fst := x_a, snd := x_f }) fun a' f =>
        if h : a = a' then isubtree ps_tail (f (cast (_ : B F a = B F a') i)) else default) =
    head default