-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/Bitblast/BVExpr/Circuit/Impl/Operations/ShiftLeft.lean
theorem blastShiftLeftConst.go_le_size (aig : AIG α) (distance : Nat) (input : AIG.RefVec aig w)
    (curr : Nat) (hcurr : curr ≤ w) (s : AIG.RefVec aig curr) :
    aig.decls.size ≤ (go aig input distance curr hcurr s).aig.decls.size

Proof state:
case isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝ : ¬curr < w
⊢ aig.decls.size ≤
    (let_fun hcurr := ⋯;
          { aig := aig, vec := hcurr ▸ s }).aig.decls.size

Tactic:
simp

Result:
no goals

Proof state:
case isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝ : curr < w
⊢ aig.decls.size ≤
    (if hdist : curr < distance then
            go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
              ((s.cast ⋯).push (aig.mkConstCached false).ref)
          else go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).aig.decls.size

Tactic:
split

Result:
case isTrue.isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝¹ : curr < w
h✝ : curr < distance
⊢ aig.decls.size ≤
    (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
            ((s.cast ⋯).push (aig.mkConstCached false).ref)).aig.decls.size

case isTrue.isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝¹ : curr < w
h✝ : ¬curr < distance
⊢ aig.decls.size ≤ (go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).aig.decls.size

Proof state:
case isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝ : curr < w
⊢ aig.decls.size ≤
    (if hdist : curr < distance then
            let res := aig.mkConstCached false;
            let aig_1 := res.aig;
            let zeroRef := res.ref;
            let_fun hfinal := ⋯;
            let s := s.cast hfinal;
            let input := input.cast hfinal;
            let s := s.push zeroRef;
            go aig_1 input distance (curr + 1) ⋯ s
          else
            let s := s.push (input.get (curr - distance) ⋯);
            go aig input distance (curr + 1) ⋯ s).aig.decls.size

Tactic:
dsimp only

Result:
case isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝ : curr < w
⊢ aig.decls.size ≤
    (if hdist : curr < distance then
            go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
              ((s.cast ⋯).push (aig.mkConstCached false).ref)
          else go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).aig.decls.size

Proof state:
case isTrue.isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝¹ : curr < w
h✝ : ¬curr < distance
⊢ aig.decls.size ≤ aig.decls.size

Tactic:
omega

Result:
no goals

Proof state:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝¹ : curr < w
h✝ : ¬curr < distance
⊢ ?m.15509 ≤ (go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).aig.decls.size

Tactic:
apply go_le_size

Result:
no goals

Proof state:
case isTrue.isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝¹ : curr < w
h✝ : curr < distance
⊢ aig.decls.size ≤ (aig.mkConstCached false).aig.decls.size

Tactic:
apply AIG.LawfulOperator.le_size

Result:
no goals

Proof state:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
⊢ aig.decls.size ≤
    (if hidx : curr < w then
            if hdist : curr < distance then
              let res := aig.mkConstCached false;
              let aig_1 := res.aig;
              let zeroRef := res.ref;
              let_fun hfinal := ⋯;
              let s := s.cast hfinal;
              let input := input.cast hfinal;
              let s := s.push zeroRef;
              go aig_1 input distance (curr + 1) ⋯ s
            else
              let s := s.push (input.get (curr - distance) ⋯);
              go aig input distance (curr + 1) ⋯ s
          else
            let_fun hcurr := ⋯;
            { aig := aig, vec := hcurr ▸ s }).aig.decls.size

Tactic:
split

Result:
case isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝ : curr < w
⊢ aig.decls.size ≤
    (if hdist : curr < distance then
            let res := aig.mkConstCached false;
            let aig_1 := res.aig;
            let zeroRef := res.ref;
            let_fun hfinal := ⋯;
            let s := s.cast hfinal;
            let input := input.cast hfinal;
            let s := s.push zeroRef;
            go aig_1 input distance (curr + 1) ⋯ s
          else
            let s := s.push (input.get (curr - distance) ⋯);
            go aig input distance (curr + 1) ⋯ s).aig.decls.size

case isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝ : ¬curr < w
⊢ aig.decls.size ≤
    (let_fun hcurr := ⋯;
          { aig := aig, vec := hcurr ▸ s }).aig.decls.size

Proof state:
case isTrue.isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝¹ : curr < w
h✝ : curr < distance
⊢ aig.decls.size ≤
    (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
            ((s.cast ⋯).push (aig.mkConstCached false).ref)).aig.decls.size

Tactic:
refine Nat.le_trans ?_ (by apply go_le_size)

Result:
case isTrue.isTrue
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝¹ : curr < w
h✝ : curr < distance
⊢ aig.decls.size ≤ (aig.mkConstCached false).aig.decls.size

Proof state:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝¹ : curr < w
h✝ : curr < distance
⊢ ?m.15358 ≤
    (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
            ((s.cast ⋯).push (aig.mkConstCached false).ref)).aig.decls.size

Tactic:
apply go_le_size

Result:
no goals

Proof state:
case isTrue.isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝¹ : curr < w
h✝ : ¬curr < distance
⊢ aig.decls.size ≤ (go aig input distance (curr + 1) ⋯ (s.push (input.get (curr - distance) ⋯))).aig.decls.size

Tactic:
refine Nat.le_trans ?_ (by apply go_le_size)

Result:
case isTrue.isFalse
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
distance : Nat
input : aig.RefVec w
curr : Nat
hcurr : curr ≤ w
s : aig.RefVec curr
h✝¹ : curr < w
h✝ : ¬curr < distance
⊢ aig.decls.size ≤ aig.decls.size