Metamath Proof Explorer


Theorem swrdrn2

Description: The range of a subword is a subset of the range of that word. Stronger version of swrdrn . (Contributed by Thierry Arnoux, 12-Dec-2023)

Ref Expression
Assertion swrdrn2 ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) → ran ( 𝑊 substr ⟨ 𝑀 , 𝑁 ⟩ ) ⊆ ran 𝑊 )

Proof

Step Hyp Ref Expression
1 swrdval2 ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) → ( 𝑊 substr ⟨ 𝑀 , 𝑁 ⟩ ) = ( 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ↦ ( 𝑊 ‘ ( 𝑥 + 𝑀 ) ) ) )
2 1 rneqd ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) → ran ( 𝑊 substr ⟨ 𝑀 , 𝑁 ⟩ ) = ran ( 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ↦ ( 𝑊 ‘ ( 𝑥 + 𝑀 ) ) ) )
3 eqidd ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → ( ♯ ‘ 𝑊 ) = ( ♯ ‘ 𝑊 ) )
4 simpl1 ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → 𝑊 ∈ Word 𝑉 )
5 3 4 wrdfd ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → 𝑊 : ( 0 ..^ ( ♯ ‘ 𝑊 ) ) ⟶ 𝑉 )
6 5 ffund ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → Fun 𝑊 )
7 elfzuz3 ( 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) → ( ♯ ‘ 𝑊 ) ∈ ( ℤ𝑁 ) )
8 7 3ad2ant3 ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) → ( ♯ ‘ 𝑊 ) ∈ ( ℤ𝑁 ) )
9 8 adantr ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → ( ♯ ‘ 𝑊 ) ∈ ( ℤ𝑁 ) )
10 fzoss2 ( ( ♯ ‘ 𝑊 ) ∈ ( ℤ𝑁 ) → ( 0 ..^ 𝑁 ) ⊆ ( 0 ..^ ( ♯ ‘ 𝑊 ) ) )
11 9 10 syl ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → ( 0 ..^ 𝑁 ) ⊆ ( 0 ..^ ( ♯ ‘ 𝑊 ) ) )
12 elfzuz ( 𝑀 ∈ ( 0 ... 𝑁 ) → 𝑀 ∈ ( ℤ ‘ 0 ) )
13 12 3ad2ant2 ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) → 𝑀 ∈ ( ℤ ‘ 0 ) )
14 13 adantr ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → 𝑀 ∈ ( ℤ ‘ 0 ) )
15 fzoss1 ( 𝑀 ∈ ( ℤ ‘ 0 ) → ( 𝑀 ..^ 𝑁 ) ⊆ ( 0 ..^ 𝑁 ) )
16 14 15 syl ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → ( 𝑀 ..^ 𝑁 ) ⊆ ( 0 ..^ 𝑁 ) )
17 simpr ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) )
18 simpl3 ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) )
19 18 elfzelzd ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → 𝑁 ∈ ℤ )
20 simpl2 ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → 𝑀 ∈ ( 0 ... 𝑁 ) )
21 20 elfzelzd ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → 𝑀 ∈ ℤ )
22 fzoaddel2 ( ( 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ∧ 𝑁 ∈ ℤ ∧ 𝑀 ∈ ℤ ) → ( 𝑥 + 𝑀 ) ∈ ( 𝑀 ..^ 𝑁 ) )
23 17 19 21 22 syl3anc ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → ( 𝑥 + 𝑀 ) ∈ ( 𝑀 ..^ 𝑁 ) )
24 16 23 sseldd ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → ( 𝑥 + 𝑀 ) ∈ ( 0 ..^ 𝑁 ) )
25 11 24 sseldd ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → ( 𝑥 + 𝑀 ) ∈ ( 0 ..^ ( ♯ ‘ 𝑊 ) ) )
26 wrddm ( 𝑊 ∈ Word 𝑉 → dom 𝑊 = ( 0 ..^ ( ♯ ‘ 𝑊 ) ) )
27 26 3ad2ant1 ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) → dom 𝑊 = ( 0 ..^ ( ♯ ‘ 𝑊 ) ) )
28 27 adantr ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → dom 𝑊 = ( 0 ..^ ( ♯ ‘ 𝑊 ) ) )
29 25 28 eleqtrrd ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → ( 𝑥 + 𝑀 ) ∈ dom 𝑊 )
30 fvelrn ( ( Fun 𝑊 ∧ ( 𝑥 + 𝑀 ) ∈ dom 𝑊 ) → ( 𝑊 ‘ ( 𝑥 + 𝑀 ) ) ∈ ran 𝑊 )
31 6 29 30 syl2anc ( ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) ∧ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ) → ( 𝑊 ‘ ( 𝑥 + 𝑀 ) ) ∈ ran 𝑊 )
32 31 ralrimiva ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) → ∀ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ( 𝑊 ‘ ( 𝑥 + 𝑀 ) ) ∈ ran 𝑊 )
33 eqid ( 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ↦ ( 𝑊 ‘ ( 𝑥 + 𝑀 ) ) ) = ( 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ↦ ( 𝑊 ‘ ( 𝑥 + 𝑀 ) ) )
34 33 rnmptss ( ∀ 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ( 𝑊 ‘ ( 𝑥 + 𝑀 ) ) ∈ ran 𝑊 → ran ( 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ↦ ( 𝑊 ‘ ( 𝑥 + 𝑀 ) ) ) ⊆ ran 𝑊 )
35 32 34 syl ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) → ran ( 𝑥 ∈ ( 0 ..^ ( 𝑁𝑀 ) ) ↦ ( 𝑊 ‘ ( 𝑥 + 𝑀 ) ) ) ⊆ ran 𝑊 )
36 2 35 eqsstrd ( ( 𝑊 ∈ Word 𝑉𝑀 ∈ ( 0 ... 𝑁 ) ∧ 𝑁 ∈ ( 0 ... ( ♯ ‘ 𝑊 ) ) ) → ran ( 𝑊 substr ⟨ 𝑀 , 𝑁 ⟩ ) ⊆ ran 𝑊 )