let p be FinSequence; :: thesis: ProperPrefixes p, dom p are_equipotent
defpred S1[ set , set ] means ex w being FinSequence st
( $1 = w & $2 = (len w) + 1 );
A1: for x being set st x in ProperPrefixes p holds
ex y being set st S1[x,y]
proof
let x be set ; :: thesis: ( x in ProperPrefixes p implies ex y being set st S1[x,y] )
assume x in ProperPrefixes p ; :: thesis: ex y being set st S1[x,y]
then consider q being FinSequence such that
A2: ( x = q & q is_a_proper_prefix_of p ) by Def4;
reconsider y = (len q) + 1 as set ;
take y ; :: thesis: S1[x,y]
take q ; :: thesis: ( x = q & y = (len q) + 1 )
thus ( x = q & y = (len q) + 1 ) by A2; :: thesis: verum
end;
consider f being Function such that
A4: dom f = ProperPrefixes p and
A5: for x being set st x in ProperPrefixes p holds
S1[x,f . x] from CLASSES1:sch 1(A1);
take f ; :: according to WELLORD2:def 4 :: thesis: ( f is one-to-one & dom f = ProperPrefixes p & rng f = dom p )
thus f is one-to-one :: thesis: ( dom f = ProperPrefixes p & rng f = dom p )
proof
let x be set ; :: according to FUNCT_1:def 8 :: thesis: for b1 being set holds
( not x in dom f or not b1 in dom f or not f . x = f . b1 or x = b1 )

let y be set ; :: thesis: ( not x in dom f or not y in dom f or not f . x = f . y or x = y )
assume A6: ( x in dom f & y in dom f & f . x = f . y ) ; :: thesis: x = y
then consider q being FinSequence such that
A7: ( x = q & f . x = (len q) + 1 ) by A4, A5;
consider r being FinSequence such that
A8: ( y = r & f . x = (len r) + 1 ) by A4, A5, A6;
thus x = y by A4, A6, A7, A8, Th19, Th42; :: thesis: verum
end;
thus dom f = ProperPrefixes p by A4; :: thesis: rng f = dom p
thus rng f c= dom p :: according to XBOOLE_0:def 10 :: thesis: dom p is_a_prefix_of rng f
proof
let x be set ; :: according to TARSKI:def 3 :: thesis: ( not x in rng f or x in dom p )
assume x in rng f ; :: thesis: x in dom p
then consider y being set such that
A9: ( y in dom f & x = f . y ) by FUNCT_1:def 5;
consider q being FinSequence such that
A10: ( y = q & x = (len q) + 1 ) by A4, A5, A9;
( len q < len p & 0 <= len q ) by A4, A9, A10, Th37;
then ( 0 + 1 <= (len q) + 1 & (len q) + 1 <= len p ) by NAT_1:13;
then x in Seg (len p) by A10, FINSEQ_1:3;
hence x in dom p by FINSEQ_1:def 3; :: thesis: verum
end;
let x be set ; :: according to TARSKI:def 3 :: thesis: ( not x in dom p or x in rng f )
assume A11: x in dom p ; :: thesis: x in rng f
then A12: x in Seg (len p) by FINSEQ_1:def 3;
reconsider n = x as Element of NAT by A11;
A13: ( 1 <= n & n <= len p ) by A12, FINSEQ_1:3;
then consider m being Nat such that
A14: n = 1 + m by NAT_1:10;
reconsider m = m as Element of NAT by ORDINAL1:def 13;
reconsider q = p | (Seg m) as FinSequence by FINSEQ_1:19;
A15: ( m <= len p & m <> len p ) by A13, A14, NAT_1:13;
then A16: len q = m by FINSEQ_1:21;
q is_a_proper_prefix_of p
proof
thus q is_a_prefix_of p by Def1; :: according to XBOOLE_0:def 8 :: thesis: not q = p
thus not q = p by A15, FINSEQ_1:21; :: thesis: verum
end;
then A17: q in ProperPrefixes p by Th36;
then ex r being FinSequence st
( q = r & f . q = (len r) + 1 ) by A5;
hence x in rng f by A4, A14, A16, A17, FUNCT_1:def 5; :: thesis: verum