← suite examples

demo-parity-01 true

category parity

Summary

Given
\(n \in \mathbb{Z},\quad n \in 2\mathbb{Z} + 1\)
Claim
\(\displaystyle \left(-1\right)^{n + 1} = 1\)
Expected
true equal at every admissible point

the two sides are equal at every admissible point

Answers (latest run per system; open code for the reproducer that ran)

systemoutcomeanswersteps (from the trace)srunquery (as sent)detail
none
always-noneno verdictnull0.02026-10-13 17:20:05 df65d778fc5c(integer n) ∧ (odd n) ⊢ (= (pow -1 (+ n 1)) 1)null
sympy
sympy-askno verdictnulldifference → (-1)**(n + 1) - 1 · ask → None0.0492026-10-13 17:20:46 df65d778fc5cQ.integer(n) ∧ Q.odd(n) ⊢ Eq(Pow((-1), (n + 1)), 1)null
code
setup — not timed
from sympy import *
import sympy

SympyVersion = sympy.__version__
# warm-up: a fixed generic expression, never case content
W = Symbol('W')
Warmup = ask(Q.positive(W**2 + 1), Q.real(W))
# every query then runs in its own forked process, starting from this state:
# the expression caches are dropped (imported and lazily loaded modules stay)
sympy.core.cache.clear_cache()
n = Symbol('n', integer=True)
Assum = And(Q.integer(n), Q.odd(n))
Residual = Pow(-1, n + 1) - 1
# not Q.eq: in SymPy 1.14 ask(Q.eq(x**2, x), Q.real(x)) is wrongly False
Answer = ask(Q.zero(Residual), Assum)
print(Residual, Answer, sep='\n')
differencePow(-1, n + 1) - 1→(-1)**(n + 1) - 1
askQ.zero(Residual)→None
answernull
sympy-askno verdictnulldifference → (-1)**(n + 1) - 1 · ask → None0.0272026-10-12 20:21:28 d7af4def9aaaQ.integer(n) ∧ Q.odd(n) ⊢ Eq(Pow((-1), (n + 1)), 1)null
code
setup — not timed
from sympy import *
import sympy

SympyVersion = sympy.__version__
# warm-up: a fixed generic expression, never case content
W = Symbol('W')
Warmup = ask(Q.positive(W**2 + 1), Q.real(W))
# every query then runs in its own forked process, starting from this state:
# the expression caches are dropped (imported and lazily loaded modules stay)
sympy.core.cache.clear_cache()
n = Symbol('n', integer=True)
Assum = And(Q.integer(n), Q.odd(n))
Residual = Pow(-1, n + 1) - 1
# not Q.eq: in SymPy 1.14 ask(Q.eq(x**2, x), Q.real(x)) is wrongly False
Answer = ask(Q.zero(Residual), Assum)
print(Residual, Answer, sep='\n')
differencePow(-1, n + 1) - 1→(-1)**(n + 1) - 1
askQ.zero(Residual)→None
answernull
sympy-refinesolvedtruedifference → (-1)**(n + 1) - 1 · refine → 00.0412026-10-13 17:20:49 df65d778fc5cQ.integer(n) ∧ Q.odd(n) ⊢ Eq(Pow((-1), (n + 1)), 1)true
code
setup — not timed
from sympy import *
import sympy

SympyVersion = sympy.__version__
# warm-up: a fixed generic expression, never case content
W = Symbol('W')
Warmup = refine(Abs(W), Q.positive(W))
# every query then runs in its own forked process, starting from this state:
# the expression caches are dropped (imported and lazily loaded modules stay)
sympy.core.cache.clear_cache()
n = Symbol('n', integer=True)
Assum = And(Q.integer(n), Q.odd(n))
Residual = Pow(-1, n + 1) - 1
Result = refine(Residual, Assum)
# true iff the result is 0; false only if it is a definite nonzero number
Answer = True if Result == 0 else False if (Result.is_number and Result.is_finite and Result.is_zero is False) else None
print(Result, Answer, sep='\n')
differencePow(-1, n + 1) - 1→(-1)**(n + 1) - 1
refinerefine(Residual, Assum)→0
answertrue
sympy-refinesolvedtruedifference → (-1)**(n + 1) - 1 · refine → 00.042026-10-12 20:21:30 d7af4def9aaaQ.integer(n) ∧ Q.odd(n) ⊢ Eq(Pow((-1), (n + 1)), 1)true
code
setup — not timed
from sympy import *
import sympy

SympyVersion = sympy.__version__
# warm-up: a fixed generic expression, never case content
W = Symbol('W')
Warmup = refine(Abs(W), Q.positive(W))
# every query then runs in its own forked process, starting from this state:
# the expression caches are dropped (imported and lazily loaded modules stay)
sympy.core.cache.clear_cache()
n = Symbol('n', integer=True)
Assum = And(Q.integer(n), Q.odd(n))
Residual = Pow(-1, n + 1) - 1
Result = refine(Residual, Assum)
# true iff the result is 0; false only if it is a definite nonzero number
Answer = True if Result == 0 else False if (Result.is_number and Result.is_finite and Result.is_zero is False) else None
print(Result, Answer, sep='\n')
differencePow(-1, n + 1) - 1→(-1)**(n + 1) - 1
refinerefine(Residual, Assum)→0
answertrue
sympy-simplifysolvedtruedifference → 0 · simplify → 00.0082026-10-13 17:20:51 df65d778fc5cQ.integer(n) ∧ Q.odd(n) ⊢ Eq(Pow((-1), (n + 1)), 1)true
code
setup — not timed
from sympy import *
import sympy

SympyVersion = sympy.__version__
# warm-up: a fixed generic expression, never case content
W = Symbol('W')
Warmup = simplify(sin(W)**2 + cos(W)**2)
# every query then runs in its own forked process, starting from this state:
# the expression caches are dropped (imported and lazily loaded modules stay)
sympy.core.cache.clear_cache()
n = Symbol('n', integer=True, odd=True)
Residual = Pow(-1, n + 1) - 1
Result = simplify(Residual)
# true iff the result is 0; false only if it is a definite nonzero number
Answer = True if Result == 0 else False if (Result.is_number and Result.is_finite and Result.is_zero is False) else None
print(Result, Answer, sep='\n')
differencePow(-1, n + 1) - 1→0
simplifysimplify(Residual)→0
answertrue
sympy-simplifysolvedtruedifference → 0 · simplify → 00.0082026-10-12 20:21:32 d7af4def9aaaQ.integer(n) ∧ Q.odd(n) ⊢ Eq(Pow((-1), (n + 1)), 1)true
code
setup — not timed
from sympy import *
import sympy

SympyVersion = sympy.__version__
# warm-up: a fixed generic expression, never case content
W = Symbol('W')
Warmup = simplify(sin(W)**2 + cos(W)**2)
# every query then runs in its own forked process, starting from this state:
# the expression caches are dropped (imported and lazily loaded modules stay)
sympy.core.cache.clear_cache()
n = Symbol('n', integer=True, odd=True)
Residual = Pow(-1, n + 1) - 1
Result = simplify(Residual)
# true iff the result is 0; false only if it is a definite nonzero number
Answer = True if Result == 0 else False if (Result.is_number and Result.is_finite and Result.is_zero is False) else None
print(Result, Answer, sep='\n')
differencePow(-1, n + 1) - 1→0
simplifysimplify(Residual)→0
answertrue
wolfram
wolfram-fullsimplify solvedtruedifference → -1 + (-1)^(1 + n) · result → 00.0212026-10-13 17:20:59 df65d778fc5cElement[n, Integers] ∧ Element[((n) - 1)/2, Integers] ⊢ (Power[(-1), (n + 1)] == 1)true
code
setup — not timed
(
  $HistoryLength = 0;
  $Messages = {};
  Warmup = FullSimplify[Sin[W]^2 + Cos[W]^2, Element[W, Reals]];
  GenericWarmup = Quiet[{Simplify[Abs[W] + W, W < 0], Simplify[Sqrt[W^2] - W, W > 0], Refine[Sqrt[W^2], W > 0], Simplify[Log[W V] - Log[W] - Log[V], W > 0 && V > 0], Simplify[Log[-W] - Log[W] - I Pi, W < 0], Simplify[(-1)^(2 W) - 1, Element[W, Integers]], Simplify[Mod[W + 1, 2], Element[W, Integers] && Element[(W - 1)/2, Integers]], Simplify[ArcTan[W] + ArcTan[1/W] - Pi/2, W > 0], FullSimplify[ArcCot[W] - ArcTan[1/W], W > 0], Simplify[Abs[Exp[I W]] - 1, Element[W, Reals]], Simplify[Re[W] - (W + Conjugate[W])/2], Simplify[Gamma[W + 1] - W!, Element[W, Integers] && W > 0], Simplify[Floor[W] - W, Element[W, Integers]], Simplify[Sqrt[W] Sqrt[V] - Sqrt[W V], W > 0 && V > 0], Simplify[HeavisideTheta[W] - 1, W > 0], Simplify[2^W 2^V - 2^(W + V), Element[W, Reals] && Element[V, Reals]], Simplify[Sum[V, {V, 1, W}] - W (W + 1)/2, Element[W, Integers] && W > 0]}];
  Quiet[Check[Message[General::argx, "W", 0], Null]];
  {$Version, Warmup, Length[GenericWarmup]}
)
(* evaluated in a forked copy of the setup kernel: TimeConstrained would not fire here (no timer thread), so the parent enforces a hard timeout of 9 s by killing this process *)
(
  Assum = (Element[n, Integers]) && (Element[((n) - 1)/2, Integers]);
  Residual = ((-1)^(n + 1)) - (1);
  Result = FullSimplify[Residual, Assum];
  Answer = Which[Result === 0, True, NumericQ[Result] && TrueQ[Result != 0], False, True, Null];
  {Residual, Result, Answer}
)
difference((-1)^(n + 1)) - (1)→-1 + (-1)^(1 + n)
resultFullSimplify[Residual, Assum]→0
answertrue
wolfram-refine solvedtruedifference → -1 + (-1)^(1 + n) · result → 00.0212026-10-13 17:20:56 df65d778fc5cElement[n, Integers] ∧ Element[((n) - 1)/2, Integers] ⊢ (Power[(-1), (n + 1)] == 1)true
code
setup — not timed
(
  $HistoryLength = 0;
  $Messages = {};
  Warmup = Refine[Sin[W]^2 + Cos[W]^2, Element[W, Reals]];
  GenericWarmup = Quiet[{Simplify[Abs[W] + W, W < 0], Simplify[Sqrt[W^2] - W, W > 0], Refine[Sqrt[W^2], W > 0], Simplify[Log[W V] - Log[W] - Log[V], W > 0 && V > 0], Simplify[Log[-W] - Log[W] - I Pi, W < 0], Simplify[(-1)^(2 W) - 1, Element[W, Integers]], Simplify[Mod[W + 1, 2], Element[W, Integers] && Element[(W - 1)/2, Integers]], Simplify[ArcTan[W] + ArcTan[1/W] - Pi/2, W > 0], FullSimplify[ArcCot[W] - ArcTan[1/W], W > 0], Simplify[Abs[Exp[I W]] - 1, Element[W, Reals]], Simplify[Re[W] - (W + Conjugate[W])/2], Simplify[Gamma[W + 1] - W!, Element[W, Integers] && W > 0], Simplify[Floor[W] - W, Element[W, Integers]], Simplify[Sqrt[W] Sqrt[V] - Sqrt[W V], W > 0 && V > 0], Simplify[HeavisideTheta[W] - 1, W > 0], Simplify[2^W 2^V - 2^(W + V), Element[W, Reals] && Element[V, Reals]], Simplify[Sum[V, {V, 1, W}] - W (W + 1)/2, Element[W, Integers] && W > 0]}];
  Quiet[Check[Message[General::argx, "W", 0], Null]];
  {$Version, Warmup, Length[GenericWarmup]}
)
(* evaluated in a forked copy of the setup kernel: TimeConstrained would not fire here (no timer thread), so the parent enforces a hard timeout of 9 s by killing this process *)
(
  Assum = (Element[n, Integers]) && (Element[((n) - 1)/2, Integers]);
  Residual = ((-1)^(n + 1)) - (1);
  Result = Refine[Residual, Assum];
  Answer = Which[Result === 0, True, NumericQ[Result] && TrueQ[Result != 0], False, True, Null];
  {Residual, Result, Answer}
)
difference((-1)^(n + 1)) - (1)→-1 + (-1)^(1 + n)
resultRefine[Residual, Assum]→0
answertrue
wolfram-simplify solvedtruedifference → -1 + (-1)^(1 + n) · result → 00.0212026-10-13 17:20:52 df65d778fc5cElement[n, Integers] ∧ Element[((n) - 1)/2, Integers] ⊢ (Power[(-1), (n + 1)] == 1)true
code
setup — not timed
(
  $HistoryLength = 0;
  $Messages = {};
  Warmup = Simplify[Sin[W]^2 + Cos[W]^2, Element[W, Reals]];
  GenericWarmup = Quiet[{Simplify[Abs[W] + W, W < 0], Simplify[Sqrt[W^2] - W, W > 0], Refine[Sqrt[W^2], W > 0], Simplify[Log[W V] - Log[W] - Log[V], W > 0 && V > 0], Simplify[Log[-W] - Log[W] - I Pi, W < 0], Simplify[(-1)^(2 W) - 1, Element[W, Integers]], Simplify[Mod[W + 1, 2], Element[W, Integers] && Element[(W - 1)/2, Integers]], Simplify[ArcTan[W] + ArcTan[1/W] - Pi/2, W > 0], FullSimplify[ArcCot[W] - ArcTan[1/W], W > 0], Simplify[Abs[Exp[I W]] - 1, Element[W, Reals]], Simplify[Re[W] - (W + Conjugate[W])/2], Simplify[Gamma[W + 1] - W!, Element[W, Integers] && W > 0], Simplify[Floor[W] - W, Element[W, Integers]], Simplify[Sqrt[W] Sqrt[V] - Sqrt[W V], W > 0 && V > 0], Simplify[HeavisideTheta[W] - 1, W > 0], Simplify[2^W 2^V - 2^(W + V), Element[W, Reals] && Element[V, Reals]], Simplify[Sum[V, {V, 1, W}] - W (W + 1)/2, Element[W, Integers] && W > 0]}];
  Quiet[Check[Message[General::argx, "W", 0], Null]];
  {$Version, Warmup, Length[GenericWarmup]}
)
(* evaluated in a forked copy of the setup kernel: TimeConstrained would not fire here (no timer thread), so the parent enforces a hard timeout of 9 s by killing this process *)
(
  Assum = (Element[n, Integers]) && (Element[((n) - 1)/2, Integers]);
  Residual = ((-1)^(n + 1)) - (1);
  Result = Simplify[Residual, Assum];
  Answer = Which[Result === 0, True, NumericQ[Result] && TrueQ[Result != 0], False, True, Null];
  {Residual, Result, Answer}
)
difference((-1)^(n + 1)) - (1)→-1 + (-1)^(1 + n)
resultSimplify[Residual, Assum]→0
answertrue
Older runs (11)
systemoutcomeanswersteps (from the trace)srunquery (as sent)detail
wolfram-fullsimplify solvedtruedifference → -1 + (-1)^(1 + n) · result → 00.0232026-10-13 16:39:09 03f5149718d0Element[n, Integers] ∧ Element[((n) - 1)/2, Integers] ⊢ (Power[(-1), (n + 1)] == 1)true
code
setup — not timed
(
  $HistoryLength = 0;
  $Messages = {};
  Warmup = FullSimplify[Sin[W]^2 + Cos[W]^2, Element[W, Reals]];
  GenericWarmup = Quiet[{Simplify[Abs[W] + W, W < 0], Simplify[Sqrt[W^2] - W, W > 0], Refine[Sqrt[W^2], W > 0], Simplify[Log[W V] - Log[W] - Log[V], W > 0 && V > 0], Simplify[Log[-W] - Log[W] - I Pi, W < 0], Simplify[(-1)^(2 W) - 1, Element[W, Integers]], Simplify[Mod[W + 1, 2], Element[W, Integers] && Element[(W - 1)/2, Integers]], Simplify[ArcTan[W] + ArcTan[1/W] - Pi/2, W > 0], FullSimplify[ArcCot[W] - ArcTan[1/W], W > 0], Simplify[Abs[Exp[I W]] - 1, Element[W, Reals]], Simplify[Re[W] - (W + Conjugate[W])/2], Simplify[Gamma[W + 1] - W!, Element[W, Integers] && W > 0], Simplify[Floor[W] - W, Element[W, Integers]], Simplify[Sqrt[W] Sqrt[V] - Sqrt[W V], W > 0 && V > 0], Simplify[HeavisideTheta[W] - 1, W > 0], Simplify[2^W 2^V - 2^(W + V), Element[W, Reals] && Element[V, Reals]], Simplify[Sum[V, {V, 1, W}] - W (W + 1)/2, Element[W, Integers] && W > 0]}];
  Quiet[Check[Message[General::argx, "W", 0], Null]];
  {$Version, Warmup, Length[GenericWarmup]}
)
(* evaluated in a forked copy of the setup kernel: TimeConstrained would not fire here (no timer thread), so the parent enforces a hard timeout of 9 s by killing this process *)
(
  Assum = (Element[n, Integers]) && (Element[((n) - 1)/2, Integers]);
  Residual = ((-1)^(n + 1)) - (1);
  Result = FullSimplify[Residual, Assum];
  Answer = Which[Result === 0, True, NumericQ[Result] && TrueQ[Result != 0], False, True, Null];
  {Residual, Result, Answer}
)
difference((-1)^(n + 1)) - (1)→-1 + (-1)^(1 + n)
resultFullSimplify[Residual, Assum]→0
answertrue
wolfram-refine solvedtruedifference → -1 + (-1)^(1 + n) · result → 00.0212026-10-13 16:39:06 03f5149718d0Element[n, Integers] ∧ Element[((n) - 1)/2, Integers] ⊢ (Power[(-1), (n + 1)] == 1)true
code
setup — not timed
(
  $HistoryLength = 0;
  $Messages = {};
  Warmup = Refine[Sin[W]^2 + Cos[W]^2, Element[W, Reals]];
  GenericWarmup = Quiet[{Simplify[Abs[W] + W, W < 0], Simplify[Sqrt[W^2] - W, W > 0], Refine[Sqrt[W^2], W > 0], Simplify[Log[W V] - Log[W] - Log[V], W > 0 && V > 0], Simplify[Log[-W] - Log[W] - I Pi, W < 0], Simplify[(-1)^(2 W) - 1, Element[W, Integers]], Simplify[Mod[W + 1, 2], Element[W, Integers] && Element[(W - 1)/2, Integers]], Simplify[ArcTan[W] + ArcTan[1/W] - Pi/2, W > 0], FullSimplify[ArcCot[W] - ArcTan[1/W], W > 0], Simplify[Abs[Exp[I W]] - 1, Element[W, Reals]], Simplify[Re[W] - (W + Conjugate[W])/2], Simplify[Gamma[W + 1] - W!, Element[W, Integers] && W > 0], Simplify[Floor[W] - W, Element[W, Integers]], Simplify[Sqrt[W] Sqrt[V] - Sqrt[W V], W > 0 && V > 0], Simplify[HeavisideTheta[W] - 1, W > 0], Simplify[2^W 2^V - 2^(W + V), Element[W, Reals] && Element[V, Reals]], Simplify[Sum[V, {V, 1, W}] - W (W + 1)/2, Element[W, Integers] && W > 0]}];
  Quiet[Check[Message[General::argx, "W", 0], Null]];
  {$Version, Warmup, Length[GenericWarmup]}
)
(* evaluated in a forked copy of the setup kernel: TimeConstrained would not fire here (no timer thread), so the parent enforces a hard timeout of 9 s by killing this process *)
(
  Assum = (Element[n, Integers]) && (Element[((n) - 1)/2, Integers]);
  Residual = ((-1)^(n + 1)) - (1);
  Result = Refine[Residual, Assum];
  Answer = Which[Result === 0, True, NumericQ[Result] && TrueQ[Result != 0], False, True, Null];
  {Residual, Result, Answer}
)
difference((-1)^(n + 1)) - (1)→-1 + (-1)^(1 + n)
resultRefine[Residual, Assum]→0
answertrue
wolfram-simplify solvedtruedifference → -1 + (-1)^(1 + n) · result → 00.0212026-10-13 16:39:02 03f5149718d0Element[n, Integers] ∧ Element[((n) - 1)/2, Integers] ⊢ (Power[(-1), (n + 1)] == 1)true
code
setup — not timed
(
  $HistoryLength = 0;
  $Messages = {};
  Warmup = Simplify[Sin[W]^2 + Cos[W]^2, Element[W, Reals]];
  GenericWarmup = Quiet[{Simplify[Abs[W] + W, W < 0], Simplify[Sqrt[W^2] - W, W > 0], Refine[Sqrt[W^2], W > 0], Simplify[Log[W V] - Log[W] - Log[V], W > 0 && V > 0], Simplify[Log[-W] - Log[W] - I Pi, W < 0], Simplify[(-1)^(2 W) - 1, Element[W, Integers]], Simplify[Mod[W + 1, 2], Element[W, Integers] && Element[(W - 1)/2, Integers]], Simplify[ArcTan[W] + ArcTan[1/W] - Pi/2, W > 0], FullSimplify[ArcCot[W] - ArcTan[1/W], W > 0], Simplify[Abs[Exp[I W]] - 1, Element[W, Reals]], Simplify[Re[W] - (W + Conjugate[W])/2], Simplify[Gamma[W + 1] - W!, Element[W, Integers] && W > 0], Simplify[Floor[W] - W, Element[W, Integers]], Simplify[Sqrt[W] Sqrt[V] - Sqrt[W V], W > 0 && V > 0], Simplify[HeavisideTheta[W] - 1, W > 0], Simplify[2^W 2^V - 2^(W + V), Element[W, Reals] && Element[V, Reals]], Simplify[Sum[V, {V, 1, W}] - W (W + 1)/2, Element[W, Integers] && W > 0]}];
  Quiet[Check[Message[General::argx, "W", 0], Null]];
  {$Version, Warmup, Length[GenericWarmup]}
)
(* evaluated in a forked copy of the setup kernel: TimeConstrained would not fire here (no timer thread), so the parent enforces a hard timeout of 9 s by killing this process *)
(
  Assum = (Element[n, Integers]) && (Element[((n) - 1)/2, Integers]);
  Residual = ((-1)^(n + 1)) - (1);
  Result = Simplify[Residual, Assum];
  Answer = Which[Result === 0, True, NumericQ[Result] && TrueQ[Result != 0], False, True, Null];
  {Residual, Result, Answer}
)
difference((-1)^(n + 1)) - (1)→-1 + (-1)^(1 + n)
resultSimplify[Residual, Assum]→0
answertrue
sympy-simplifysolvedtruedifference → 0 · simplify → 00.0072026-10-13 16:39:01 03f5149718d0Q.integer(n) ∧ Q.odd(n) ⊢ Eq(Pow((-1), (n + 1)), 1)true
code
setup — not timed
from sympy import *
import sympy

SympyVersion = sympy.__version__
# warm-up: a fixed generic expression, never case content
W = Symbol('W')
Warmup = simplify(sin(W)**2 + cos(W)**2)
# every query then runs in its own forked process, starting from this state:
# the expression caches are dropped (imported and lazily loaded modules stay)
sympy.core.cache.clear_cache()
n = Symbol('n', integer=True, odd=True)
Residual = Pow(-1, n + 1) - 1
Result = simplify(Residual)
# true iff the result is 0; false only if it is a definite nonzero number
Answer = True if Result == 0 else False if (Result.is_number and Result.is_finite and Result.is_zero is False) else None
print(Result, Answer, sep='\n')
differencePow(-1, n + 1) - 1→0
simplifysimplify(Residual)→0
answertrue
sympy-refinesolvedtruedifference → (-1)**(n + 1) - 1 · refine → 00.0412026-10-13 16:38:59 03f5149718d0Q.integer(n) ∧ Q.odd(n) ⊢ Eq(Pow((-1), (n + 1)), 1)true
code
setup — not timed
from sympy import *
import sympy

SympyVersion = sympy.__version__
# warm-up: a fixed generic expression, never case content
W = Symbol('W')
Warmup = refine(Abs(W), Q.positive(W))
# every query then runs in its own forked process, starting from this state:
# the expression caches are dropped (imported and lazily loaded modules stay)
sympy.core.cache.clear_cache()
n = Symbol('n', integer=True)
Assum = And(Q.integer(n), Q.odd(n))
Residual = Pow(-1, n + 1) - 1
Result = refine(Residual, Assum)
# true iff the result is 0; false only if it is a definite nonzero number
Answer = True if Result == 0 else False if (Result.is_number and Result.is_finite and Result.is_zero is False) else None
print(Result, Answer, sep='\n')
differencePow(-1, n + 1) - 1→(-1)**(n + 1) - 1
refinerefine(Residual, Assum)→0
answertrue
always-noneno verdictnull0.02026-10-13 16:38:56 03f5149718d0(integer n) ∧ (odd n) ⊢ (= (pow -1 (+ n 1)) 1)null
sympy-askno verdictnulldifference → (-1)**(n + 1) - 1 · ask → None0.0492026-10-13 16:38:56 03f5149718d0Q.integer(n) ∧ Q.odd(n) ⊢ Eq(Pow((-1), (n + 1)), 1)null
code
setup — not timed
from sympy import *
import sympy

SympyVersion = sympy.__version__
# warm-up: a fixed generic expression, never case content
W = Symbol('W')
Warmup = ask(Q.positive(W**2 + 1), Q.real(W))
# every query then runs in its own forked process, starting from this state:
# the expression caches are dropped (imported and lazily loaded modules stay)
sympy.core.cache.clear_cache()
n = Symbol('n', integer=True)
Assum = And(Q.integer(n), Q.odd(n))
Residual = Pow(-1, n + 1) - 1
# not Q.eq: in SymPy 1.14 ask(Q.eq(x**2, x), Q.real(x)) is wrongly False
Answer = ask(Q.zero(Residual), Assum)
print(Residual, Answer, sep='\n')
differencePow(-1, n + 1) - 1→(-1)**(n + 1) - 1
askQ.zero(Residual)→None
answernull
wolfram-fullsimplify solvedtruedifference → -1 + (-1)^(1 + n) · result → 00.0222026-10-12 20:21:41 d7af4def9aaaElement[n, Integers] ∧ Element[((n) - 1)/2, Integers] ⊢ (Power[(-1), (n + 1)] == 1)true
code
setup — not timed
(
  $HistoryLength = 0;
  $Messages = {};
  Warmup = FullSimplify[Sin[W]^2 + Cos[W]^2, Element[W, Reals]];
  GenericWarmup = Quiet[{Simplify[Abs[W] + W, W < 0], Simplify[Sqrt[W^2] - W, W > 0], Refine[Sqrt[W^2], W > 0], Simplify[Log[W V] - Log[W] - Log[V], W > 0 && V > 0], Simplify[Log[-W] - Log[W] - I Pi, W < 0], Simplify[(-1)^(2 W) - 1, Element[W, Integers]], Simplify[Mod[W + 1, 2], Element[W, Integers] && Element[(W - 1)/2, Integers]], Simplify[ArcTan[W] + ArcTan[1/W] - Pi/2, W > 0], FullSimplify[ArcCot[W] - ArcTan[1/W], W > 0], Simplify[Abs[Exp[I W]] - 1, Element[W, Reals]], Simplify[Re[W] - (W + Conjugate[W])/2], Simplify[Gamma[W + 1] - W!, Element[W, Integers] && W > 0], Simplify[Floor[W] - W, Element[W, Integers]], Simplify[Sqrt[W] Sqrt[V] - Sqrt[W V], W > 0 && V > 0], Simplify[HeavisideTheta[W] - 1, W > 0], Simplify[2^W 2^V - 2^(W + V), Element[W, Reals] && Element[V, Reals]], Simplify[Sum[V, {V, 1, W}] - W (W + 1)/2, Element[W, Integers] && W > 0]}];
  Quiet[Check[Message[General::argx, "W", 0], Null]];
  {$Version, Warmup, Length[GenericWarmup]}
)
(* evaluated in a forked copy of the setup kernel: TimeConstrained would not fire here (no timer thread), so the parent enforces a hard timeout of 9 s by killing this process *)
(
  Assum = (Element[n, Integers]) && (Element[((n) - 1)/2, Integers]);
  Residual = ((-1)^(n + 1)) - (1);
  Result = FullSimplify[Residual, Assum];
  Answer = Which[Result === 0, True, NumericQ[Result] && TrueQ[Result != 0], False, True, Null];
  {Residual, Result, Answer}
)
difference((-1)^(n + 1)) - (1)→-1 + (-1)^(1 + n)
resultFullSimplify[Residual, Assum]→0
answertrue
wolfram-refine solvedtruedifference → -1 + (-1)^(1 + n) · result → 00.0212026-10-12 20:21:37 d7af4def9aaaElement[n, Integers] ∧ Element[((n) - 1)/2, Integers] ⊢ (Power[(-1), (n + 1)] == 1)true
code
setup — not timed
(
  $HistoryLength = 0;
  $Messages = {};
  Warmup = Refine[Sin[W]^2 + Cos[W]^2, Element[W, Reals]];
  GenericWarmup = Quiet[{Simplify[Abs[W] + W, W < 0], Simplify[Sqrt[W^2] - W, W > 0], Refine[Sqrt[W^2], W > 0], Simplify[Log[W V] - Log[W] - Log[V], W > 0 && V > 0], Simplify[Log[-W] - Log[W] - I Pi, W < 0], Simplify[(-1)^(2 W) - 1, Element[W, Integers]], Simplify[Mod[W + 1, 2], Element[W, Integers] && Element[(W - 1)/2, Integers]], Simplify[ArcTan[W] + ArcTan[1/W] - Pi/2, W > 0], FullSimplify[ArcCot[W] - ArcTan[1/W], W > 0], Simplify[Abs[Exp[I W]] - 1, Element[W, Reals]], Simplify[Re[W] - (W + Conjugate[W])/2], Simplify[Gamma[W + 1] - W!, Element[W, Integers] && W > 0], Simplify[Floor[W] - W, Element[W, Integers]], Simplify[Sqrt[W] Sqrt[V] - Sqrt[W V], W > 0 && V > 0], Simplify[HeavisideTheta[W] - 1, W > 0], Simplify[2^W 2^V - 2^(W + V), Element[W, Reals] && Element[V, Reals]], Simplify[Sum[V, {V, 1, W}] - W (W + 1)/2, Element[W, Integers] && W > 0]}];
  Quiet[Check[Message[General::argx, "W", 0], Null]];
  {$Version, Warmup, Length[GenericWarmup]}
)
(* evaluated in a forked copy of the setup kernel: TimeConstrained would not fire here (no timer thread), so the parent enforces a hard timeout of 9 s by killing this process *)
(
  Assum = (Element[n, Integers]) && (Element[((n) - 1)/2, Integers]);
  Residual = ((-1)^(n + 1)) - (1);
  Result = Refine[Residual, Assum];
  Answer = Which[Result === 0, True, NumericQ[Result] && TrueQ[Result != 0], False, True, Null];
  {Residual, Result, Answer}
)
difference((-1)^(n + 1)) - (1)→-1 + (-1)^(1 + n)
resultRefine[Residual, Assum]→0
answertrue
wolfram-simplify solvedtruedifference → -1 + (-1)^(1 + n) · result → 00.0222026-10-12 20:21:34 d7af4def9aaaElement[n, Integers] ∧ Element[((n) - 1)/2, Integers] ⊢ (Power[(-1), (n + 1)] == 1)true
code
setup — not timed
(
  $HistoryLength = 0;
  $Messages = {};
  Warmup = Simplify[Sin[W]^2 + Cos[W]^2, Element[W, Reals]];
  GenericWarmup = Quiet[{Simplify[Abs[W] + W, W < 0], Simplify[Sqrt[W^2] - W, W > 0], Refine[Sqrt[W^2], W > 0], Simplify[Log[W V] - Log[W] - Log[V], W > 0 && V > 0], Simplify[Log[-W] - Log[W] - I Pi, W < 0], Simplify[(-1)^(2 W) - 1, Element[W, Integers]], Simplify[Mod[W + 1, 2], Element[W, Integers] && Element[(W - 1)/2, Integers]], Simplify[ArcTan[W] + ArcTan[1/W] - Pi/2, W > 0], FullSimplify[ArcCot[W] - ArcTan[1/W], W > 0], Simplify[Abs[Exp[I W]] - 1, Element[W, Reals]], Simplify[Re[W] - (W + Conjugate[W])/2], Simplify[Gamma[W + 1] - W!, Element[W, Integers] && W > 0], Simplify[Floor[W] - W, Element[W, Integers]], Simplify[Sqrt[W] Sqrt[V] - Sqrt[W V], W > 0 && V > 0], Simplify[HeavisideTheta[W] - 1, W > 0], Simplify[2^W 2^V - 2^(W + V), Element[W, Reals] && Element[V, Reals]], Simplify[Sum[V, {V, 1, W}] - W (W + 1)/2, Element[W, Integers] && W > 0]}];
  Quiet[Check[Message[General::argx, "W", 0], Null]];
  {$Version, Warmup, Length[GenericWarmup]}
)
(* evaluated in a forked copy of the setup kernel: TimeConstrained would not fire here (no timer thread), so the parent enforces a hard timeout of 9 s by killing this process *)
(
  Assum = (Element[n, Integers]) && (Element[((n) - 1)/2, Integers]);
  Residual = ((-1)^(n + 1)) - (1);
  Result = Simplify[Residual, Assum];
  Answer = Which[Result === 0, True, NumericQ[Result] && TrueQ[Result != 0], False, True, Null];
  {Residual, Result, Answer}
)
difference((-1)^(n + 1)) - (1)→-1 + (-1)^(1 + n)
resultSimplify[Residual, Assum]→0
answertrue
always-noneno verdictnull0.02026-10-12 20:21:33 d7af4def9aaa(integer n) ∧ (odd n) ⊢ (= (pow -1 (+ n 1)) 1)null

Source (parity.sexp)

(case demo-parity-01 (category parity)
  (var n integer)
  (assume (odd n))
  (ask (= (pow -1 (+ n 1)) 1))
  (expect true))