:: EQREL_1 semantic presentation

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

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

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

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

Lemma36: for i, j being Element of NAT st i < j holds
j - i is Element of 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 X being set holds
( id X is_reflexive_in X & id X is_symmetric_in X & id X is_transitive_in X )
proof end;

definition
let X 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 X being set holds id X is Equivalence_Relation of X ;

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

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

Lemma43: for x, y, X being set
for R being Relation of X st [x,y] in R holds
( x in X & y in X )
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 X, x being set
for R being reflexive total Relation of X st x in X holds
[x,x] in R
proof end;

theorem Th12: :: EQREL_1:12
for X, x, y being set
for R being symmetric total Relation of X st [x,y] in R holds
[y,x] in R
proof end;

theorem Th13: :: EQREL_1:13
for X, x, y, z being set
for R being transitive total Relation of X st [x,y] in R & [y,z] in R holds
[x,z] in R
proof end;

theorem Th14: :: EQREL_1:14
for X being set
for R being reflexive total Relation of X st ex x being set st x in X holds
R <> {} by ;

theorem Th15: :: EQREL_1:15
canceled;

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

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

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

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

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

theorem Th20: :: EQREL_1:20
for X being set
for R being Relation of X ex EqR being Equivalence_Relation of X st
( R c= EqR & ( for EqR2 being Equivalence_Relation of X st R c= EqR2 holds
EqR c= EqR2 ) )
proof end;

definition
let X be set ;
let EqR1 be Equivalence_Relation of X;
let EqR2 be Equivalence_Relation of X;
canceled;
func c2 "\/" c3 -> Equivalence_Relation of a1 means :Def3: :: EQREL_1:def 3
( EqR1 \/ EqR2 c= it & ( for EqR being Equivalence_Relation of X st EqR1 \/ EqR2 c= EqR holds
it c= EqR ) );
existence
ex b1 being Equivalence_Relation of X st
( EqR1 \/ EqR2 c= b1 & ( for EqR being Equivalence_Relation of X st EqR1 \/ EqR2 c= EqR holds
b1 c= EqR ) )
by ;
uniqueness
for b1, b2 being Equivalence_Relation of X st EqR1 \/ EqR2 c= b1 & ( for EqR being Equivalence_Relation of X st EqR1 \/ EqR2 c= EqR holds
b1 c= EqR ) & EqR1 \/ EqR2 c= b2 & ( for EqR being Equivalence_Relation of X st EqR1 \/ EqR2 c= EqR holds
b2 c= EqR ) holds
b1 = b2
proof end;
commutativity
for b1, EqR1, EqR2 being Equivalence_Relation of X st EqR1 \/ EqR2 c= b1 & ( for EqR being Equivalence_Relation of X st EqR1 \/ EqR2 c= EqR holds
b1 c= EqR ) holds
( EqR2 \/ EqR1 c= b1 & ( for EqR being Equivalence_Relation of X st EqR2 \/ EqR1 c= EqR holds
b1 c= EqR ) )
;
idempotence
for EqR1 being Equivalence_Relation of X holds
( EqR1 \/ EqR1 c= EqR1 & ( for EqR being Equivalence_Relation of X st EqR1 \/ EqR1 c= EqR holds
EqR1 c= EqR ) )
;
end;

:: deftheorem Def2 EQREL_1:def 2 :
canceled;

:: deftheorem Def3 defines "\/" EQREL_1:def 3 :
for X being set
for EqR1, EqR2, b4 being Equivalence_Relation of X holds
( b4 = EqR1 "\/" EqR2 iff ( EqR1 \/ EqR2 c= b4 & ( for EqR being Equivalence_Relation of X st EqR1 \/ EqR2 c= EqR holds
b4 c= EqR ) ) );

theorem Th21: :: EQREL_1:21
canceled;

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

theorem Th23: :: EQREL_1:23
for X being set
for EqR1, EqR2 being Equivalence_Relation of X holds EqR1 "\/" EqR2 = EqR2 "\/" EqR1 ;

theorem Th24: :: EQREL_1:24
for X being set
for EqR1, EqR2 being Equivalence_Relation of X holds EqR1 /\ (EqR1 "\/" EqR2) = EqR1
proof end;

theorem Th25: :: EQREL_1:25
for X being set
for EqR1, EqR2 being Equivalence_Relation of X holds EqR1 "\/" (EqR1 /\ EqR2) = EqR1
proof end;

scheme :: EQREL_1:sch 65
s65{ F1() -> set , P1[ set , set ] } :
ex EqR being Equivalence_Relation of F1() st
for x, y being set holds
( [x,y] in EqR iff ( x in F1() & y in F1() & P1[x,y] ) )
provided
E38: for x being set st x in F1() holds
P1[x,x] and
E39: for x, y being set st P1[x,y] holds
P1[y,x] and
E48: for x, y, z being set st P1[x,y] & P1[y,z] holds
P1[x,z]
proof end;

definition
let R be Relation;
let x be set ;
func Class c1,c2 -> set equals :: EQREL_1:def 4
R .: {x};
coherence
R .: {x} is set
;
end;

:: deftheorem Def4 defines Class EQREL_1:def 4 :
for R being Relation
for x being set holds Class R,x = R .: {x};

definition
let X be set , Y be set ;
let R be Relation of X,Y;
let x be set ;
redefine func Class as Class c3,c4 -> Subset of a2;
coherence
Class R,x is Subset of Y
proof end;
end;

theorem Th26: :: EQREL_1:26
for y, x being set
for R being Relation holds
( y in Class R,x iff [x,y] in R )
proof end;

theorem Th27: :: EQREL_1:27
for X, y, x being set
for R being symmetric total Relation of X holds
( y in Class R,x iff [y,x] in R )
proof end;

theorem Th28: :: EQREL_1:28
for X being set
for R being Tolerance of X
for x being set st x in X holds
x in Class R,x
proof end;

theorem Th29: :: EQREL_1:29
for X being set
for R being Tolerance of X
for x being set st x in X holds
ex y being set st x in Class R,y
proof end;

theorem Th30: :: EQREL_1:30
for X, y, x, z being set
for R being transitive Tolerance of X st y in Class R,x & z in Class R,x holds
[y,z] in R
proof end;

Lemma68: for X, y being set
for EqR being Equivalence_Relation of X
for x being set st x in X holds
( [x,y] in EqR iff Class EqR,x = Class EqR,y )
proof end;

theorem Th31: :: EQREL_1:31
for X, y being set
for EqR being Equivalence_Relation of X
for x being set st x in X holds
( y in Class EqR,x iff Class EqR,x = Class EqR,y )
proof end;

theorem Th32: :: EQREL_1:32
for X being set
for EqR being Equivalence_Relation of X
for x, y being set st x in X & y in X & not Class EqR,x = Class EqR,y holds
Class EqR,x misses Class EqR,y
proof end;

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

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

theorem Th35: :: EQREL_1:35
for X being set
for EqR being Equivalence_Relation of X st ex x being set st Class EqR,x = X holds
EqR = nabla X
proof end;

theorem Th36: :: EQREL_1:36
for x, X, y being set
for EqR1, EqR2 being Equivalence_Relation of X st x in X holds
( [x,y] in EqR1 "\/" EqR2 iff ex f being FinSequence st
( 1 <= len f & x = f . 1 & y = f . (len f) & ( for i being Element of NAT st 1 <= i & i < len f holds
[(f . i),(f . (i + 1))] in EqR1 \/ EqR2 ) ) )
proof end;

theorem Th37: :: EQREL_1:37
for X being set
for EqR1, EqR2, E being Equivalence_Relation of X st E = EqR1 \/ EqR2 holds
for x being set holds
( not x in X or Class E,x = Class EqR1,x or Class E,x = Class EqR2,x )
proof end;

theorem Th38: :: EQREL_1:38
for X being set
for EqR1, EqR2 being Equivalence_Relation of X holds
( not EqR1 \/ EqR2 = nabla X or EqR1 = nabla X or EqR2 = nabla X )
proof end;

definition
let X be set ;
let EqR be Equivalence_Relation of X;
func Class c2 -> Subset-Family of a1 means :Def5: :: EQREL_1:def 5
for A being Subset of X holds
( A in it iff ex x being set st
( x in X & A = Class EqR,x ) );
existence
ex b1 being Subset-Family of X st
for A being Subset of X holds
( A in b1 iff ex x being set st
( x in X & A = Class EqR,x ) )
proof end;
uniqueness
for b1, b2 being Subset-Family of X st ( for A being Subset of X holds
( A in b1 iff ex x being set st
( x in X & A = Class EqR,x ) ) ) & ( for A being Subset of X holds
( A in b2 iff ex x being set st
( x in X & A = Class EqR,x ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def5 defines Class EQREL_1:def 5 :
for X being set
for EqR being Equivalence_Relation of X
for b3 being Subset-Family of X holds
( b3 = Class EqR iff for A being Subset of X holds
( A in b3 iff ex x being set st
( x in X & A = Class EqR,x ) ) );

theorem Th39: :: EQREL_1:39
canceled;

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

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

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

theorem Th41: :: EQREL_1:41
canceled;

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

theorem Th43: :: EQREL_1:43
for X being set
for P being a_partition of X ex EqR being Equivalence_Relation of X st P = Class EqR
proof end;

theorem Th44: :: EQREL_1:44
for X, y being set
for EqR being Equivalence_Relation of X
for x being set st x in X holds
( [x,y] in EqR iff Class EqR,x = Class EqR,y ) by ;

theorem Th45: :: EQREL_1:45
for x, X being set
for EqR being Equivalence_Relation of X st x in Class EqR holds
ex y being Element of X st x = Class EqR,y
proof end;

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

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

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

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

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

notation
let I be non empty set ;
let R be Equivalence_Relation of I;
let x be Element of I;
synonym EqClass c2,c3 for Class c1,c2;
end;

definition
let I be non empty set ;
let R be Equivalence_Relation of I;
let x be Element of I;
redefine func Class as EqClass c2,c3 -> Element of Class a2;
coherence
Class R,x is Element of Class R
proof end;
end;

definition
let X be set ;
func SmallestPartition c1 -> a_partition of a1 equals :: EQREL_1:def 7
Class (id X);
coherence
Class (id X) is a_partition of X
;
end;

:: deftheorem Def7 defines SmallestPartition EQREL_1:def 7 :
for X being set holds SmallestPartition X = Class (id X);

theorem Th46: :: EQREL_1:46
for X being non empty set holds SmallestPartition X = { {x} where x is Element of X : verum }
proof end;