Article FIB_FUSC, MML version 4.99.1005

:: FIB_FUSC:funcnot 1 => FIB_FUSC:func 1
definition
  func Fib_Program -> FinSequence of the Instructions of SCM equals
    (((((((<*(dl. 1) >0_goto il. 2*> ^ <*halt SCM*>) ^ <*(dl. 3) := dl. 0*>) ^ <*SubFrom(dl. 1,dl. 0)*>) ^ <*(dl. 1) =0_goto il. 1*>) ^ <*(dl. 4) := dl. 2*>) ^ <*(dl. 2) := dl. 3*>) ^ <*AddTo(dl. 3,dl. 4)*>) ^ <*goto il. 3*>;
end;

:: FIB_FUSC:def 1
theorem
Fib_Program = (((((((<*(dl. 1) >0_goto il. 2*> ^ <*halt SCM*>) ^ <*(dl. 3) := dl. 0*>) ^ <*SubFrom(dl. 1,dl. 0)*>) ^ <*(dl. 1) =0_goto il. 1*>) ^ <*(dl. 4) := dl. 2*>) ^ <*(dl. 2) := dl. 3*>) ^ <*AddTo(dl. 3,dl. 4)*>) ^ <*goto il. 3*>;

:: FIB_FUSC:th 1
theorem
for b1 being Element of NAT
for b2 being State-consisting of 0,0,0,Fib_Program,((<*1*> ^ <*b1*>) ^ <*0*>) ^ <*0*> holds
   b2 is halting(NAT, {INT}, SCM) &
    (b1 = 0 implies LifeSpan b2 = 1) &
    (b1 <= 0 or LifeSpan b2 = (6 * b1) - 2) &
    (Result b2) . dl. 3 = Fib b1;

:: FIB_FUSC:funcnot 2 => FIB_FUSC:func 2
definition
  let a1 be integer set;
  func Fusc' A1 -> Element of NAT means
    (for b1 being Element of NAT
          st a1 = b1
       holds it <> Fusc b1) implies a1 is not Element of NAT & it = 0;
end;

:: FIB_FUSC:def 2
theorem
for b1 being integer set
for b2 being Element of NAT holds
      b2 = Fusc' b1
   iff
      (for b3 being Element of NAT
            st b1 = b3
         holds b2 <> Fusc b3 implies b1 is not Element of NAT & b2 = 0);

:: FIB_FUSC:funcnot 3 => FIB_FUSC:func 3
definition
  func Fusc_Program -> FinSequence of the Instructions of SCM equals
    (((((((<*(dl. 1) =0_goto il. 8*> ^ <*(dl. 4) := dl. 0*>) ^ <*Divide(dl. 1,dl. 4)*>) ^ <*(dl. 4) =0_goto il. 6*>) ^ <*AddTo(dl. 3,dl. 2)*>) ^ <*goto il. 0*>) ^ <*AddTo(dl. 2,dl. 3)*>) ^ <*goto il. 0*>) ^ <*halt SCM*>;
end;

:: FIB_FUSC:def 3
theorem
Fusc_Program = (((((((<*(dl. 1) =0_goto il. 8*> ^ <*(dl. 4) := dl. 0*>) ^ <*Divide(dl. 1,dl. 4)*>) ^ <*(dl. 4) =0_goto il. 6*>) ^ <*AddTo(dl. 3,dl. 2)*>) ^ <*goto il. 0*>) ^ <*AddTo(dl. 2,dl. 3)*>) ^ <*goto il. 0*>) ^ <*halt SCM*>;

:: FIB_FUSC:th 2
theorem
for b1 being Element of NAT
   st 0 < b1
for b2 being State-consisting of 0,0,0,Fusc_Program,((<*2*> ^ <*b1*>) ^ <*1*>) ^ <*0*> holds
   b2 is halting(NAT, {INT}, SCM) &
    (Result b2) . dl. 3 = Fusc b1 &
    LifeSpan b2 = (6 * ([\log(2,b1)/] + 1)) + 1;

:: FIB_FUSC:th 3
theorem
for b1, b2, b3, b4 being Element of NAT
for b5 being State-consisting of 3,0,0,Fib_Program,((<*1*> ^ <*b1*>) ^ <*b3*>) ^ <*b4*>
      st 0 < b1 & b3 = Fib b2 & b4 = Fib (b2 + 1)
   holds b5 is halting(NAT, {INT}, SCM) &
    LifeSpan b5 = (6 * b1) - 4 &
    (ex b6 being Element of NAT st
       b6 = (b2 + b1) - 1 &
        (Result b5) . dl. 2 = Fib b6 &
        (Result b5) . dl. 3 = Fib (b6 + 1));

:: FIB_FUSC:th 5
theorem
for b1, b2, b3, b4 being Element of NAT
for b5 being State-consisting of 0,0,0,Fusc_Program,((<*2*> ^ <*b1*>) ^ <*b3*>) ^ <*b4*>
      st 0 < b2 &
         Fusc b2 = (b3 * Fusc b1) + (b4 * Fusc (b1 + 1))
   holds b5 is halting(NAT, {INT}, SCM) &
    (Result b5) . dl. 3 = Fusc b2 &
    (b1 = 0 implies LifeSpan b5 = 1) &
    (b1 <= 0 or LifeSpan b5 = (6 * ([\log(2,b1)/] + 1)) + 1);

:: FIB_FUSC:th 6
theorem
for b1 being Element of NAT
   st 0 < b1
for b2 being State-consisting of 0,0,0,Fusc_Program,((<*2*> ^ <*b1*>) ^ <*1*>) ^ <*0*> holds
   b2 is halting(NAT, {INT}, SCM) &
    (Result b2) . dl. 3 = Fusc b1 &
    (b1 = 0 implies LifeSpan b2 = 1) &
    (b1 <= 0 or LifeSpan b2 = (6 * ([\log(2,b1)/] + 1)) + 1);