def prove(Eq): n = Symbol.n(integer=True, positive=True) m = Symbol.m(integer=True, positive=True) A = Symbol.A(dtype=dtype.integer * n) a = Symbol.a(integer=True, shape=(n, )) B = Symbol.B(dtype=dtype.integer * m) b = Symbol.b(integer=True, shape=(m, )) f = Function.f(nargs=(n, ), integer=True, shape=(m, )) g = Function.g(nargs=(m, ), integer=True, shape=(n, )) assert f.is_integer assert g.is_integer assert f.shape == (m, ) assert g.shape == (n, ) Eq << apply(Equality(UNION[a:A](f(a).set), B), Equality(UNION[b:B](g(b).set), A)) Eq << sets.imply.less_than.union_comprehension.apply(*Eq[0].lhs.args) Eq << Eq[-1].subs(Eq[0]) Eq << sets.imply.less_than.union_comprehension.apply(*Eq[1].lhs.args) Eq << Eq[-1].subs(Eq[1]) Eq <<= Eq[-1] & Eq[-3]
def prove(Eq): n = Symbol.n(integer=True, positive=True) m = Symbol.m(integer=True, positive=True) A = Symbol.A(dtype=dtype.integer * n) a = Symbol.a(integer=True, shape=(n, )) B = Symbol.B(dtype=dtype.integer * m) b = Symbol.b(integer=True, shape=(m, )) f = Function.f(nargs=(n, ), integer=True, shape=(m, )) g = Function.g(nargs=(m, ), integer=True, shape=(n, )) assert f.is_integer assert g.is_integer assert f.shape == (m, ) assert g.shape == (n, ) Eq << apply(ForAll[a:A](Contains(f(a), B)), ForAll[b:B](Contains(g(b), A)), ForAll[a:A](Equality(a, g(f(a)))), ForAll[b:B](Equality( b, f(g(b))))) Eq << sets.forall_contains.forall_contains.forall_equality.imply.equality.apply( Eq[0], Eq[1], Eq[2]) Eq << sets.forall_contains.forall_contains.forall_equality.imply.equality.apply( Eq[1], Eq[0], Eq[3]) Eq << sets.equality.equality.imply.equality.abs.apply(Eq[-1], Eq[-2]).reversed
def prove(Eq): n = Symbol.n(integer=True, positive=True) x = Symbol.x(complex=True, shape=(n, )) f = Function.f(nargs=(n, ), integer=True, shape=()) g = Function.g(nargs=(n, ), integer=True, shape=()) A = Symbol.A(definition=conditionset(x, Equality(f(x), 1))) B = Symbol.B(definition=conditionset(x, Equality(g(x), 1))) assert f.is_integer and g.is_integer assert f.shape == g.shape == () Eq << apply(ForAll[x:A](Equality(g(x), 1)), ForAll[x:B](Equality(f(x), 1))) Eq << sets.imply.conditionset.apply(A) Eq << sets.imply.conditionset.apply(B) Eq << ForAll[x:A](Contains(x, B), plausible=True) Eq << Eq[-1].definition Eq << ForAll[x:B](Contains(x, A), plausible=True) Eq << Eq[-1].definition Eq << sets.forall_contains.forall_contains.imply.equality.apply( Eq[-2], Eq[-1])
def prove(Eq): n = Symbol.n(integer=True, positive=True) x = Symbol.x(complex=True, shape=(n, )) y = Symbol.y(complex=True, shape=(n, )) f = Function.f(nargs=(n, ), complex=True, shape=()) g = Function.g(nargs=(n, ), complex=True, shape=()) Eq << apply(Unequal(f(x), g(y)) | Equality(x, y), wrt=x) Eq << Eq[1].as_Or()
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 prove(Eq): n = Symbol.n(integer=True, positive=True) m = Symbol.m(integer=True, positive=True) f = Function.f(nargs=(n, ), real=True, shape=(m, )) x = Symbol.x(real=True, shape=(n, )) a = Symbol.a(real=True) b = Symbol.b(real=True, shape=(n, )) Eq << apply(Equality(x * a, b), f) y = Symbol.y(definition=f(a * x)) Eq << y.this.definition Eq << Eq[-1].this.rhs.subs(Eq[0]) Eq << Eq[-1].subs(Eq[-2])
def prove(Eq): n = Symbol.n(complex=True, positive=True) A = Symbol.A(dtype=dtype.complex * n) a = Symbol.a(complex=True, shape=(n, )) b = Symbol.b(complex=True, shape=(n, )) f = Function.f(nargs=(n, ), complex=True, shape=()) assert f.is_complex assert f.shape == () Eq << apply(Contains(b, A), ForAll[a:A](Equality(f(a), 1))) Eq << Eq[1].subs(a, b) Eq <<= Eq[-1] & Eq[0] Eq << Eq[-1].split()
def prove(Eq): n = Symbol.n(complex=True, positive=True) A = Symbol.A(dtype=dtype.complex * n) B = Symbol.B(dtype=dtype.complex * n) x = Symbol.x(complex=True, shape=(n, )) f = Function.f(nargs=(n, ), complex=True, shape=()) assert f.is_complex assert f.shape == () Eq << apply(Subset(B, A), ForAll[x:A](Equality(f(x), 1))) Eq << Eq[0].definition Eq << Eq[-1].limits_subs(Eq[-1].variable, x) Eq << Eq[-1].apply(sets.contains.forall.imply.condition, Eq[1], join=False)
def prove(Eq): n = Symbol.n(integer=True, positive=True) m = Symbol.m(integer=True, positive=True) A = Symbol.A(dtype=dtype.integer * n) a = Symbol.a(integer=True, shape=(n, )) B = Symbol.B(dtype=dtype.integer * m) b = Symbol.b(integer=True, shape=(m, )) f = Function.f(nargs=(n, ), integer=True, shape=(m, )) g = Function.g(nargs=(m, ), integer=True, shape=(n, )) assert f.is_integer assert g.is_integer assert f.shape == (m, ) assert g.shape == (n, ) Eq << apply(ForAll[a:A](Contains(f(a), B)), ForAll[b:B](Contains(g(b), A)), ForAll[a:A](Equality(a, g(f(a))))) Eq << Eq[1].apply(sets.contains.imply.subset, simplify=False) Eq.subset_A = Eq[-1].apply(sets.subset.imply.subset, *Eq[-1].limits, simplify=False) Eq.supset_A = Eq.subset_A.func.reversed_type(*Eq.subset_A.args, plausible=True) Eq << Eq.supset_A.definition.definition Eq << Eq[-1].subs(Eq[2]) Eq << ForAll[a:A](Exists[b:B](Equality(f(a), b)), plausible=True) Eq << Eq[-1].this.function.simplify() Eq << Eq[-1].apply(algebre.scalar.equality.invoke, g) Eq <<= Eq.supset_A & Eq.subset_A