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

A14: 1 <= j + 1 by NAT_1:11;
then 1 in Seg (j + 1) ;
hence p . 1 = H2(1) by A12, A13
.= F4() by A5, 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 A12, A14;
then A15: p . (len p) = H2(j + 1) by A12, A13
.= f . j by NAT_D:34 ;
j > 0 by A1, A2, A4, A5, A11;
then j >= 0 + 1 by NAT_1:13;
then consider j9 being Nat such that
A16: j = 1 + j9 by NAT_1:10;
reconsider j9 = j9 as Element of NAT by ORDINAL1:def 12;
A17: f . j = F6() . ((In ((f . j9),F3())),F2()) by A6, A16;
A18: j9 < j by A16, NAT_1:13;
then A19: P2[f . j9] by A11;
A20: f . j9 in F5() by A11, A18;
P1[f . j9] by A11, A18;
hence p . (len p) nin F5() by A3, A11, A15, A17, A19, A20; :: 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
A22: 1 <= i and
A23: i < len p ; :: thesis: ( p . i in F5() & p . (i + 1) = F6() . ((p . i),F2()) )
A24: i + 1 >= 1 by A22, NAT_1:13;
A25: i + 1 <= len p by A23, NAT_1:13;
A26: i in Seg (j + 1) by A12, A22, A23;
A27: i + 1 in Seg (j + 1) by A12, A24, A25;
A28: p . i = H2(i) by A12, A13, A26;
A29: p . (i + 1) = H2(i + 1) by A12, A13, A27;
consider i9 being Nat such that
A30: i = 1 + i9 by A22, NAT_1:10;
reconsider i9 = i9 as Element of NAT by ORDINAL1:def 12;
i <= j by A12, A23, NAT_1:13;
then A31: i9 < j by A30, NAT_1:13;
A32: i -' 1 = i9 by A30, NAT_D:34;
A33: (i + 1) -' 1 = i by NAT_D:34;
In ((f . i9),F3()) = f . i9 ;
hence ( p . i in F5() & p . (i + 1) = F6() . ((p . i),F2()) ) by A6, A11, A28, A29, A30, A31, A32, A33; :: thesis: verum
end;
end;