-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/Bitblast/BVExpr/Circuit/Impl/Operations/ShiftRight.lean
theorem blastShiftRightConst.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:
α : 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 : distance + curr < w then
              let s := s.push (input.get (distance + curr) ⋯);
              go aig input distance (curr + 1) ⋯ s
            else
              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_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 : distance + curr < w then
            let s := s.push (input.get (distance + curr) ⋯);
            go aig input distance (curr + 1) ⋯ s
          else
            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).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 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:
α : 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✝ : ¬distance + curr < w
⊢ ?m.14623 ≤
    (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:
α : 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✝ : distance + curr < w
⊢ ?m.14510 ≤ (go aig input distance (curr + 1) ⋯ (s.push (input.get (distance + curr) ⋯))).aig.decls.size

Tactic:
apply go_le_size

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 : distance + curr < w then go aig input distance (curr + 1) ⋯ (s.push (input.get (distance + curr) ⋯))
          else
            go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
              ((s.cast ⋯).push (aig.mkConstCached false).ref)).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✝ : distance + curr < w
⊢ aig.decls.size ≤ (go aig input distance (curr + 1) ⋯ (s.push (input.get (distance + curr) ⋯))).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✝ : ¬distance + curr < w
⊢ aig.decls.size ≤
    (go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
            ((s.cast ⋯).push (aig.mkConstCached false).ref)).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 : distance + curr < w then
            let s := s.push (input.get (distance + curr) ⋯);
            go aig input distance (curr + 1) ⋯ s
          else
            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).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 : distance + curr < w then go aig input distance (curr + 1) ⋯ (s.push (input.get (distance + curr) ⋯))
          else
            go (aig.mkConstCached false).aig (input.cast ⋯) distance (curr + 1) ⋯
              ((s.cast ⋯).push (aig.mkConstCached false).ref)).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✝ : distance + curr < w
⊢ 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
⊢ aig.decls.size ≤ (go aig input distance curr hcurr s).aig.decls.size

Tactic:
unfold go

Result:
α : 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 : distance + curr < w then
              let s := s.push (input.get (distance + curr) ⋯);
              go aig input distance (curr + 1) ⋯ s
            else
              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_fun hcurr := ⋯;
            { aig := aig, vec := hcurr ▸ s }).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✝ : ¬distance + curr < w
⊢ aig.decls.size ≤ (aig.mkConstCached false).aig.decls.size

Tactic:
apply AIG.LawfulOperator.le_size

Result:
no goals