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

Theorem absmax 13173
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 9599 . . . . . 6  |-  ( A  e.  RR  ->  A  e.  CC )
2 2cn 10627 . . . . . . 7  |-  2  e.  CC
3 2ne0 10649 . . . . . . 7  |-  2  =/=  0
4 divcan3 10252 . . . . . . 7  |-  ( ( A  e.  CC  /\  2  e.  CC  /\  2  =/=  0 )  ->  (
( 2  x.  A
)  /  2 )  =  A )
52, 3, 4mp3an23 1316 . . . . . 6  |-  ( A  e.  CC  ->  (
( 2  x.  A
)  /  2 )  =  A )
61, 5syl 16 . . . . 5  |-  ( A  e.  RR  ->  (
( 2  x.  A
)  /  2 )  =  A )
76ad2antlr 726 . . . 4  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  ( (
2  x.  A )  /  2 )  =  A )
8 ltle 9690 . . . . . . . . 9  |-  ( ( B  e.  RR  /\  A  e.  RR )  ->  ( B  <  A  ->  B  <_  A )
)
98imp 429 . . . . . . . 8  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  B  <_  A )
10 abssubge0 13171 . . . . . . . . 9  |-  ( ( B  e.  RR  /\  A  e.  RR  /\  B  <_  A )  ->  ( abs `  ( A  -  B ) )  =  ( A  -  B
) )
11103expa 1196 . . . . . . . 8  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <_  A
)  ->  ( abs `  ( A  -  B
) )  =  ( A  -  B ) )
129, 11syldan 470 . . . . . . 7  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  ( abs `  ( A  -  B
) )  =  ( A  -  B ) )
1312oveq2d 6312 . . . . . 6  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  ( ( A  +  B )  +  ( abs `  ( A  -  B )
) )  =  ( ( A  +  B
)  +  ( A  -  B ) ) )
14 recn 9599 . . . . . . . 8  |-  ( B  e.  RR  ->  B  e.  CC )
15 simpr 461 . . . . . . . . . 10  |-  ( ( B  e.  CC  /\  A  e.  CC )  ->  A  e.  CC )
16 simpl 457 . . . . . . . . . 10  |-  ( ( B  e.  CC  /\  A  e.  CC )  ->  B  e.  CC )
1715, 16, 15ppncand 9990 . . . . . . . . 9  |-  ( ( B  e.  CC  /\  A  e.  CC )  ->  ( ( A  +  B )  +  ( A  -  B ) )  =  ( A  +  A ) )
18 2times 10675 . . . . . . . . . 10  |-  ( A  e.  CC  ->  (
2  x.  A )  =  ( A  +  A ) )
1918adantl 466 . . . . . . . . 9  |-  ( ( B  e.  CC  /\  A  e.  CC )  ->  ( 2  x.  A
)  =  ( A  +  A ) )
2017, 19eqtr4d 2501 . . . . . . . 8  |-  ( ( B  e.  CC  /\  A  e.  CC )  ->  ( ( A  +  B )  +  ( A  -  B ) )  =  ( 2  x.  A ) )
2114, 1, 20syl2an 477 . . . . . . 7  |-  ( ( B  e.  RR  /\  A  e.  RR )  ->  ( ( A  +  B )  +  ( A  -  B ) )  =  ( 2  x.  A ) )
2221adantr 465 . . . . . 6  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  ( ( A  +  B )  +  ( A  -  B ) )  =  ( 2  x.  A
) )
2313, 22eqtrd 2498 . . . . 5  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  ( ( A  +  B )  +  ( abs `  ( A  -  B )
) )  =  ( 2  x.  A ) )
2423oveq1d 6311 . . . 4  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  ( (
( A  +  B
)  +  ( abs `  ( A  -  B
) ) )  / 
2 )  =  ( ( 2  x.  A
)  /  2 ) )
25 ltnle 9681 . . . . . 6  |-  ( ( B  e.  RR  /\  A  e.  RR )  ->  ( B  <  A  <->  -.  A  <_  B )
)
2625biimpa 484 . . . . 5  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  -.  A  <_  B )
2726iffalsed 3955 . . . 4  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  if ( A  <_  B ,  B ,  A )  =  A )
287, 24, 273eqtr4rd 2509 . . 3  |-  ( ( ( B  e.  RR  /\  A  e.  RR )  /\  B  <  A
)  ->  if ( A  <_  B ,  B ,  A )  =  ( ( ( A  +  B )  +  ( abs `  ( A  -  B ) ) )  /  2 ) )
2928ancom1s 805 . 2  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  B  <  A
)  ->  if ( A  <_  B ,  B ,  A )  =  ( ( ( A  +  B )  +  ( abs `  ( A  -  B ) ) )  /  2 ) )
30 divcan3 10252 . . . . . 6  |-  ( ( B  e.  CC  /\  2  e.  CC  /\  2  =/=  0 )  ->  (
( 2  x.  B
)  /  2 )  =  B )
312, 3, 30mp3an23 1316 . . . . 5  |-  ( B  e.  CC  ->  (
( 2  x.  B
)  /  2 )  =  B )
3214, 31syl 16 . . . 4  |-  ( B  e.  RR  ->  (
( 2  x.  B
)  /  2 )  =  B )
3332ad2antlr 726 . . 3  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  ( (
2  x.  B )  /  2 )  =  B )
34 abssuble0 13172 . . . . . . 7  |-  ( ( A  e.  RR  /\  B  e.  RR  /\  A  <_  B )  ->  ( abs `  ( A  -  B ) )  =  ( B  -  A
) )
35343expa 1196 . . . . . 6  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  ( abs `  ( A  -  B
) )  =  ( B  -  A ) )
3635oveq2d 6312 . . . . 5  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  ( ( A  +  B )  +  ( abs `  ( A  -  B )
) )  =  ( ( A  +  B
)  +  ( B  -  A ) ) )
37 simpr 461 . . . . . . . . 9  |-  ( ( A  e.  CC  /\  B  e.  CC )  ->  B  e.  CC )
38 simpl 457 . . . . . . . . 9  |-  ( ( A  e.  CC  /\  B  e.  CC )  ->  A  e.  CC )
3937, 38, 37ppncand 9990 . . . . . . . 8  |-  ( ( A  e.  CC  /\  B  e.  CC )  ->  ( ( B  +  A )  +  ( B  -  A ) )  =  ( B  +  B ) )
40 addcom 9783 . . . . . . . . 9  |-  ( ( A  e.  CC  /\  B  e.  CC )  ->  ( A  +  B
)  =  ( B  +  A ) )
4140oveq1d 6311 . . . . . . . 8  |-  ( ( A  e.  CC  /\  B  e.  CC )  ->  ( ( A  +  B )  +  ( B  -  A ) )  =  ( ( B  +  A )  +  ( B  -  A ) ) )
42 2times 10675 . . . . . . . . 9  |-  ( B  e.  CC  ->  (
2  x.  B )  =  ( B  +  B ) )
4342adantl 466 . . . . . . . 8  |-  ( ( A  e.  CC  /\  B  e.  CC )  ->  ( 2  x.  B
)  =  ( B  +  B ) )
4439, 41, 433eqtr4d 2508 . . . . . . 7  |-  ( ( A  e.  CC  /\  B  e.  CC )  ->  ( ( A  +  B )  +  ( B  -  A ) )  =  ( 2  x.  B ) )
451, 14, 44syl2an 477 . . . . . 6  |-  ( ( A  e.  RR  /\  B  e.  RR )  ->  ( ( A  +  B )  +  ( B  -  A ) )  =  ( 2  x.  B ) )
4645adantr 465 . . . . 5  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  ( ( A  +  B )  +  ( B  -  A ) )  =  ( 2  x.  B
) )
4736, 46eqtrd 2498 . . . 4  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  ( ( A  +  B )  +  ( abs `  ( A  -  B )
) )  =  ( 2  x.  B ) )
4847oveq1d 6311 . . 3  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  ( (
( A  +  B
)  +  ( abs `  ( A  -  B
) ) )  / 
2 )  =  ( ( 2  x.  B
)  /  2 ) )
49 iftrue 3950 . . . 4  |-  ( A  <_  B  ->  if ( A  <_  B ,  B ,  A )  =  B )
5049adantl 466 . . 3  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  if ( A  <_  B ,  B ,  A )  =  B )
5133, 48, 503eqtr4rd 2509 . 2  |-  ( ( ( A  e.  RR  /\  B  e.  RR )  /\  A  <_  B
)  ->  if ( A  <_  B ,  B ,  A )  =  ( ( ( A  +  B )  +  ( abs `  ( A  -  B ) ) )  /  2 ) )
52 simpr 461 . 2  |-  ( ( A  e.  RR  /\  B  e.  RR )  ->  B  e.  RR )
53 simpl 457 . 2  |-  ( ( A  e.  RR  /\  B  e.  RR )  ->  A  e.  RR )
5429, 51, 52, 53ltlecasei 9709 1  |-  ( ( A  e.  RR  /\  B  e.  RR )  ->  if ( A  <_  B ,  B ,  A )  =  ( ( ( A  +  B )  +  ( abs `  ( A  -  B ) ) )  /  2 ) )
Colors of variables: wff setvar class
Syntax hints:   -. wn 3    -> wi 4    /\ wa 369    = wceq 1395    e. wcel 1819    =/= wne 2652   ifcif 3944   class class class wbr 4456   ` cfv 5594  (class class class)co 6296   CCcc 9507   RRcr 9508   0cc0 9509    + caddc 9512    x. cmul 9514    < clt 9645    <_ cle 9646    - cmin 9824    / cdiv 10227   2c2 10606   abscabs 13078
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1619  ax-4 1632  ax-5 1705  ax-6 1748  ax-7 1791  ax-8 1821  ax-9 1823  ax-10 1838  ax-11 1843  ax-12 1855  ax-13 2000  ax-ext 2435  ax-sep 4578  ax-nul 4586  ax-pow 4634  ax-pr 4695  ax-un 6591  ax-cnex 9565  ax-resscn 9566  ax-1cn 9567  ax-icn 9568  ax-addcl 9569  ax-addrcl 9570  ax-mulcl 9571  ax-mulrcl 9572  ax-mulcom 9573  ax-addass 9574  ax-mulass 9575  ax-distr 9576  ax-i2m1 9577  ax-1ne0 9578  ax-1rid 9579  ax-rnegex 9580  ax-rrecex 9581  ax-cnre 9582  ax-pre-lttri 9583  ax-pre-lttrn 9584  ax-pre-ltadd 9585  ax-pre-mulgt0 9586  ax-pre-sup 9587
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 974  df-3an 975  df-tru 1398  df-ex 1614  df-nf 1618  df-sb 1741  df-eu 2287  df-mo 2288  df-clab 2443  df-cleq 2449  df-clel 2452  df-nfc 2607  df-ne 2654  df-nel 2655  df-ral 2812  df-rex 2813  df-reu 2814  df-rmo 2815  df-rab 2816  df-v 3111  df-sbc 3328  df-csb 3431  df-dif 3474  df-un 3476  df-in 3478  df-ss 3485  df-pss 3487  df-nul 3794  df-if 3945  df-pw 4017  df-sn 4033  df-pr 4035  df-tp 4037  df-op 4039  df-uni 4252  df-iun 4334  df-br 4457  df-opab 4516  df-mpt 4517  df-tr 4551  df-eprel 4800  df-id 4804  df-po 4809  df-so 4810  df-fr 4847  df-we 4849  df-ord 4890  df-on 4891  df-lim 4892  df-suc 4893  df-xp 5014  df-rel 5015  df-cnv 5016  df-co 5017  df-dm 5018  df-rn 5019  df-res 5020  df-ima 5021  df-iota 5557  df-fun 5596  df-fn 5597  df-f 5598  df-f1 5599  df-fo 5600  df-f1o 5601  df-fv 5602  df-riota 6258  df-ov 6299  df-oprab 6300  df-mpt2 6301  df-om 6700  df-2nd 6800  df-recs 7060  df-rdg 7094  df-er 7329  df-en 7536  df-dom 7537  df-sdom 7538  df-sup 7919  df-pnf 9647  df-mnf 9648  df-xr 9649  df-ltxr 9650  df-le 9651  df-sub 9826  df-neg 9827  df-div 10228  df-nn 10557  df-2 10615  df-3 10616  df-n0 10817  df-z 10886  df-uz 11107  df-rp 11246  df-seq 12110  df-exp 12169  df-cj 12943  df-re 12944  df-im 12945  df-sqrt 13079  df-abs 13080
This theorem is referenced by: (None)
  Copyright terms: Public domain W3C validator