logo

Expression of type Conditional

from the theory of proveit.numbers.divisibility

In [1]:
import proveit
# Automation is not needed when building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_expr # Load the stored expression as 'stored_expr'
# import Expression classes needed to build the expression
from proveit import Conditional, a, b, p
from proveit.logic import And, Equals, Forall, InSet, Not
from proveit.numbers import Divides, GCD, NaturalPos, greater, one
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [p], instance_expr = Not(And(Divides(p, a), Divides(p, b))), domain = NaturalPos, condition = greater(p, one)), And(InSet(a, NaturalPos), InSet(b, NaturalPos), Equals(GCD(a, b), one)))
expr:
In [3]:
# check that the built expression is the same as the stored expression
assert expr == stored_expr
assert expr._style_id == stored_expr._style_id
print("Passed sanity check: expr matches stored_expr")
Passed sanity check: expr matches stored_expr
In [4]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\left\{\forall_{p \in \mathbb{N}^+~|~p > 1}~(\lnot \left(\left(p \rvert a\right) \land \left(p \rvert b\right)\right)) \textrm{ if } a \in \mathbb{N}^+ ,  b \in \mathbb{N}^+ ,  gcd\left(a, b\right) = 1\right..
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
condition_delimiter'comma' or 'and'commacomma('with_comma_delimiter', 'with_conjunction_delimiter')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Conditionalvalue: 1
condition: 2
1Operationoperator: 3
operand: 6
2Operationoperator: 27
operands: 5
3Literal
4ExprTuple6
5ExprTuple7, 8, 9
6Lambdaparameter: 41
body: 11
7Operationoperator: 29
operands: 12
8Operationoperator: 29
operands: 13
9Operationoperator: 14
operands: 15
10ExprTuple41
11Conditionalvalue: 16
condition: 17
12ExprTuple40, 35
13ExprTuple42, 35
14Literal
15ExprTuple18, 36
16Operationoperator: 19
operand: 24
17Operationoperator: 27
operands: 21
18Operationoperator: 22
operands: 23
19Literal
20ExprTuple24
21ExprTuple25, 26
22Literal
23ExprTuple40, 42
24Operationoperator: 27
operands: 28
25Operationoperator: 29
operands: 30
26Operationoperator: 31
operands: 32
27Literal
28ExprTuple33, 34
29Literal
30ExprTuple41, 35
31Literal
32ExprTuple36, 41
33Operationoperator: 38
operands: 37
34Operationoperator: 38
operands: 39
35Literal
36Literal
37ExprTuple41, 40
38Literal
39ExprTuple41, 42
40Variable
41Variable
42Variable