Article AMI_2, MML version 4.99.1005

:: AMI_2:funcnot 1 => XBOOLE_0:func 1
notation
  synonym SCM-Halt for {};
end;

:: AMI_2:funcnot 2 => AMI_2:func 1
definition
  redefine func SCM-Halt -> Element of Segm 9;
end;

:: AMI_2:funcnot 3 => AMI_2:func 2
definition
  func SCM-Data-Loc -> set equals
    [:{1},NAT:];
end;

:: AMI_2:def 1
theorem
SCM-Data-Loc = [:{1},NAT:];

:: AMI_2:funcnot 4 => AMI_2:func 3
definition
  func SCM-Memory -> set equals
    ({NAT} \/ SCM-Data-Loc) \/ NAT;
end;

:: AMI_2:def 3
theorem
SCM-Memory = ({NAT} \/ SCM-Data-Loc) \/ NAT;

:: AMI_2:funcreg 1
registration
  cluster SCM-Memory -> non empty;
end;

:: AMI_2:funcnot 5 => AMI_2:func 4
definition
  redefine func SCM-Data-Loc -> Element of bool SCM-Memory;
end;

:: AMI_2:funcnot 6 => AMI_2:func 5
definition
  redefine func NAT -> Element of bool SCM-Memory;
end;

:: AMI_2:funcreg 2
registration
  cluster SCM-Data-Loc -> non empty;
end;

:: AMI_2:funcnot 7 => AMI_2:func 6
definition
  func SCM-Instr -> Element of bool [:NAT,((union {INT}) \/ SCM-Memory) *:] equals
    (({[SCM-Halt,{}]} \/ {[b1,<*b2*>] where b1 is Element of Segm 9, b2 is Element of NAT: b1 = 6}) \/ {[b1,<*b2,b3*>] where b1 is Element of Segm 9, b2 is Element of NAT, b3 is Element of SCM-Data-Loc: b1 in {7,8}}) \/ {[b1,<*b2,b3*>] where b1 is Element of Segm 9, b2 is Element of SCM-Data-Loc, b3 is Element of SCM-Data-Loc: b1 in {1,2,3,4,5}};
end;

:: AMI_2:def 4
theorem
SCM-Instr = (({[SCM-Halt,{}]} \/ {[b1,<*b2*>] where b1 is Element of Segm 9, b2 is Element of NAT: b1 = 6}) \/ {[b1,<*b2,b3*>] where b1 is Element of Segm 9, b2 is Element of NAT, b3 is Element of SCM-Data-Loc: b1 in {7,8}}) \/ {[b1,<*b2,b3*>] where b1 is Element of Segm 9, b2 is Element of SCM-Data-Loc, b3 is Element of SCM-Data-Loc: b1 in {1,2,3,4,5}};

:: AMI_2:th 2
theorem
[{},{}] in SCM-Instr;

:: AMI_2:funcreg 3
registration
  cluster SCM-Instr -> non empty;
end;

:: AMI_2:th 3
theorem
for b1 being Element of NAT holds
   [6,<*b1*>] in SCM-Instr;

:: AMI_2:th 4
theorem
for b1 being set
for b2 being Element of NAT
for b3 being Element of SCM-Data-Loc
      st b1 in {7,8}
   holds [b1,<*b2,b3*>] in SCM-Instr;

:: AMI_2:th 5
theorem
for b1 being set
for b2, b3 being Element of SCM-Data-Loc
      st b1 in {1,2,3,4,5}
   holds [b1,<*b2,b3*>] in SCM-Instr;

:: AMI_2:funcnot 8 => AMI_2:func 7
definition
  func SCM-OK -> Function-like quasi_total Relation of SCM-Memory,{INT} \/ {SCM-Instr,NAT} means
    for b1 being Element of SCM-Memory holds
       (b1 = NAT implies it . b1 = NAT) & (b1 in SCM-Data-Loc implies it . b1 = INT) & (b1 in NAT implies it . b1 = SCM-Instr);
end;

:: AMI_2:def 5
theorem
for b1 being Function-like quasi_total Relation of SCM-Memory,{INT} \/ {SCM-Instr,NAT} holds
      b1 = SCM-OK
   iff
      for b2 being Element of SCM-Memory holds
         (b2 = NAT implies b1 . b2 = NAT) & (b2 in SCM-Data-Loc implies b1 . b2 = INT) & (b2 in NAT implies b1 . b2 = SCM-Instr);

:: AMI_2:th 6
theorem
SCM-Instr <> INT & NAT <> SCM-Instr;

:: AMI_2:th 7
theorem
for b1 being Element of SCM-Memory holds
      SCM-OK . b1 = NAT
   iff
      b1 = NAT;

:: AMI_2:th 8
theorem
for b1 being Element of SCM-Memory holds
      SCM-OK . b1 = INT
   iff
      b1 in SCM-Data-Loc;

:: AMI_2:th 9
theorem
for b1 being Element of SCM-Memory holds
      SCM-OK . b1 = SCM-Instr
   iff
      b1 in NAT;

:: AMI_2:modenot 1
definition
  mode SCM-State is Element of product SCM-OK;
end;

:: AMI_2:th 10
theorem
for b1 being Element of SCM-Data-Loc holds
   SCM-OK . b1 = INT;

:: AMI_2:th 11
theorem
for b1 being Element of NAT holds
   SCM-OK . b1 = SCM-Instr;

:: AMI_2:th 12
theorem
for b1 being Element of NAT
for b2 being Element of SCM-Data-Loc holds
   b1 <> b2;

:: AMI_2:th 13
theorem
pi(product SCM-OK,NAT) = NAT;

:: AMI_2:th 14
theorem
for b1 being Element of SCM-Data-Loc holds
   pi(product SCM-OK,b1) = INT;

:: AMI_2:th 15
theorem
for b1 being Element of NAT holds
   pi(product SCM-OK,b1) = SCM-Instr;

:: AMI_2:funcnot 9 => AMI_2:func 8
definition
  let a1 be Element of product SCM-OK;
  func IC A1 -> Element of NAT equals
    a1 . NAT;
end;

:: AMI_2:def 6
theorem
for b1 being Element of product SCM-OK holds
   IC b1 = b1 . NAT;

:: AMI_2:funcnot 10 => AMI_2:func 9
definition
  let a1 be Element of product SCM-OK;
  let a2 be natural set;
  func SCM-Chg(A1,A2) -> Element of product SCM-OK equals
    a1 +* (NAT .--> a2);
end;

:: AMI_2:def 7
theorem
for b1 being Element of product SCM-OK
for b2 being natural set holds
   SCM-Chg(b1,b2) = b1 +* (NAT .--> b2);

:: AMI_2:th 16
theorem
for b1 being Element of product SCM-OK
for b2 being natural set holds
   (SCM-Chg(b1,b2)) . NAT = b2;

:: AMI_2:th 17
theorem
for b1 being Element of product SCM-OK
for b2 being natural set
for b3 being Element of SCM-Data-Loc holds
   (SCM-Chg(b1,b2)) . b3 = b1 . b3;

:: AMI_2:th 18
theorem
for b1 being Element of product SCM-OK
for b2, b3 being natural set holds
(SCM-Chg(b1,b2)) . b3 = b1 . b3;

:: AMI_2:funcnot 11 => AMI_2:func 10
definition
  let a1 be Element of product SCM-OK;
  let a2 be Element of SCM-Data-Loc;
  let a3 be integer set;
  func SCM-Chg(A1,A2,A3) -> Element of product SCM-OK equals
    a1 +* (a2 .--> a3);
end;

:: AMI_2:def 8
theorem
for b1 being Element of product SCM-OK
for b2 being Element of SCM-Data-Loc
for b3 being integer set holds
   SCM-Chg(b1,b2,b3) = b1 +* (b2 .--> b3);

:: AMI_2:th 19
theorem
for b1 being Element of product SCM-OK
for b2 being Element of SCM-Data-Loc
for b3 being integer set holds
   (SCM-Chg(b1,b2,b3)) . NAT = b1 . NAT;

:: AMI_2:th 20
theorem
for b1 being Element of product SCM-OK
for b2 being Element of SCM-Data-Loc
for b3 being integer set holds
   (SCM-Chg(b1,b2,b3)) . b2 = b3;

:: AMI_2:th 21
theorem
for b1 being Element of product SCM-OK
for b2 being Element of SCM-Data-Loc
for b3 being integer set
for b4 being Element of SCM-Data-Loc
      st b4 <> b2
   holds (SCM-Chg(b1,b2,b3)) . b4 = b1 . b4;

:: AMI_2:th 22
theorem
for b1 being Element of product SCM-OK
for b2 being Element of SCM-Data-Loc
for b3 being integer set
for b4 being Element of NAT holds
   (SCM-Chg(b1,b2,b3)) . b4 = b1 . b4;

:: AMI_2:funcnot 12 => AMI_2:func 11
definition
  let a1 be Element of SCM-Instr;
  assume ex b1, b2 being Element of SCM-Data-Loc st
       ex b3 being Element of Segm 9 st
          a1 = [b3,<*b1,b2*>];
  func A1 address_1 -> Element of SCM-Data-Loc means
    ex b1 being FinSequence of SCM-Data-Loc st
       b1 = a1 `2 & it = b1 /. 1;
end;

:: AMI_2:def 9
theorem
for b1 being Element of SCM-Instr
   st ex b2, b3 being Element of SCM-Data-Loc st
        ex b4 being Element of Segm 9 st
           b1 = [b4,<*b2,b3*>]
for b2 being Element of SCM-Data-Loc holds
      b2 = b1 address_1
   iff
      ex b3 being FinSequence of SCM-Data-Loc st
         b3 = b1 `2 & b2 = b3 /. 1;

:: AMI_2:funcnot 13 => AMI_2:func 12
definition
  let a1 be Element of SCM-Instr;
  assume ex b1, b2 being Element of SCM-Data-Loc st
       ex b3 being Element of Segm 9 st
          a1 = [b3,<*b1,b2*>];
  func A1 address_2 -> Element of SCM-Data-Loc means
    ex b1 being FinSequence of SCM-Data-Loc st
       b1 = a1 `2 & it = b1 /. 2;
end;

:: AMI_2:def 10
theorem
for b1 being Element of SCM-Instr
   st ex b2, b3 being Element of SCM-Data-Loc st
        ex b4 being Element of Segm 9 st
           b1 = [b4,<*b2,b3*>]
for b2 being Element of SCM-Data-Loc holds
      b2 = b1 address_2
   iff
      ex b3 being FinSequence of SCM-Data-Loc st
         b3 = b1 `2 & b2 = b3 /. 2;

:: AMI_2:th 23
theorem
for b1 being Element of SCM-Instr
for b2, b3 being Element of SCM-Data-Loc
for b4 being Element of Segm 9
      st b1 = [b4,<*b2,b3*>]
   holds b1 address_1 = b2 & b1 address_2 = b3;

:: AMI_2:funcnot 14 => AMI_2:func 13
definition
  let a1 be Element of SCM-Instr;
  assume ex b1 being Element of NAT st
       ex b2 being Element of Segm 9 st
          a1 = [b2,<*b1*>];
  func A1 jump_address -> Element of NAT means
    ex b1 being FinSequence of NAT st
       b1 = a1 `2 & it = b1 /. 1;
end;

:: AMI_2:def 11
theorem
for b1 being Element of SCM-Instr
   st ex b2 being Element of NAT st
        ex b3 being Element of Segm 9 st
           b1 = [b3,<*b2*>]
for b2 being Element of NAT holds
      b2 = b1 jump_address
   iff
      ex b3 being FinSequence of NAT st
         b3 = b1 `2 & b2 = b3 /. 1;

:: AMI_2:th 24
theorem
for b1 being Element of SCM-Instr
for b2 being Element of NAT
for b3 being Element of Segm 9
      st b1 = [b3,<*b2*>]
   holds b1 jump_address = b2;

:: AMI_2:funcnot 15 => AMI_2:func 14
definition
  let a1 be Element of SCM-Instr;
  assume ex b1 being Element of NAT st
       ex b2 being Element of SCM-Data-Loc st
          ex b3 being Element of Segm 9 st
             a1 = [b3,<*b1,b2*>];
  func A1 cjump_address -> Element of NAT means
    ex b1 being Element of NAT st
       ex b2 being Element of SCM-Data-Loc st
          <*b1,b2*> = a1 `2 & it = <*b1,b2*> /. 1;
end;

:: AMI_2:def 12
theorem
for b1 being Element of SCM-Instr
   st ex b2 being Element of NAT st
        ex b3 being Element of SCM-Data-Loc st
           ex b4 being Element of Segm 9 st
              b1 = [b4,<*b2,b3*>]
for b2 being Element of NAT holds
      b2 = b1 cjump_address
   iff
      ex b3 being Element of NAT st
         ex b4 being Element of SCM-Data-Loc st
            <*b3,b4*> = b1 `2 & b2 = <*b3,b4*> /. 1;

:: AMI_2:funcnot 16 => AMI_2:func 15
definition
  let a1 be Element of SCM-Instr;
  assume ex b1 being Element of NAT st
       ex b2 being Element of SCM-Data-Loc st
          ex b3 being Element of Segm 9 st
             a1 = [b3,<*b1,b2*>];
  func A1 cond_address -> Element of SCM-Data-Loc means
    ex b1 being Element of NAT st
       ex b2 being Element of SCM-Data-Loc st
          <*b1,b2*> = a1 `2 & it = <*b1,b2*> /. 2;
end;

:: AMI_2:def 13
theorem
for b1 being Element of SCM-Instr
   st ex b2 being Element of NAT st
        ex b3 being Element of SCM-Data-Loc st
           ex b4 being Element of Segm 9 st
              b1 = [b4,<*b2,b3*>]
for b2 being Element of SCM-Data-Loc holds
      b2 = b1 cond_address
   iff
      ex b3 being Element of NAT st
         ex b4 being Element of SCM-Data-Loc st
            <*b3,b4*> = b1 `2 & b2 = <*b3,b4*> /. 2;

:: AMI_2:th 25
theorem
for b1 being Element of SCM-Instr
for b2 being Element of NAT
for b3 being Element of SCM-Data-Loc
for b4 being Element of Segm 9
      st b1 = [b4,<*b2,b3*>]
   holds b1 cjump_address = b2 & b1 cond_address = b3;

:: AMI_2:funcreg 4
registration
  let a1 be Element of product SCM-OK;
  let a2 be Element of SCM-Data-Loc;
  cluster a1 . a2 -> integer;
end;

:: AMI_2:funcnot 17 => AMI_2:func 16
definition
  let a1 be Element of SCM-Instr;
  let a2 be Element of product SCM-OK;
  func SCM-Exec-Res(A1,A2) -> Element of product SCM-OK equals
    SCM-Chg(SCM-Chg(a2,a1 address_1,a2 . (a1 address_2)),succ IC a2)
    if ex b1, b2 being Element of SCM-Data-Loc st
       a1 = [1,<*b1,b2*>],
SCM-Chg(SCM-Chg(a2,a1 address_1,(a2 . (a1 address_1)) + (a2 . (a1 address_2))),succ IC a2)
    if ex b1, b2 being Element of SCM-Data-Loc st
       a1 = [2,<*b1,b2*>],
SCM-Chg(SCM-Chg(a2,a1 address_1,(a2 . (a1 address_1)) - (a2 . (a1 address_2))),succ IC a2)
    if ex b1, b2 being Element of SCM-Data-Loc st
       a1 = [3,<*b1,b2*>],
SCM-Chg(SCM-Chg(a2,a1 address_1,(a2 . (a1 address_1)) * (a2 . (a1 address_2))),succ IC a2)
    if ex b1, b2 being Element of SCM-Data-Loc st
       a1 = [4,<*b1,b2*>],
SCM-Chg(SCM-Chg(SCM-Chg(a2,a1 address_1,(a2 . (a1 address_1)) div (a2 . (a1 address_2))),a1 address_2,(a2 . (a1 address_1)) mod (a2 . (a1 address_2))),succ IC a2)
    if ex b1, b2 being Element of SCM-Data-Loc st
       a1 = [5,<*b1,b2*>],
SCM-Chg(a2,a1 jump_address)
    if ex b1 being Element of NAT st
       a1 = [6,<*b1*>],
SCM-Chg(a2,IFEQ(a2 . (a1 cond_address),{},a1 cjump_address,succ IC a2))
    if ex b1 being Element of NAT st
       ex b2 being Element of SCM-Data-Loc st
          a1 = [7,<*b1,b2*>],
SCM-Chg(a2,IFGT(a2 . (a1 cond_address),{},a1 cjump_address,succ IC a2))
    if ex b1 being Element of NAT st
       ex b2 being Element of SCM-Data-Loc st
          a1 = [8,<*b1,b2*>]
    otherwise a2;
end;

:: AMI_2:def 16
theorem
for b1 being Element of SCM-Instr
for b2 being Element of product SCM-OK holds
   (for b3, b4 being Element of SCM-Data-Loc holds
    b1 <> [1,<*b3,b4*>] or SCM-Exec-Res(b1,b2) = SCM-Chg(SCM-Chg(b2,b1 address_1,b2 . (b1 address_2)),succ IC b2)) &
    (for b3, b4 being Element of SCM-Data-Loc holds
    b1 <> [2,<*b3,b4*>] or SCM-Exec-Res(b1,b2) = SCM-Chg(SCM-Chg(b2,b1 address_1,(b2 . (b1 address_1)) + (b2 . (b1 address_2))),succ IC b2)) &
    (for b3, b4 being Element of SCM-Data-Loc holds
    b1 <> [3,<*b3,b4*>] or SCM-Exec-Res(b1,b2) = SCM-Chg(SCM-Chg(b2,b1 address_1,(b2 . (b1 address_1)) - (b2 . (b1 address_2))),succ IC b2)) &
    (for b3, b4 being Element of SCM-Data-Loc holds
    b1 <> [4,<*b3,b4*>] or SCM-Exec-Res(b1,b2) = SCM-Chg(SCM-Chg(b2,b1 address_1,(b2 . (b1 address_1)) * (b2 . (b1 address_2))),succ IC b2)) &
    (for b3, b4 being Element of SCM-Data-Loc holds
    b1 <> [5,<*b3,b4*>] or SCM-Exec-Res(b1,b2) = SCM-Chg(SCM-Chg(SCM-Chg(b2,b1 address_1,(b2 . (b1 address_1)) div (b2 . (b1 address_2))),b1 address_2,(b2 . (b1 address_1)) mod (b2 . (b1 address_2))),succ IC b2)) &
    (for b3 being Element of NAT holds
       b1 <> [6,<*b3*>] or SCM-Exec-Res(b1,b2) = SCM-Chg(b2,b1 jump_address)) &
    (for b3 being Element of NAT
    for b4 being Element of SCM-Data-Loc holds
       b1 <> [7,<*b3,b4*>] or SCM-Exec-Res(b1,b2) = SCM-Chg(b2,IFEQ(b2 . (b1 cond_address),{},b1 cjump_address,succ IC b2))) &
    (for b3 being Element of NAT
    for b4 being Element of SCM-Data-Loc holds
       b1 <> [8,<*b3,b4*>] or SCM-Exec-Res(b1,b2) = SCM-Chg(b2,IFGT(b2 . (b1 cond_address),{},b1 cjump_address,succ IC b2))) &
    ((for b3, b4 being Element of SCM-Data-Loc holds
     b1 <> [1,<*b3,b4*>]) &
     (for b3, b4 being Element of SCM-Data-Loc holds
     b1 <> [2,<*b3,b4*>]) &
     (for b3, b4 being Element of SCM-Data-Loc holds
     b1 <> [3,<*b3,b4*>]) &
     (for b3, b4 being Element of SCM-Data-Loc holds
     b1 <> [4,<*b3,b4*>]) &
     (for b3, b4 being Element of SCM-Data-Loc holds
     b1 <> [5,<*b3,b4*>]) &
     (for b3 being Element of NAT holds
        b1 <> [6,<*b3*>]) &
     (for b3 being Element of NAT
     for b4 being Element of SCM-Data-Loc holds
        b1 <> [7,<*b3,b4*>]) &
     (for b3 being Element of NAT
     for b4 being Element of SCM-Data-Loc holds
        b1 <> [8,<*b3,b4*>]) implies SCM-Exec-Res(b1,b2) = b2);

:: AMI_2:funcnot 18 => AMI_2:func 17
definition
  func SCM-Exec -> Function-like quasi_total Relation of SCM-Instr,Funcs(product SCM-OK,product SCM-OK) means
    for b1 being Element of SCM-Instr
    for b2 being Element of product SCM-OK holds
       (it . b1) . b2 = SCM-Exec-Res(b1,b2);
end;

:: AMI_2:def 17
theorem
for b1 being Function-like quasi_total Relation of SCM-Instr,Funcs(product SCM-OK,product SCM-OK) holds
      b1 = SCM-Exec
   iff
      for b2 being Element of SCM-Instr
      for b3 being Element of product SCM-OK holds
         (b1 . b2) . b3 = SCM-Exec-Res(b2,b3);

:: AMI_2:th 27
theorem
not NAT in SCM-Data-Loc;

:: AMI_2:th 28
theorem
not NAT in NAT;

:: AMI_2:th 29
theorem
SCM-Data-Loc misses NAT;

:: AMI_2:th 30
theorem
NAT in SCM-Memory;

:: AMI_2:th 32
theorem
for b1 being set
      st b1 in SCM-Data-Loc
   holds ex b2 being Element of NAT st
      b1 = [1,b2];

:: AMI_2:th 33
theorem
for b1 being natural set holds
   [1,b1] in SCM-Data-Loc;