MPE Home Metamath Proof Explorer < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  MPE Home  >  Th. List  >  absmax Structured version   Unicode version

Theorem absmax 12134
Description: The maximum of two numbers using absolute value. (Contributed by NM, 7-Aug-2008.)
Assertion
Ref Expression
absmax  |-  ( ( A  e.  RR  /\  B  e.  RR )  ->  if ( A  <_  B ,  B ,  A )  =  ( ( ( A  +  B )  +  ( abs `  ( A  -  B ) ) )  /  2 ) )

Proof of Theorem absmax
StepHypRef Expression
1 recn 9081 . . . . . 6  |-  ( A  e.  RR  ->  A  e.  CC )
2 2cn 10071 . . . . . . 7  |-  2  e.  CC
3 2ne0 10084 . . . . . . 7  |-  2  =/=  0
4 divcan3 9703 . . . . . . 7  |-  ( ( A  e.  CC  /\  2  e.  CC  /\  2  =/=  0 )  ->  (
( 2  x.  A
)  /  2 )  =  A )
52, 3, 4mp3an23 1272 . . . . . 6  |-  ( A  e.  CC  ->  (
( 2  x.  A
)  /  2 )  =  A )
61, 5syl 16 . . . . 5  |-  ( A  e.  RR  ->  (
( 2  x.  A
)  /  2 )  =  A )
76ad2antlr 709 . . . 4  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  ( (
2  x.  A )  /  2 )  =  A )
8 ltle 9164 . . . . . . . . 9  |-  ( ( B  e.  RR  /\  A  e.  RR )  ->  ( B  <  A  ->  B  <_  A )
)
98imp 420 . . . . . . . 8  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  B  <_  A )
10 abssubge0 12132 . . . . . . . . 9  |-  ( ( B  e.  RR  /\  A  e.  RR  /\  B  <_  A )  ->  ( abs `  ( A  -  B ) )  =  ( A  -  B
) )
11103expa 1154 . . . . . . . 8  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <_  A
)  ->  ( abs `  ( A  -  B
) )  =  ( A  -  B ) )
129, 11syldan 458 . . . . . . 7  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  ( abs `  ( A  -  B
) )  =  ( A  -  B ) )
1312oveq2d 6098 . . . . . 6  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  ( ( A  +  B )  +  ( abs `  ( A  -  B )
) )  =  ( ( A  +  B
)  +  ( A  -  B ) ) )
14 recn 9081 . . . . . . . 8  |-  ( B  e.  RR  ->  B  e.  CC )
15 simpr 449 . . . . . . . . . 10  |-  ( ( B  e.  CC  /\  A  e.  CC )  ->  A  e.  CC )
16 simpl 445 . . . . . . . . . 10  |-  ( ( B  e.  CC  /\  A  e.  CC )  ->  B  e.  CC )
1715, 16, 15ppncand 9452 . . . . . . . . 9  |-  ( ( B  e.  CC  /\  A  e.  CC )  ->  ( ( A  +  B )  +  ( A  -  B ) )  =  ( A  +  A ) )
18 2times 10100 . . . . . . . . . 10  |-  ( A  e.  CC  ->  (
2  x.  A )  =  ( A  +  A ) )
1918adantl 454 . . . . . . . . 9  |-  ( ( B  e.  CC  /\  A  e.  CC )  ->  ( 2  x.  A
)  =  ( A  +  A ) )
2017, 19eqtr4d 2472 . . . . . . . 8  |-  ( ( B  e.  CC  /\  A  e.  CC )  ->  ( ( A  +  B )  +  ( A  -  B ) )  =  ( 2  x.  A ) )
2114, 1, 20syl2an 465 . . . . . . 7  |-  ( ( B  e.  RR  /\  A  e.  RR )  ->  ( ( A  +  B )  +  ( A  -  B ) )  =  ( 2  x.  A ) )
2221adantr 453 . . . . . 6  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  ( ( A  +  B )  +  ( A  -  B ) )  =  ( 2  x.  A
) )
2313, 22eqtrd 2469 . . . . 5  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  ( ( A  +  B )  +  ( abs `  ( A  -  B )
) )  =  ( 2  x.  A ) )
2423oveq1d 6097 . . . 4  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  ( (
( A  +  B
)  +  ( abs `  ( A  -  B
) ) )  / 
2 )  =  ( ( 2  x.  A
)  /  2 ) )
25 ltnle 9156 . . . . . 6  |-  ( ( B  e.  RR  /\  A  e.  RR )  ->  ( B  <  A  <->  -.  A  <_  B )
)
2625biimpa 472 . . . . 5  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  -.  A  <_  B )
27 iffalse 3747 . . . . 5  |-  ( -.  A  <_  B  ->  if ( A  <_  B ,  B ,  A )  =  A )
2826, 27syl 16 . . . 4  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  if ( A  <_  B ,  B ,  A )  =  A )
297, 24, 283eqtr4rd 2480 . . 3  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  if ( A  <_  B ,  B ,  A )  =  ( ( ( A  +  B )  +  ( abs `  ( A  -  B ) ) )  /  2 ) )
3029ancom1s 782 . 2  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  B  <  A
)  ->  if ( A  <_  B ,  B ,  A )  =  ( ( ( A  +  B )  +  ( abs `  ( A  -  B ) ) )  /  2 ) )
31 divcan3 9703 . . . . . 6  |-  ( ( B  e.  CC  /\  2  e.  CC  /\  2  =/=  0 )  ->  (
( 2  x.  B
)  /  2 )  =  B )
322, 3, 31mp3an23 1272 . . . . 5  |-  ( B  e.  CC  ->  (
( 2  x.  B
)  /  2 )  =  B )
3314, 32syl 16 . . . 4  |-  ( B  e.  RR  ->  (
( 2  x.  B
)  /  2 )  =  B )
3433ad2antlr 709 . . 3  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  ( (
2  x.  B )  /  2 )  =  B )
35 abssuble0 12133 . . . . . . 7  |-  ( ( A  e.  RR  /\  B  e.  RR  /\  A  <_  B )  ->  ( abs `  ( A  -  B ) )  =  ( B  -  A
) )
36353expa 1154 . . . . . 6  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  ( abs `  ( A  -  B
) )  =  ( B  -  A ) )
3736oveq2d 6098 . . . . 5  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  ( ( A  +  B )  +  ( abs `  ( A  -  B )
) )  =  ( ( A  +  B
)  +  ( B  -  A ) ) )
38 simpr 449 . . . . . . . . 9  |-  ( ( A  e.  CC  /\  B  e.  CC )  ->  B  e.  CC )
39 simpl 445 . . . . . . . . 9  |-  ( ( A  e.  CC  /\  B  e.  CC )  ->  A  e.  CC )
4038, 39, 38ppncand 9452 . . . . . . . 8  |-  ( ( A  e.  CC  /\  B  e.  CC )  ->  ( ( B  +  A )  +  ( B  -  A ) )  =  ( B  +  B ) )
41 addcom 9253 . . . . . . . . 9  |-  ( ( A  e.  CC  /\  B  e.  CC )  ->  ( A  +  B
)  =  ( B  +  A ) )
4241oveq1d 6097 . . . . . . . 8  |-  ( ( A  e.  CC  /\  B  e.  CC )  ->  ( ( A  +  B )  +  ( B  -  A ) )  =  ( ( B  +  A )  +  ( B  -  A ) ) )
43 2times 10100 . . . . . . . . 9  |-  ( B  e.  CC  ->  (
2  x.  B )  =  ( B  +  B ) )
4443adantl 454 . . . . . . . 8  |-  ( ( A  e.  CC  /\  B  e.  CC )  ->  ( 2  x.  B
)  =  ( B  +  B ) )
4540, 42, 443eqtr4d 2479 . . . . . . 7  |-  ( ( A  e.  CC  /\  B  e.  CC )  ->  ( ( A  +  B )  +  ( B  -  A ) )  =  ( 2  x.  B ) )
461, 14, 45syl2an 465 . . . . . 6  |-  ( ( A  e.  RR  /\  B  e.  RR )  ->  ( ( A  +  B )  +  ( B  -  A ) )  =  ( 2  x.  B ) )
4746adantr 453 . . . . 5  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  ( ( A  +  B )  +  ( B  -  A ) )  =  ( 2  x.  B
) )
4837, 47eqtrd 2469 . . . 4  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  ( ( A  +  B )  +  ( abs `  ( A  -  B )
) )  =  ( 2  x.  B ) )
4948oveq1d 6097 . . 3  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  ( (
( A  +  B
)  +  ( abs `  ( A  -  B
) ) )  / 
2 )  =  ( ( 2  x.  B
)  /  2 ) )
50 iftrue 3746 . . . 4  |-  ( A  <_  B  ->  if ( A  <_  B ,  B ,  A )  =  B )
5150adantl 454 . . 3  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  if ( A  <_  B ,  B ,  A )  =  B )
5234, 49, 513eqtr4rd 2480 . 2  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  if ( A  <_  B ,  B ,  A )  =  ( ( ( A  +  B )  +  ( abs `  ( A  -  B ) ) )  /  2 ) )
53 simpr 449 . 2  |-  ( ( A  e.  RR  /\  B  e.  RR )  ->  B  e.  RR )
54 simpl 445 . 2  |-  ( ( A  e.  RR  /\  B  e.  RR )  ->  A  e.  RR )
5530, 52, 53, 54ltlecasei 9182 1  |-  ( ( A  e.  RR  /\  B  e.  RR )  ->  if ( A  <_  B ,  B ,  A )  =  ( ( ( A  +  B )  +  ( abs `  ( A  -  B ) ) )  /  2 ) )
Colors of variables: wff set class
Syntax hints:   -. wn 3    -> wi 4    /\ wa 360    = wceq 1653    e. wcel 1726    =/= wne 2600   ifcif 3740   class class class wbr 4213   ` cfv 5455  (class class class)co 6082   CCcc 8989   RRcr 8990   0cc0 8991    + caddc 8994    x. cmul 8996    < clt 9121    <_ cle 9122    - cmin 9292    / cdiv 9678   2c2 10050   abscabs 12040
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1556  ax-5 1567  ax-17 1627  ax-9 1667  ax-8 1688  ax-13 1728  ax-14 1730  ax-6 1745  ax-7 1750  ax-11 1762  ax-12 1951  ax-ext 2418  ax-sep 4331  ax-nul 4339  ax-pow 4378  ax-pr 4404  ax-un 4702  ax-cnex 9047  ax-resscn 9048  ax-1cn 9049  ax-icn 9050  ax-addcl 9051  ax-addrcl 9052  ax-mulcl 9053  ax-mulrcl 9054  ax-mulcom 9055  ax-addass 9056  ax-mulass 9057  ax-distr 9058  ax-i2m1 9059  ax-1ne0 9060  ax-1rid 9061  ax-rnegex 9062  ax-rrecex 9063  ax-cnre 9064  ax-pre-lttri 9065  ax-pre-lttrn 9066  ax-pre-ltadd 9067  ax-pre-mulgt0 9068  ax-pre-sup 9069
This theorem depends on definitions:  df-bi 179  df-or 361  df-an 362  df-3or 938  df-3an 939  df-tru 1329  df-ex 1552  df-nf 1555  df-sb 1660  df-eu 2286  df-mo 2287  df-clab 2424  df-cleq 2430  df-clel 2433  df-nfc 2562  df-ne 2602  df-nel 2603  df-ral 2711  df-rex 2712  df-reu 2713  df-rmo 2714  df-rab 2715  df-v 2959  df-sbc 3163  df-csb 3253  df-dif 3324  df-un 3326  df-in 3328  df-ss 3335  df-pss 3337  df-nul 3630  df-if 3741  df-pw 3802  df-sn 3821  df-pr 3822  df-tp 3823  df-op 3824  df-uni 4017  df-iun 4096  df-br 4214  df-opab 4268  df-mpt 4269  df-tr 4304  df-eprel 4495  df-id 4499  df-po 4504  df-so 4505  df-fr 4542  df-we 4544  df-ord 4585  df-on 4586  df-lim 4587  df-suc 4588  df-om 4847  df-xp 4885  df-rel 4886  df-cnv 4887  df-co 4888  df-dm 4889  df-rn 4890  df-res 4891  df-ima 4892  df-iota 5419  df-fun 5457  df-fn 5458  df-f 5459  df-f1 5460  df-fo 5461  df-f1o 5462  df-fv 5463  df-ov 6085  df-oprab 6086  df-mpt2 6087  df-2nd 6351  df-riota 6550  df-recs 6634  df-rdg 6669  df-er 6906  df-en 7111  df-dom 7112  df-sdom 7113  df-sup 7447  df-pnf 9123  df-mnf 9124  df-xr 9125  df-ltxr 9126  df-le 9127  df-sub 9294  df-neg 9295  df-div 9679  df-nn 10002  df-2 10059  df-3 10060  df-n0 10223  df-z 10284  df-uz 10490  df-rp 10614  df-seq 11325  df-exp 11384  df-cj 11905  df-re 11906  df-im 11907  df-sqr 12041  df-abs 12042
  Copyright terms: Public domain W3C validator