:: MARGREL1 semantic presentation

definition
let c1, c2 be non empty set ;
let c3 be Element of c1;
redefine func --> as c2 --> c3 -> Element of Funcs a2,a1;
coherence
c2 --> c3 is Element of Funcs c2,c1
proof end;
end;

definition
let c1 be set ;
attr a1 is relation-like means :Def1: :: MARGREL1:def 1
( ( for b1 being set st b1 in a1 holds
b1 is FinSequence ) & ( for b1, b2 being FinSequence st b1 in a1 & b2 in a1 holds
len b1 = len b2 ) );
end;

:: deftheorem Def1 defines relation-like MARGREL1:def 1 :
for b1 being set holds
( b1 is relation-like iff ( ( for b2 being set st b2 in b1 holds
b2 is FinSequence ) & ( for b2, b3 being FinSequence st b2 in b1 & b3 in b1 holds
len b2 = len b3 ) ) );

registration
cluster relation-like set ;
existence
ex b1 being set st b1 is relation-like
proof end;
end;

definition
mode relation is relation-like set ;
end;

theorem Th1: :: MARGREL1:1
canceled;

theorem Th2: :: MARGREL1:2
canceled;

theorem Th3: :: MARGREL1:3
canceled;

theorem Th4: :: MARGREL1:4
canceled;

theorem Th5: :: MARGREL1:5
canceled;

theorem Th6: :: MARGREL1:6
canceled;

theorem Th7: :: MARGREL1:7
for b1 being set
for b2 being relation st b1 c= b2 holds
b1 is relation-like
proof end;

theorem Th8: :: MARGREL1:8
for b1 being FinSequence holds {b1} is relation-like
proof end;

scheme :: MARGREL1:sch 1
s1{ F1() -> set , P1[ FinSequence] } :
ex b1 being relation st
for b2 being FinSequence holds
( b2 in b1 iff ( b2 in F1() & P1[b2] ) )
provided
E2: for b1, b2 being FinSequence st P1[b1] & P1[b2] holds
len b1 = len b2
proof end;

definition
let c1, c2 be relation;
redefine pred c1 = c2 means :: MARGREL1:def 2
for b1 being FinSequence holds
( b1 in a1 iff b1 in a2 );
compatibility
( c1 = c2 iff for b1 being FinSequence holds
( b1 in c1 iff b1 in c2 ) )
proof end;
end;

:: deftheorem Def2 defines = MARGREL1:def 2 :
for b1, b2 being relation holds
( b1 = b2 iff for b3 being FinSequence holds
( b3 in b1 iff b3 in b2 ) );

registration
cluster {} -> relation-like ;
coherence
{} is relation-like
proof end;
end;

theorem Th9: :: MARGREL1:9
for b1 being relation st ( for b2 being FinSequence holds not b2 in b1 ) holds
b1 = {}
proof end;

definition
let c1 be relation;
assume E3: c1 <> {} ;
canceled;
func the_arity_of c1 -> Nat means :: MARGREL1:def 4
for b1 being FinSequence st b1 in a1 holds
a2 = len b1;
existence
ex b1 being Nat st
for b2 being FinSequence st b2 in c1 holds
b1 = len b2
proof end;
uniqueness
for b1, b2 being Nat st ( for b3 being FinSequence st b3 in c1 holds
b1 = len b3 ) & ( for b3 being FinSequence st b3 in c1 holds
b2 = len b3 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def3 MARGREL1:def 3 :
canceled;

:: deftheorem Def4 defines the_arity_of MARGREL1:def 4 :
for b1 being relation st b1 <> {} holds
for b2 being Nat holds
( b2 = the_arity_of b1 iff for b3 being FinSequence st b3 in b1 holds
b2 = len b3 );

definition
let c1 be Nat;
mode relation_length of c1 -> relation means :: MARGREL1:def 5
for b1 being FinSequence st b1 in a2 holds
len b1 = a1;
existence
ex b1 being relation st
for b2 being FinSequence st b2 in b1 holds
len b2 = c1
proof end;
end;

:: deftheorem Def5 defines relation_length MARGREL1:def 5 :
for b1 being Nat
for b2 being relation holds
( b2 is relation_length of b1 iff for b3 being FinSequence st b3 in b2 holds
len b3 = b1 );

definition
let c1 be set ;
mode relation of c1 -> relation means :: MARGREL1:def 6
for b1 being FinSequence st b1 in a2 holds
rng b1 c= a1;
existence
ex b1 being relation st
for b2 being FinSequence st b2 in b1 holds
rng b2 c= c1
proof end;
end;

:: deftheorem Def6 defines relation MARGREL1:def 6 :
for b1 being set
for b2 being relation holds
( b2 is relation of b1 iff for b3 being FinSequence st b3 in b2 holds
rng b3 c= b1 );

theorem Th10: :: MARGREL1:10
canceled;

theorem Th11: :: MARGREL1:11
canceled;

theorem Th12: :: MARGREL1:12
canceled;

theorem Th13: :: MARGREL1:13
canceled;

theorem Th14: :: MARGREL1:14
canceled;

theorem Th15: :: MARGREL1:15
canceled;

theorem Th16: :: MARGREL1:16
canceled;

theorem Th17: :: MARGREL1:17
canceled;

theorem Th18: :: MARGREL1:18
canceled;

theorem Th19: :: MARGREL1:19
canceled;

theorem Th20: :: MARGREL1:20
for b1 being set holds {} is relation of b1
proof end;

theorem Th21: :: MARGREL1:21
for b1 being Nat holds {} is relation_length of b1
proof end;

definition
let c1 be set ;
let c2 be Nat;
mode relation of c1,c2 -> relation means :: MARGREL1:def 7
( a3 is relation of a1 & a3 is relation_length of a2 );
existence
ex b1 being relation st
( b1 is relation of c1 & b1 is relation_length of c2 )
proof end;
end;

:: deftheorem Def7 defines relation MARGREL1:def 7 :
for b1 being set
for b2 being Nat
for b3 being relation holds
( b3 is relation of b1,b2 iff ( b3 is relation of b1 & b3 is relation_length of b2 ) );

definition
let c1 be non empty set ;
func relations_on c1 -> set means :Def8: :: MARGREL1:def 8
for b1 being set holds
( b1 in a2 iff ( b1 c= a1 * & ( for b2, b3 being FinSequence of a1 st b2 in b1 & b3 in b1 holds
len b2 = len b3 ) ) );
existence
ex b1 being set st
for b2 being set holds
( b2 in b1 iff ( b2 c= c1 * & ( for b3, b4 being FinSequence of c1 st b3 in b2 & b4 in b2 holds
len b3 = len b4 ) ) )
proof end;
uniqueness
for b1, b2 being set st ( for b3 being set holds
( b3 in b1 iff ( b3 c= c1 * & ( for b4, b5 being FinSequence of c1 st b4 in b3 & b5 in b3 holds
len b4 = len b5 ) ) ) ) & ( for b3 being set holds
( b3 in b2 iff ( b3 c= c1 * & ( for b4, b5 being FinSequence of c1 st b4 in b3 & b5 in b3 holds
len b4 = len b5 ) ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def8 defines relations_on MARGREL1:def 8 :
for b1 being non empty set
for b2 being set holds
( b2 = relations_on b1 iff for b3 being set holds
( b3 in b2 iff ( b3 c= b1 * & ( for b4, b5 being FinSequence of b1 st b4 in b3 & b5 in b3 holds
len b4 = len b5 ) ) ) );

registration
let c1 be non empty set ;
cluster relations_on a1 -> non empty ;
coherence
not relations_on c1 is empty
proof end;
end;

definition
let c1 be non empty set ;
mode relation of a1 is Element of relations_on a1;
end;

theorem Th22: :: MARGREL1:22
canceled;

theorem Th23: :: MARGREL1:23
canceled;

theorem Th24: :: MARGREL1:24
canceled;

theorem Th25: :: MARGREL1:25
canceled;

theorem Th26: :: MARGREL1:26
for b1 being non empty set
for b2 being set
for b3 being Element of relations_on b1 st b2 c= b3 holds
b2 is Element of relations_on b1
proof end;

theorem Th27: :: MARGREL1:27
for b1 being non empty set
for b2 being FinSequence of b1 holds {b2} is Element of relations_on b1
proof end;

theorem Th28: :: MARGREL1:28
for b1 being non empty set
for b2, b3 being Element of b1 holds {<*b2,b3*>} is Element of relations_on b1
proof end;

definition
let c1 be non empty set ;
let c2, c3 be Element of relations_on c1;
redefine pred = as c2 = c3 means :Def9: :: MARGREL1:def 9
for b1 being FinSequence of a1 holds
( b1 in a2 iff b1 in a3 );
compatibility
( c2 = c3 iff for b1 being FinSequence of c1 holds
( b1 in c2 iff b1 in c3 ) )
proof end;
end;

:: deftheorem Def9 defines = MARGREL1:def 9 :
for b1 being non empty set
for b2, b3 being Element of relations_on b1 holds
( b2 = b3 iff for b4 being FinSequence of b1 holds
( b4 in b2 iff b4 in b3 ) );

scheme :: MARGREL1:sch 2
s2{ F1() -> non empty set , P1[ FinSequence of F1()] } :
ex b1 being Element of relations_on F1() st
for b2 being FinSequence of F1() holds
( b2 in b1 iff P1[b2] )
provided
E7: for b1, b2 being FinSequence of F1() st P1[b1] & P1[b2] holds
len b1 = len b2
proof end;

definition
let c1 be non empty set ;
func empty_rel c1 -> Element of relations_on a1 means :Def10: :: MARGREL1:def 10
for b1 being FinSequence of a1 holds not b1 in a2;
existence
ex b1 being Element of relations_on c1 st
for b2 being FinSequence of c1 holds not b2 in b1
proof end;
uniqueness
for b1, b2 being Element of relations_on c1 st ( for b3 being FinSequence of c1 holds not b3 in b1 ) & ( for b3 being FinSequence of c1 holds not b3 in b2 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def10 defines empty_rel MARGREL1:def 10 :
for b1 being non empty set
for b2 being Element of relations_on b1 holds
( b2 = empty_rel b1 iff for b3 being FinSequence of b1 holds not b3 in b2 );

theorem Th29: :: MARGREL1:29
canceled;

theorem Th30: :: MARGREL1:30
canceled;

theorem Th31: :: MARGREL1:31
canceled;

theorem Th32: :: MARGREL1:32
for b1 being non empty set holds empty_rel b1 = {}
proof end;

definition
let c1 be non empty set ;
let c2 be Element of relations_on c1;
assume E8: c2 <> empty_rel c1 ;
func the_arity_of c2 -> Nat means :: MARGREL1:def 11
for b1 being FinSequence of a1 st b1 in a2 holds
a3 = len b1;
existence
ex b1 being Nat st
for b2 being FinSequence of c1 st b2 in c2 holds
b1 = len b2
proof end;
uniqueness
for b1, b2 being Nat st ( for b3 being FinSequence of c1 st b3 in c2 holds
b1 = len b3 ) & ( for b3 being FinSequence of c1 st b3 in c2 holds
b2 = len b3 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def11 defines the_arity_of MARGREL1:def 11 :
for b1 being non empty set
for b2 being Element of relations_on b1 st b2 <> empty_rel b1 holds
for b3 being Nat holds
( b3 = the_arity_of b2 iff for b4 being FinSequence of b1 st b4 in b2 holds
b3 = len b4 );

scheme :: MARGREL1:sch 3
s3{ F1() -> non empty set , F2() -> Nat, P1[ FinSequence of F1()] } :
ex b1 being Element of relations_on F1() st
for b2 being FinSequence of F1() st len b2 = F2() holds
( b2 in b1 iff P1[b2] )
proof end;

definition
func BOOLEAN -> set equals :: MARGREL1:def 12
{0,1};
coherence
{0,1} is set
;
end;

:: deftheorem Def12 defines BOOLEAN MARGREL1:def 12 :
BOOLEAN = {0,1};

registration
cluster BOOLEAN -> non empty ;
coherence
not BOOLEAN is empty
;
end;

definition
func FALSE -> Element of BOOLEAN equals :: MARGREL1:def 13
0;
coherence
0 is Element of BOOLEAN
by TARSKI:def 2;
func TRUE -> Element of BOOLEAN equals :: MARGREL1:def 14
1;
coherence
1 is Element of BOOLEAN
by TARSKI:def 2;
end;

:: deftheorem Def13 defines FALSE MARGREL1:def 13 :
FALSE = 0;

:: deftheorem Def14 defines TRUE MARGREL1:def 14 :
TRUE = 1;

theorem Th33: :: MARGREL1:33
canceled;

theorem Th34: :: MARGREL1:34
canceled;

theorem Th35: :: MARGREL1:35
canceled;

theorem Th36: :: MARGREL1:36
( FALSE = 0 & TRUE = 1 ) ;

theorem Th37: :: MARGREL1:37
BOOLEAN = {FALSE ,TRUE } ;

theorem Th38: :: MARGREL1:38
FALSE <> TRUE ;

definition
let c1 be set ;
attr a1 is boolean means :Def15: :: MARGREL1:def 15
a1 in BOOLEAN ;
end;

:: deftheorem Def15 defines boolean MARGREL1:def 15 :
for b1 being set holds
( b1 is boolean iff b1 in BOOLEAN );

registration
cluster boolean set ;
existence
ex b1 being set st b1 is boolean
proof end;
cluster -> boolean Element of BOOLEAN ;
coherence
for b1 being Element of BOOLEAN holds b1 is boolean
by Def15;
end;

theorem Th39: :: MARGREL1:39
for b1 being boolean set holds
( b1 = FALSE or b1 = TRUE )
proof end;

definition
let c1 be boolean set ;
func 'not' c1 -> boolean set equals :Def16: :: MARGREL1:def 16
TRUE if a1 = FALSE
otherwise FALSE ;
correctness
coherence
( ( c1 = FALSE implies TRUE is boolean set ) & ( not c1 = FALSE implies FALSE is boolean set ) )
;
consistency
for b1 being boolean set holds verum
;
;
involutiveness
for b1, b2 being boolean set st ( b2 = FALSE implies b1 = TRUE ) & ( not b2 = FALSE implies b1 = FALSE ) holds
( ( b1 = FALSE implies b2 = TRUE ) & ( not b1 = FALSE implies b2 = FALSE ) )
by Th39;
let c2 be boolean set ;
func c1 '&' c2 -> set equals :Def17: :: MARGREL1:def 17
TRUE if ( a1 = TRUE & a2 = TRUE )
otherwise FALSE ;
correctness
coherence
( ( c1 = TRUE & c2 = TRUE implies TRUE is set ) & ( ( not c1 = TRUE or not c2 = TRUE ) implies FALSE is set ) )
;
consistency
for b1 being set holds verum
;
;
commutativity
for b1 being set
for b2, b3 being boolean set st ( b2 = TRUE & b3 = TRUE implies b1 = TRUE ) & ( ( not b2 = TRUE or not b3 = TRUE ) implies b1 = FALSE ) holds
( ( b3 = TRUE & b2 = TRUE implies b1 = TRUE ) & ( ( not b3 = TRUE or not b2 = TRUE ) implies b1 = FALSE ) )
;
end;

:: deftheorem Def16 defines 'not' MARGREL1:def 16 :
for b1 being boolean set holds
( ( b1 = FALSE implies 'not' b1 = TRUE ) & ( not b1 = FALSE implies 'not' b1 = FALSE ) );

:: deftheorem Def17 defines '&' MARGREL1:def 17 :
for b1, b2 being boolean set holds
( ( b1 = TRUE & b2 = TRUE implies b1 '&' b2 = TRUE ) & ( ( not b1 = TRUE or not b2 = TRUE ) implies b1 '&' b2 = FALSE ) );

registration
let c1 be boolean set ;
cluster 'not' a1 -> boolean ;
coherence
'not' c1 is boolean
;
let c2 be boolean set ;
cluster a1 '&' a2 -> boolean ;
correctness
coherence
c1 '&' c2 is boolean
;
proof end;
end;

definition
let c1 be Element of BOOLEAN ;
redefine func 'not' as 'not' c1 -> Element of BOOLEAN ;
correctness
coherence
'not' c1 is Element of BOOLEAN
;
by Def15;
let c2 be Element of BOOLEAN ;
redefine func '&' as c1 '&' c2 -> Element of BOOLEAN ;
correctness
coherence
c1 '&' c2 is Element of BOOLEAN
;
by Def15;
end;

theorem Th40: :: MARGREL1:40
for b1 being boolean set holds 'not' ('not' b1) = b1 ;

theorem Th41: :: MARGREL1:41
for b1 being boolean set holds
( ( b1 = FALSE implies 'not' b1 = TRUE ) & ( 'not' b1 = TRUE implies b1 = FALSE ) & ( b1 = TRUE implies 'not' b1 = FALSE ) & ( 'not' b1 = FALSE implies b1 = TRUE ) )
proof end;

theorem Th42: :: MARGREL1:42
canceled;

theorem Th43: :: MARGREL1:43
for b1 being boolean set holds
( b1 <> TRUE iff b1 = FALSE ) by Th39;

theorem Th44: :: MARGREL1:44
canceled;

theorem Th45: :: MARGREL1:45
for b1, b2 being boolean set holds
( ( b1 '&' b2 = TRUE implies ( b1 = TRUE & b2 = TRUE ) ) & ( b1 = TRUE & b2 = TRUE implies b1 '&' b2 = TRUE ) & ( not b1 '&' b2 = FALSE or b1 = FALSE or b2 = FALSE ) & ( ( b1 = FALSE or b2 = FALSE ) implies b1 '&' b2 = FALSE ) )
proof end;

theorem Th46: :: MARGREL1:46
for b1 being boolean set holds b1 '&' ('not' b1) = FALSE
proof end;

theorem Th47: :: MARGREL1:47
for b1 being boolean set holds 'not' (b1 '&' ('not' b1)) = TRUE
proof end;

theorem Th48: :: MARGREL1:48
canceled;

theorem Th49: :: MARGREL1:49
for b1 being boolean set holds FALSE '&' b1 = FALSE by Th45;

theorem Th50: :: MARGREL1:50
for b1 being boolean set holds TRUE '&' b1 = b1
proof end;

theorem Th51: :: MARGREL1:51
for b1 being boolean set st b1 '&' b1 = FALSE holds
b1 = FALSE by Th45;

theorem Th52: :: MARGREL1:52
for b1, b2, b3 being boolean set holds b1 '&' (b2 '&' b3) = (b1 '&' b2) '&' b3
proof end;

definition
let c1 be set ;
func ALL c1 -> set equals :Def18: :: MARGREL1:def 18
TRUE if not FALSE in a1
otherwise FALSE ;
correctness
coherence
( ( not FALSE in c1 implies TRUE is set ) & ( FALSE in c1 implies FALSE is set ) )
;
consistency
for b1 being set holds verum
;
;
end;

:: deftheorem Def18 defines ALL MARGREL1:def 18 :
for b1 being set holds
( ( not FALSE in b1 implies ALL b1 = TRUE ) & ( FALSE in b1 implies ALL b1 = FALSE ) );

registration
let c1 be set ;
cluster ALL a1 -> boolean ;
correctness
coherence
ALL c1 is boolean
;
proof end;
end;

definition
let c1 be set ;
redefine func ALL as ALL c1 -> Element of BOOLEAN ;
correctness
coherence
ALL c1 is Element of BOOLEAN
;
by Def15;
end;

theorem Th53: :: MARGREL1:53
for b1 being set holds
( ( not FALSE in b1 implies ALL b1 = TRUE ) & ( ALL b1 = TRUE implies not FALSE in b1 ) & ( FALSE in b1 implies ALL b1 = FALSE ) & ( ALL b1 = FALSE implies FALSE in b1 ) ) by Def18;