Theorem: AIG.RefStream.ite.go_le_size (LeanSAT/AIG/If.lean)

State before:
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
discr : aig.Ref
lhs rhs : aig.RefStream w
s : aig.RefStream curr
⊢ aig.decls.size ≤ (go aig curr hcurr discr lhs rhs s).aig.decls.size
Tactic:
unfold go
State after:
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
discr : aig.Ref
lhs rhs : aig.RefStream w
s : aig.RefStream curr
⊢ aig.decls.size ≤
    (if hcurr : curr < w then
            let input := { discr := discr, lhs := lhs.getRef curr hcurr, rhs := rhs.getRef curr hcurr };
            let res := aig.mkIfCached input;
            let aig_1 := res.aig;
            let ref := res.ref;
            let_fun this := ⋯;
            let discr_1 := discr.cast this;
            let lhs_1 := lhs.cast this;
            let rhs_1 := rhs.cast this;
            let s := s.cast this;
            let s := s.pushRef ref;
            go aig_1 (curr + 1) ⋯ discr_1 lhs_1 rhs_1 s
          else
            let_fun this := ⋯;
            { aig := aig, stream := this ▸ s }).aig.decls.size

State before:
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
discr : aig.Ref
lhs rhs : aig.RefStream w
s : aig.RefStream curr
⊢ aig.decls.size ≤
    (if hcurr : curr < w then
            let input := { discr := discr, lhs := lhs.getRef curr hcurr, rhs := rhs.getRef curr hcurr };
            let res := aig.mkIfCached input;
            let aig_1 := res.aig;
            let ref := res.ref;
            let_fun this := ⋯;
            let discr_1 := discr.cast this;
            let lhs_1 := lhs.cast this;
            let rhs_1 := rhs.cast this;
            let s := s.cast this;
            let s := s.pushRef ref;
            go aig_1 (curr + 1) ⋯ discr_1 lhs_1 rhs_1 s
          else
            let_fun this := ⋯;
            { aig := aig, stream := this ▸ 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
discr : aig.Ref
lhs rhs : aig.RefStream w
s : aig.RefStream curr
h✝ : curr < w
⊢ aig.decls.size ≤
    (let input := { discr := discr, lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ };
          let res := aig.mkIfCached input;
          let aig_1 := res.aig;
          let ref := res.ref;
          let_fun this := ⋯;
          let discr_1 := discr.cast this;
          let lhs_1 := lhs.cast this;
          let rhs_1 := rhs.cast this;
          let s := s.cast this;
          let s := s.pushRef ref;
          go aig_1 (curr + 1) ⋯ discr_1 lhs_1 rhs_1 s).aig.decls.size

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

State before:
case isTrue
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
discr : aig.Ref
lhs rhs : aig.RefStream w
s : aig.RefStream curr
h✝ : curr < w
⊢ aig.decls.size ≤
    (let input := { discr := discr, lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ };
          let res := aig.mkIfCached input;
          let aig_1 := res.aig;
          let ref := res.ref;
          let_fun this := ⋯;
          let discr_1 := discr.cast this;
          let lhs_1 := lhs.cast this;
          let rhs_1 := rhs.cast this;
          let s := s.cast this;
          let s := s.pushRef ref;
          go aig_1 (curr + 1) ⋯ discr_1 lhs_1 rhs_1 s).aig.decls.size

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

State before:
case isFalse
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
discr : aig.Ref
lhs rhs : aig.RefStream w
s : aig.RefStream curr
h✝ : ¬curr < w
⊢ aig.decls.size ≤
    (let_fun this := ⋯;
          { aig := aig, stream := this ▸ 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
discr : aig.Ref
lhs rhs : aig.RefStream w
s : aig.RefStream curr
h✝ : curr < w
⊢ aig.decls.size ≤
    (let input := { discr := discr, lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ };
          let res := aig.mkIfCached input;
          let aig_1 := res.aig;
          let ref := res.ref;
          let_fun this := ⋯;
          let discr_1 := discr.cast this;
          let lhs_1 := lhs.cast this;
          let rhs_1 := rhs.cast this;
          let s := s.cast this;
          let s := s.pushRef ref;
          go aig_1 (curr + 1) ⋯ discr_1 lhs_1 rhs_1 s).aig.decls.size
Tactic:
dsimp
State after:
case isTrue
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
discr : aig.Ref
lhs rhs : aig.RefStream w
s : aig.RefStream curr
h✝ : curr < w
⊢ aig.decls.size ≤
    (go (aig.mkIfCached { discr := discr, lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1) ⋯
            { gate := discr.gate, hgate := ⋯ } (lhs.cast ⋯) (rhs.cast ⋯)
            ((s.cast ⋯).pushRef
              (aig.mkIfCached
                  { discr := discr, lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref)).aig.decls.size

State before:
case isTrue
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
discr : aig.Ref
lhs rhs : aig.RefStream w
s : aig.RefStream curr
h✝ : curr < w
⊢ aig.decls.size ≤
    (go (aig.mkIfCached { discr := discr, lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1) ⋯
            { gate := discr.gate, hgate := ⋯ } (lhs.cast ⋯) (rhs.cast ⋯)
            ((s.cast ⋯).pushRef
              (aig.mkIfCached
                  { discr := discr, lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref)).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
discr : aig.Ref
lhs rhs : aig.RefStream w
s : aig.RefStream curr
h✝ : curr < w
⊢ aig.decls.size ≤
    (aig.mkIfCached { discr := discr, lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig.decls.size

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

State before:
α : Type
inst✝² : BEq α
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
curr : Nat
hcurr : curr ≤ w
discr : aig.Ref
lhs rhs : aig.RefStream w
s : aig.RefStream curr
h✝ : curr < w
⊢ ?m.98826 ≤
    (go (aig.mkIfCached { discr := discr, lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1) ⋯
            { gate := discr.gate, hgate := ⋯ } (lhs.cast ⋯) (rhs.cast ⋯)
            ((s.cast ⋯).pushRef
              (aig.mkIfCached
                  { discr := discr, lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref)).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
discr : aig.Ref
lhs rhs : aig.RefStream w
s : aig.RefStream curr
h✝ : ¬curr < w
⊢ aig.decls.size ≤
    (let_fun this := ⋯;
          { aig := aig, stream := this ▸ s }).aig.decls.size
Tactic:
simp
State after:
no goals