# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
sub_expr2 = Add(_t, one)
sub_expr3 = Add(_t, _s)
sub_expr4 = Interval(sub_expr2, sub_expr3)
sub_expr5 = Interval(one, sub_expr3)
sub_expr6 = MultiQubitElem(element = Output(state = TensorProd(_Psi_ket, _ket_u), part = sub_expr1), targets = sub_expr5)
sub_expr7 = MultiQubitElem(element = Gate(operation = QPE(_U, _t), part = sub_expr1), targets = sub_expr5)
sub_expr8 = [ExprRange(sub_expr1, sub_expr6, one, _t).with_wrapping_at(2,6), ExprRange(sub_expr1, sub_expr6, sub_expr2, sub_expr3).with_wrapping_at(2,6)]
expr = Implies(QcircuitEquiv(Qcircuit(vert_expr_array = VertExprArray([ExprRange(sub_expr1, MultiQubitElem(element = Output(state = _Psi_ket, part = sub_expr1), targets = Interval(one, _t)), one, _t), ExprRange(sub_expr1, MultiQubitElem(element = Output(state = _ket_u, part = sub_expr1), targets = sub_expr4), one, _s)])), Qcircuit(vert_expr_array = VertExprArray(sub_expr8))), QcircuitEquiv(_Psi_circuit, Qcircuit(vert_expr_array = VertExprArray([ExprRange(sub_expr1, Input(state = ket_plus), one, _t), ExprRange(sub_expr1, MultiQubitElem(element = Input(state = _ket_u, part = sub_expr1), targets = sub_expr4), one, _s)], [ExprRange(sub_expr1, sub_expr7, one, _t), ExprRange(sub_expr1, sub_expr7, sub_expr2, sub_expr3)], sub_expr8))).with_wrapping_at(1)).with_wrapping_at(2)