Metamath Proof Explorer


Theorem pfxlen

Description: Length of a prefix. (Contributed by Stefan O'Rear, 24-Aug-2015) (Revised by AV, 2-May-2020)

Ref Expression
Assertion pfxlen ⊢ S ∈ Word A ∧ L ∈ 0 … S → S prefix L = L

Proof

Step Hyp Ref Expression
1 pfxfn ⊢ S ∈ Word A ∧ L ∈ 0 … S → S prefix L Fn 0 ..^ L
2 hashfn ⊢ S prefix L Fn 0 ..^ L → S prefix L = 0 ..^ L
3 1 2 syl ⊢ S ∈ Word A ∧ L ∈ 0 … S → S prefix L = 0 ..^ L
4 elfznn0 ⊢ L ∈ 0 … S → L ∈ ℕ 0
5 4 adantl ⊢ S ∈ Word A ∧ L ∈ 0 … S → L ∈ ℕ 0
6 hashfzo0 ⊢ L ∈ ℕ 0 → 0 ..^ L = L
7 5 6 syl ⊢ S ∈ Word A ∧ L ∈ 0 … S → 0 ..^ L = L
8 3 7 eqtrd ⊢ S ∈ Word A ∧ L ∈ 0 … S → S prefix L = L