:: Properties of Fuzzy Relation
:: by Noboru Endou , Takashi Mitsuishi and Keiji Ohkubo
::
:: Copyright (c) 2001-2021 Association of Mizar Users

registration
let C1 be non empty set ;
let F be Membership_Func of C1;
cluster rng F -> non empty ;
coherence
not rng F is empty
proof end;
end;

reconsider jj = 1 as Real ;

theorem Th1: :: FUZZY_4:1
for C1 being non empty set
for F being Membership_Func of C1 holds
( rng F is real-bounded & ( for x being set st x in dom F holds
F . x <= upper_bound (rng F) ) & ( for x being set st x in dom F holds
F . x >= lower_bound (rng F) ) )
proof end;

theorem :: FUZZY_4:2
for C1 being non empty set
for F, G being Membership_Func of C1 st ( for x being set st x in C1 holds
F . x <= G . x ) holds
upper_bound (rng F) <= upper_bound (rng G)
proof end;

theorem Th3: :: FUZZY_4:3
for C1, C2 being non empty set
for f being RMembership_Func of C1,C2
for c being set holds
( 0 <= f . c & f . c <= 1 )
proof end;

theorem :: FUZZY_4:4
for C1, C2 being non empty set
for f being RMembership_Func of C1,C2
for x, y being set holds
( 0 <= f . (x,y) & f . (x,y) <= 1 ) by Th3;

notation
let C1, C2 be non empty set ;
let h be RMembership_Func of C2,C1;
synonym converse h for ~ C1;
end;

definition
let C1, C2 be non empty set ;
let h be RMembership_Func of C2,C1;
:: original: converse
redefine func converse h -> RMembership_Func of C1,C2 means :Def1: :: FUZZY_4:def 1
for x, y being object st [x,y] in [:C1,C2:] holds
it . (x,y) = h . (y,x);
coherence
converse is RMembership_Func of C1,C2
proof end;
compatibility
for b1 being RMembership_Func of C1,C2 holds
( b1 = converse iff for x, y being object st [x,y] in [:C1,C2:] holds
b1 . (x,y) = h . (y,x) )
proof end;
end;

:: deftheorem Def1 defines converse FUZZY_4:def 1 :
for C1, C2 being non empty set
for h being RMembership_Func of C2,C1
for b4 being RMembership_Func of C1,C2 holds
( b4 = converse h iff for x, y being object st [x,y] in [:C1,C2:] holds
b4 . (x,y) = h . (y,x) );

theorem :: FUZZY_4:5
for C1, C2 being non empty set
for f being RMembership_Func of C1,C2 holds converse () = f
proof end;

theorem Th6: :: FUZZY_4:6
for C1, C2 being non empty set
for f being RMembership_Func of C1,C2 holds 1_minus () = converse ()
proof end;

theorem Th7: :: FUZZY_4:7
for C1, C2 being non empty set
for f, g being RMembership_Func of C1,C2 holds converse (max (f,g)) = max ((),())
proof end;

theorem Th8: :: FUZZY_4:8
for C1, C2 being non empty set
for f, g being RMembership_Func of C1,C2 holds converse (min (f,g)) = min ((),())
proof end;

theorem Th9: :: FUZZY_4:9
for C1, C2 being non empty set
for f, g being RMembership_Func of C1,C2
for x, y being set st x in C1 & y in C2 & f . [x,y] <= g . [x,y] holds
() . [y,x] <= () . [y,x]
proof end;

theorem :: FUZZY_4:10
for C1, C2 being non empty set
for f, g being RMembership_Func of C1,C2 st g c= holds
converse g c=
proof end;

theorem :: FUZZY_4:11
for C1, C2 being non empty set
for f, g being RMembership_Func of C1,C2 holds converse (f \ g) = () \ ()
proof end;

theorem :: FUZZY_4:12
for C1, C2 being non empty set
for f, g being RMembership_Func of C1,C2 holds converse (f \+\ g) = () \+\ ()
proof end;

:: Definition and properties of the composition
definition
let C1, C2, C3 be non empty set ;
let h be RMembership_Func of C1,C2;
let g be RMembership_Func of C2,C3;
let x, z be object ;
assume that
A1: x in C1 and
A2: z in C3 ;
func min (h,g,x,z) -> Membership_Func of C2 means :Def2: :: FUZZY_4:def 2
for y being Element of C2 holds it . y = min ((h . [x,y]),(g . [y,z]));
existence
ex b1 being Membership_Func of C2 st
for y being Element of C2 holds b1 . y = min ((h . [x,y]),(g . [y,z]))
proof end;
uniqueness
for b1, b2 being Membership_Func of C2 st ( for y being Element of C2 holds b1 . y = min ((h . [x,y]),(g . [y,z])) ) & ( for y being Element of C2 holds b2 . y = min ((h . [x,y]),(g . [y,z])) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def2 defines min FUZZY_4:def 2 :
for C1, C2, C3 being non empty set
for h being RMembership_Func of C1,C2
for g being RMembership_Func of C2,C3
for x, z being object st x in C1 & z in C3 holds
for b8 being Membership_Func of C2 holds
( b8 = min (h,g,x,z) iff for y being Element of C2 holds b8 . y = min ((h . [x,y]),(g . [y,z])) );

definition
let C1, C2, C3 be non empty set ;
let h be RMembership_Func of C1,C2;
let g be RMembership_Func of C2,C3;
func h (#) g -> RMembership_Func of C1,C3 means :Def3: :: FUZZY_4:def 3
for x, z being object st [x,z] in [:C1,C3:] holds
it . (x,z) = upper_bound (rng (min (h,g,x,z)));
existence
ex b1 being RMembership_Func of C1,C3 st
for x, z being object st [x,z] in [:C1,C3:] holds
b1 . (x,z) = upper_bound (rng (min (h,g,x,z)))
proof end;
uniqueness
for b1, b2 being RMembership_Func of C1,C3 st ( for x, z being object st [x,z] in [:C1,C3:] holds
b1 . (x,z) = upper_bound (rng (min (h,g,x,z))) ) & ( for x, z being object st [x,z] in [:C1,C3:] holds
b2 . (x,z) = upper_bound (rng (min (h,g,x,z))) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def3 defines (#) FUZZY_4:def 3 :
for C1, C2, C3 being non empty set
for h being RMembership_Func of C1,C2
for g being RMembership_Func of C2,C3
for b6 being RMembership_Func of C1,C3 holds
( b6 = h (#) g iff for x, z being object st [x,z] in [:C1,C3:] holds
b6 . (x,z) = upper_bound (rng (min (h,g,x,z))) );

Lm1: for C1, C2, C3 being non empty set
for f being RMembership_Func of C1,C2
for g, h being RMembership_Func of C2,C3
for x, z being set st x in C1 & z in C3 holds
upper_bound (rng (min (f,(max (g,h)),x,z))) = max ((upper_bound (rng (min (f,g,x,z)))),(upper_bound (rng (min (f,h,x,z)))))

proof end;

theorem :: FUZZY_4:13
for C1, C2, C3 being non empty set
for f being RMembership_Func of C1,C2
for g, h being RMembership_Func of C2,C3 holds f (#) (max (g,h)) = max ((f (#) g),(f (#) h))
proof end;

Lm2: for C1, C2, C3 being non empty set
for f, g being RMembership_Func of C1,C2
for h being RMembership_Func of C2,C3
for x, z being set st x in C1 & z in C3 holds
upper_bound (rng (min ((max (f,g)),h,x,z))) = max ((upper_bound (rng (min (f,h,x,z)))),(upper_bound (rng (min (g,h,x,z)))))

proof end;

theorem :: FUZZY_4:14
for C1, C2, C3 being non empty set
for f, g being RMembership_Func of C1,C2
for h being RMembership_Func of C2,C3 holds (max (f,g)) (#) h = max ((f (#) h),(g (#) h))
proof end;

Lm3: for C1, C2, C3 being non empty set
for f being RMembership_Func of C1,C2
for g, h being RMembership_Func of C2,C3
for x, z being set st x in C1 & z in C3 holds
upper_bound (rng (min (f,(min (g,h)),x,z))) <= min ((upper_bound (rng (min (f,g,x,z)))),(upper_bound (rng (min (f,h,x,z)))))

proof end;

theorem :: FUZZY_4:15
for C1, C2, C3 being non empty set
for f being RMembership_Func of C1,C2
for g, h being RMembership_Func of C2,C3 holds min ((f (#) g),(f (#) h)) c=
proof end;

Lm4: for C1, C2, C3 being non empty set
for f, g being RMembership_Func of C1,C2
for h being RMembership_Func of C2,C3
for x, z being set st x in C1 & z in C3 holds
upper_bound (rng (min ((min (f,g)),h,x,z))) <= min ((upper_bound (rng (min (f,h,x,z)))),(upper_bound (rng (min (g,h,x,z)))))

proof end;

theorem :: FUZZY_4:16
for C1, C2, C3 being non empty set
for f, g being RMembership_Func of C1,C2
for h being RMembership_Func of C2,C3 holds min ((f (#) h),(g (#) h)) c=
proof end;

Lm5: for C1, C2, C3 being non empty set
for f being RMembership_Func of C1,C2
for g being RMembership_Func of C2,C3
for x, z being set st x in C1 & z in C3 holds
upper_bound (rng (min ((),(),z,x))) = upper_bound (rng (min (f,g,x,z)))

proof end;

theorem :: FUZZY_4:17
for C1, C2, C3 being non empty set
for f being RMembership_Func of C1,C2
for g being RMembership_Func of C2,C3 holds converse (f (#) g) = () (#) ()
proof end;

theorem Th18: :: FUZZY_4:18
for C1, C2, C3 being non empty set
for f, g being RMembership_Func of C1,C2
for h, k being RMembership_Func of C2,C3
for x, z being set st x in C1 & z in C3 & ( for y being set st y in C2 holds
( f . [x,y] <= g . [x,y] & h . [y,z] <= k . [y,z] ) ) holds
(f (#) h) . [x,z] <= (g (#) k) . [x,z]
proof end;

theorem :: FUZZY_4:19
for C1, C2, C3 being non empty set
for f, g being RMembership_Func of C1,C2
for h, k being RMembership_Func of C2,C3 st g c= & k c= holds
g (#) k c=
proof end;

Lm6: ( 1 in REAL & 0 in REAL )
by XREAL_0:def 1;

definition
let C1, C2 be non empty set ;
func Imf (C1,C2) -> RMembership_Func of C1,C2 means :Def4: :: FUZZY_4:def 4
for x, y being object st [x,y] in [:C1,C2:] holds
( ( x = y implies it . (x,y) = 1 ) & ( x <> y implies it . (x,y) = 0 ) );
existence
ex b1 being RMembership_Func of C1,C2 st
for x, y being object st [x,y] in [:C1,C2:] holds
( ( x = y implies b1 . (x,y) = 1 ) & ( x <> y implies b1 . (x,y) = 0 ) )
proof end;
uniqueness
for b1, b2 being RMembership_Func of C1,C2 st ( for x, y being object st [x,y] in [:C1,C2:] holds
( ( x = y implies b1 . (x,y) = 1 ) & ( x <> y implies b1 . (x,y) = 0 ) ) ) & ( for x, y being object st [x,y] in [:C1,C2:] holds
( ( x = y implies b2 . (x,y) = 1 ) & ( x <> y implies b2 . (x,y) = 0 ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def4 defines Imf FUZZY_4:def 4 :
for C1, C2 being non empty set
for b3 being RMembership_Func of C1,C2 holds
( b3 = Imf (C1,C2) iff for x, y being object st [x,y] in [:C1,C2:] holds
( ( x = y implies b3 . (x,y) = 1 ) & ( x <> y implies b3 . (x,y) = 0 ) ) );

theorem :: FUZZY_4:20
for C1, C2 being non empty set
for c being Element of [:C1,C2:] holds
( (Zmf (C1,C2)) . c = 0 & (Umf (C1,C2)) . c = 1 ) by FUNCT_3:def 3;

theorem :: FUZZY_4:21
for C1, C2 being non empty set
for x, y being set st [x,y] in [:C1,C2:] holds
( (Zmf (C1,C2)) . [x,y] = 0 & (Umf (C1,C2)) . [x,y] = 1 ) by FUNCT_3:def 3;

Lm7: for C1, C2, C3 being non empty set
for f being RMembership_Func of C2,C3
for x, z being set st x in C1 & z in C3 holds
upper_bound (rng (min ((Zmf (C1,C2)),f,x,z))) = (Zmf (C1,C3)) . [x,z]

proof end;

theorem Th22: :: FUZZY_4:22
for C1, C2, C3 being non empty set
for f being RMembership_Func of C2,C3 holds (Zmf (C1,C2)) (#) f = Zmf (C1,C3)
proof end;

Lm8: for C1, C2, C3 being non empty set
for f being RMembership_Func of C1,C2
for x, z being set st x in C1 & z in C3 holds
upper_bound (rng (min (f,(Zmf (C2,C3)),x,z))) = (Zmf (C1,C3)) . [x,z]

proof end;

theorem Th23: :: FUZZY_4:23
for C1, C2, C3 being non empty set
for f being RMembership_Func of C1,C2 holds f (#) (Zmf (C2,C3)) = Zmf (C1,C3)
proof end;

theorem :: FUZZY_4:24
for C1 being non empty set
for f being RMembership_Func of C1,C1 holds f (#) (Zmf (C1,C1)) = (Zmf (C1,C1)) (#) f
proof end;

:: missing, 2006.12.03, AT
theorem :: FUZZY_4:25
for X, Y being non empty set
for x being Element of X
for y being Element of Y holds
( ( x = y implies (Imf (X,Y)) . (x,y) = 1 ) & ( x <> y implies (Imf (X,Y)) . (x,y) = 0 ) )
proof end;

theorem :: FUZZY_4:26
for X, Y being non empty set
for x being Element of X
for y being Element of Y
for f being RMembership_Func of X,Y holds () . (y,x) = f . (x,y) by ;