Theorem: BVExpr.bitblast.blastAdd.go_le_size (LeanSAT/Reflect/BVExpr/BitBlast/Impl/Add.lean)

State before:
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
⊢ aig.decls.size ≤ (go aig curr hcurr cin s lhs rhs).aig.decls.size
Tactic:
unfold go
State after:
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
⊢ aig.decls.size ≤
    (if hidx : curr < w then
            let lin := lhs.getRef curr hidx;
            let rin := rhs.getRef curr hidx;
            let res := mkFullAdder aig { lhs := lin, rhs := rin, cin := cin };
            let aig_1 := res.aig;
            let outRef := res.out;
            let carryRef := res.cout;
            let s := s.cast ⋯;
            let lhs := lhs.cast ⋯;
            let rhs := rhs.cast ⋯;
            let s := s.pushRef outRef;
            go aig_1 (curr + 1) ⋯ carryRef s lhs rhs
          else
            let_fun hcurr := ⋯;
            { aig := aig, stream := hcurr ▸ s }).aig.decls.size

State before:
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
⊢ aig.decls.size ≤
    (if hidx : curr < w then
            let lin := lhs.getRef curr hidx;
            let rin := rhs.getRef curr hidx;
            let res := mkFullAdder aig { lhs := lin, rhs := rin, cin := cin };
            let aig_1 := res.aig;
            let outRef := res.out;
            let carryRef := res.cout;
            let s := s.cast ⋯;
            let lhs := lhs.cast ⋯;
            let rhs := rhs.cast ⋯;
            let s := s.pushRef outRef;
            go aig_1 (curr + 1) ⋯ carryRef s lhs rhs
          else
            let_fun hcurr := ⋯;
            { aig := aig, stream := hcurr ▸ s }).aig.decls.size
Tactic:
dsimp
State after:
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
⊢ aig.decls.size ≤
    (if hidx : curr < w then
            go (mkFullAdder aig { lhs := lhs.getRef curr hidx, rhs := rhs.getRef curr hidx, cin := cin }).aig (curr + 1)
              ⋯ (mkFullAdder aig { lhs := lhs.getRef curr hidx, rhs := rhs.getRef curr hidx, cin := cin }).cout
              ((s.cast ⋯).pushRef
                (mkFullAdder aig { lhs := lhs.getRef curr hidx, rhs := rhs.getRef curr hidx, cin := cin }).out)
              (lhs.cast ⋯) (rhs.cast ⋯)
          else { aig := aig, stream := ⋯ ▸ s }).aig.decls.size

State before:
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
⊢ aig.decls.size ≤
    (if hidx : curr < w then
            go (mkFullAdder aig { lhs := lhs.getRef curr hidx, rhs := rhs.getRef curr hidx, cin := cin }).aig (curr + 1)
              ⋯ (mkFullAdder aig { lhs := lhs.getRef curr hidx, rhs := rhs.getRef curr hidx, cin := cin }).cout
              ((s.cast ⋯).pushRef
                (mkFullAdder aig { lhs := lhs.getRef curr hidx, rhs := rhs.getRef curr hidx, cin := cin }).out)
              (lhs.cast ⋯) (rhs.cast ⋯)
          else { aig := aig, stream := ⋯ ▸ s }).aig.decls.size
Tactic:
split
State after:
case isTrue
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
h✝ : curr < w
⊢ aig.decls.size ≤
    (go (mkFullAdder aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).aig (curr + 1) ⋯
            (mkFullAdder aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).cout
            ((s.cast ⋯).pushRef
              (mkFullAdder aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).out)
            (lhs.cast ⋯) (rhs.cast ⋯)).aig.decls.size

case isFalse
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
h✝ : ¬curr < w
⊢ aig.decls.size ≤ { aig := aig, stream := ⋯ ▸ s }.aig.decls.size

State before:
case isTrue
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
h✝ : curr < w
⊢ aig.decls.size ≤
    (go (mkFullAdder aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).aig (curr + 1) ⋯
            (mkFullAdder aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).cout
            ((s.cast ⋯).pushRef
              (mkFullAdder aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).out)
            (lhs.cast ⋯) (rhs.cast ⋯)).aig.decls.size

case isFalse
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
h✝ : ¬curr < w
⊢ aig.decls.size ≤ { aig := aig, stream := ⋯ ▸ s }.aig.decls.size
Tactic:
. refine Nat.le_trans ?_ (by apply go_le_size)
  apply AIG.LawfulOperator.le_size_of_le_aig_size (f := mkFullAdderCarry)
  apply AIG.LawfulOperator.le_size (f := mkFullAdderOut)
State after:
case isFalse
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
h✝ : ¬curr < w
⊢ aig.decls.size ≤ { aig := aig, stream := ⋯ ▸ s }.aig.decls.size

State before:
case isFalse
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
h✝ : ¬curr < w
⊢ aig.decls.size ≤ { aig := aig, stream := ⋯ ▸ s }.aig.decls.size
Tactic:
. simp
State after:
no goals

State before:
case isTrue
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
h✝ : curr < w
⊢ aig.decls.size ≤
    (go (mkFullAdder aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).aig (curr + 1) ⋯
            (mkFullAdder aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).cout
            ((s.cast ⋯).pushRef
              (mkFullAdder aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).out)
            (lhs.cast ⋯) (rhs.cast ⋯)).aig.decls.size
Tactic:
refine Nat.le_trans ?_ (by apply go_le_size)
State after:
case isTrue
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
h✝ : curr < w
⊢ aig.decls.size ≤ (mkFullAdder aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).aig.decls.size

State before:
case isTrue
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
h✝ : curr < w
⊢ aig.decls.size ≤ (mkFullAdder aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).aig.decls.size
Tactic:
apply AIG.LawfulOperator.le_size_of_le_aig_size (f := mkFullAdderCarry)
State after:
case isTrue.h
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
h✝ : curr < w
⊢ aig.decls.size ≤
    (mkFullAdderOut aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).aig.decls.size

State before:
case isTrue.h
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
h✝ : curr < w
⊢ aig.decls.size ≤
    (mkFullAdderOut aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).aig.decls.size
Tactic:
apply AIG.LawfulOperator.le_size (f := mkFullAdderOut)
State after:
no goals

State before:
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
h✝ : curr < w
⊢ ?m.28930 ≤
    (go (mkFullAdder aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).aig (curr + 1) ⋯
            (mkFullAdder aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).cout
            ((s.cast ⋯).pushRef
              (mkFullAdder aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝, cin := cin }).out)
            (lhs.cast ⋯) (rhs.cast ⋯)).aig.decls.size
Tactic:
apply go_le_size
State after:
no goals

State before:
case isFalse
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
cin : aig.Ref
s : aig.RefStream curr
lhs rhs : aig.RefStream w
h✝ : ¬curr < w
⊢ aig.decls.size ≤ { aig := aig, stream := ⋯ ▸ s }.aig.decls.size
Tactic:
simp
State after:
no goals