logo
In [1]:
import proveit
theory = proveit.Theory() # the theorem's theory
from proveit import x, y, defaults
from proveit.logic import Equals, InSet
from proveit.numbers import greater_eq, Less, Real
from proveit.numbers.ordering import less_eq_def, max_def_bin
In [2]:
%proving max_y_ge_x
With these allowed/disallowed theorem/theory presumptions (e.g., to avoid circular dependencies), we begin our proof of
max_y_ge_x:
(see dependencies)
In [3]:
defaults.assumptions = max_y_ge_x.conditions
defaults.assumptions:
In [4]:
max_def_bin
In [5]:
max_x_y = max_def_bin.instantiate({x: x, y: y}, auto_simplify=False)
max_x_y: ,  ⊢  

We proceed by breaking the assumption $y \ge x$ into 2 cases

In [6]:
less_eq_def
In [7]:
y_ge_x_def = less_eq_def.instantiate({x: x, y: y})
y_ge_x_def:  ⊢  
In [8]:
y_ge_x_def.derive_right_via_equality()

Case 1: $x < y$

In [9]:
max_x_y_is_y_if_x_less_y = max_x_y.inner_expr().rhs.simplify(assumptions=[InSet(x, Real), InSet(y, Real), Less(x, y)])
max_x_y_is_y_if_x_less_y: , ,  ⊢  

Case 2: $x = y$

In [10]:
greater_eq(x, y).prove(assumptions=[InSet(x, Real), InSet(y, Real), Equals(x, y)])
, ,  ⊢  
In [11]:
max_x_y_when_x_eq_y = max_x_y.inner_expr().rhs.simplify(assumptions=[InSet(x, Real), InSet(y, Real), Equals(x, y)])
max_x_y_when_x_eq_y: , ,  ⊢  
In [12]:
# Use the fact that x = y to substitute
max_x_y_when_x_eq_y.inner_expr().rhs.substitute(y, assumptions=[Equals(x, y)], auto_simplify=False)
, ,  ⊢  

Combine the 2 cases

In [13]:
or_version_of_thm = y_ge_x_def.rhs.derive_via_singular_dilemma(
    max_x_y_is_y_if_x_less_y.expr)
or_version_of_thm: , ,  ⊢  
max_y_ge_x may now be readily provable (assuming required theorems are usable).  Simply execute "%qed".
In [14]:
%qed
proveit.numbers.ordering.max_y_ge_x has been proven.
Out[14]:
 step typerequirementsstatement
0generalization1  ⊢  
1instantiation2, 3, 4, 13, 5, 6, ,  ⊢  
  : , : , :
2theorem  ⊢  
 proveit.logic.booleans.disjunction.singular_constructive_dilemma
3instantiation7, 9  ⊢  
  : , :
4instantiation8, 9  ⊢  
  : , :
5deduction10,  ⊢  
6deduction11,  ⊢  
7axiom  ⊢  
 proveit.logic.booleans.disjunction.left_in_bool
8axiom  ⊢  
 proveit.logic.booleans.disjunction.right_in_bool
9instantiation12, 13  ⊢  
  :
10instantiation21, 22, 14, ,  ⊢  
  : , : , :
11instantiation21, 15, 55, ,  ⊢  
  : , : , :
12conjecture  ⊢  
 proveit.logic.booleans.in_bool_if_true
13instantiation16, 17, 18  ⊢  
  : , :
14instantiation32, 19, 20, ,  ⊢  
  : , : , :
15instantiation21, 22, 23, ,  ⊢  
  : , : , :
16theorem  ⊢  
 proveit.logic.equality.rhs_via_equality
17assumption  ⊢  
18instantiation24  ⊢  
  : , :
19instantiation32, 25, 26, ,  ⊢  
  : , : , :
20instantiation35, 37, 36, 38  ⊢  
  : , : , : , : , :
21theorem  ⊢  
 proveit.logic.equality.sub_right_side_into
22instantiation27, 52, 51,  ⊢  
  : , :
23instantiation32, 28, 29, ,  ⊢  
  : , : , :
24axiom  ⊢  
 proveit.numbers.ordering.less_eq_def
25instantiation41, 30, ,  ⊢  
  : , : , :
26instantiation41, 31  ⊢  
  : , : , :
27axiom  ⊢  
 proveit.numbers.ordering.max_def_bin
28instantiation32, 33, 34, ,  ⊢  
  : , : , :
29instantiation35, 36, 37, 38  ⊢  
  : , : , : , : , :
30instantiation46, 39, ,  ⊢  
  : , :
31instantiation45, 44  ⊢  
  : , :
32axiom  ⊢  
 proveit.logic.equality.equals_transitivity
33instantiation41, 40, ,  ⊢  
  : , : , :
34instantiation41, 42, ,  ⊢  
  : , : , :
35axiom  ⊢  
 proveit.core_expr_types.conditionals.true_case_reduction
36axiom  ⊢  
 proveit.numbers.number_sets.natural_numbers.zero_in_nats
37theorem  ⊢  
 proveit.numbers.numerals.decimals.nat1
38conjecture  ⊢  
 proveit.core_expr_types.tuples.tuple_len_0_typical_eq
39instantiation43, 52, 51, 44, ,  ⊢  
  : , :
40instantiation45, 49, ,  ⊢  
  : , :
41axiom  ⊢  
 proveit.logic.equality.substitution
42instantiation46, 47, ,  ⊢  
  : , :
43conjecture  ⊢  
 proveit.numbers.ordering.not_less_eq_from_less
44assumption  ⊢  
45conjecture  ⊢  
 proveit.core_expr_types.conditionals.satisfied_condition_reduction
46conjecture  ⊢  
 proveit.core_expr_types.conditionals.dissatisfied_condition_reduction
47instantiation48, 51, 52, 49, ,  ⊢  
  : , :
48conjecture  ⊢  
 proveit.numbers.ordering.not_less_from_less_eq
49instantiation50, 51, 52, 53, ,  ⊢  
  : , :
50conjecture  ⊢  
 proveit.numbers.ordering.relax_equal_to_less_eq
51assumption  ⊢  
52assumption  ⊢  
53instantiation54, 55  ⊢  
  : , :
54theorem  ⊢  
 proveit.logic.equality.equals_reversal
55assumption  ⊢