Metamath Proof Explorer


Theorem max0sub

Description: Decompose a real number into positive and negative parts. (Contributed by Mario Carneiro, 6-Aug-2014)

Ref Expression
Assertion max0sub A if 0 A A 0 if 0 A A 0 = A

Proof

Step Hyp Ref Expression
1 0red A 0
2 id A A
3 iftrue 0 A if 0 A A 0 = A
4 3 adantl A 0 A if 0 A A 0 = A
5 0xr 0 *
6 renegcl A A
7 6 adantr A 0 A A
8 7 rexrd A 0 A A *
9 le0neg2 A 0 A A 0
10 9 biimpa A 0 A A 0
11 xrmaxeq 0 * A * A 0 if 0 A A 0 = 0
12 5 8 10 11 mp3an2i A 0 A if 0 A A 0 = 0
13 4 12 oveq12d A 0 A if 0 A A 0 if 0 A A 0 = A 0
14 recn A A
15 14 adantr A 0 A A
16 15 subid1d A 0 A A 0 = A
17 13 16 eqtrd A 0 A if 0 A A 0 if 0 A A 0 = A
18 rexr A A *
19 18 adantr A A 0 A *
20 simpr A A 0 A 0
21 xrmaxeq 0 * A * A 0 if 0 A A 0 = 0
22 5 19 20 21 mp3an2i A A 0 if 0 A A 0 = 0
23 le0neg1 A A 0 0 A
24 23 biimpa A A 0 0 A
25 24 iftrued A A 0 if 0 A A 0 = A
26 22 25 oveq12d A A 0 if 0 A A 0 if 0 A A 0 = 0 A
27 df-neg A = 0 A
28 14 adantr A A 0 A
29 28 negnegd A A 0 A = A
30 27 29 eqtr3id A A 0 0 A = A
31 26 30 eqtrd A A 0 if 0 A A 0 if 0 A A 0 = A
32 1 2 17 31 lecasei A if 0 A A 0 if 0 A A 0 = A