Пример #1
0
modIntClosure = Forall((a, b), InSet(Mod(a, b), Integers), domain=Integers)
modIntClosure

modInInterval = Forall((a, b),
                       InSet(Mod(a, b), Interval(zero, Sub(b, one))),
                       domain=Integers)
modInInterval

modRealClosure = Forall((a, b), InSet(Mod(a, b), Reals), domain=Reals)
modRealClosure

modAbsRealClosure = Forall((a, b), InSet(ModAbs(a, b), Reals), domain=Reals)
modAbsRealClosure

absComplexClosure = Forall([a], InSet(Abs(a), Reals), domain=Complexes)
absComplexClosure

absNonzeroClosure = Forall([a],
                           InSet(Abs(a), RealsPos),
                           domain=Complexes,
                           conditions=[NotEquals(a, zero)])
absNonzeroClosure

modInIntervalCO = Forall((a, b),
                         InSet(Mod(a, b), IntervalCO(zero, b)),
                         domain=Reals)
modInIntervalCO

absIsNonNeg = Forall(a, GreaterThanEquals(Abs(a), zero), domain=Complexes)
absIsNonNeg
Пример #2
0
sqrtRealPosClosure = Forall([a], InSet(sqrt(a), RealsPos), domain=RealsPos)
sqrtRealPosClosure

sqrtComplexClosure = Forall([a], InSet(sqrt(a), Complexes), domain=Complexes)
sqrtComplexClosure

# Should generalize to even power closure, but need to define and implement evens set to do this.
sqrdPosClosure = Forall(a,
                        InSet(Exp(a, two), RealsPos),
                        domain=Reals,
                        conditions=[NotEquals(a, zero)])
sqrdPosClosure

squarePosIneq = Forall([a, b],
                       LessThanEquals(Exp(Abs(a), two), Exp(b, two)),
                       domain=Reals,
                       conditions=(LessThanEquals(Abs(a), b), ))
squarePosIneq

squarePosEq = Forall(a, Equals(Exp(Abs(a), two), Exp(a, two)), domain=Reals)
squarePosEq

expNotEqZero = Forall([a, b],
                      NotEquals(Exp(a, b), zero),
                      domain=Complexes,
                      conditions=[NotEquals(a, zero)])
expNotEqZero

expZeroEqOne = Forall([a],
                      Equals(Exp(a, zero), one),
Пример #3
0
# m: Random variable for the measurement of Psi as an integer from the register's binary representation.
m_ = Literal(pkg, 'm')

# phase_m: Random variable for the phase result of the quantum phase estimation.
#          phase_m = m / 2^t
phase_m_ = Literal(pkg, 'phase_m', {LATEX: r'\varphi_m'})

# b: The "best" outcome of m such that phase_m is as close as possible to phase.
b_ = Literal(pkg, 'b')

# 2^t
two_pow_t = Exp(two, t_)

# 2^{t-1}
two_pow_t_minus_one = Exp(two, Sub(t_, one))

# amplitude of output register as indexted
alpha_ = Literal(pkg, 'alpha', {STRING: 'alpha', LATEX: r'\alpha'})
alpha_l = SubIndexed(alpha_, l)
abs_alpha_l = Abs(alpha_l)
alpha_l_sqrd = Exp(Abs(alpha_l), two)

# delta: difference between the phase and the best phase_m
delta_ = Literal(pkg, 'delta', {LATEX: r'\delta'})

fullDomain = Interval(Add(Neg(Exp(two, Sub(t_, one))), one),
                      Exp(two, Sub(t_, one)))
negDomain = Interval(Add(Neg(two_pow_t_minus_one), one), Neg(Add(eps, one)))
posDomain = Interval(Add(eps, one), two_pow_t_minus_one)
epsDomain = Interval(one, Sub(two_pow_t_minus_one, two))
Пример #4
0
                         conditions=[GreaterThanEquals(a, zero)])
sqrtRealClosure

sqrtRealPosClosure = Forall([a], InSet(sqrt(a), RealsPos), domain=RealsPos)
sqrtRealPosClosure

sqrtComplexClosure = Forall([a], InSet(sqrt(a), Complexes), domain=Complexes)
sqrtComplexClosure

# Should generalize to even power closure, but need to define and implement evens set to do this.
sqrdPosClosure = Forall(a, InSet(Exp(a, two), RealsPos), 
                        domain=Reals, conditions=[NotEquals(a, zero)])
sqrdPosClosure

squarePosIneq = Forall([a,b],
                        LessThanEquals(Exp(Abs(a),two),Exp(b,two)),
                        domain = Reals,
                        conditions = (LessThanEquals(Abs(a),b),))
squarePosIneq

squarePosEq = Forall(a,
                     Equals(Exp(Abs(a),two),Exp(a,two)),
                     domain = Reals)
squarePosEq

expNotEqZero = Forall([a, b], NotEquals(Exp(a,b), zero), domain=Complexes, conditions=[NotEquals(a, zero)])
expNotEqZero

expZeroEqOne = Forall([a], Equals(Exp(a, zero), one), domain=Complexes, conditions=[NotEquals(a, zero)])
expZeroEqOne