Metamath Proof Explorer


Theorem eqwrd

Description: Two words are equal iff they have the same length and the same symbol at each position. (Contributed by AV, 13-Apr-2018) (Revised by JJ, 30-Dec-2023)

Ref Expression
Assertion eqwrd
|- ( ( U e. Word S /\ W e. Word T ) -> ( U = W <-> ( ( # ` U ) = ( # ` W ) /\ A. i e. ( 0 ..^ ( # ` U ) ) ( U ` i ) = ( W ` i ) ) ) )

Proof

Step Hyp Ref Expression
1 wrdfn
 |-  ( U e. Word S -> U Fn ( 0 ..^ ( # ` U ) ) )
2 wrdfn
 |-  ( W e. Word T -> W Fn ( 0 ..^ ( # ` W ) ) )
3 eqfnfv2
 |-  ( ( U Fn ( 0 ..^ ( # ` U ) ) /\ W Fn ( 0 ..^ ( # ` W ) ) ) -> ( U = W <-> ( ( 0 ..^ ( # ` U ) ) = ( 0 ..^ ( # ` W ) ) /\ A. i e. ( 0 ..^ ( # ` U ) ) ( U ` i ) = ( W ` i ) ) ) )
4 1 2 3 syl2an
 |-  ( ( U e. Word S /\ W e. Word T ) -> ( U = W <-> ( ( 0 ..^ ( # ` U ) ) = ( 0 ..^ ( # ` W ) ) /\ A. i e. ( 0 ..^ ( # ` U ) ) ( U ` i ) = ( W ` i ) ) ) )
5 fveq2
 |-  ( ( 0 ..^ ( # ` U ) ) = ( 0 ..^ ( # ` W ) ) -> ( # ` ( 0 ..^ ( # ` U ) ) ) = ( # ` ( 0 ..^ ( # ` W ) ) ) )
6 lencl
 |-  ( U e. Word S -> ( # ` U ) e. NN0 )
7 hashfzo0
 |-  ( ( # ` U ) e. NN0 -> ( # ` ( 0 ..^ ( # ` U ) ) ) = ( # ` U ) )
8 6 7 syl
 |-  ( U e. Word S -> ( # ` ( 0 ..^ ( # ` U ) ) ) = ( # ` U ) )
9 lencl
 |-  ( W e. Word T -> ( # ` W ) e. NN0 )
10 hashfzo0
 |-  ( ( # ` W ) e. NN0 -> ( # ` ( 0 ..^ ( # ` W ) ) ) = ( # ` W ) )
11 9 10 syl
 |-  ( W e. Word T -> ( # ` ( 0 ..^ ( # ` W ) ) ) = ( # ` W ) )
12 8 11 eqeqan12d
 |-  ( ( U e. Word S /\ W e. Word T ) -> ( ( # ` ( 0 ..^ ( # ` U ) ) ) = ( # ` ( 0 ..^ ( # ` W ) ) ) <-> ( # ` U ) = ( # ` W ) ) )
13 5 12 syl5ib
 |-  ( ( U e. Word S /\ W e. Word T ) -> ( ( 0 ..^ ( # ` U ) ) = ( 0 ..^ ( # ` W ) ) -> ( # ` U ) = ( # ` W ) ) )
14 oveq2
 |-  ( ( # ` U ) = ( # ` W ) -> ( 0 ..^ ( # ` U ) ) = ( 0 ..^ ( # ` W ) ) )
15 13 14 impbid1
 |-  ( ( U e. Word S /\ W e. Word T ) -> ( ( 0 ..^ ( # ` U ) ) = ( 0 ..^ ( # ` W ) ) <-> ( # ` U ) = ( # ` W ) ) )
16 15 anbi1d
 |-  ( ( U e. Word S /\ W e. Word T ) -> ( ( ( 0 ..^ ( # ` U ) ) = ( 0 ..^ ( # ` W ) ) /\ A. i e. ( 0 ..^ ( # ` U ) ) ( U ` i ) = ( W ` i ) ) <-> ( ( # ` U ) = ( # ` W ) /\ A. i e. ( 0 ..^ ( # ` U ) ) ( U ` i ) = ( W ` i ) ) ) )
17 4 16 bitrd
 |-  ( ( U e. Word S /\ W e. Word T ) -> ( U = W <-> ( ( # ` U ) = ( # ` W ) /\ A. i e. ( 0 ..^ ( # ` U ) ) ( U ` i ) = ( W ` i ) ) ) )