Proof of Theorem pfxeq
Step | Hyp | Ref
| Expression |
1 | | pfxcl 14318 |
. . . . 5
⊢ (𝑊 ∈ Word 𝑉 → (𝑊 prefix 𝑀) ∈ Word 𝑉) |
2 | | pfxcl 14318 |
. . . . 5
⊢ (𝑈 ∈ Word 𝑉 → (𝑈 prefix 𝑁) ∈ Word 𝑉) |
3 | | eqwrd 14188 |
. . . . 5
⊢ (((𝑊 prefix 𝑀) ∈ Word 𝑉 ∧ (𝑈 prefix 𝑁) ∈ Word 𝑉) → ((𝑊 prefix 𝑀) = (𝑈 prefix 𝑁) ↔ ((♯‘(𝑊 prefix 𝑀)) = (♯‘(𝑈 prefix 𝑁)) ∧ ∀𝑖 ∈ (0..^(♯‘(𝑊 prefix 𝑀)))((𝑊 prefix 𝑀)‘𝑖) = ((𝑈 prefix 𝑁)‘𝑖)))) |
4 | 1, 2, 3 | syl2an 595 |
. . . 4
⊢ ((𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) → ((𝑊 prefix 𝑀) = (𝑈 prefix 𝑁) ↔ ((♯‘(𝑊 prefix 𝑀)) = (♯‘(𝑈 prefix 𝑁)) ∧ ∀𝑖 ∈ (0..^(♯‘(𝑊 prefix 𝑀)))((𝑊 prefix 𝑀)‘𝑖) = ((𝑈 prefix 𝑁)‘𝑖)))) |
5 | 4 | 3ad2ant2 1132 |
. . 3
⊢ (((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) → ((𝑊 prefix 𝑀) = (𝑈 prefix 𝑁) ↔ ((♯‘(𝑊 prefix 𝑀)) = (♯‘(𝑈 prefix 𝑁)) ∧ ∀𝑖 ∈ (0..^(♯‘(𝑊 prefix 𝑀)))((𝑊 prefix 𝑀)‘𝑖) = ((𝑈 prefix 𝑁)‘𝑖)))) |
6 | | simp2l 1197 |
. . . . . 6
⊢ (((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) → 𝑊 ∈ Word 𝑉) |
7 | | simpl 482 |
. . . . . . . 8
⊢ ((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) → 𝑀 ∈
ℕ0) |
8 | | lencl 14164 |
. . . . . . . . 9
⊢ (𝑊 ∈ Word 𝑉 → (♯‘𝑊) ∈
ℕ0) |
9 | 8 | adantr 480 |
. . . . . . . 8
⊢ ((𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) → (♯‘𝑊) ∈
ℕ0) |
10 | | simpl 482 |
. . . . . . . 8
⊢ ((𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈)) → 𝑀 ≤ (♯‘𝑊)) |
11 | 7, 9, 10 | 3anim123i 1149 |
. . . . . . 7
⊢ (((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) → (𝑀 ∈ ℕ0 ∧
(♯‘𝑊) ∈
ℕ0 ∧ 𝑀
≤ (♯‘𝑊))) |
12 | | elfz2nn0 13276 |
. . . . . . 7
⊢ (𝑀 ∈
(0...(♯‘𝑊))
↔ (𝑀 ∈
ℕ0 ∧ (♯‘𝑊) ∈ ℕ0 ∧ 𝑀 ≤ (♯‘𝑊))) |
13 | 11, 12 | sylibr 233 |
. . . . . 6
⊢ (((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) → 𝑀 ∈ (0...(♯‘𝑊))) |
14 | | pfxlen 14324 |
. . . . . 6
⊢ ((𝑊 ∈ Word 𝑉 ∧ 𝑀 ∈ (0...(♯‘𝑊))) → (♯‘(𝑊 prefix 𝑀)) = 𝑀) |
15 | 6, 13, 14 | syl2anc 583 |
. . . . 5
⊢ (((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) → (♯‘(𝑊 prefix 𝑀)) = 𝑀) |
16 | | simp2r 1198 |
. . . . . 6
⊢ (((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) → 𝑈 ∈ Word 𝑉) |
17 | | simpr 484 |
. . . . . . . 8
⊢ ((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) → 𝑁 ∈
ℕ0) |
18 | | lencl 14164 |
. . . . . . . . 9
⊢ (𝑈 ∈ Word 𝑉 → (♯‘𝑈) ∈
ℕ0) |
19 | 18 | adantl 481 |
. . . . . . . 8
⊢ ((𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) → (♯‘𝑈) ∈
ℕ0) |
20 | | simpr 484 |
. . . . . . . 8
⊢ ((𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈)) → 𝑁 ≤ (♯‘𝑈)) |
21 | 17, 19, 20 | 3anim123i 1149 |
. . . . . . 7
⊢ (((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) → (𝑁 ∈ ℕ0 ∧
(♯‘𝑈) ∈
ℕ0 ∧ 𝑁
≤ (♯‘𝑈))) |
22 | | elfz2nn0 13276 |
. . . . . . 7
⊢ (𝑁 ∈
(0...(♯‘𝑈))
↔ (𝑁 ∈
ℕ0 ∧ (♯‘𝑈) ∈ ℕ0 ∧ 𝑁 ≤ (♯‘𝑈))) |
23 | 21, 22 | sylibr 233 |
. . . . . 6
⊢ (((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) → 𝑁 ∈ (0...(♯‘𝑈))) |
24 | | pfxlen 14324 |
. . . . . 6
⊢ ((𝑈 ∈ Word 𝑉 ∧ 𝑁 ∈ (0...(♯‘𝑈))) → (♯‘(𝑈 prefix 𝑁)) = 𝑁) |
25 | 16, 23, 24 | syl2anc 583 |
. . . . 5
⊢ (((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) → (♯‘(𝑈 prefix 𝑁)) = 𝑁) |
26 | 15, 25 | eqeq12d 2754 |
. . . 4
⊢ (((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) → ((♯‘(𝑊 prefix 𝑀)) = (♯‘(𝑈 prefix 𝑁)) ↔ 𝑀 = 𝑁)) |
27 | 26 | anbi1d 629 |
. . 3
⊢ (((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) → (((♯‘(𝑊 prefix 𝑀)) = (♯‘(𝑈 prefix 𝑁)) ∧ ∀𝑖 ∈ (0..^(♯‘(𝑊 prefix 𝑀)))((𝑊 prefix 𝑀)‘𝑖) = ((𝑈 prefix 𝑁)‘𝑖)) ↔ (𝑀 = 𝑁 ∧ ∀𝑖 ∈ (0..^(♯‘(𝑊 prefix 𝑀)))((𝑊 prefix 𝑀)‘𝑖) = ((𝑈 prefix 𝑁)‘𝑖)))) |
28 | 15 | adantr 480 |
. . . . . . 7
⊢ ((((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) → (♯‘(𝑊 prefix 𝑀)) = 𝑀) |
29 | 28 | oveq2d 7271 |
. . . . . 6
⊢ ((((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) → (0..^(♯‘(𝑊 prefix 𝑀))) = (0..^𝑀)) |
30 | 29 | raleqdv 3339 |
. . . . 5
⊢ ((((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) → (∀𝑖 ∈ (0..^(♯‘(𝑊 prefix 𝑀)))((𝑊 prefix 𝑀)‘𝑖) = ((𝑈 prefix 𝑁)‘𝑖) ↔ ∀𝑖 ∈ (0..^𝑀)((𝑊 prefix 𝑀)‘𝑖) = ((𝑈 prefix 𝑁)‘𝑖))) |
31 | 6 | ad2antrr 722 |
. . . . . . . 8
⊢
(((((𝑀 ∈
ℕ0 ∧ 𝑁
∈ ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) ∧ 𝑖 ∈ (0..^𝑀)) → 𝑊 ∈ Word 𝑉) |
32 | 13 | ad2antrr 722 |
. . . . . . . 8
⊢
(((((𝑀 ∈
ℕ0 ∧ 𝑁
∈ ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) ∧ 𝑖 ∈ (0..^𝑀)) → 𝑀 ∈ (0...(♯‘𝑊))) |
33 | | simpr 484 |
. . . . . . . 8
⊢
(((((𝑀 ∈
ℕ0 ∧ 𝑁
∈ ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) ∧ 𝑖 ∈ (0..^𝑀)) → 𝑖 ∈ (0..^𝑀)) |
34 | | pfxfv 14323 |
. . . . . . . 8
⊢ ((𝑊 ∈ Word 𝑉 ∧ 𝑀 ∈ (0...(♯‘𝑊)) ∧ 𝑖 ∈ (0..^𝑀)) → ((𝑊 prefix 𝑀)‘𝑖) = (𝑊‘𝑖)) |
35 | 31, 32, 33, 34 | syl3anc 1369 |
. . . . . . 7
⊢
(((((𝑀 ∈
ℕ0 ∧ 𝑁
∈ ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) ∧ 𝑖 ∈ (0..^𝑀)) → ((𝑊 prefix 𝑀)‘𝑖) = (𝑊‘𝑖)) |
36 | 16 | ad2antrr 722 |
. . . . . . . 8
⊢
(((((𝑀 ∈
ℕ0 ∧ 𝑁
∈ ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) ∧ 𝑖 ∈ (0..^𝑀)) → 𝑈 ∈ Word 𝑉) |
37 | 23 | ad2antrr 722 |
. . . . . . . 8
⊢
(((((𝑀 ∈
ℕ0 ∧ 𝑁
∈ ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) ∧ 𝑖 ∈ (0..^𝑀)) → 𝑁 ∈ (0...(♯‘𝑈))) |
38 | | oveq2 7263 |
. . . . . . . . . . 11
⊢ (𝑀 = 𝑁 → (0..^𝑀) = (0..^𝑁)) |
39 | 38 | eleq2d 2824 |
. . . . . . . . . 10
⊢ (𝑀 = 𝑁 → (𝑖 ∈ (0..^𝑀) ↔ 𝑖 ∈ (0..^𝑁))) |
40 | 39 | adantl 481 |
. . . . . . . . 9
⊢ ((((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) → (𝑖 ∈ (0..^𝑀) ↔ 𝑖 ∈ (0..^𝑁))) |
41 | 40 | biimpa 476 |
. . . . . . . 8
⊢
(((((𝑀 ∈
ℕ0 ∧ 𝑁
∈ ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) ∧ 𝑖 ∈ (0..^𝑀)) → 𝑖 ∈ (0..^𝑁)) |
42 | | pfxfv 14323 |
. . . . . . . 8
⊢ ((𝑈 ∈ Word 𝑉 ∧ 𝑁 ∈ (0...(♯‘𝑈)) ∧ 𝑖 ∈ (0..^𝑁)) → ((𝑈 prefix 𝑁)‘𝑖) = (𝑈‘𝑖)) |
43 | 36, 37, 41, 42 | syl3anc 1369 |
. . . . . . 7
⊢
(((((𝑀 ∈
ℕ0 ∧ 𝑁
∈ ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) ∧ 𝑖 ∈ (0..^𝑀)) → ((𝑈 prefix 𝑁)‘𝑖) = (𝑈‘𝑖)) |
44 | 35, 43 | eqeq12d 2754 |
. . . . . 6
⊢
(((((𝑀 ∈
ℕ0 ∧ 𝑁
∈ ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) ∧ 𝑖 ∈ (0..^𝑀)) → (((𝑊 prefix 𝑀)‘𝑖) = ((𝑈 prefix 𝑁)‘𝑖) ↔ (𝑊‘𝑖) = (𝑈‘𝑖))) |
45 | 44 | ralbidva 3119 |
. . . . 5
⊢ ((((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) → (∀𝑖 ∈ (0..^𝑀)((𝑊 prefix 𝑀)‘𝑖) = ((𝑈 prefix 𝑁)‘𝑖) ↔ ∀𝑖 ∈ (0..^𝑀)(𝑊‘𝑖) = (𝑈‘𝑖))) |
46 | 30, 45 | bitrd 278 |
. . . 4
⊢ ((((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) ∧ 𝑀 = 𝑁) → (∀𝑖 ∈ (0..^(♯‘(𝑊 prefix 𝑀)))((𝑊 prefix 𝑀)‘𝑖) = ((𝑈 prefix 𝑁)‘𝑖) ↔ ∀𝑖 ∈ (0..^𝑀)(𝑊‘𝑖) = (𝑈‘𝑖))) |
47 | 46 | pm5.32da 578 |
. . 3
⊢ (((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) → ((𝑀 = 𝑁 ∧ ∀𝑖 ∈ (0..^(♯‘(𝑊 prefix 𝑀)))((𝑊 prefix 𝑀)‘𝑖) = ((𝑈 prefix 𝑁)‘𝑖)) ↔ (𝑀 = 𝑁 ∧ ∀𝑖 ∈ (0..^𝑀)(𝑊‘𝑖) = (𝑈‘𝑖)))) |
48 | 5, 27, 47 | 3bitrd 304 |
. 2
⊢ (((𝑀 ∈ ℕ0
∧ 𝑁 ∈
ℕ0) ∧ (𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ≤ (♯‘𝑊) ∧ 𝑁 ≤ (♯‘𝑈))) → ((𝑊 prefix 𝑀) = (𝑈 prefix 𝑁) ↔ (𝑀 = 𝑁 ∧ ∀𝑖 ∈ (0..^𝑀)(𝑊‘𝑖) = (𝑈‘𝑖)))) |
49 | 48 | 3com12 1121 |
1
⊢ (((𝑊 ∈ Word 𝑉 ∧ 𝑈 ∈ Word 𝑉) ∧ (𝑀 ∈ ℕ0 ∧ 𝑁 ∈ ℕ0)
∧ (𝑀 ≤
(♯‘𝑊) ∧
𝑁 ≤ (♯‘𝑈))) → ((𝑊 prefix 𝑀) = (𝑈 prefix 𝑁) ↔ (𝑀 = 𝑁 ∧ ∀𝑖 ∈ (0..^𝑀)(𝑊‘𝑖) = (𝑈‘𝑖)))) |