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