per cases ( F4() nin F5() or F4() in F5() ) ;
suppose F4() nin F5() ; :: thesis: F6() iteration_terminates_for F2(),F4()
end;
suppose A3: F4() in F5() ; :: thesis: F6() iteration_terminates_for F2(),F4()
deffunc H1( set , set ) -> Element of F3() = F6() . ((In ($2,F3())),F2());
consider f being sequence of F3() such that
A4: f . 0 = F4() and
A5: for i being Nat holds f . (i + 1) = H1(i,f . i) from NAT_1:sch 12();
defpred S1[ Nat] means ex i being Element of NAT st F7((f . i)) = $1;
F7((f . 0)) in NAT by ORDINAL1:def 12;
then A6: ex j being Nat st S1[j] ;
consider j being Nat such that
A7: ( S1[j] & ( for i being Nat st S1[i] holds
j <= i ) ) from NAT_1:sch 5(A6);
consider i0 being Element of NAT such that
A8: F7((f . i0)) = j by A7;
defpred S2[ Nat] means P1[f . $1];
In ((f . i0),F3()) = f . i0 ;
then f . (i0 + 1) = F6() . ((f . i0),F2()) by A5;
then ( P1[f . i0] implies F7((f . (i0 + 1))) < j ) by A2, A8;
then A9: ex i being Nat st S2[i] by A7;
consider j being Nat such that
A10: ( S2[j] & ( for i being Nat st S2[i] holds
j <= i ) ) from NAT_1:sch 5(A9);
deffunc H2( Nat) -> Element of F3() = f . ($1 -' 1);
consider p being FinSequence of F3() such that
A11: ( len p = j + 1 & ( for i being Nat st i in dom p holds
p . i = H2(i) ) ) from FINSEQ_2:sch 1();
A12: dom p = Seg (j + 1) by A11, FINSEQ_1:def 3;
reconsider p = p as non empty FinSequence of F3() by A11;
take p ; :: according to AOFA_000:def 33 :: thesis: ( p . 1 = F4() & p . (len p) nin F5() & ( for i being Nat st 1 <= i & i < len p holds
( p . i in F5() & p . (i + 1) = F6() . ((p . i),F2()) ) ) )

A13: 1 <= j + 1 by NAT_1:11;
then 1 in Seg (j + 1) ;
hence p . 1 = H2(1) by A11, A12
.= F4() by A4, XREAL_1:232 ;
:: thesis: ( p . (len p) nin F5() & ( for i being Nat st 1 <= i & i < len p holds
( p . i in F5() & p . (i + 1) = F6() . ((p . i),F2()) ) ) )

len p in Seg (j + 1) by A11, A13;
then A14: p . (len p) = H2(j + 1) by A11, A12
.= f . j by NAT_D:34 ;
j > 0 by A1, A3, A4, A10;
then j >= 0 + 1 by NAT_1:13;
then consider j9 being Nat such that
A15: j = 1 + j9 by NAT_1:10;
reconsider j9 = j9 as Element of NAT by ORDINAL1:def 12;
A16: f . j = F6() . ((In ((f . j9),F3())),F2()) by A5, A15;
j9 < j by A15, NAT_1:13;
then P1[f . j9] by A10;
hence p . (len p) nin F5() by A2, A10, A14, A16; :: thesis: for i being Nat st 1 <= i & i < len p holds
( p . i in F5() & p . (i + 1) = F6() . ((p . i),F2()) )

let i be Nat; :: thesis: ( 1 <= i & i < len p implies ( p . i in F5() & p . (i + 1) = F6() . ((p . i),F2()) ) )
assume that
A18: 1 <= i and
A19: i < len p ; :: thesis: ( p . i in F5() & p . (i + 1) = F6() . ((p . i),F2()) )
A20: i + 1 >= 1 by A18, NAT_1:13;
A21: i + 1 <= len p by A19, NAT_1:13;
A22: i in Seg (j + 1) by A11, A18, A19;
A23: i + 1 in Seg (j + 1) by A11, A20, A21;
A24: p . i = H2(i) by A11, A12, A22;
A25: p . (i + 1) = H2(i + 1) by A11, A12, A23;
consider i9 being Nat such that
A26: i = 1 + i9 by A18, NAT_1:10;
reconsider i9 = i9 as Element of NAT by ORDINAL1:def 12;
i <= j by A11, A19, NAT_1:13;
then A27: i9 < j by A26, NAT_1:13;
then A28: P1[f . i9] by A10;
A29: i -' 1 = i9 by A26, NAT_D:34;
A30: (i + 1) -' 1 = i by NAT_D:34;
A31: In ((f . i9),F3()) = f . i9 ;
now :: thesis: ( i9 <> 0 implies p . i in F5() )
assume i9 <> 0 ; :: thesis: p . i in F5()
then i9 >= 0 + 1 by NAT_1:13;
then consider i99 being Nat such that
A32: i9 = 1 + i99 by NAT_1:10;
reconsider i99 = i99 as Element of NAT by ORDINAL1:def 12;
i99 <= i9 by A32, NAT_1:11;
then i99 < j by A27, XXREAL_0:2;
then A33: P1[f . i99] by A10;
f . i9 = H1(i99,f . i99) by A5, A32;
hence p . i in F5() by A2, A24, A28, A29, A33; :: thesis: verum
end;
hence ( p . i in F5() & p . (i + 1) = F6() . ((p . i),F2()) ) by A3, A4, A5, A24, A25, A26, A29, A30, A31; :: thesis: verum
end;
end;