-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/Bitblast/BVExpr/Circuit/Impl/Operations/Udiv.lean
theorem blastDivSubtractShift_le_size (aig : AIG α) (falseRef trueRef : AIG.Ref aig)
     (n d : AIG.RefVec aig w) (wn wr : Nat) (q r : AIG.RefVec aig w) :
    aig.decls.size ≤ (blastDivSubtractShift aig falseRef trueRef n d wn wr q r).aig.decls.size

Proof state:
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
falseRef trueRef : aig.Ref
n d : aig.RefVec w
wn wr : Nat
q r : aig.RefVec w
⊢ aig.decls.size ≤
    (AIG.RefVec.ite
            (AIG.RefVec.ite
                (BVPred.mkUlt
                    (blastSub
                        (blastShiftConcat
                            (blastShiftConcat (blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).aig
                                { lhs := q.cast ⋯, bit := falseRef.cast ⋯ }).aig
                            { lhs := (q.cast ⋯).cast ⋯, bit := (trueRef.cast ⋯).cast ⋯ }).aig
                        {
                          lhs :=
                            ((blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).vec.cast ⋯).cast ⋯,
                          rhs := ((d.cast ⋯).cast ⋯).cast ⋯ }).aig
                    {
                      lhs :=
                        (((blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).vec.cast ⋯).cast ⋯).cast
                          ⋯,
                      rhs := (((d.cast ⋯).cast ⋯).cast ⋯).cast ⋯ }).aig
                {
                  discr :=
                    (BVPred.mkUlt
                        (blastSub
                            (blastShiftConcat
                                (blastShiftConcat
                                    (blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).aig
                                    { lhs := q.cast ⋯, bit := falseRef.cast ⋯ }).aig
                                { lhs := (q.cast ⋯).cast ⋯, bit := (trueRef.cast ⋯).cast ⋯ }).aig
                            {
                              lhs :=
                                ((blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).vec.cast ⋯).cast
                                  ⋯,
                              rhs := ((d.cast ⋯).cast ⋯).cast ⋯ }).aig
                        {
                          lhs :=
                            (((blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).vec.cast ⋯).cast
                                  ⋯).cast
                              ⋯,
                          rhs := (((d.cast ⋯).cast ⋯).cast ⋯).cast ⋯ }).ref,
                  lhs :=
                    (((blastShiftConcat (blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).aig
                                    { lhs := q.cast ⋯, bit := falseRef.cast ⋯ }).vec.cast
                              ⋯).cast
                          ⋯).cast
                      ⋯,
                  rhs :=
                    ((blastShiftConcat
                                (blastShiftConcat
                                    (blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).aig
                                    { lhs := q.cast ⋯, bit := falseRef.cast ⋯ }).aig
                                { lhs := (q.cast ⋯).cast ⋯, bit := (trueRef.cast ⋯).cast ⋯ }).vec.cast
                          ⋯).cast
                      ⋯ }).aig
            {
              discr :=
                (BVPred.mkUlt
                        (blastSub
                            (blastShiftConcat
                                (blastShiftConcat
                                    (blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).aig
                                    { lhs := q.cast ⋯, bit := falseRef.cast ⋯ }).aig
                                { lhs := (q.cast ⋯).cast ⋯, bit := (trueRef.cast ⋯).cast ⋯ }).aig
                            {
                              lhs :=
                                ((blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).vec.cast ⋯).cast
                                  ⋯,
                              rhs := ((d.cast ⋯).cast ⋯).cast ⋯ }).aig
                        {
                          lhs :=
                            (((blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).vec.cast ⋯).cast
                                  ⋯).cast
                              ⋯,
                          rhs := (((d.cast ⋯).cast ⋯).cast ⋯).cast ⋯ }).ref.cast
                  ⋯,
              lhs :=
                (((((blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).vec.cast ⋯).cast ⋯).cast
                          ⋯).cast
                      ⋯).cast
                  ⋯,
              rhs :=
                ((blastSub
                            (blastShiftConcat
                                (blastShiftConcat
                                    (blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).aig
                                    { lhs := q.cast ⋯, bit := falseRef.cast ⋯ }).aig
                                { lhs := (q.cast ⋯).cast ⋯, bit := (trueRef.cast ⋯).cast ⋯ }).aig
                            {
                              lhs :=
                                ((blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).vec.cast ⋯).cast
                                  ⋯,
                              rhs := ((d.cast ⋯).cast ⋯).cast ⋯ }).vec.cast
                      ⋯).cast
                  ⋯ }).aig.decls.size

Tactic:
apply AIG.LawfulVecOperator.le_size_of_le_aig_size (f := AIG.RefVec.ite)

Result:
case h
α : Type
inst✝¹ : Hashable α
inst✝ : DecidableEq α
w : Nat
aig : AIG α
falseRef trueRef : aig.Ref
n d : aig.RefVec w
wn wr : Nat
q r : aig.RefVec w
⊢ aig.decls.size ≤
    (AIG.RefVec.ite
            (BVPred.mkUlt
                (blastSub
                    (blastShiftConcat
                        (blastShiftConcat (blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).aig
                            { lhs := q.cast ⋯, bit := falseRef.cast ⋯ }).aig
                        { lhs := (q.cast ⋯).cast ⋯, bit := (trueRef.cast ⋯).cast ⋯ }).aig
                    { lhs := ((blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).vec.cast ⋯).cast ⋯,
                      rhs := ((d.cast ⋯).cast ⋯).cast ⋯ }).aig
                {
                  lhs :=
                    (((blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).vec.cast ⋯).cast ⋯).cast ⋯,
                  rhs := (((d.cast ⋯).cast ⋯).cast ⋯).cast ⋯ }).aig
            {
              discr :=
                (BVPred.mkUlt
                    (blastSub
                        (blastShiftConcat
                            (blastShiftConcat (blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).aig
                                { lhs := q.cast ⋯, bit := falseRef.cast ⋯ }).aig
                            { lhs := (q.cast ⋯).cast ⋯, bit := (trueRef.cast ⋯).cast ⋯ }).aig
                        {
                          lhs :=
                            ((blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).vec.cast ⋯).cast ⋯,
                          rhs := ((d.cast ⋯).cast ⋯).cast ⋯ }).aig
                    {
                      lhs :=
                        (((blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).vec.cast ⋯).cast ⋯).cast
                          ⋯,
                      rhs := (((d.cast ⋯).cast ⋯).cast ⋯).cast ⋯ }).ref,
              lhs :=
                (((blastShiftConcat (blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).aig
                                { lhs := q.cast ⋯, bit := falseRef.cast ⋯ }).vec.cast
                          ⋯).cast
                      ⋯).cast
                  ⋯,
              rhs :=
                ((blastShiftConcat
                            (blastShiftConcat (blastShiftConcat aig { lhs := r, bit := n.getD (wn - 1) falseRef }).aig
                                { lhs := q.cast ⋯, bit := falseRef.cast ⋯ }).aig
                            { lhs := (q.cast ⋯).cast ⋯, bit := (trueRef.cast ⋯).cast ⋯ }).vec.cast
                      ⋯).cast
                  ⋯ }).aig.decls.size