Metamath Proof Explorer


Theorem reabsifpos

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

Ref Expression
Assertion reabsifpos ( 𝐴 ∈ ℝ → ( abs ‘ 𝐴 ) = if ( 0 < 𝐴 , 𝐴 , - 𝐴 ) )

Proof

Step Hyp Ref Expression
1 0re 0 ∈ ℝ
2 ltle ( ( 0 ∈ ℝ ∧ 𝐴 ∈ ℝ ) → ( 0 < 𝐴 → 0 ≤ 𝐴 ) )
3 1 2 mpan ( 𝐴 ∈ ℝ → ( 0 < 𝐴 → 0 ≤ 𝐴 ) )
4 3 imdistani ( ( 𝐴 ∈ ℝ ∧ 0 < 𝐴 ) → ( 𝐴 ∈ ℝ ∧ 0 ≤ 𝐴 ) )
5 absid ( ( 𝐴 ∈ ℝ ∧ 0 ≤ 𝐴 ) → ( abs ‘ 𝐴 ) = 𝐴 )
6 4 5 syl ( ( 𝐴 ∈ ℝ ∧ 0 < 𝐴 ) → ( abs ‘ 𝐴 ) = 𝐴 )
7 6 eqcomd ( ( 𝐴 ∈ ℝ ∧ 0 < 𝐴 ) → 𝐴 = ( abs ‘ 𝐴 ) )
8 id ( 𝐴 ∈ ℝ → 𝐴 ∈ ℝ )
9 0red ( 𝐴 ∈ ℝ → 0 ∈ ℝ )
10 8 9 lenltd ( 𝐴 ∈ ℝ → ( 𝐴 ≤ 0 ↔ ¬ 0 < 𝐴 ) )
11 10 pm5.32i ( ( 𝐴 ∈ ℝ ∧ 𝐴 ≤ 0 ) ↔ ( 𝐴 ∈ ℝ ∧ ¬ 0 < 𝐴 ) )
12 absnid ( ( 𝐴 ∈ ℝ ∧ 𝐴 ≤ 0 ) → ( abs ‘ 𝐴 ) = - 𝐴 )
13 11 12 sylbir ( ( 𝐴 ∈ ℝ ∧ ¬ 0 < 𝐴 ) → ( abs ‘ 𝐴 ) = - 𝐴 )
14 13 eqcomd ( ( 𝐴 ∈ ℝ ∧ ¬ 0 < 𝐴 ) → - 𝐴 = ( abs ‘ 𝐴 ) )
15 7 14 ifeqda ( 𝐴 ∈ ℝ → if ( 0 < 𝐴 , 𝐴 , - 𝐴 ) = ( abs ‘ 𝐴 ) )
16 15 eqcomd ( 𝐴 ∈ ℝ → ( abs ‘ 𝐴 ) = if ( 0 < 𝐴 , 𝐴 , - 𝐴 ) )