Theorem: Array.sizeOf_lt_of_mem
File: src/lean/Init/Data/Array/Mem.lean

tactic: simp [Membership.mem, contains, any, Id.run, BEq.beq, anyM] at h
state_before: α : Type u_1
a : α
inst✝¹ : DecidableEq α
inst✝ : SizeOf α
as : Array α
h : a ∈ as
⊢ sizeOf a < sizeOf as

tactic: apply aux 0 h
state_before: α : Type u_1
a : α
inst✝¹ : DecidableEq α
inst✝ : SizeOf α
as : Array α
h : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) 0 = true
⊢ sizeOf a < sizeOf as

tactic: unfold anyM.loop at h
state_before: α : Type u_1
a : α
inst✝¹ : DecidableEq α
inst✝ : SizeOf α
as : Array α
h✝ : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) 0 = true
j : Nat
h : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) j = true
⊢ sizeOf a < sizeOf as

tactic: split at h
state_before: α : Type u_1
a : α
inst✝¹ : DecidableEq α
inst✝ : SizeOf α
as : Array α
h✝ : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) 0 = true
j : Nat
h :
  (if hlt : j < size as then
      let_fun this := (_ : j < size as);
      do
      let __do_lift ← decide (a = as[j])
      if __do_lift = true then pure true
        else anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) (j + 1)
    else pure false) =
    true
⊢ sizeOf a < sizeOf as

tactic: simp [Bind.bind, pure] at h
state_before: case inl
α : Type u_1
a : α
inst✝¹ : DecidableEq α
inst✝ : SizeOf α
as : Array α
h✝¹ : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) 0 = true
j : Nat
h✝ : j < size as
h :
  (let_fun this := (_ : j < size as);
    do
    let __do_lift ← decide (a = as[j])
    if __do_lift = true then pure true
      else anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) (j + 1)) =
    true
⊢ sizeOf a < sizeOf as

tactic: split at h
state_before: case inl
α : Type u_1
a : α
inst✝¹ : DecidableEq α
inst✝ : SizeOf α
as : Array α
h✝¹ : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) 0 = true
j : Nat
h✝ : j < size as
h :
  (if a = as[j] then true else anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) (j + 1)) = true
⊢ sizeOf a < sizeOf as

tactic: next he => subst a; apply sizeOf_get_lt
state_before: case inl.inl
α : Type u_1
a : α
inst✝¹ : DecidableEq α
inst✝ : SizeOf α
as : Array α
h✝² : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) 0 = true
j : Nat
h✝¹ : j < size as
h✝ : a = as[j]
h : true = true
⊢ sizeOf a < sizeOf as

case inl.inr
α : Type u_1
a : α
inst✝¹ : DecidableEq α
inst✝ : SizeOf α
as : Array α
h✝² : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) 0 = true
j : Nat
h✝¹ : j < size as
h✝ : ¬a = as[j]
h : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) (j + 1) = true
⊢ sizeOf a < sizeOf as

tactic: next => have ih := aux (j+1) h; assumption
state_before: case inl.inr
α : Type u_1
a : α
inst✝¹ : DecidableEq α
inst✝ : SizeOf α
as : Array α
h✝² : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) 0 = true
j : Nat
h✝¹ : j < size as
h✝ : ¬a = as[j]
h : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) (j + 1) = true
⊢ sizeOf a < sizeOf as

tactic: subst a
state_before: α : Type u_1
a : α
inst✝¹ : DecidableEq α
inst✝ : SizeOf α
as : Array α
h✝¹ : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) 0 = true
j : Nat
h✝ : j < size as
he : a = as[j]
h : true = true
⊢ sizeOf a < sizeOf as

tactic: apply sizeOf_get_lt
state_before: α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : SizeOf α
as : Array α
j : Nat
h✝¹ : j < size as
h✝ : true = true
h : anyM.loop (fun b => decide (as[j] = b)) as (size as) (_ : size as ≤ size as) 0 = true
⊢ sizeOf as[j] < sizeOf as

tactic: have ih := aux (j+1) h
state_before: α : Type u_1
a : α
inst✝¹ : DecidableEq α
inst✝ : SizeOf α
as : Array α
h✝² : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) 0 = true
j : Nat
h✝¹ : j < size as
h✝ : ¬a = as[j]
h : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) (j + 1) = true
⊢ sizeOf a < sizeOf as

tactic: assumption
state_before: α : Type u_1
a : α
inst✝¹ : DecidableEq α
inst✝ : SizeOf α
as : Array α
h✝² : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) 0 = true
j : Nat
h✝¹ : j < size as
h✝ : ¬a = as[j]
h : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) (j + 1) = true
ih : sizeOf a < sizeOf as
⊢ sizeOf a < sizeOf as

tactic: contradiction
state_before: case inr
α : Type u_1
a : α
inst✝¹ : DecidableEq α
inst✝ : SizeOf α
as : Array α
h✝¹ : anyM.loop (fun b => decide (a = b)) as (size as) (_ : size as ≤ size as) 0 = true
j : Nat
h✝ : ¬j < size as
h : False
⊢ sizeOf a < sizeOf as