def prove(Eq): A = Symbol.A(dtype=dtype.integer, given=True) B = Symbol.B(dtype=dtype.integer, given=True) Eq << apply(Equality(A - B, A)) Eq << Eq[0].intersect(B).reversed
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) 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): A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) Eq << apply(Equality(Intersection(A, B), S.EmptySet)) C = Symbol.C(dtype=dtype.integer, definition=A | B) D = Symbol.D(dtype=dtype.integer, definition=A - B) Eq << C.this.definition Eq << D.this.definition Eq << Eq[-1].union(A) Eq << Eq[-2].union(B) Eq << sets.equality.imply.equality.given.emptyset.complement.apply(Eq[0]) Eq << Eq[-1].abs() Eq << Eq[1].subs(Eq[-1].reversed) Eq << Eq[-1] - Eq[-1].rhs.args[0] Eq << (A - B).assertion()
def prove(Eq): A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) Eq << apply(Equality(A & B, S.EmptySet)) Eq << Eq[0].union(A - B).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): A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) Eq << apply(A, B) Eq << Equality(abs(A | B), abs(A) + abs(B - A), plausible=True) Eq << Eq[-1].subs(Eq[-2]) Eq << Eq[-1] - Eq[-1].lhs.args[1] C = Symbol.C(dtype=dtype.integer, definition=A & B) D = Symbol.D(dtype=dtype.integer, definition=B - A) Eq.C_definition = C.this.definition Eq.D_definition = D.this.definition Eq << Equality(D & C, S.EmptySet, plausible=True) Eq << Eq[-1].subs(Eq.C_definition, Eq.D_definition) Eq << sets.equality.imply.equality.given.intersection.addition_principle.apply( Eq[-1]) Eq << Eq[-1].subs(Eq.C_definition, Eq.D_definition) Eq << Equality(D & A, S.EmptySet, plausible=True) Eq << Eq[-1].subs(Eq.D_definition) Eq << sets.equality.imply.equality.given.intersection.addition_principle.apply( Eq[-1]) Eq << Eq[-1].subs(Eq.D_definition)
def prove(Eq): e = Symbol.e(integer=True) A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) Eq << apply(Contains(e, A), Contains(e, B)) Eq << Eq[-1].split()
def prove(Eq): A = Symbol.A(dtype=dtype.integer, given=True) B = Symbol.B(dtype=dtype.integer, given=True) Eq << apply(Equality(B - A, EmptySet())) Eq << Eq[0].union(A).reversed Eq << Eq[1].subs(Eq[-1])
def prove(Eq): A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) Eq << apply(A, B) Eq << sets.imply.equality.inclusion_exclusion_principle.apply(A, B).reversed Eq << Eq[-1] + Eq[-2]
def prove(Eq): n = Symbol.n(integer=True, positive=True) x = Symbol.x(complex=True, shape=(n,)) A = Symbol.A(dtype=dtype.complex * n) B = Symbol.B(dtype=dtype.complex * n) Eq << apply(Contains(x, A), Subset(A, B)) # Eq <<= Eq[0] & Eq[1] Eq <<= Eq[1] & Eq[0]
def prove(Eq): n = Symbol.n(integer=True, positive=True) x = Symbol.x(complex=True, shape=(n, )) A = Symbol.A(dtype=dtype.complex * n) B = Symbol.B(dtype=dtype.complex * n) Eq << apply(ForAll[x:A](Contains(x, B))) Eq << Eq[0].apply(sets.contains.imply.subset, simplify=False) Eq << Eq[-1].apply(sets.subset.imply.subset, *Eq[-1].limits)
def prove(Eq): A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) Eq << apply(A, B) Eq << Eq[-1].lhs.arg.this.rewrite(complement=0) Eq << Eq[-1].abs() Eq << Eq[-1].subs(Eq[-1].rhs.args[1], 0)
def prove(Eq): A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) Eq << apply(Supset(A, B)) Eq << Eq[0].reversed Eq << sets.subset.imply.less_than.apply(Eq[-1]) Eq << Eq[-1].reversed
def prove(Eq): A = Symbol.A(dtype=dtype.integer, given=True) B = Symbol.B(dtype=dtype.integer, given=True) Eq << apply(Equality(abs(A | B), abs(A) + abs(B))) Eq << sets.imply.equality.inclusion_exclusion_principle.apply(A, B) Eq << Eq[-1].subs(Eq[0]) Eq << Eq[-1].apply(sets.equality.imply.equality.emptyset)
def prove(Eq): A = Symbol.A(dtype=dtype.integer, given=True) B = Symbol.B(dtype=dtype.integer, given=True) equality = Equality(A, B) Eq << apply(equality) Eq << ~Eq[-1] Eq << Eq[-1].subs(equality)
def prove(Eq): A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) Eq << apply(Subset(A, B)) Eq << sets.subset.imply.equality.complement.apply(Eq[0]) Eq << ~Eq[1] Eq << Eq[-1] + Eq[-2].reversed
def prove(Eq): A = Symbol.A(dtype=dtype.integer, given=True) B = Symbol.B(dtype=dtype.integer, given=True) C = Symbol.C(dtype=dtype.integer, given=True) Eq << apply(Equality(B & C, S.EmptySet, evaluate=False), Subset(A, B, evaluate=False)) Eq << sets.equality.imply.equality.given.emptyset.subset.apply( Eq[0], Eq[1]) Eq << Eq[-1].union(Eq[-2].lhs).reversed
def prove(Eq): n = Symbol.n(complex=True, positive=True) A = Symbol.A(dtype=dtype.complex * n) B = Symbol.B(dtype=dtype.complex * n) Eq << apply(Subset(B, A)) x = Eq[1].variable Eq << ForAll[x:B](Contains(x, B), plausible=True) Eq << Eq[-1].simplify() Eq << Eq[-1].apply(sets.contains.subset.imply.contains, Eq[0], join=False)
def prove(Eq): A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) subset = Subset(A, B) Eq << apply(subset) Eq << Eq[0].union(B) Eq << Supset(*Eq[-1].args, plausible=True) Eq << Eq[-1].subs(Eq[-2])
def prove(Eq): a = Symbol.a(integer=True) B = Symbol.B(dtype=dtype.integer) Eq << apply(Equality(a.set & B, S.EmptySet)) Eq << ~Eq[-1] Eq << Eq[-1].apply(sets.contains.imply.equality.union) Eq << Eq[-1].intersect(a.set) Eq << Eq[-1].subs(Eq[0])
def prove(Eq): n = Symbol.n(integer=True, positive=True) p = Symbol.p(integer=True, shape=(n, )) x = Symbol.x(integer=True, shape=(n, )) Eq << apply( Equality(p.set_comprehension(), Interval(0, n - 1, integer=True)), x) A = Symbol.A(definition=Eq[1].lhs) B = Symbol.B(definition=Eq[1].rhs) Eq.A_definition = A.this.definition i = Eq[1].lhs.variable _i = Symbol.i(domain=Interval(0, n - 1, integer=True)) Eq.A_definition = Eq.A_definition.this.rhs.limits_subs(i, _i) j = Eq[1].rhs.variable _j = Symbol.j(domain=Interval(0, n - 1, integer=True)) Eq.B_definition = B.this.definition Eq.B_definition = Eq.B_definition.this.rhs.limits_subs( Eq.B_definition.rhs.variable, _j) Eq.subset = Subset(Eq.A_definition.rhs, Eq.B_definition.rhs, plausible=True) Eq << Eq.subset.simplify() Eq << Eq[-1].definition Eq << Eq[-1].subs(Eq[-1].variable, p[_i]) Eq.supset = Supset(Eq.subset.lhs, Eq.subset.rhs, plausible=True) Eq << Eq.supset.simplify() Eq.definition = Eq[-1].definition Eq << discrete.combinatorics.permutation.index.equality.apply(Eq[0], _j) index_j = Eq[-1].lhs.indices[0] Eq << Eq.definition.subs(Eq[-1].reversed) Eq << Eq[-1].subs(Eq[-1].variable, index_j) Eq <<= Eq.subset & Eq.supset Eq << Eq[-1].this.lhs.limits_subs(_i, i) Eq << Eq[-1].this.rhs.limits_subs(_j, j)
def prove(Eq): n = Symbol.n(integer=True, positive=True) x = Symbol.x(complex=True, shape=(n,)) A = Symbol.A(dtype=dtype.integer*n) B = Symbol.B(dtype=dtype.integer*n) Eq << apply(ForAll[x:A](Contains(x, B)), ForAll[x:B](Contains(x, A))) Eq << sets.forall_contains.imply.subset.apply(Eq[0]) Eq << sets.forall_contains.imply.subset.apply(Eq[1]) Eq <<= Eq[-1] & Eq[-2] Eq << Eq[-1].reversed
def prove(Eq): A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) Eq << apply(Equality(A & B, A | B)) Eq << Subset(A, A | B, plausible=True).subs(Eq[0].reversed) Eq << Subset(A & B, B, plausible=True) Eq.subset = Eq[-2].subs(Eq[-1]) Eq << Subset(B, A | B, plausible=True).subs(Eq[0].reversed) Eq << Subset(A & B, A, plausible=True) Eq << Eq[-2].subs(Eq[-1]).subs(Eq.subset).reversed
def prove(Eq): A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) Eq << apply(A, B) Eq << sets.imply.equality.inclusion_exclusion_principle.apply(A, B).reversed Eq << sets.imply.greater_than.apply(B, A) Eq << Eq[-1] + Eq[-2] Eq << Eq[-1] - Eq[-1].lhs.args[1] Eq << Eq[-1].reversed
def prove(Eq): A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) subset = Subset(A, B) Eq << apply(subset) Eq << Eq[0].intersect(A) Eq << Supset(*Eq[-1].args, plausible=True) Eq <<= Eq[-1] & Eq[-2] Eq << Eq[-1].reversed
def prove(Eq): A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) C = Symbol.C(dtype=dtype.integer) subset = Subset(A, B, evaluate=False) equality = Equality(B & C, S.EmptySet, evaluate=False) Eq << apply(equality, subset) Eq << subset.intersect(C) Eq << Eq[-1].subs(equality) Eq << Supset(*Eq[-1].args, plausible=True) Eq << Eq[-1].subs(Eq[-2])
def prove(Eq): A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) inequality = Unequality(A & B, S.EmptySet) Eq << apply(inequality) Eq << (A & B).assertion() Eq << (Eq[-1] & inequality) Eq << Eq[-1].split() Eq << Eq[-1].split() Eq << (~Eq[1]).limits_subs(Eq[1].variable, Eq[-1].variable) Eq << (Eq[-1] & Eq[-3])
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): A = Symbol.A(dtype=dtype.integer) B = Symbol.B(dtype=dtype.integer) inequality = Unequality(A, B) subset = Subset(A, B, evaluate=False) Eq << apply(inequality, subset) Eq << ~Eq[-1] Eq << Eq[-1].union(A) Eq << Subset(B, A | B, plausible=True) Eq << Eq[-1].subs(Eq[-2]) Eq << Eq[-1].subs(subset).reversed Eq << Eq[-1].subs(Eq[0])