:: WELLFND1 semantic presentation

registration
let c1, c2 be set ;
cluster PFuncs a1,a2 -> functional ;
coherence
PFuncs c1,c2 is functional
proof end;
end;

definition
let c1 be 1-sorted ;
let c2 be set ;
let c3 be PartFunc of the carrier of c1,c2;
redefine func dom as dom c3 -> Subset of a1;
coherence
dom c3 is Subset of c1
proof end;
end;

theorem Th1: :: WELLFND1:1
for b1 being set
for b2, b3 being Function st b2 c= b3 & b1 c= dom b2 holds
b2 | b1 = b3 | b1
proof end;

theorem Th2: :: WELLFND1:2
for b1 being functional set st ( for b2, b3 being Function st b2 in b1 & b3 in b1 holds
b2 tolerates b3 ) holds
union b1 is Function
proof end;

scheme :: WELLFND1:sch 1
s1{ F1() -> set , F2() -> set , P1[ set ] } :
ex b1 being Subset of (PFuncs F1(),F2()) st
for b2 being PartFunc of F1(),F2() holds
( b2 in b1 iff P1[b2] )
proof end;

registration
let c1 be set ;
cluster nextcard a1 -> non empty ;
coherence
not nextcard c1 is empty
by CARD_1:def 6;
end;

registration
cluster regular set ;
existence
ex b1 being Aleph st b1 is regular
by CARD_5:42;
end;

theorem Th3: :: WELLFND1:3
for b1 being regular Aleph
for b2 being set st b2 c= b1 & Card b2 in b1 holds
sup b2 in b1
proof end;

theorem Th4: :: WELLFND1:4
for b1 being RelStr
for b2 being set holds the InternalRel of b1 -Seg b2 c= the carrier of b1
proof end;

definition
let c1 be RelStr ;
let c2 be Subset of c1;
redefine attr a2 is lower means :Def1: :: WELLFND1:def 1
for b1, b2 being set st b1 in a2 & [b2,b1] in the InternalRel of a1 holds
b2 in a2;
compatibility
( c2 is lower iff for b1, b2 being set st b1 in c2 & [b2,b1] in the InternalRel of c1 holds
b2 in c2 )
proof end;
end;

:: deftheorem Def1 defines lower WELLFND1:def 1 :
for b1 being RelStr
for b2 being Subset of b1 holds
( b2 is lower iff for b3, b4 being set st b3 in b2 & [b4,b3] in the InternalRel of b1 holds
b4 in b2 );

theorem Th5: :: WELLFND1:5
for b1 being RelStr
for b2 being Subset of b1
for b3 being set st b2 is lower & b3 in b2 holds
the InternalRel of b1 -Seg b3 c= b2
proof end;

theorem Th6: :: WELLFND1:6
for b1 being RelStr
for b2 being lower Subset of b1
for b3 being Subset of b1
for b4 being set st b3 = b2 \/ {b4} & the InternalRel of b1 -Seg b4 c= b2 holds
b3 is lower
proof end;

definition
let c1 be RelStr ;
attr a1 is well_founded means :Def2: :: WELLFND1:def 2
the InternalRel of a1 is_well_founded_in the carrier of a1;
end;

:: deftheorem Def2 defines well_founded WELLFND1:def 2 :
for b1 being RelStr holds
( b1 is well_founded iff the InternalRel of b1 is_well_founded_in the carrier of b1 );

registration
cluster non empty well_founded RelStr ;
existence
ex b1 being RelStr st
( not b1 is empty & b1 is well_founded )
proof end;
end;

definition
let c1 be RelStr ;
let c2 be Subset of c1;
attr a2 is well_founded means :Def3: :: WELLFND1:def 3
the InternalRel of a1 is_well_founded_in a2;
end;

:: deftheorem Def3 defines well_founded WELLFND1:def 3 :
for b1 being RelStr
for b2 being Subset of b1 holds
( b2 is well_founded iff the InternalRel of b1 is_well_founded_in b2 );

registration
let c1 be RelStr ;
cluster well_founded Element of bool the carrier of a1;
existence
ex b1 being Subset of c1 st b1 is well_founded
proof end;
end;

definition
let c1 be RelStr ;
func well_founded-Part c1 -> Subset of a1 means :Def4: :: WELLFND1:def 4
a2 = union { b1 where B is Subset of a1 : ( b1 is well_founded & b1 is lower ) } ;
existence
ex b1 being Subset of c1 st b1 = union { b2 where B is Subset of c1 : ( b2 is well_founded & b2 is lower ) }
proof end;
uniqueness
for b1, b2 being Subset of c1 st b1 = union { b3 where B is Subset of c1 : ( b3 is well_founded & b3 is lower ) } & b2 = union { b3 where B is Subset of c1 : ( b3 is well_founded & b3 is lower ) } holds
b1 = b2
;
end;

:: deftheorem Def4 defines well_founded-Part WELLFND1:def 4 :
for b1 being RelStr
for b2 being Subset of b1 holds
( b2 = well_founded-Part b1 iff b2 = union { b3 where B is Subset of b1 : ( b3 is well_founded & b3 is lower ) } );

registration
let c1 be RelStr ;
cluster well_founded-Part a1 -> lower well_founded ;
coherence
( well_founded-Part c1 is lower & well_founded-Part c1 is well_founded )
proof end;
end;

theorem Th7: :: WELLFND1:7
for b1 being non empty RelStr
for b2 being Element of b1 holds {b2} is well_founded Subset of b1
proof end;

theorem Th8: :: WELLFND1:8
for b1 being RelStr
for b2, b3 being well_founded Subset of b1 st b2 is lower holds
b2 \/ b3 is well_founded Subset of b1
proof end;

theorem Th9: :: WELLFND1:9
for b1 being RelStr holds
( b1 is well_founded iff well_founded-Part b1 = the carrier of b1 )
proof end;

theorem Th10: :: WELLFND1:10
for b1 being non empty RelStr
for b2 being Element of b1 st the InternalRel of b1 -Seg b2 c= well_founded-Part b1 holds
b2 in well_founded-Part b1
proof end;

scheme :: WELLFND1:sch 2
s2{ F1() -> non empty RelStr , F2() -> Element of F1(), P1[ set ] } :
ex b1 being Element of F1() st
( P1[b1] & ( for b2 being Element of F1() holds
( not b1 <> b2 or not P1[b2] or not [b2,b1] in the InternalRel of F1() ) ) )
provided
E15: P1[F2()] and
E16: F1() is well_founded
proof end;

theorem Th11: :: WELLFND1:11
for b1 being non empty RelStr holds
( b1 is well_founded iff for b2 being set st ( for b3 being Element of b1 st the InternalRel of b1 -Seg b3 c= b2 holds
b3 in b2 ) holds
the carrier of b1 c= b2 )
proof end;

scheme :: WELLFND1:sch 3
s3{ F1() -> non empty RelStr , P1[ set ] } :
for b1 being Element of F1() holds P1[b1]
provided
E16: for b1 being Element of F1() st ( for b2 being Element of F1() st b2 <> b1 & [b2,b1] in the InternalRel of F1() holds
P1[b2] ) holds
P1[b1] and
E17: F1() is well_founded
proof end;

definition
let c1 be non empty RelStr ;
let c2 be non empty set ;
let c3 be Function of [:the carrier of c1,(PFuncs the carrier of c1,c2):],c2;
let c4 be Function;
pred c4 is_recursively_expressed_by c3 means :Def5: :: WELLFND1:def 5
for b1 being Element of a1 holds a4 . b1 = a3 . [b1,(a4 | (the InternalRel of a1 -Seg b1))];
end;

:: deftheorem Def5 defines is_recursively_expressed_by WELLFND1:def 5 :
for b1 being non empty RelStr
for b2 being non empty set
for b3 being Function of [:the carrier of b1,(PFuncs the carrier of b1,b2):],b2
for b4 being Function holds
( b4 is_recursively_expressed_by b3 iff for b5 being Element of b1 holds b4 . b5 = b3 . [b5,(b4 | (the InternalRel of b1 -Seg b5))] );

theorem Th12: :: WELLFND1:12
for b1 being non empty RelStr holds
( b1 is well_founded iff for b2 being non empty set
for b3 being Function of [:the carrier of b1,(PFuncs the carrier of b1,b2):],b2 ex b4 being Function of the carrier of b1,b2 st b4 is_recursively_expressed_by b3 )
proof end;

theorem Th13: :: WELLFND1:13
for b1 being non empty RelStr
for b2 being non trivial set st ( for b3 being Function of [:the carrier of b1,(PFuncs the carrier of b1,b2):],b2
for b4, b5 being Function of the carrier of b1,b2 st b4 is_recursively_expressed_by b3 & b5 is_recursively_expressed_by b3 holds
b4 = b5 ) holds
b1 is well_founded
proof end;

theorem Th14: :: WELLFND1:14
for b1 being non empty well_founded RelStr
for b2 being non empty set
for b3 being Function of [:the carrier of b1,(PFuncs the carrier of b1,b2):],b2
for b4, b5 being Function of the carrier of b1,b2 st b4 is_recursively_expressed_by b3 & b5 is_recursively_expressed_by b3 holds
b4 = b5
proof end;

definition
let c1 be RelStr ;
let c2 be sequence of c1;
canceled;
attr a2 is descending means :Def7: :: WELLFND1:def 7
for b1 being Nat holds
( a2 . (b1 + 1) <> a2 . b1 & [(a2 . (b1 + 1)),(a2 . b1)] in the InternalRel of a1 );
end;

:: deftheorem Def6 WELLFND1:def 6 :
canceled;

:: deftheorem Def7 defines descending WELLFND1:def 7 :
for b1 being RelStr
for b2 being sequence of b1 holds
( b2 is descending iff for b3 being Nat holds
( b2 . (b3 + 1) <> b2 . b3 & [(b2 . (b3 + 1)),(b2 . b3)] in the InternalRel of b1 ) );

theorem Th15: :: WELLFND1:15
for b1 being non empty RelStr holds
( b1 is well_founded iff for b2 being sequence of b1 holds not b2 is descending )
proof end;