let X, Y be set ; :: thesis: for n being Element of NAT st X <> Y & n > 1 holds
ex a1 being TwoValued Alternating FinSequence st
( rng a1 = {X,Y} & len a1 = n & a1 . 1 = X )
let n be Element of NAT ; :: thesis: ( X <> Y & n > 1 implies ex a1 being TwoValued Alternating FinSequence st
( rng a1 = {X,Y} & len a1 = n & a1 . 1 = X ) )
assume that
A1:
X <> Y
and
A2:
n > 1
; :: thesis: ex a1 being TwoValued Alternating FinSequence st
( rng a1 = {X,Y} & len a1 = n & a1 . 1 = X )
set p = <*X,Y*>;
A3:
( <*X,Y*> . 1 = X & <*X,Y*> . 2 = Y )
by FINSEQ_1:61;
deffunc H1( Nat, Nat) -> Element of NAT = 3 -' $2;
consider f1 being Function of NAT ,NAT such that
A4:
( f1 . 0 = 2 & ( for n being Nat holds f1 . (n + 1) = H1(n,f1 . n) ) )
from NAT_1:sch 12();
defpred S1[ Element of NAT ] means ( ( f1 . $1 = 1 or f1 . $1 = 2 ) & f1 . $1 <> f1 . ($1 + 1) );
then A8:
S1[ 0 ]
by A4;
A9:
for i being Element of NAT st S1[i] holds
S1[i + 1]
A11:
for i being Element of NAT holds S1[i]
from NAT_1:sch 1(A8, A9);
deffunc H2( Nat) -> set = <*X,Y*> . (f1 . $1);
consider p1 being FinSequence such that
A12:
( len p1 = n & ( for k being Nat st k in dom p1 holds
p1 . k = H2(k) ) )
from FINSEQ_1:sch 2();
A13:
now let y be
set ;
:: thesis: ( ( y in {X,Y} implies ex x being set st
( x in dom p1 & y = p1 . x ) ) & ( ex x being set st
( x in dom p1 & y = p1 . x ) implies y in {X,Y} ) )given x being
set such that A17:
(
x in dom p1 &
y = p1 . x )
;
:: thesis: y in {X,Y}
x in Seg (len p1)
by A17, FINSEQ_1:def 3;
then consider x' being
Element of
NAT such that A18:
(
x' = x & 1
<= x' &
x' <= len p1 )
;
x' in dom p1
by A18, FINSEQ_3:27;
then
(
p1 . x' = <*X,Y*> . (f1 . x') & (
f1 . x' = 1 or
f1 . x' = 2 ) )
by A11, A12;
hence
y in {X,Y}
by A3, A17, A18, TARSKI:def 2;
:: thesis: verum end;
then
rng p1 = {X,Y}
by FUNCT_1:def 5;
then reconsider p1 = p1 as TwoValued FinSequence by A1, A2, A12, Th19;
then reconsider p1 = p1 as TwoValued Alternating FinSequence by Def4;
take
p1
; :: thesis: ( rng p1 = {X,Y} & len p1 = n & p1 . 1 = X )
thus
rng p1 = {X,Y}
by A13, FUNCT_1:def 5; :: thesis: ( len p1 = n & p1 . 1 = X )
thus
len p1 = n
by A12; :: thesis: p1 . 1 = X
1 in dom p1
by A2, A12, FINSEQ_3:27;
hence
p1 . 1 = X
by A3, A5, A12; :: thesis: verum