Article MARGREL1, MML version 4.99.1005

:: MARGREL1:funcnot 1 => MARGREL1:func 1
definition
  let a1, a2 be non empty set;
  let a3 be Element of a1;
  redefine func a2 --> a3 -> Element of Funcs(a2,a1);
end;

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

:: MARGREL1:dfs 1
definiens
  let a1 be set;
To prove
     a1 is relation-like
it is sufficient to prove
  thus (for b1 being set
           st b1 in a1
        holds b1 is Relation-like Function-like FinSequence-like set) &
     (for b1, b2 being Relation-like Function-like FinSequence-like set
           st b1 in a1 & b2 in a1
        holds len b1 = len b2);

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

:: MARGREL1:exreg 1
registration
  cluster relation-like set;
end;

:: MARGREL1:modenot 1
definition
  mode relation is relation-like set;
end;

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

:: MARGREL1:th 8
theorem
for b1 being Relation-like Function-like FinSequence-like set holds
   {b1} is relation-like;

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


:: MARGREL1:prednot 1 => HIDDEN:pred 1
definition
  let a1, a2 be set;
  pred A1 = A2 means
    for b1 being Relation-like Function-like FinSequence-like set holds
          b1 in a1
       iff
          b1 in a2;
  symmetry;
::  for a1, a2 being set
::        st a1 = a2
::     holds a2 = a1;
  reflexivity;
::  for a1 being set holds
::     a1 = a1;
end;

:: MARGREL1:dfs 2
definiens
  let a1, a2 be relation-like set;
To prove
     a1 = a2
it is sufficient to prove
  thus for b1 being Relation-like Function-like FinSequence-like set holds
          b1 in a1
       iff
          b1 in a2;

:: MARGREL1:def 2
theorem
for b1, b2 being relation-like set holds
   b1 = b2
iff
   for b3 being Relation-like Function-like FinSequence-like set holds
         b3 in b1
      iff
         b3 in b2;

:: MARGREL1:funcreg 1
registration
  cluster {} -> relation-like;
end;

:: MARGREL1:th 9
theorem
for b1 being relation-like set
      st for b2 being Relation-like Function-like FinSequence-like set holds
           not b2 in b1
   holds b1 = {};

:: MARGREL1:funcnot 2 => MARGREL1:func 2
definition
  let a1 be relation-like set;
  assume a1 <> {};
  func the_arity_of A1 -> Element of NAT means
    for b1 being Relation-like Function-like FinSequence-like set
          st b1 in a1
       holds it = len b1;
end;

:: MARGREL1:def 4
theorem
for b1 being relation-like set
   st b1 <> {}
for b2 being Element of NAT holds
      b2 = the_arity_of b1
   iff
      for b3 being Relation-like Function-like FinSequence-like set
            st b3 in b1
         holds b2 = len b3;

:: MARGREL1:modenot 2 => MARGREL1:mode 1
definition
  let a1 be Element of NAT;
  mode relation_length of A1 -> relation-like set means
    for b1 being Relation-like Function-like FinSequence-like set
          st b1 in it
       holds len b1 = a1;
end;

:: MARGREL1:dfs 4
definiens
  let a1 be Element of NAT;
  let a2 be relation-like set;
To prove
     a2 is relation_length of a1
it is sufficient to prove
  thus for b1 being Relation-like Function-like FinSequence-like set
          st b1 in a2
       holds len b1 = a1;

:: MARGREL1:def 5
theorem
for b1 being Element of NAT
for b2 being relation-like set holds
      b2 is relation_length of b1
   iff
      for b3 being Relation-like Function-like FinSequence-like set
            st b3 in b2
         holds len b3 = b1;

:: MARGREL1:modenot 3 => MARGREL1:mode 2
definition
  let a1 be set;
  mode relation of A1 -> relation-like set means
    for b1 being Relation-like Function-like FinSequence-like set
          st b1 in it
       holds proj2 b1 c= a1;
end;

:: MARGREL1:dfs 5
definiens
  let a1 be set;
  let a2 be relation-like set;
To prove
     a2 is relation of a1
it is sufficient to prove
  thus for b1 being Relation-like Function-like FinSequence-like set
          st b1 in a2
       holds proj2 b1 c= a1;

:: MARGREL1:def 6
theorem
for b1 being set
for b2 being relation-like set holds
      b2 is relation of b1
   iff
      for b3 being Relation-like Function-like FinSequence-like set
            st b3 in b2
         holds proj2 b3 c= b1;

:: MARGREL1:th 20
theorem
for b1 being set holds
   {} is relation of b1;

:: MARGREL1:th 21
theorem
for b1 being Element of NAT holds
   {} is relation_length of b1;

:: MARGREL1:modenot 4 => MARGREL1:mode 3
definition
  let a1 be set;
  let a2 be Element of NAT;
  mode relation of A1,A2 -> relation-like set means
    it is relation of a1 & it is relation_length of a2;
end;

:: MARGREL1:dfs 6
definiens
  let a1 be set;
  let a2 be Element of NAT;
  let a3 be relation-like set;
To prove
     a3 is relation of a1,a2
it is sufficient to prove
  thus a3 is relation of a1 & a3 is relation_length of a2;

:: MARGREL1:def 7
theorem
for b1 being set
for b2 being Element of NAT
for b3 being relation-like set holds
      b3 is relation of b1,b2
   iff
      b3 is relation of b1 & b3 is relation_length of b2;

:: MARGREL1:funcnot 3 => MARGREL1:func 3
definition
  let a1 be non empty set;
  func relations_on A1 -> set means
    for b1 being set holds
          b1 in it
       iff
          b1 c= a1 * &
           (for b2, b3 being FinSequence of a1
                 st b2 in b1 & b3 in b1
              holds len b2 = len b3);
end;

:: MARGREL1:def 8
theorem
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);

:: MARGREL1:funcreg 2
registration
  let a1 be non empty set;
  cluster relations_on a1 -> non empty;
end;

:: MARGREL1:modenot 5
definition
  let a1 be non empty set;
  mode relation of a1 is Element of relations_on a1;
end;

:: MARGREL1:th 26
theorem
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;

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

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

:: MARGREL1:prednot 2 => MARGREL1:pred 1
definition
  let a1 be non empty set;
  let a2, a3 be Element of relations_on a1;
  redefine pred A2 = A3 means
    for b1 being FinSequence of a1 holds
          b1 in a2
       iff
          b1 in a3;
  symmetry;
::  for a1 being non empty set
::  for a2, a3 being Element of relations_on a1
::        st a2 = a3
::     holds a3 = a2;
  reflexivity;
::  for a1 being non empty set
::  for a2 being Element of relations_on a1 holds
::     a2 = a2;
end;

:: MARGREL1:dfs 8
definiens
  let a1 be non empty set;
  let a2, a3 be Element of relations_on a1;
To prove
     a2 = a3
it is sufficient to prove
  thus for b1 being FinSequence of a1 holds
          b1 in a2
       iff
          b1 in a3;

:: MARGREL1:def 9
theorem
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;

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


:: MARGREL1:funcnot 4 => MARGREL1:func 4
definition
  let a1 be non empty set;
  func empty_rel A1 -> Element of relations_on a1 means
    for b1 being FinSequence of a1 holds
       not b1 in it;
end;

:: MARGREL1:def 10
theorem
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;

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

:: MARGREL1:funcnot 5 => MARGREL1:func 5
definition
  let a1 be non empty set;
  let a2 be Element of relations_on a1;
  assume a2 <> empty_rel a1;
  func the_arity_of A2 -> Element of NAT means
    for b1 being FinSequence of a1
          st b1 in a2
       holds it = len b1;
end;

:: MARGREL1:def 11
theorem
for b1 being non empty set
for b2 being Element of relations_on b1
   st b2 <> empty_rel b1
for b3 being Element of NAT holds
      b3 = the_arity_of b2
   iff
      for b4 being FinSequence of b1
            st b4 in b2
         holds b3 = len b4;

:: MARGREL1:sch 3
scheme MARGREL1:sch 3
{F1 -> non empty set,
  F2 -> Element of NAT}:
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]


:: MARGREL1:funcnot 6 => MARGREL1:func 6
definition
  func BOOLEAN -> set equals
    {0,1};
end;

:: MARGREL1:def 12
theorem
BOOLEAN = {0,1};

:: MARGREL1:funcreg 3
registration
  cluster BOOLEAN -> non empty;
end;

:: MARGREL1:funcnot 7 => MARGREL1:func 7
definition
  redefine func FALSE -> Element of BOOLEAN;
end;

:: MARGREL1:funcnot 8 => MARGREL1:func 8
definition
  redefine func TRUE -> Element of BOOLEAN;
end;

:: MARGREL1:attrnot 2 => XBOOLEAN:attr 1
definition
  let a1 be set;
  attr a1 is boolean means
    a1 in BOOLEAN;
end;

:: MARGREL1:dfs 12
definiens
  let a1 be set;
To prove
     a1 is boolean
it is sufficient to prove
  thus a1 in BOOLEAN;

:: MARGREL1:def 13
theorem
for b1 being set holds
      b1 is boolean
   iff
      b1 in BOOLEAN;

:: MARGREL1:condreg 1
registration
  cluster -> boolean (Element of BOOLEAN);
end;

:: MARGREL1:funcnot 9 => XBOOLEAN:func 3
definition
  let a1 be boolean set;
  func 'not' A1 -> boolean set equals
    TRUE
    if a1 = FALSE
    otherwise FALSE;
  involutiveness;
::  for a1 being boolean set holds
::     'not' 'not' a1 = a1;
end;

:: MARGREL1:def 14
theorem
for b1 being boolean set holds
   (b1 = FALSE implies 'not' b1 = TRUE) & (b1 = FALSE or 'not' b1 = FALSE);

:: MARGREL1:funcnot 10 => XBOOLEAN:func 4
definition
  let a1, a2 be boolean set;
  func A1 '&' A2 -> set equals
    TRUE
    if a1 = TRUE & a2 = TRUE
    otherwise FALSE;
  commutativity;
::  for a1, a2 being boolean set holds
::  a1 '&' a2 = a2 '&' a1;
  idempotence;
::  for a1 being boolean set holds
::     a1 '&' a1 = a1;
end;

:: MARGREL1:def 15
theorem
for b1, b2 being boolean set holds
(b1 = TRUE & b2 = TRUE implies b1 '&' b2 = TRUE) &
 (b1 = TRUE & b2 = TRUE or b1 '&' b2 = FALSE);

:: MARGREL1:funcnot 11 => MARGREL1:func 9
definition
  let a1 be Element of BOOLEAN;
  redefine func 'not' a1 -> Element of BOOLEAN;
  involutiveness;
::  for a1 being Element of BOOLEAN holds
::     'not' 'not' a1 = a1;
end;

:: MARGREL1:funcnot 12 => MARGREL1:func 10
definition
  let a1, a2 be Element of BOOLEAN;
  redefine func a1 '&' a2 -> Element of BOOLEAN;
  commutativity;
::  for a1, a2 being Element of BOOLEAN holds
::  a1 '&' a2 = a2 '&' a1;
  idempotence;
::  for a1 being Element of BOOLEAN holds
::     a1 '&' a1 = a1;
end;

:: MARGREL1:th 40
theorem
for b1 being boolean set holds
   'not' 'not' b1 = b1;

:: MARGREL1:th 41
theorem
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);

:: MARGREL1:th 45
theorem
for b1, b2 being boolean set holds
(b1 '&' b2 = TRUE implies b1 = TRUE & b2 = TRUE) &
 (b1 = TRUE & b2 = TRUE implies b1 '&' b2 = TRUE) &
 (b1 '&' b2 = FALSE & b1 <> FALSE implies b2 = FALSE) &
 (b1 <> FALSE & b2 <> FALSE or b1 '&' b2 = FALSE);

:: MARGREL1:th 49
theorem
for b1 being boolean set holds
   FALSE '&' b1 = FALSE;

:: MARGREL1:th 50
theorem
for b1 being boolean set holds
   TRUE '&' b1 = b1;

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

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

:: MARGREL1:funcnot 13 => MARGREL1:func 11
definition
  let a1 be set;
  func ALL A1 -> set equals
    TRUE
    if not FALSE in a1
    otherwise FALSE;
end;

:: MARGREL1:def 16
theorem
for b1 being set holds
   (FALSE in b1 or ALL b1 = TRUE) & (FALSE in b1 implies ALL b1 = FALSE);

:: MARGREL1:funcreg 4
registration
  let a1 be set;
  cluster ALL a1 -> boolean;
end;

:: MARGREL1:funcnot 14 => MARGREL1:func 12
definition
  let a1 be set;
  redefine func ALL a1 -> Element of BOOLEAN;
end;

:: MARGREL1:th 53
theorem
for b1 being set holds
   (FALSE in b1 or 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);

:: MARGREL1:attrnot 3 => MARGREL1:attr 2
definition
  let a1 be Relation-like Function-like set;
  attr a1 is boolean-valued means
    proj2 a1 c= BOOLEAN;
end;

:: MARGREL1:dfs 16
definiens
  let a1 be Relation-like Function-like set;
To prove
     a1 is boolean-valued
it is sufficient to prove
  thus proj2 a1 c= BOOLEAN;

:: MARGREL1:def 17
theorem
for b1 being Relation-like Function-like set holds
      b1 is boolean-valued
   iff
      proj2 b1 c= BOOLEAN;

:: MARGREL1:exreg 2
registration
  cluster Relation-like Function-like boolean-valued set;
end;

:: MARGREL1:funcreg 5
registration
  let a1 be Relation-like Function-like boolean-valued set;
  let a2 be set;
  cluster a1 . a2 -> boolean;
end;

:: MARGREL1:funcnot 15 => MARGREL1:func 13
definition
  let a1 be Relation-like Function-like boolean-valued set;
  func 'not' A1 -> Relation-like Function-like boolean-valued set means
    proj1 it = proj1 a1 &
     (for b1 being set
           st b1 in proj1 a1
        holds it . b1 = 'not' (a1 . b1));
  involutiveness;
::  for a1 being Relation-like Function-like boolean-valued set holds
::     'not' 'not' a1 = a1;
end;

:: MARGREL1:def 18
theorem
for b1, b2 being Relation-like Function-like boolean-valued set holds
   b2 = 'not' b1
iff
   proj1 b2 = proj1 b1 &
    (for b3 being set
          st b3 in proj1 b1
       holds b2 . b3 = 'not' (b1 . b3));

:: MARGREL1:funcnot 16 => MARGREL1:func 14
definition
  let a1, a2 be Relation-like Function-like boolean-valued set;
  func A1 '&' A2 -> Relation-like Function-like boolean-valued set means
    proj1 it = (proj1 a1) /\ proj1 a2 &
     (for b1 being set
           st b1 in proj1 it
        holds it . b1 = (a1 . b1) '&' (a2 . b1));
  commutativity;
::  for a1, a2 being Relation-like Function-like boolean-valued set holds
::  a1 '&' a2 = a2 '&' a1;
  idempotence;
::  for a1 being Relation-like Function-like boolean-valued set holds
::     a1 '&' a1 = a1;
end;

:: MARGREL1:def 19
theorem
for b1, b2, b3 being Relation-like Function-like boolean-valued set holds
   b3 = b1 '&' b2
iff
   proj1 b3 = (proj1 b1) /\ proj1 b2 &
    (for b4 being set
          st b4 in proj1 b3
       holds b3 . b4 = (b1 . b4) '&' (b2 . b4));

:: MARGREL1:condreg 2
registration
  let a1 be set;
  cluster -> boolean-valued (Element of Funcs(a1,BOOLEAN));
end;

:: MARGREL1:funcnot 17 => MARGREL1:func 15
definition
  let a1 be non empty set;
  let a2 be Element of Funcs(a1,BOOLEAN);
  redefine func 'not' A2 -> Element of Funcs(a1,BOOLEAN) means
    for b1 being Element of a1 holds
       it . b1 = 'not' (a2 . b1);
  involutiveness;
::  for a1 being non empty set
::  for a2 being Element of Funcs(a1,BOOLEAN) holds
::     'not' 'not' a2 = a2;
end;

:: MARGREL1:def 20
theorem
for b1 being non empty set
for b2, b3 being Element of Funcs(b1,BOOLEAN) holds
   b3 = 'not' b2
iff
   for b4 being Element of b1 holds
      b3 . b4 = 'not' (b2 . b4);

:: MARGREL1:funcnot 18 => MARGREL1:func 16
definition
  let a1 be non empty set;
  let a2, a3 be Element of Funcs(a1,BOOLEAN);
  redefine func A2 '&' A3 -> Element of Funcs(a1,BOOLEAN) means
    for b1 being Element of a1 holds
       it . b1 = (a2 . b1) '&' (a3 . b1);
  commutativity;
::  for a1 being non empty set
::  for a2, a3 being Element of Funcs(a1,BOOLEAN) holds
::  a2 '&' a3 = a3 '&' a2;
  idempotence;
::  for a1 being non empty set
::  for a2 being Element of Funcs(a1,BOOLEAN) holds
::     a2 '&' a2 = a2;
end;

:: MARGREL1:def 21
theorem
for b1 being non empty set
for b2, b3, b4 being Element of Funcs(b1,BOOLEAN) holds
   b4 = b2 '&' b3
iff
   for b5 being Element of b1 holds
      b4 . b5 = (b2 . b5) '&' (b3 . b5);