Metamath Proof Explorer


Theorem pfxnd

Description: The value of a prefix operation for a length argument larger than the word length is the empty set. (This is due to our definition of function values for out-of-domain arguments, see ndmfv ). (Contributed by AV, 3-May-2020)

Ref Expression
Assertion pfxnd ( ( 𝑊 ∈ Word 𝑉𝐿 ∈ ℕ0 ∧ ( ♯ ‘ 𝑊 ) < 𝐿 ) → ( 𝑊 prefix 𝐿 ) = ∅ )

Proof

Step Hyp Ref Expression
1 pfxval ( ( 𝑊 ∈ Word 𝑉𝐿 ∈ ℕ0 ) → ( 𝑊 prefix 𝐿 ) = ( 𝑊 substr ⟨ 0 , 𝐿 ⟩ ) )
2 1 3adant3 ( ( 𝑊 ∈ Word 𝑉𝐿 ∈ ℕ0 ∧ ( ♯ ‘ 𝑊 ) < 𝐿 ) → ( 𝑊 prefix 𝐿 ) = ( 𝑊 substr ⟨ 0 , 𝐿 ⟩ ) )
3 simp1 ( ( 𝑊 ∈ Word 𝑉𝐿 ∈ ℕ0 ∧ ( ♯ ‘ 𝑊 ) < 𝐿 ) → 𝑊 ∈ Word 𝑉 )
4 0zd ( ( 𝑊 ∈ Word 𝑉𝐿 ∈ ℕ0 ∧ ( ♯ ‘ 𝑊 ) < 𝐿 ) → 0 ∈ ℤ )
5 nn0z ( 𝐿 ∈ ℕ0𝐿 ∈ ℤ )
6 5 3ad2ant2 ( ( 𝑊 ∈ Word 𝑉𝐿 ∈ ℕ0 ∧ ( ♯ ‘ 𝑊 ) < 𝐿 ) → 𝐿 ∈ ℤ )
7 3 4 6 3jca ( ( 𝑊 ∈ Word 𝑉𝐿 ∈ ℕ0 ∧ ( ♯ ‘ 𝑊 ) < 𝐿 ) → ( 𝑊 ∈ Word 𝑉 ∧ 0 ∈ ℤ ∧ 𝐿 ∈ ℤ ) )
8 3mix3 ( ( ♯ ‘ 𝑊 ) < 𝐿 → ( 0 < 0 ∨ 𝐿 ≤ 0 ∨ ( ♯ ‘ 𝑊 ) < 𝐿 ) )
9 8 3ad2ant3 ( ( 𝑊 ∈ Word 𝑉𝐿 ∈ ℕ0 ∧ ( ♯ ‘ 𝑊 ) < 𝐿 ) → ( 0 < 0 ∨ 𝐿 ≤ 0 ∨ ( ♯ ‘ 𝑊 ) < 𝐿 ) )
10 swrdnd ( ( 𝑊 ∈ Word 𝑉 ∧ 0 ∈ ℤ ∧ 𝐿 ∈ ℤ ) → ( ( 0 < 0 ∨ 𝐿 ≤ 0 ∨ ( ♯ ‘ 𝑊 ) < 𝐿 ) → ( 𝑊 substr ⟨ 0 , 𝐿 ⟩ ) = ∅ ) )
11 7 9 10 sylc ( ( 𝑊 ∈ Word 𝑉𝐿 ∈ ℕ0 ∧ ( ♯ ‘ 𝑊 ) < 𝐿 ) → ( 𝑊 substr ⟨ 0 , 𝐿 ⟩ ) = ∅ )
12 2 11 eqtrd ( ( 𝑊 ∈ Word 𝑉𝐿 ∈ ℕ0 ∧ ( ♯ ‘ 𝑊 ) < 𝐿 ) → ( 𝑊 prefix 𝐿 ) = ∅ )