Metamath Proof Explorer


Theorem absmax

Description: The maximum of two numbers using absolute value. (Contributed by NM, 7-Aug-2008)

Ref Expression
Assertion absmax A B if A B B A = A + B + A B 2

Proof

Step Hyp Ref Expression
1 recn A A
2 2cn 2
3 2ne0 2 0
4 divcan3 A 2 2 0 2 A 2 = A
5 2 3 4 mp3an23 A 2 A 2 = A
6 1 5 syl A 2 A 2 = A
7 6 ad2antlr B A B < A 2 A 2 = A
8 ltle B A B < A B A
9 8 imp B A B < A B A
10 abssubge0 B A B A A B = A B
11 10 3expa B A B A A B = A B
12 9 11 syldan B A B < A A B = A B
13 12 oveq2d B A B < A A + B + A B = A + B + A B
14 recn B B
15 simpr B A A
16 simpl B A B
17 15 16 15 ppncand B A A + B + A B = A + A
18 2times A 2 A = A + A
19 18 adantl B A 2 A = A + A
20 17 19 eqtr4d B A A + B + A B = 2 A
21 14 1 20 syl2an B A A + B + A B = 2 A
22 21 adantr B A B < A A + B + A B = 2 A
23 13 22 eqtrd B A B < A A + B + A B = 2 A
24 23 oveq1d B A B < A A + B + A B 2 = 2 A 2
25 ltnle B A B < A ¬ A B
26 25 biimpa B A B < A ¬ A B
27 26 iffalsed B A B < A if A B B A = A
28 7 24 27 3eqtr4rd B A B < A if A B B A = A + B + A B 2
29 28 ancom1s A B B < A if A B B A = A + B + A B 2
30 divcan3 B 2 2 0 2 B 2 = B
31 2 3 30 mp3an23 B 2 B 2 = B
32 14 31 syl B 2 B 2 = B
33 32 ad2antlr A B A B 2 B 2 = B
34 abssuble0 A B A B A B = B A
35 34 3expa A B A B A B = B A
36 35 oveq2d A B A B A + B + A B = A + B + B A
37 simpr A B B
38 simpl A B A
39 37 38 37 ppncand A B B + A + B A = B + B
40 addcom A B A + B = B + A
41 40 oveq1d A B A + B + B A = B + A + B A
42 2times B 2 B = B + B
43 42 adantl A B 2 B = B + B
44 39 41 43 3eqtr4d A B A + B + B A = 2 B
45 1 14 44 syl2an A B A + B + B A = 2 B
46 45 adantr A B A B A + B + B A = 2 B
47 36 46 eqtrd A B A B A + B + A B = 2 B
48 47 oveq1d A B A B A + B + A B 2 = 2 B 2
49 iftrue A B if A B B A = B
50 49 adantl A B A B if A B B A = B
51 33 48 50 3eqtr4rd A B A B if A B B A = A + B + A B 2
52 simpr A B B
53 simpl A B A
54 29 51 52 53 ltlecasei A B if A B B A = A + B + A B 2