Metamath Proof Explorer


Theorem ehl2eudis

Description: The Euclidean distance function in a real Euclidean space of dimension 2. (Contributed by AV, 16-Jan-2023)

Ref Expression
Hypotheses ehl2eudis.e
|- E = ( EEhil ` 2 )
ehl2eudis.x
|- X = ( RR ^m { 1 , 2 } )
ehl2eudis.d
|- D = ( dist ` E )
Assertion ehl2eudis
|- D = ( f e. X , g e. X |-> ( sqrt ` ( ( ( ( f ` 1 ) - ( g ` 1 ) ) ^ 2 ) + ( ( ( f ` 2 ) - ( g ` 2 ) ) ^ 2 ) ) ) )

Proof

Step Hyp Ref Expression
1 ehl2eudis.e
 |-  E = ( EEhil ` 2 )
2 ehl2eudis.x
 |-  X = ( RR ^m { 1 , 2 } )
3 ehl2eudis.d
 |-  D = ( dist ` E )
4 2nn0
 |-  2 e. NN0
5 fz12pr
 |-  ( 1 ... 2 ) = { 1 , 2 }
6 5 eqcomi
 |-  { 1 , 2 } = ( 1 ... 2 )
7 6 1 2 3 ehleudis
 |-  ( 2 e. NN0 -> D = ( f e. X , g e. X |-> ( sqrt ` sum_ k e. { 1 , 2 } ( ( ( f ` k ) - ( g ` k ) ) ^ 2 ) ) ) )
8 4 7 ax-mp
 |-  D = ( f e. X , g e. X |-> ( sqrt ` sum_ k e. { 1 , 2 } ( ( ( f ` k ) - ( g ` k ) ) ^ 2 ) ) )
9 fveq2
 |-  ( k = 1 -> ( f ` k ) = ( f ` 1 ) )
10 fveq2
 |-  ( k = 1 -> ( g ` k ) = ( g ` 1 ) )
11 9 10 oveq12d
 |-  ( k = 1 -> ( ( f ` k ) - ( g ` k ) ) = ( ( f ` 1 ) - ( g ` 1 ) ) )
12 11 oveq1d
 |-  ( k = 1 -> ( ( ( f ` k ) - ( g ` k ) ) ^ 2 ) = ( ( ( f ` 1 ) - ( g ` 1 ) ) ^ 2 ) )
13 fveq2
 |-  ( k = 2 -> ( f ` k ) = ( f ` 2 ) )
14 fveq2
 |-  ( k = 2 -> ( g ` k ) = ( g ` 2 ) )
15 13 14 oveq12d
 |-  ( k = 2 -> ( ( f ` k ) - ( g ` k ) ) = ( ( f ` 2 ) - ( g ` 2 ) ) )
16 15 oveq1d
 |-  ( k = 2 -> ( ( ( f ` k ) - ( g ` k ) ) ^ 2 ) = ( ( ( f ` 2 ) - ( g ` 2 ) ) ^ 2 ) )
17 2 eleq2i
 |-  ( f e. X <-> f e. ( RR ^m { 1 , 2 } ) )
18 reex
 |-  RR e. _V
19 prex
 |-  { 1 , 2 } e. _V
20 18 19 elmap
 |-  ( f e. ( RR ^m { 1 , 2 } ) <-> f : { 1 , 2 } --> RR )
21 17 20 bitri
 |-  ( f e. X <-> f : { 1 , 2 } --> RR )
22 id
 |-  ( f : { 1 , 2 } --> RR -> f : { 1 , 2 } --> RR )
23 1ex
 |-  1 e. _V
24 23 prid1
 |-  1 e. { 1 , 2 }
25 24 a1i
 |-  ( f : { 1 , 2 } --> RR -> 1 e. { 1 , 2 } )
26 22 25 ffvelrnd
 |-  ( f : { 1 , 2 } --> RR -> ( f ` 1 ) e. RR )
27 21 26 sylbi
 |-  ( f e. X -> ( f ` 1 ) e. RR )
28 27 adantr
 |-  ( ( f e. X /\ g e. X ) -> ( f ` 1 ) e. RR )
29 2 eleq2i
 |-  ( g e. X <-> g e. ( RR ^m { 1 , 2 } ) )
30 18 19 elmap
 |-  ( g e. ( RR ^m { 1 , 2 } ) <-> g : { 1 , 2 } --> RR )
31 29 30 bitri
 |-  ( g e. X <-> g : { 1 , 2 } --> RR )
32 id
 |-  ( g : { 1 , 2 } --> RR -> g : { 1 , 2 } --> RR )
33 24 a1i
 |-  ( g : { 1 , 2 } --> RR -> 1 e. { 1 , 2 } )
34 32 33 ffvelrnd
 |-  ( g : { 1 , 2 } --> RR -> ( g ` 1 ) e. RR )
35 31 34 sylbi
 |-  ( g e. X -> ( g ` 1 ) e. RR )
36 35 adantl
 |-  ( ( f e. X /\ g e. X ) -> ( g ` 1 ) e. RR )
37 28 36 resubcld
 |-  ( ( f e. X /\ g e. X ) -> ( ( f ` 1 ) - ( g ` 1 ) ) e. RR )
38 37 resqcld
 |-  ( ( f e. X /\ g e. X ) -> ( ( ( f ` 1 ) - ( g ` 1 ) ) ^ 2 ) e. RR )
39 38 recnd
 |-  ( ( f e. X /\ g e. X ) -> ( ( ( f ` 1 ) - ( g ` 1 ) ) ^ 2 ) e. CC )
40 2ex
 |-  2 e. _V
41 40 prid2
 |-  2 e. { 1 , 2 }
42 41 a1i
 |-  ( f : { 1 , 2 } --> RR -> 2 e. { 1 , 2 } )
43 22 42 ffvelrnd
 |-  ( f : { 1 , 2 } --> RR -> ( f ` 2 ) e. RR )
44 21 43 sylbi
 |-  ( f e. X -> ( f ` 2 ) e. RR )
45 44 adantr
 |-  ( ( f e. X /\ g e. X ) -> ( f ` 2 ) e. RR )
46 41 a1i
 |-  ( g : { 1 , 2 } --> RR -> 2 e. { 1 , 2 } )
47 32 46 ffvelrnd
 |-  ( g : { 1 , 2 } --> RR -> ( g ` 2 ) e. RR )
48 31 47 sylbi
 |-  ( g e. X -> ( g ` 2 ) e. RR )
49 48 adantl
 |-  ( ( f e. X /\ g e. X ) -> ( g ` 2 ) e. RR )
50 45 49 resubcld
 |-  ( ( f e. X /\ g e. X ) -> ( ( f ` 2 ) - ( g ` 2 ) ) e. RR )
51 50 resqcld
 |-  ( ( f e. X /\ g e. X ) -> ( ( ( f ` 2 ) - ( g ` 2 ) ) ^ 2 ) e. RR )
52 51 recnd
 |-  ( ( f e. X /\ g e. X ) -> ( ( ( f ` 2 ) - ( g ` 2 ) ) ^ 2 ) e. CC )
53 39 52 jca
 |-  ( ( f e. X /\ g e. X ) -> ( ( ( ( f ` 1 ) - ( g ` 1 ) ) ^ 2 ) e. CC /\ ( ( ( f ` 2 ) - ( g ` 2 ) ) ^ 2 ) e. CC ) )
54 23 40 pm3.2i
 |-  ( 1 e. _V /\ 2 e. _V )
55 54 a1i
 |-  ( ( f e. X /\ g e. X ) -> ( 1 e. _V /\ 2 e. _V ) )
56 1ne2
 |-  1 =/= 2
57 56 a1i
 |-  ( ( f e. X /\ g e. X ) -> 1 =/= 2 )
58 12 16 53 55 57 sumpr
 |-  ( ( f e. X /\ g e. X ) -> sum_ k e. { 1 , 2 } ( ( ( f ` k ) - ( g ` k ) ) ^ 2 ) = ( ( ( ( f ` 1 ) - ( g ` 1 ) ) ^ 2 ) + ( ( ( f ` 2 ) - ( g ` 2 ) ) ^ 2 ) ) )
59 58 fveq2d
 |-  ( ( f e. X /\ g e. X ) -> ( sqrt ` sum_ k e. { 1 , 2 } ( ( ( f ` k ) - ( g ` k ) ) ^ 2 ) ) = ( sqrt ` ( ( ( ( f ` 1 ) - ( g ` 1 ) ) ^ 2 ) + ( ( ( f ` 2 ) - ( g ` 2 ) ) ^ 2 ) ) ) )
60 59 mpoeq3ia
 |-  ( f e. X , g e. X |-> ( sqrt ` sum_ k e. { 1 , 2 } ( ( ( f ` k ) - ( g ` k ) ) ^ 2 ) ) ) = ( f e. X , g e. X |-> ( sqrt ` ( ( ( ( f ` 1 ) - ( g ` 1 ) ) ^ 2 ) + ( ( ( f ` 2 ) - ( g ` 2 ) ) ^ 2 ) ) ) )
61 8 60 eqtri
 |-  D = ( f e. X , g e. X |-> ( sqrt ` ( ( ( ( f ` 1 ) - ( g ` 1 ) ) ^ 2 ) + ( ( ( f ` 2 ) - ( g ` 2 ) ) ^ 2 ) ) ) )