def prove(Eq): n = Symbol.n(integer=True, positive=True) x = Symbol.x(shape=(oo, ), integer=True, nonnegative=True) P = Symbol.P(definition=conditionset( x[:n], Equality(x[:n].set, Interval(0, n - 1, integer=True)))) Eq << apply(P) Eq << ForAll[x[:n]:P](Contains(x[:n], P), plausible=True) Eq << Eq[-1].simplify() Eq << Eq[-1].this.function.subs(Eq[0])
def apply(n): i = Symbol.i(integer=True) p = Symbol.p(shape=(oo, ), integer=True, nonnegative=True) P = Symbol.P(dtype=dtype.integer * n, definition=conditionset( p[:n], Equality(p[:n].set_comprehension(), Interval(0, n - 1, integer=True)))) return ForAll[p[:n]:P](Exists[i:n](Equality(p[i], n - 1)))
def prove(Eq): n = Symbol.n(integer=True, positive=True) m = Symbol.m(integer=True, positive=True) x = Symbol.x(complex=True, shape=(n, )) y = Symbol.y(complex=True, shape=(m, )) A = Symbol.A(dtype=dtype.complex * n) f = Function.f(nargs=(m, ), shape=(), integer=True) g = Function.g(nargs=(n, ), shape=(m, )) P = Symbol.P(definition=conditionset(y, Equality(f(y), 1))) Eq << apply(ForAll[x:A](Equality(f(g(x)), 1)), P) Eq << Eq[-1].definition
def apply(n): i = Symbol.i(integer=True) p = Symbol.p(shape=(oo, ), integer=True, nonnegative=True) P = Symbol.P(dtype=dtype.integer * n, definition=conditionset( p[:n], Equality(p[:n].set_comprehension(), Interval(0, n - 1, integer=True)))) b = Symbol.b(integer=True, shape=(oo, ), nonnegative=True) return ForAll[p[:n]:P](Exists[b[:n]](Equality( p[:n], LAMBDA[i:n](i) @ MatProduct[i:n](Swap(n, i, b[i])))))
def apply(given): assert given.is_ForAll S = given.rhs n = S.element_type.shape[0] ref = given.lhs k = ref.variable x = ref.function.base assert len(ref.function.indices) == 1 index = ref.function.indices[0] assert index.is_MatMul and len(index.args) == 2 assert index.args[0].is_Indexed and index.args[1].is_LAMBDA w = index.args[0].base i, j, _k = index.args[0].indices assert w.definition.is_LAMBDA (_j, zero, n_1), (_i, _zero, _n_1) = w.definition.limits assert zero.is_zero and _zero.is_zero assert n_1 == _n_1 == n - 1 assert _k == k and _i == i and _j == j assert isinstance(w.definition.function, Swap) _n, _i, _j = w.definition.function.args assert _n == n and _i == i and _j == j assert index.args[1].is_LAMBDA and len(index.args[1].limits) == 1 _k, *_ = index.args[1].limits[0] assert _k == k p = Symbol.p(shape=(oo, ), integer=True, nonnegative=True) P = Symbol.P(dtype=dtype.integer * n, definition=conditionset( p[:n], Equality(p[:n].set_comprehension(), Interval(0, n - 1, integer=True)))) return ForAll[p[:n]:P, x:S](Contains(LAMBDA[k:n](x[p[k]]), S), given=given)
def apply(given): assert given.is_ForAll S = given.rhs n = S.element_type.shape[0] k = Symbol.k(integer=True) x = given.variable w, i, j = given.function.lhs.args[0].args assert w[i, j].is_Swap or w[i, j].definition.is_Swap p = Symbol.p(shape=(oo, ), integer=True, nonnegative=True) P = Symbol.P(dtype=dtype.integer * n, definition=conditionset( p[:n], Equality(p[:n].set_comprehension(), Interval(0, n - 1, integer=True)))) return ForAll[p[:n]:P, x:S](Contains(LAMBDA[k:n](x[p[k]]), S), given=given)
def apply(m, d, w=None): n = d.shape[0] i = Symbol.i(integer=True) j = Symbol.j(integer=True) assert m >= 0 if w is None: w = Symbol.w(definition=LAMBDA[j, i](Swap(n, i, j))) else: assert len(w.shape) == 4 and all(s == n for s in w.shape) assert w[i, j].is_Swap or w[i, j].definition.is_Swap x = Symbol.x(shape=(oo, ), integer=True, nonnegative=True) x = x[:n] P = Symbol.P(dtype=dtype.integer * n, definition=conditionset( x, Equality(x.set_comprehension(), Interval(0, n - 1, integer=True)))) return ForAll[x:P](Contains(x @ MatProduct[i:m](w[i, d[i]]), P))
def prove(Eq): n = Symbol.n(domain=Interval(2, oo, integer=True)) S = Symbol.S(dtype=dtype.integer * n) x = Symbol.x(**S.element_symbol().dtype.dict) i = Symbol.i(integer=True) j = Symbol.j(integer=True) k = Symbol.k(integer=True) e = Symbol.e(dtype=dtype.integer, given=True) p = Symbol.p(shape=(oo, ), integer=True, nonnegative=True) P = Symbol.P(dtype=dtype.integer * n, definition=conditionset( p[:n], Equality(p[:n].set_comprehension(), Interval(0, n - 1, integer=True)))) Eq << apply(ForAll[x:S](Equality(x.set_comprehension(), e)), ForAll[x:S, p[:n]:P](Contains(LAMBDA[k:n](x[p[k]]), S)), Equality(abs(e), n))