logo

Expression of type Implies

from the theory of proveit.numbers.exponentiation

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 a, a_star, b, b_star
from proveit.logic import And, Equals, Exists, FALSE, Forall, Implies
from proveit.numbers import Abs, GCD, NaturalPos, frac, one, sqrt, two
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Abs(sqrt(two))
expr = Implies(And(Exists(instance_param_or_params = [a, b], instance_expr = And(Equals(sub_expr1, frac(a, b)), Equals(GCD(a, b), one)), domain = NaturalPos), Forall(instance_param_or_params = [a_star, b_star], instance_expr = Implies(And(Equals(sub_expr1, frac(a_star, b_star)), Equals(GCD(a_star, b_star), one)), FALSE), domain = NaturalPos)), FALSE)
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[\exists_{a, b \in \mathbb{N}^+}~\left(\left(\left|\sqrt{2}\right| = \frac{a}{b}\right) \land \left(gcd\left(a, b\right) = 1\right)\right)\right] \land \left[\forall_{a^*, b^* \in \mathbb{N}^+}~\left(\left(\left(\left|\sqrt{2}\right| = \frac{a^*}{b^*}\right) \land \left(gcd\left(a^*, b^*\right) = 1\right)\right) \Rightarrow \bot\right)\right]\right) \Rightarrow \bot
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
operation'infix' or 'function' style formattinginfixinfix
wrap_positionsposition(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation.()()('with_wrapping_at', 'with_wrap_before_operator', 'with_wrap_after_operator', 'without_wrapping', 'wrap_positions')
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'centercenter('with_justification',)
directionDirection of the relation (normal or reversed)normalnormal('with_direction_reversed', 'is_reversed')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 20
operands: 1
1ExprTuple2, 28
2Operationoperator: 35
operands: 3
3ExprTuple4, 5
4Operationoperator: 6
operand: 10
5Operationoperator: 8
operand: 11
6Literal
7ExprTuple10
8Literal
9ExprTuple11
10Lambdaparameters: 45
body: 12
11Lambdaparameters: 57
body: 13
12Conditionalvalue: 14
condition: 15
13Conditionalvalue: 16
condition: 17
14Operationoperator: 35
operands: 18
15Operationoperator: 35
operands: 19
16Operationoperator: 20
operands: 21
17Operationoperator: 35
operands: 22
18ExprTuple23, 24
19ExprTuple25, 26
20Literal
21ExprTuple27, 28
22ExprTuple29, 30
23Operationoperator: 47
operands: 31
24Operationoperator: 47
operands: 32
25Operationoperator: 38
operands: 33
26Operationoperator: 38
operands: 34
27Operationoperator: 35
operands: 36
28Literal
29Operationoperator: 38
operands: 37
30Operationoperator: 38
operands: 39
31ExprTuple51, 40
32ExprTuple41, 66
33ExprTuple49, 44
34ExprTuple50, 44
35Literal
36ExprTuple42, 43
37ExprTuple59, 44
38Literal
39ExprTuple60, 44
40Operationoperator: 64
operands: 45
41Operationoperator: 56
operands: 45
42Operationoperator: 47
operands: 46
43Operationoperator: 47
operands: 48
44Literal
45ExprTuple49, 50
46ExprTuple51, 52
47Literal
48ExprTuple53, 66
49Variable
50Variable
51Operationoperator: 54
operand: 58
52Operationoperator: 64
operands: 57
53Operationoperator: 56
operands: 57
54Literal
55ExprTuple58
56Literal
57ExprTuple59, 60
58Operationoperator: 61
operands: 62
59Variable
60Variable
61Literal
62ExprTuple67, 63
63Operationoperator: 64
operands: 65
64Literal
65ExprTuple66, 67
66Literal
67Literal