Metamath Proof Explorer


Theorem reabsifnpos

Description: Alternate expression for the absolute value of a real number. (Contributed by RP, 11-May-2024)

Ref Expression
Assertion reabsifnpos
|- ( A e. RR -> ( abs ` A ) = if ( A <_ 0 , -u A , A ) )

Proof

Step Hyp Ref Expression
1 absnid
 |-  ( ( A e. RR /\ A <_ 0 ) -> ( abs ` A ) = -u A )
2 1 eqcomd
 |-  ( ( A e. RR /\ A <_ 0 ) -> -u A = ( abs ` A ) )
3 0re
 |-  0 e. RR
4 ltnle
 |-  ( ( 0 e. RR /\ A e. RR ) -> ( 0 < A <-> -. A <_ 0 ) )
5 ltle
 |-  ( ( 0 e. RR /\ A e. RR ) -> ( 0 < A -> 0 <_ A ) )
6 4 5 sylbird
 |-  ( ( 0 e. RR /\ A e. RR ) -> ( -. A <_ 0 -> 0 <_ A ) )
7 3 6 mpan
 |-  ( A e. RR -> ( -. A <_ 0 -> 0 <_ A ) )
8 7 imdistani
 |-  ( ( A e. RR /\ -. A <_ 0 ) -> ( A e. RR /\ 0 <_ A ) )
9 absid
 |-  ( ( A e. RR /\ 0 <_ A ) -> ( abs ` A ) = A )
10 8 9 syl
 |-  ( ( A e. RR /\ -. A <_ 0 ) -> ( abs ` A ) = A )
11 10 eqcomd
 |-  ( ( A e. RR /\ -. A <_ 0 ) -> A = ( abs ` A ) )
12 2 11 ifeqda
 |-  ( A e. RR -> if ( A <_ 0 , -u A , A ) = ( abs ` A ) )
13 12 eqcomd
 |-  ( A e. RR -> ( abs ` A ) = if ( A <_ 0 , -u A , A ) )