logo

Expression of type ExprTuple

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, ExprTuple, Lambda, 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 = ExprTuple(Lambda([a, b], 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(\left(a, b\right) \mapsto \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..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameters: 25
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 29
operands: 7
5Literal
6ExprTuple8
7ExprTuple9, 10, 11
8Lambdaparameter: 43
body: 13
9Operationoperator: 31
operands: 14
10Operationoperator: 31
operands: 15
11Operationoperator: 16
operands: 17
12ExprTuple43
13Conditionalvalue: 18
condition: 19
14ExprTuple42, 37
15ExprTuple44, 37
16Literal
17ExprTuple20, 38
18Operationoperator: 21
operand: 26
19Operationoperator: 29
operands: 23
20Operationoperator: 24
operands: 25
21Literal
22ExprTuple26
23ExprTuple27, 28
24Literal
25ExprTuple42, 44
26Operationoperator: 29
operands: 30
27Operationoperator: 31
operands: 32
28Operationoperator: 33
operands: 34
29Literal
30ExprTuple35, 36
31Literal
32ExprTuple43, 37
33Literal
34ExprTuple38, 43
35Operationoperator: 40
operands: 39
36Operationoperator: 40
operands: 41
37Literal
38Literal
39ExprTuple43, 42
40Literal
41ExprTuple43, 44
42Variable
43Variable
44Variable