let R be non empty RelStr ; :: thesis: for X being Subset of R holds
( X is well_founded iff for f being sequence of R holds
( not rng f c= X or not f is descending ) )

let X be Subset of R; :: thesis: ( X is well_founded iff for f being sequence of R holds
( not rng f c= X or not f is descending ) )

per cases ( X = {} or X <> {} ) ;
suppose X = {} ; :: thesis: ( X is well_founded iff for f being sequence of R holds
( not rng f c= X or not f is descending ) )

then X = {} R ;
hence ( X is well_founded iff for f being sequence of R holds
( not rng f c= X or not f is descending ) ) by Th11; :: thesis: verum
end;
suppose A1: X <> {} ; :: thesis: ( X is well_founded iff for f being sequence of R holds
( not rng f c= X or not f is descending ) )

set S = subrelstr X;
set I = the InternalRel of R;
set I2 = the InternalRel of R |_2 X;
A2: the carrier of (subrelstr X) = X by YELLOW_0:def 15;
then A3: the InternalRel of (subrelstr X) = the InternalRel of R |_2 X by YELLOW_0:def 14;
hereby :: thesis: ( ( for f being sequence of R holds
( not rng f c= X or not f is descending ) ) implies X is well_founded )
assume X is well_founded ; :: thesis: for f being sequence of R holds
( not rng f c= X or not f is descending )

then A4: subrelstr X is well_founded by Th10;
given f being sequence of R such that A5: ( rng f c= X & f is descending ) ; :: thesis: contradiction
A6: dom f = NAT by FUNCT_2:def 1;
then reconsider F = f as sequence of (subrelstr X) by A2, A5, FUNCT_2:2;
A7: not subrelstr X is empty by A1, YELLOW_0:def 15;
for n being Nat holds
( F . (n + 1) <> F . n & [(F . (n + 1)),(F . n)] in the InternalRel of R |_2 X )
proof
let n be Nat; :: thesis: ( F . (n + 1) <> F . n & [(F . (n + 1)),(F . n)] in the InternalRel of R |_2 X )
thus F . (n + 1) <> F . n by A5, WELLFND1:def 6; :: thesis: [(F . (n + 1)),(F . n)] in the InternalRel of R |_2 X
A8: [(f . (n + 1)),(f . n)] in the InternalRel of R by A5, WELLFND1:def 6;
( n in NAT & n + 1 in NAT ) by ORDINAL1:def 12;
then ( f . n in rng f & f . (n + 1) in rng f ) by A6, FUNCT_1:def 3;
then [(f . (n + 1)),(f . n)] in [:X,X:] by A5, ZFMISC_1:87;
then [(F . (n + 1)),(F . n)] in the InternalRel of R /\ [:X,X:] by A8, XBOOLE_0:def 4;
hence [(F . (n + 1)),(F . n)] in the InternalRel of R |_2 X by WELLORD1:def 6; :: thesis: verum
end;
hence contradiction by A7, A4, A3, WELLFND1:def 6, WELLFND1:14; :: thesis: verum
end;
assume A9: for f being sequence of R holds
( not rng f c= X or not f is descending ) ; :: thesis: X is well_founded
assume not X is well_founded ; :: thesis: contradiction
then not subrelstr X is well_founded by Th10;
then consider f being sequence of (subrelstr X) such that
A10: f is descending by A1, A2, WELLFND1:14;
A11: rng f c= X by A2;
A12: rng f c= the carrier of R by A2, XBOOLE_1:1;
dom f = NAT by A1, A2, FUNCT_2:def 1;
then reconsider F = f as sequence of R by A12, FUNCT_2:2;
for n being Nat holds
( F . (n + 1) <> F . n & [(F . (n + 1)),(F . n)] in the InternalRel of R )
proof
let n be Nat; :: thesis: ( F . (n + 1) <> F . n & [(F . (n + 1)),(F . n)] in the InternalRel of R )
thus F . (n + 1) <> F . n by A10, WELLFND1:def 6; :: thesis: [(F . (n + 1)),(F . n)] in the InternalRel of R
[(f . (n + 1)),(f . n)] in the InternalRel of R |_2 X by A3, A10, WELLFND1:def 6;
then [(f . (n + 1)),(f . n)] in the InternalRel of R /\ [:X,X:] by WELLORD1:def 6;
hence [(F . (n + 1)),(F . n)] in the InternalRel of R by XBOOLE_0:def 4; :: thesis: verum
end;
hence contradiction by A9, A11, WELLFND1:def 6; :: thesis: verum
end;
end;