Exemple #1
0
def apply(given, i=None, j=None, w=None):
    from axiom.discrete.combinatorics.permutation.index.eq import index_function
    x_set_comprehension, interval = given.of(Equal)
    n = interval.max() + 1
    assert interval.min() == 0
    assert len(x_set_comprehension.limits) == 1
    k, a, b = x_set_comprehension.limits[0]
    assert b - a == n
    x = Lamda(x_set_comprehension.function.arg,
              *x_set_comprehension.limits).simplify()

    if j is None:
        j = Symbol.j(domain=Range(0, n), given=True)

    if i is None:
        i = Symbol.i(domain=Range(0, n), given=True)

    assert j >= 0 and j < n
    assert i >= 0 and i < n

    index = index_function(n)
    if w is None:
        _i = Symbol.i(integer=True)
        _j = Symbol.j(integer=True)
        w = Symbol.w(Lamda[_j, _i](Swap(n, _i, _j)))

    return Equal(index[i](w[index[i](x[:n]), index[j](x[:n])] @ x[:n]),
                 index[j](x[:n]))
Exemple #2
0
def apply(given, i=None, j=None):
    from axiom.discrete.combinatorics.permutation.index.eq import index_function
    assert given.is_Equal
    x_set_comprehension, interval = given.args
    n = interval.max() + 1
    assert interval.min() == 0
    assert len(x_set_comprehension.limits) == 1
    k, a, b = x_set_comprehension.limits[0]
    assert b - a == n
    x = Lamda(x_set_comprehension.function.arg,
              *x_set_comprehension.limits).simplify()

    if j is None:
        j = Symbol.j(domain=Range(0, n), given=True)

    if i is None:
        i = Symbol.i(domain=Range(0, n), given=True)

    assert j >= 0 and j < n
    assert i >= 0 and i < n

    index = index_function(n)

    di = index[i](x[:n])
    dj = index[j](x[:n])

    return Equal(KroneckerDelta(di, dj), KroneckerDelta(i, j))
Exemple #3
0
def apply(a_size, xa_equality, j=None):
    a_set_comprehension_abs, n = a_size.of(Equal)
    a_set_comprehension = a_set_comprehension_abs.of(Abs)
    x_set_comprehension, _a_set_comprehension = xa_equality.of(Equal)

    assert a_set_comprehension == _a_set_comprehension

    assert len(x_set_comprehension.limits) == 1
    k, a, b = x_set_comprehension.limits[0]
    assert n == b - a

    assert len(a_set_comprehension.limits) == 1
    k, a, b = a_set_comprehension.limits[0]
    assert n == b - a

    x = Lamda(x_set_comprehension.function.arg, *x_set_comprehension.limits).simplify()
    a = Lamda(a_set_comprehension.function.arg, *a_set_comprehension.limits).simplify()

    if j is None:
        j = Symbol.j(domain=Range(0, n), given=True)

    assert j >= 0 and j < n

    from axiom.discrete.combinatorics.permutation.index.eq import index_function
    index = index_function(n)
    index_j = index[j](x[:n], a[:n], evaluate=False)
    return Contains(index_j, Range(0, n)), Equal(x[index_j], a[j])
Exemple #4
0
def X_definition(n, w, x):
    from axiom.discrete.combinatorics.permutation.index.eq import index_function
    i = Symbol.i(integer=True)
    j = Symbol.j(integer=True)

    index = index_function(n + 1)
    return Symbol(
        "X", Lamda[j:n + 1](
            w[n, index[j](x[:n + 1], evaluate=False)] @ x[:n + 1])), index
Exemple #5
0
def prove(Eq):
    from axiom import sets, algebra
    n = Symbol.n(domain=Range(2, oo))
    S = Symbol.S(etype=dtype.integer * n)

    x = Symbol.x(**S.element_symbol().type.dict)

    i = Symbol.i(integer=True)
    j = Symbol.j(integer=True)
    k = Symbol.k(integer=True)

    e = Symbol.e(etype=dtype.integer, given=True)

    p = Symbol.p(shape=(n,), integer=True, nonnegative=True)

    P = Symbol.P(conditionset(p[:n], Equal(p[:n].set_comprehension(), Range(0, n))))

    Eq << apply(All[x:S](Equal(x.set_comprehension(), e)),
                All[x:S, p[:n]:P](Contains(Lamda[k:n](x[p[k]]), S)),
                Equal(abs(e), n))

    Eq << sets.eq.imply.any_eq.condset.all.apply(Eq[3])

    Eq << algebra.all.any.imply.any_all_et.apply(Eq[1], Eq[-1])

    Eq << Eq[-1].this.function.function.apply(algebra.eq.eq.imply.eq.transit)

    a, cond = Eq[-1].limits[0]
    from axiom.discrete.combinatorics.permutation.index.eq import index_function
    index = index_function(n)

#     p= Lamda[j:n](index[j](x, a))

#     x[index[j](x, a)] = a[j]
    Eq << Any[a:cond](All[p:P](Contains(Lamda[k:n](a[p[k]]),
                                              S)))

    Eq << Any[a:cond](All[p:P](Equal(p, Lamda[j:n](index[j](Lamda[k:n](a[p[k]]),
                                                                      a)))))

    Eq << Any[a:cond](All[x:S](Contains(Lamda[j:n](index[j](x,
                                                                   a)), P)))

    Eq << Any[a:cond](All[x:S](Equal(x,
                                              Lamda[k:n](a[Lamda[j:n](index[j](x, a))[k]]))))
Exemple #6
0
def apply(given, j=None):
    assert given.is_Equal
    x_set_comprehension, interval = given.args
    n = interval.max() + 1
    assert interval.min() == 0
    assert len(x_set_comprehension.limits) == 1
    k, a, b = x_set_comprehension.limits[0]
    assert b - a == n
    x = Lamda(x_set_comprehension.function.arg,
              *x_set_comprehension.limits).simplify()

    if j is None:
        j = Symbol.j(domain=Range(0, n), given=True)

    assert j >= 0 and j < n

    index = index_function(n)

    return Equal(index[x[j]](x[:n]), j)