:: EQREL_1 semantic presentation

definition
let c1 be set ;
func nabla c1 -> Relation of a1 equals :: EQREL_1:def 1
[:a1,a1:];
coherence
[:c1,c1:] is Relation of c1
by RELSET_1:def 1;
end;

:: deftheorem Def1 defines nabla EQREL_1:def 1 :
for b1 being set holds nabla b1 = [:b1,b1:];

registration
let c1 be set ;
cluster nabla a1 -> reflexive total ;
coherence
( nabla c1 is total & nabla c1 is reflexive )
proof end;
end;

definition
let c1 be set ;
let c2, c3 be Relation of c1;
redefine func /\ as c2 /\ c3 -> Relation of a1;
coherence
c2 /\ c3 is Relation of c1
proof end;
redefine func \/ as c2 \/ c3 -> Relation of a1;
coherence
c2 \/ c3 is Relation of c1
proof end;
end;

Lemma1: for b1, b2 being Nat st b1 < b2 holds
b2 - b1 is Nat
by NAT_1:61;

theorem Th1: :: EQREL_1:1
canceled;

theorem Th2: :: EQREL_1:2
canceled;

theorem Th3: :: EQREL_1:3
canceled;

theorem Th4: :: EQREL_1:4
for b1 being set holds
( id b1 is_reflexive_in b1 & id b1 is_symmetric_in b1 & id b1 is_transitive_in b1 )
proof end;

definition
let c1 be set ;
mode Tolerance of a1 is reflexive symmetric total Relation of a1;
mode Equivalence_Relation of a1 is symmetric transitive total Relation of a1;
end;

theorem Th5: :: EQREL_1:5
canceled;

theorem Th6: :: EQREL_1:6
for b1 being set holds id b1 is Equivalence_Relation of b1 ;

theorem Th7: :: EQREL_1:7
for b1 being set holds nabla b1 is Equivalence_Relation of b1
proof end;

registration
let c1 be set ;
cluster nabla a1 -> reflexive symmetric transitive total ;
coherence
( nabla c1 is total & nabla c1 is symmetric & nabla c1 is transitive )
by Th7;
end;

Lemma3: for b1, b2, b3 being set
for b4 being Relation of b3 st [b1,b2] in b4 holds
( b1 in b3 & b2 in b3 )
proof end;

theorem Th8: :: EQREL_1:8
canceled;

theorem Th9: :: EQREL_1:9
canceled;

theorem Th10: :: EQREL_1:10
canceled;

theorem Th11: :: EQREL_1:11
for b1, b2 being set
for b3 being reflexive total Relation of b1 st b2 in b1 holds
[b2,b2] in b3
proof end;

theorem Th12: :: EQREL_1:12
for b1, b2, b3 being set
for b4 being symmetric total Relation of b1 st [b2,b3] in b4 holds
[b3,b2] in b4
proof end;

theorem Th13: :: EQREL_1:13
for b1, b2, b3, b4 being set
for b5 being transitive total Relation of b1 st [b2,b3] in b5 & [b3,b4] in b5 holds
[b2,b4] in b5
proof end;

theorem Th14: :: EQREL_1:14
for b1 being set
for b2 being reflexive total Relation of b1 st ex b3 being set st b3 in b1 holds
b2 <> {} by Th11;

theorem Th15: :: EQREL_1:15
canceled;

theorem Th16: :: EQREL_1:16
for b1 being set
for b2 being Relation of b1 holds
( b2 is Equivalence_Relation of b1 iff ( b2 is reflexive & b2 is symmetric & b2 is transitive & field b2 = b1 ) )
proof end;

definition
let c1 be set ;
let c2, c3 be Equivalence_Relation of c1;
redefine func /\ as c2 /\ c3 -> Equivalence_Relation of a1;
coherence
c2 /\ c3 is Equivalence_Relation of c1
proof end;
end;

theorem Th17: :: EQREL_1:17
for b1 being set
for b2 being Equivalence_Relation of b1 holds (id b1) /\ b2 = id b1
proof end;

theorem Th18: :: EQREL_1:18
for b1 being set
for b2 being Relation of b1 holds (nabla b1) /\ b2 = b2 by XBOOLE_1:28;

theorem Th19: :: EQREL_1:19
for b1 being set
for b2 being Subset-Family of [:b1,b1:] st b2 <> {} & ( for b3 being set st b3 in b2 holds
b3 is Equivalence_Relation of b1 ) holds
meet b2 is Equivalence_Relation of b1
proof end;

theorem Th20: :: EQREL_1:20
for b1 being set
for b2 being Relation of b1 ex b3 being Equivalence_Relation of b1 st
( b2 c= b3 & ( for b4 being Equivalence_Relation of b1 st b2 c= b4 holds
b3 c= b4 ) )
proof end;

definition
let c1 be set ;
let c2, c3 be Equivalence_Relation of c1;
canceled;
func c2 "\/" c3 -> Equivalence_Relation of a1 means :Def3: :: EQREL_1:def 3
( a2 \/ a3 c= a4 & ( for b1 being Equivalence_Relation of a1 st a2 \/ a3 c= b1 holds
a4 c= b1 ) );
existence
ex b1 being Equivalence_Relation of c1 st
( c2 \/ c3 c= b1 & ( for b2 being Equivalence_Relation of c1 st c2 \/ c3 c= b2 holds
b1 c= b2 ) )
by Th20;
uniqueness
for b1, b2 being Equivalence_Relation of c1 st c2 \/ c3 c= b1 & ( for b3 being Equivalence_Relation of c1 st c2 \/ c3 c= b3 holds
b1 c= b3 ) & c2 \/ c3 c= b2 & ( for b3 being Equivalence_Relation of c1 st c2 \/ c3 c= b3 holds
b2 c= b3 ) holds
b1 = b2
proof end;
commutativity
for b1, b2, b3 being Equivalence_Relation of c1 st b2 \/ b3 c= b1 & ( for b4 being Equivalence_Relation of c1 st b2 \/ b3 c= b4 holds
b1 c= b4 ) holds
( b3 \/ b2 c= b1 & ( for b4 being Equivalence_Relation of c1 st b3 \/ b2 c= b4 holds
b1 c= b4 ) )
;
idempotence
for b1 being Equivalence_Relation of c1 holds
( b1 \/ b1 c= b1 & ( for b2 being Equivalence_Relation of c1 st b1 \/ b1 c= b2 holds
b1 c= b2 ) )
;
end;

:: deftheorem Def2 EQREL_1:def 2 :
canceled;

:: deftheorem Def3 defines "\/" EQREL_1:def 3 :
for b1 being set
for b2, b3, b4 being Equivalence_Relation of b1 holds
( b4 = b2 "\/" b3 iff ( b2 \/ b3 c= b4 & ( for b5 being Equivalence_Relation of b1 st b2 \/ b3 c= b5 holds
b4 c= b5 ) ) );

theorem Th21: :: EQREL_1:21
canceled;

theorem Th22: :: EQREL_1:22
for b1 being set
for b2 being Equivalence_Relation of b1 holds b2 "\/" b2 = b2 ;

theorem Th23: :: EQREL_1:23
for b1 being set
for b2, b3 being Equivalence_Relation of b1 holds b2 "\/" b3 = b3 "\/" b2 ;

theorem Th24: :: EQREL_1:24
for b1 being set
for b2, b3 being Equivalence_Relation of b1 holds b2 /\ (b2 "\/" b3) = b2
proof end;

theorem Th25: :: EQREL_1:25
for b1 being set
for b2, b3 being Equivalence_Relation of b1 holds b2 "\/" (b2 /\ b3) = b2
proof end;

scheme :: EQREL_1:sch 1
s1{ F1() -> set , P1[ set , set ] } :
ex b1 being Equivalence_Relation of F1() st
for b2, b3 being set holds
( [b2,b3] in b1 iff ( b2 in F1() & b3 in F1() & P1[b2,b3] ) )
provided
E11: for b1 being set st b1 in F1() holds
P1[b1,b1] and
E12: for b1, b2 being set st P1[b1,b2] holds
P1[b2,b1] and
E13: for b1, b2, b3 being set st P1[b1,b2] & P1[b2,b3] holds
P1[b1,b3]
proof end;

definition
let c1 be set ;
let c2 be Tolerance of c1;
let c3 be set ;
func Class c2,c3 -> Subset of a1 equals :: EQREL_1:def 4
a2 .: {a3};
correctness
coherence
c2 .: {c3} is Subset of c1
;
;
end;

:: deftheorem Def4 defines Class EQREL_1:def 4 :
for b1 being set
for b2 being Tolerance of b1
for b3 being set holds Class b2,b3 = b2 .: {b3};

theorem Th26: :: EQREL_1:26
canceled;

theorem Th27: :: EQREL_1:27
for b1, b2, b3 being set
for b4 being Tolerance of b1 holds
( b2 in Class b4,b3 iff [b2,b3] in b4 )
proof end;

theorem Th28: :: EQREL_1:28
for b1 being set
for b2 being Tolerance of b1
for b3 being set st b3 in b1 holds
b3 in Class b2,b3
proof end;

theorem Th29: :: EQREL_1:29
for b1 being set
for b2 being Tolerance of b1
for b3 being set st b3 in b1 holds
ex b4 being set st b3 in Class b2,b4
proof end;

theorem Th30: :: EQREL_1:30
for b1, b2, b3, b4 being set
for b5 being transitive Tolerance of b1 st b2 in Class b5,b3 & b4 in Class b5,b3 holds
[b2,b4] in b5
proof end;

Lemma13: for b1, b2 being set
for b3 being Equivalence_Relation of b1
for b4 being set st b4 in b1 holds
( [b4,b2] in b3 iff Class b3,b4 = Class b3,b2 )
proof end;

theorem Th31: :: EQREL_1:31
for b1, b2 being set
for b3 being Equivalence_Relation of b1
for b4 being set st b4 in b1 holds
( b2 in Class b3,b4 iff Class b3,b4 = Class b3,b2 )
proof end;

theorem Th32: :: EQREL_1:32
for b1 being set
for b2 being Equivalence_Relation of b1
for b3, b4 being set st b3 in b1 & b4 in b1 & not Class b2,b3 = Class b2,b4 holds
Class b2,b3 misses Class b2,b4
proof end;

theorem Th33: :: EQREL_1:33
for b1, b2 being set st b2 in b1 holds
Class (id b1),b2 = {b2}
proof end;

theorem Th34: :: EQREL_1:34
for b1, b2 being set st b2 in b1 holds
Class (nabla b1),b2 = b1
proof end;

theorem Th35: :: EQREL_1:35
for b1 being set
for b2 being Equivalence_Relation of b1 st ex b3 being set st Class b2,b3 = b1 holds
b2 = nabla b1
proof end;

theorem Th36: :: EQREL_1:36
for b1, b2, b3 being set
for b4, b5 being Equivalence_Relation of b2 st b1 in b2 holds
( [b1,b3] in b4 "\/" b5 iff ex b6 being FinSequence st
( 1 <= len b6 & b1 = b6 . 1 & b3 = b6 . (len b6) & ( for b7 being Nat st 1 <= b7 & b7 < len b6 holds
[(b6 . b7),(b6 . (b7 + 1))] in b4 \/ b5 ) ) )
proof end;

theorem Th37: :: EQREL_1:37
for b1 being set
for b2, b3, b4 being Equivalence_Relation of b1 st b4 = b2 \/ b3 holds
for b5 being set holds
( not b5 in b1 or Class b4,b5 = Class b2,b5 or Class b4,b5 = Class b3,b5 )
proof end;

theorem Th38: :: EQREL_1:38
for b1 being set
for b2, b3 being Equivalence_Relation of b1 holds
( not b2 \/ b3 = nabla b1 or b2 = nabla b1 or b3 = nabla b1 )
proof end;

definition
let c1 be set ;
let c2 be Equivalence_Relation of c1;
func Class c2 -> Subset-Family of a1 means :Def5: :: EQREL_1:def 5
for b1 being Subset of a1 holds
( b1 in a3 iff ex b2 being set st
( b2 in a1 & b1 = Class a2,b2 ) );
existence
ex b1 being Subset-Family of c1 st
for b2 being Subset of c1 holds
( b2 in b1 iff ex b3 being set st
( b3 in c1 & b2 = Class c2,b3 ) )
proof end;
uniqueness
for b1, b2 being Subset-Family of c1 st ( for b3 being Subset of c1 holds
( b3 in b1 iff ex b4 being set st
( b4 in c1 & b3 = Class c2,b4 ) ) ) & ( for b3 being Subset of c1 holds
( b3 in b2 iff ex b4 being set st
( b4 in c1 & b3 = Class c2,b4 ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def5 defines Class EQREL_1:def 5 :
for b1 being set
for b2 being Equivalence_Relation of b1
for b3 being Subset-Family of b1 holds
( b3 = Class b2 iff for b4 being Subset of b1 holds
( b4 in b3 iff ex b5 being set st
( b5 in b1 & b4 = Class b2,b5 ) ) );

theorem Th39: :: EQREL_1:39
canceled;

theorem Th40: :: EQREL_1:40
for b1 being set
for b2 being Equivalence_Relation of b1 st b1 = {} holds
Class b2 = {}
proof end;

definition
let c1 be set ;
mode a_partition of c1 -> Subset-Family of a1 means :Def6: :: EQREL_1:def 6
( union a2 = a1 & ( for b1 being Subset of a1 st b1 in a2 holds
( b1 <> {} & ( for b2 being Subset of a1 holds
( not b2 in a2 or b1 = b2 or b1 misses b2 ) ) ) ) ) if a1 <> {}
otherwise a2 = {} ;
existence
( ( c1 <> {} implies ex b1 being Subset-Family of c1 st
( union b1 = c1 & ( for b2 being Subset of c1 st b2 in b1 holds
( b2 <> {} & ( for b3 being Subset of c1 holds
( not b3 in b1 or b2 = b3 or b2 misses b3 ) ) ) ) ) ) & ( not c1 <> {} implies ex b1 being Subset-Family of c1 st b1 = {} ) )
proof end;
consistency
for b1 being Subset-Family of c1 holds verum
;
end;

:: deftheorem Def6 defines a_partition EQREL_1:def 6 :
for b1 being set
for b2 being Subset-Family of b1 holds
( ( b1 <> {} implies ( b2 is a_partition of b1 iff ( union b2 = b1 & ( for b3 being Subset of b1 st b3 in b2 holds
( b3 <> {} & ( for b4 being Subset of b1 holds
( not b4 in b2 or b3 = b4 or b3 misses b4 ) ) ) ) ) ) ) & ( not b1 <> {} implies ( b2 is a_partition of b1 iff b2 = {} ) ) );

theorem Th41: :: EQREL_1:41
canceled;

theorem Th42: :: EQREL_1:42
for b1 being set
for b2 being Equivalence_Relation of b1 holds Class b2 is a_partition of b1
proof end;

theorem Th43: :: EQREL_1:43
for b1 being set
for b2 being a_partition of b1 ex b3 being Equivalence_Relation of b1 st b2 = Class b3
proof end;

theorem Th44: :: EQREL_1:44
for b1, b2 being set
for b3 being Equivalence_Relation of b1
for b4 being set st b4 in b1 holds
( [b4,b2] in b3 iff Class b3,b4 = Class b3,b2 ) by Lemma13;

theorem Th45: :: EQREL_1:45
for b1, b2 being set
for b3 being Equivalence_Relation of b2 st b1 in Class b3 holds
ex b4 being Element of b2 st b1 = Class b3,b4
proof end;

registration
let c1 be non empty set ;
cluster -> non empty a_partition of a1;
coherence
for b1 being a_partition of c1 holds not b1 is empty
proof end;
end;

registration
let c1 be set ;
cluster -> with_non-empty_elements a_partition of a1;
coherence
for b1 being a_partition of c1 holds b1 is with_non-empty_elements
proof end;
end;

definition
let c1 be set ;
let c2 be Equivalence_Relation of c1;
redefine func Class as Class c2 -> a_partition of a1;
coherence
Class c2 is a_partition of c1
by Th42;
end;

registration
let c1 be non empty set ;
let c2 be Equivalence_Relation of c1;
cluster Class a2 -> non empty ;
coherence
not Class c2 is empty
;
end;

registration
let c1 be non empty set ;
let c2 be Equivalence_Relation of c1;
cluster Class a2 -> non empty with_non-empty_elements ;
coherence
Class c2 is with_non-empty_elements
;
end;