Quelle ami_8.abs
Sprache: Mizar
|
|
:: Formal Verification of a Generic Iterative Algorithm
:: by Artur Korni{\l}owicz
::
:: Received July 20, 2026
:: Copyright (c) 2026 Association of Mizar Users
:: (Stowarzyszenie Uzytkownikow Mizara, Bialystok, Poland).
:: This code can be distributed under the GNU General Public Licence
:: version 3.0 or later, or the Creative Commons Attribution-ShareAlike
:: License version 4.0 or later, subject to the binding interpretation
:: detailed in file COPYING.interpretation.
:: See COPYING.GPL and COPYING.CC-BY-SA for the full text of these
:: licenses, or see http://www.gnu.org/licenses/gpl.html and
:: http://creativecommons.org/licenses/by-sa/4.0/.
environ
vocabularies NUMBERS, CARD_1, XXREAL_0, RELAT_1, FINSEQ_1, ARYTM_3, ARYTM_1,
NAT_1, AMI_3, AFINSQ_1, AMI_1, ORDINAL4, GRAPHSP, SCM_1, MSUALG_1,
FUNCT_1, FSM_1, EXTPRO_1, TARSKI, FINSET_1, ORDINAL1, XCMPLX_0, COMPOS_1,
INT_1, SUBSET_1, REALSET1, PARTFUN1, FUNCOP_1, TURING_1, AMI_2, FRECHET,
CIRCUIT2, FOMODEL1, PBOOLE, EUCLID_3, FUNCT_4, MEMSTR_0, XBOOLE_0,
STRUCT_0, SCMFSA6C, AMI_8;
notations TARSKI, XBOOLE_0, SUBSET_1, ENUMSET1, PROOFS_1, XCMPLX_0, ORDINAL1,
NUMBERS, RELAT_1, FUNCT_1, RELSET_1, PARTFUN1, XXREAL_0, XREAL_0, INT_1,
NAT_D, FINSET_1, FUNCOP_1, FUNCT_4, PBOOLE, AFINSQ_1, STRUCT_0, MEMSTR_0,
COMPOS_1, EXTPRO_1, SCM_1, AMI_2, AMI_3, NEWTON, NUMPOLY1, AMISTD_1;
constructors SCM_1, DOMAIN_1, NEWTON, PROOFS_1, NUMPOLY1, AMISTD_1, NAT_D,
RELSET_1, PRE_POLY;
registrations XREAL_0, INT_1, AMI_3, ORDINAL1, AFINSQ_1, SCM_1, COMPOS_0,
NAT_1, EXTPRO_1, FUNCOP_1, STRUCT_0, AMI_6, PBOOLE, NUMPOLY1, RELSET_1,
XXREAL_0, FINSET_1, MEMSTR_0, FUNCT_4, FUNCT_1;
requirements REAL, NUMERALS, SUBSET, ARITHM, BOOLE;
begin :: Preliminaries
reserve x1,x2,x3,x4,x5,x6 for object;
reserve f for Function;
reserve j,k,m,n for Nat;
reserve i,i1,i2,i3 for Integer;
registration
let a,b,c,x,y,z be object;
cluster (a,b,c) --> (x,y,z) -> finite;
end;
theorem :: AMI_8:1
dom <%x1,x2,x3,x4%> = { 0, 1, 2, 3};
theorem :: AMI_8:2
len <%x1,x2,x3,x4%> = 4;
theorem :: AMI_8:3
for f,g being Function, w,x,y,z being object st dom f = dom g &
f.w = g.w & f.x = g.x & f.y = g.y & f.z = g.z holds f|{w,x,y,z} = g|{w,x,y,z}
;
begin :: Sequences
definition
let x1,x2,x3,x4,x5;
func <%x1,x2,x3,x4,x5%> -> set equals
:: AMI_8:def 1
<%x1,x2,x3,x4%>^<%x5%>;
end;
registration
let x1,x2,x3,x4,x5;
cluster <%x1,x2,x3,x4,x5%> -> Function-like Relation-like;
end;
registration
let x1,x2,x3,x4,x5;
cluster <%x1,x2,x3,x4,x5%> -> finite Sequence-like;
end;
theorem :: AMI_8:4
dom <%x1,x2,x3,x4,x5%> = { 0, 1, 2, 3, 4};
theorem :: AMI_8:5
len <%x1,x2,x3,x4,x5%> = 5;
registration
let x1,x2,x3,x4,x5;
reduce <%x1,x2,x3,x4,x5%>. 0 to x1;
reduce <%x1,x2,x3,x4,x5%>. 1 to x2;
reduce <%x1,x2,x3,x4,x5%>. 2 to x3;
reduce <%x1,x2,x3,x4,x5%>. 3 to x4;
reduce <%x1,x2,x3,x4,x5%>. 4 to x5;
end;
definition
let x1,x2,x3,x4,x5,x6;
func <%x1,x2,x3,x4,x5,x6%> -> set equals
:: AMI_8:def 2
<%x1,x2,x3,x4,x5%>^<%x6%>;
end;
registration
let x1,x2,x3,x4,x5,x6;
cluster <%x1,x2,x3,x4,x5,x6%> -> Function-like Relation-like;
end;
registration
let x1,x2,x3,x4,x5,x6;
cluster <%x1,x2,x3,x4,x5,x6%> -> finite Sequence-like;
end;
theorem :: AMI_8:6
dom <%x1,x2,x3,x4,x5,x6%> = { 0, 1, 2, 3, 4, 5};
theorem :: AMI_8:7
len <%x1,x2,x3,x4,x5,x6%> = 6;
registration
let x1,x2,x3,x4,x5,x6;
reduce <%x1,x2,x3,x4,x5,x6%>. 0 to x1;
reduce <%x1,x2,x3,x4,x5,x6%>. 1 to x2;
reduce <%x1,x2,x3,x4,x5,x6%>. 2 to x3;
reduce <%x1,x2,x3,x4,x5,x6%>. 3 to x4;
reduce <%x1,x2,x3,x4,x5,x6%>. 4 to x5;
reduce <%x1,x2,x3,x4,x5,x6%>. 5 to x6;
end;
theorem :: AMI_8:8
<%x1,x2,x3,x4,x5,x6%> c= f implies
f. 0 = x1 & f. 1 = x2 & f. 2 = x3 & f. 3 = x4 & f. 4 = x5 & f. 5 = x6;
begin :: General theory of SCM
reserve s for State of SCM;
reserve I for Instruction of SCM;
reserve P for Instruction-Sequence of SCM;
reserve X for XFinSequence of the InstructionsF of SCM;
theorem :: AMI_8:9
for d being Data-Location holds i in (the_Values_of SCM).d;
registration
let la be Data-Location;
let a be Integer;
cluster la .--> a -> (the_Values_of SCM)-compatible;
end;
registration
let la,lb be Data-Location;
let a,b be Integer;
cluster (la,lb) --> (a,b) -> (the_Values_of SCM)-compatible;
end;
registration
let la,lb,lc be Data-Location;
let a,b,c be Integer;
cluster (la,lb,lc) --> (a,b,c) -> (the_Values_of SCM)-compatible;
end;
registration
let d be Data-Location, i be Integer;
cluster d .--> i -> data-only for PartState of SCM;
end;
registration
let p, q be data-only FinPartState of SCM;
cluster p +* q -> data-only;
end;
registration
let la,lb be Data-Location;
let a,b be Integer;
cluster (la,lb) --> (a,b) -> data-only for FinPartState of SCM;
end;
registration
let la,lb,lc be Data-Location;
let a,b,c be Integer;
cluster (la,lb,lc) --> (a,b,c) -> data-only for FinPartState of SCM;
end;
definition
let n,I;
attr I is n-dl.constant means
:: AMI_8:def 3
for P being Instruction-Sequence of SCM
for s being State of SCM
for k being Nat st CurInstr(P,Comput(P,s,k)) = I holds
Comput(P,s,k+ 1).dl.n = Comput(P,s,k).dl.n;
end;
theorem :: AMI_8:10
m <> j implies AddTo(dl.m,dl.n) is j-dl.constant;
theorem :: AMI_8:11
m <> j implies SubFrom(dl.m,dl.n) is j-dl.constant;
theorem :: AMI_8:12
m <> j implies MultBy(dl.m,dl.n) is j-dl.constant;
registration
let m;
let n be non zero Nat;
cluster AddTo(dl.(m+n),dl.m) -> m-dl.constant;
cluster SubFrom(dl.(m+n),dl.m) -> m-dl.constant;
cluster MultBy(dl.(m+n),dl.m) -> m-dl.constant;
end;
registration
cluster AddTo(dl. 2,dl. 1) -> 0-dl.constant;
cluster SubFrom(dl. 2,dl. 1) -> 0-dl.constant;
cluster MultBy(dl. 2,dl. 1) -> 0-dl.constant;
end;
registration
let n;
cluster sequential n-dl.constant for Instruction of SCM;
end;
theorem :: AMI_8:13
for I being sequential Instruction of SCM
st CurInstr(P,Comput(P,s,n)) = I & IC Comput(P,s,n) in dom P
holds IC Comput(P,s,n+ 1) = IC Comput(P,s,n) + 1;
theorem :: AMI_8:14
for s being n-started State-consisting of <%i1,i2,i3%>
holds s.dl. 0 = i1 & s.dl. 1 = i2 & s.dl. 2 = i3;
registration
let X;
cluster X-extending for Instruction-Sequence of SCM;
end;
theorem :: AMI_8:15
for s being State of SCM st Initialize ((dl. 0,dl. 1,dl. 2) --> (i1,i2,i3)) c= s
holds s is State-consisting of <%i1,i2,i3%>;
begin :: Correctness of algorithms computing operations on one previous element
:: dl.0 - a, dl.1 - b, dl.2 - c
:: a := 1 - for step
:: b - input
:: c - output
:: 0) if b > 0 then goto 2
:: 1) halt
:: 2) I (e.g., c := c+b or c := c*b)
:: 3) b := b-a
:: 4) if b = 0 then goto 1
:: 5) goto 2
definition
let OPER be Instruction of SCM;
func IterativeAlgorithm(OPER) -> XFinSequence of the InstructionsF of SCM
equals
:: AMI_8:def 4
<% dl. 1 > 0_goto 2,
halt SCM,
OPER,
SubFrom(dl. 1,dl. 0),
dl. 1 = 0_goto 1,
SCM-goto 2
%>;
end;
theorem :: AMI_8:16
IterativeAlgorithm(I) c= P implies
for k st IC Comput(P,s,k) = 0 holds
(Comput(P,s,k).dl. 1 > 0 implies IC Comput(P,s,k+ 1) = 2) &
(Comput(P,s,k).dl. 1 <= 0 implies IC Comput(P,s,k+ 1) = 1) &
for j holds Comput(P,s,k+ 1).dl.j = Comput(P,s,k).dl.j;
theorem :: AMI_8:17
IterativeAlgorithm(I) c= P implies P halts_at 1;
theorem :: AMI_8:18
IterativeAlgorithm(I) c= P implies
for k,j st IC Comput(P,s,k) = 1 holds Comput(P,s,k+j) = Comput(P,s,k);
theorem :: AMI_8:19
IterativeAlgorithm(AddTo(dl.m,dl.n)) c= P implies
for k st IC Comput(P,s,k) = 2 holds
IC Comput(P,s,k+ 1) = 3 &
Comput(P,s,k+ 1).dl.m = Comput(P,s,k).dl.m + Comput(P,s,k).dl.n &
for j st j <> m holds Comput(P,s,k+ 1).dl.j = Comput(P,s,k).dl.j;
theorem :: AMI_8:20
IterativeAlgorithm(SubFrom(dl.m,dl.n)) c= P implies
for k st IC Comput(P,s,k) = 2 holds
IC Comput(P,s,k+ 1) = 3 &
Comput(P,s,k+ 1).dl.m = Comput(P,s,k).dl.m - Comput(P,s,k).dl.n &
for j st j <> m holds Comput(P,s,k+ 1).dl.j = Comput(P,s,k).dl.j;
theorem :: AMI_8:21
IterativeAlgorithm(MultBy(dl.m,dl.n)) c= P implies
for k st IC Comput(P,s,k) = 2 holds
IC Comput(P,s,k+ 1) = 3 &
Comput(P,s,k+ 1).dl.m = Comput(P,s,k).dl.m * Comput(P,s,k).dl.n &
for j st j <> m holds Comput(P,s,k+ 1).dl.j = Comput(P,s,k).dl.j;
theorem :: AMI_8:22
IterativeAlgorithm(I) c= P implies
for k st IC Comput(P,s,k) = 3 holds
IC Comput(P,s,k+ 1) = 4 &
Comput(P,s,k+ 1).dl. 1 = Comput(P,s,k).dl. 1 - Comput(P,s,k).dl. 0 &
for j st j <> 1 holds Comput(P,s,k+ 1).dl.j = Comput(P,s,k).dl.j;
theorem :: AMI_8:23
IterativeAlgorithm(I) c= P implies
for k st IC Comput(P,s,k) = 4 holds
(Comput(P,s,k).dl. 1 = 0 implies IC Comput(P,s,k+ 1) = 1) &
(Comput(P,s,k).dl. 1 <> 0 implies IC Comput(P,s,k+ 1) = 5) &
for j holds Comput(P,s,k+ 1).dl.j = Comput(P,s,k).dl.j;
theorem :: AMI_8:24
IterativeAlgorithm(I) c= P implies
for k st IC Comput(P,s,k) = 5 holds
IC Comput(P,s,k+ 1) = 2 &
for j holds Comput(P,s,k+ 1).dl.j = Comput(P,s,k).dl.j;
registration
let I;
cluster IterativeAlgorithm(I) -> (the InstructionsF of SCM)-valued;
end;
registration
let I;
cluster IterativeAlgorithm(I) -> non halt-free;
end;
theorem :: AMI_8:25
I is sequential & IterativeAlgorithm(I) c= P & IC Comput(P,s, 0) = 0 implies
IC Comput(P,s,k) in { 0, 1, 2, 3, 4, 5};
theorem :: AMI_8:26
I is sequential & I is 0-dl.constant & IterativeAlgorithm(I) c= P implies
for s being 0-started State-consisting of <%i,i1,i2%> holds
Comput(P,s,k).dl. 0 = i;
theorem :: AMI_8:27
I is sequential 0-dl.constant implies
for P being Instruction-Sequence of SCM st IterativeAlgorithm(I) c= P holds
for s being 0-started State-consisting of <%i1, 0,i2%> holds
IC Comput(P,s, 0) = 0 &
( for k being Nat st k >= 1 holds IC Comput(P,s,k) = 1) &
( for k being Nat holds
Comput(P,s,k).dl. 0 = i1 & Comput(P,s,k).dl. 1 = 0 & Comput(P,s,k).dl. 2 = i2)
& LifeSpan(P,s) = 1;
theorem :: AMI_8:28
for A being Integer, N being Nat
for P being Instruction-Sequence of SCM
st IterativeAlgorithm(I) c= P & I is sequential 0-dl.constant holds
for s being 0-started State-consisting of <% 1,N,A%> st
Comput(P,s, 2).dl. 1 = Comput(P,s, 1).dl. 1 &
( for k being Nat holds Comput(P,s, 4*k+ 6).dl. 1 = Comput(P,s, 4*k+ 5).dl. 1)
holds
P halts_on s & IC Comput(P,s, 0) = 0 & Comput(P,s, 1).dl. 2 = A &
( for k being Nat st 0 < k < N holds IC Comput(P,s, 4*k) = 5) &
( for k being Nat st k < N holds
IC Comput(P,s, 4*k+ 1) = 2 & IC Comput(P,s, 4*k+ 2) = 3 &
IC Comput(P,s, 4*k+ 3) = 4 &
Comput(P,s, 4*k+ 1).dl. 1 = N-k & Comput(P,s, 4*k+ 2).dl. 1 = N-k &
Comput(P,s, 4*k+ 3).dl. 1 = N-k- 1 & Comput(P,s, 4*k+ 4).dl. 1 = N-k- 1 &
Comput(P,s, 4*k).dl. 1 > 0 & Comput(P,s, 4*k+ 1).dl. 1 > 0 &
Comput(P,s, 4*k+ 2).dl. 1 > 0
) &
(N <> 0 implies LifeSpan(P,s) = 4*N &
for k,j being Nat st k >= N holds
IC Comput(P,s, 4*k+j) = 1 & Comput(P,s, 4*k+ 1+j).dl. 1 = 0);
theorem :: AMI_8:29
for A being Integer, N being Nat
for P being Instruction-Sequence of SCM
st (I = AddTo(dl. 2,dl. 1) or I = SubFrom(dl. 2,dl. 1) or I = MultBy(dl. 2,dl. 1))
& IterativeAlgorithm(I) c= P holds
for s being 0-started State-consisting of <% 1,N,A%> holds
P halts_on s & Comput(P,s, 1).dl. 2 = A &
( for k being Nat st 0 < k < N holds IC Comput(P,s, 4*k) = 5) &
( for k being Nat st k < N holds
IC Comput(P,s, 4*k+ 1) = 2 & IC Comput(P,s, 4*k+ 2) = 3 &
IC Comput(P,s, 4*k+ 3) = 4 &
Comput(P,s, 4*k+ 1).dl. 1 = N-k & Comput(P,s, 4*k+ 2).dl. 1 = N-k &
Comput(P,s, 4*k+ 3).dl. 1 = N-k- 1 & Comput(P,s, 4*k+ 4).dl. 1 = N-k- 1 &
Comput(P,s, 4*k).dl. 1 > 0 & Comput(P,s, 4*k+ 1).dl. 1 > 0 &
Comput(P,s, 4*k+ 2).dl. 1 > 0
) &
(N <> 0 implies LifeSpan(P,s) = 4*N &
for k,j being Nat st k >= N holds
IC Comput(P,s, 4*k+j) = 1 & Comput(P,s, 4*k+ 1+j).dl. 1 = 0);
:::$T-
registration
let i1,i2,k,n;
let s be 0-started State-consisting of <%n,i1,i2%>;
let I be sequential 0-dl.constant Instruction of SCM;
let P be IterativeAlgorithm(I)-extending Instruction-Sequence of SCM;
cluster Comput(P,s,k).dl. 0 -> natural;
end;
theorem :: AMI_8:30
(I = AddTo(dl. 2,dl. 1) or I = SubFrom(dl. 2,dl. 1) or I = MultBy(dl. 2,dl. 1))
implies
for s being 0-started State-consisting of <% 1,n,i%>
for P being IterativeAlgorithm(I)-extending Instruction-Sequence of SCM holds
Comput(P,s,k).dl. 1 is natural;
registration
let i,k,n;
let s be 0-started State-consisting of <% 1,n,i%>;
let P be IterativeAlgorithm(AddTo(dl. 2,dl. 1))-extending
Instruction-Sequence of SCM;
cluster Comput(P,s,k).dl. 1 -> natural;
end;
registration
let i,k,n;
let s be 0-started State-consisting of <% 1,n,i%>;
let P be IterativeAlgorithm(MultBy(dl. 2,dl. 1))-extending
Instruction-Sequence of SCM;
cluster Comput(P,s,k).dl. 1 -> natural;
end;
scheme :: AMI_8:sch 1
AddOfOneSch
{ A() -> Integer, N() -> Nat, F(object) -> Integer } :
for P being IterativeAlgorithm(AddTo(dl. 2,dl. 1))-extending
Instruction-Sequence of SCM
for s being 0-started State-consisting of <% 1,N(),A()%> holds
( for k being Nat st k < N() holds
Comput(P,s, 4*k+ 1).dl. 2 = A() + (F(N()) - F(Comput(P,s, 4*k+ 1).dl. 1)) &
Comput(P,s, 4*k+ 2).dl. 2 = A() + (F(N()) - F(Comput(P,s, 4*k+ 2).dl. 1-' 1)) &
Comput(P,s, 4*k+ 3).dl. 2 = Comput(P,s, 4*k+ 2).dl. 2 &
Comput(P,s, 4*k+ 4).dl. 2 = Comput(P,s, 4*k+ 3).dl. 2
) &
( for k,j being Nat st k >= N() holds Comput(P,s, 4*k+ 1+j).dl. 2 = F(N())) &
(Result(P,s)).dl. 2 = F(N())
provided
F( 0) = A() and
for n being Nat holds F(n+ 1) = (n+ 1) + F(n);
scheme :: AMI_8:sch 2
MultOfOneSch
{ A() -> Integer, N() -> Nat, F(object) -> Integer } :
for P being IterativeAlgorithm(MultBy(dl. 2,dl. 1))-extending
Instruction-Sequence of SCM
for s being 0-started State-consisting of <% 1,N(),A()%> holds
( for k being Nat st k < N() holds
Comput(P,s, 4*k+ 1).dl. 2 = A() * (F(N()) / F(Comput(P,s, 4*k+ 1).dl. 1)) &
Comput(P,s, 4*k+ 2).dl. 2 = A() * (F(N()) / F(Comput(P,s, 4*k+ 2).dl. 1-' 1)) &
Comput(P,s, 4*k+ 3).dl. 2 = Comput(P,s, 4*k+ 2).dl. 2 &
Comput(P,s, 4*k+ 4).dl. 2 = Comput(P,s, 4*k+ 3).dl. 2
) &
( for k,j being Nat st k >= N() holds Comput(P,s, 4*k+ 1+j).dl. 2 = F(N())) &
(Result(P,s)).dl. 2 = F(N())
provided
F( 0) = A() and
A() <> 0 and
for n being Nat holds F(n+ 1) = (n+ 1) * F(n);
theorem :: AMI_8:31
for P being IterativeAlgorithm(AddTo(dl. 2,dl. 1))-extending
Instruction-Sequence of SCM
for s being 0-started State-consisting of <% 1,n, 0%> holds
( for k being Nat st k < n holds
Comput(P,s, 4*k+ 1).dl. 2 = (Triangle n) - Triangle(Comput(P,s, 4*k+ 1).dl. 1) &
Comput(P,s, 4*k+ 2).dl. 2
= (Triangle n) - Triangle(Comput(P,s, 4*k+ 2).dl. 1-' 1) &
Comput(P,s, 4*k+ 3).dl. 2 = Comput(P,s, 4*k+ 2).dl. 2 &
Comput(P,s, 4*k+ 4).dl. 2 = Comput(P,s, 4*k+ 3).dl. 2
) &
( for k,j being Nat st k >= n holds Comput(P,s, 4*k+ 1+j).dl. 2 = Triangle n) &
(Result(P,s)).dl. 2 = Triangle n;
theorem :: AMI_8:32
for P being IterativeAlgorithm(MultBy(dl. 2,dl. 1))-extending
Instruction-Sequence of SCM
for s being 0-started State-consisting of <% 1,n, 1%> holds
( for k being Nat st k < n holds
Comput(P,s, 4*k+ 1).dl. 2 = n! / ((Comput(P,s, 4*k+ 1).dl. 1)!) &
Comput(P,s, 4*k+ 2).dl. 2 = n! / ((Comput(P,s, 4*k+ 2).dl. 1-' 1)!) &
Comput(P,s, 4*k+ 3).dl. 2 = Comput(P,s, 4*k+ 2).dl. 2 &
Comput(P,s, 4*k+ 4).dl. 2 = Comput(P,s, 4*k+ 3).dl. 2
) &
( for k,j being Nat st k >= n holds Comput(P,s, 4*k+ 1+j).dl. 2 = n!) &
(Result(P,s)).dl. 2 = n!;
begin :: Examples
scheme :: AMI_8:sch 3
PartFuncFinPartStEx { i1,i2() -> Integer, F(object) -> Integer }:
ex f being PartFunc of FinPartSt SCM, FinPartSt SCM st
for p,q being FinPartState of SCM holds [p,q] in f iff
ex n being Nat st p = (dl. 0,dl. 1,dl. 2) --> (i1(),n,i2()) & q = dl. 2 .--> F(n)
;
scheme :: AMI_8:sch 4
PartFuncFinPartStUn { i1,i2() -> Integer, F(object) -> Integer } :
for f1, f2 being PartFunc of FinPartSt SCM, FinPartSt SCM st
( for p,q being FinPartState of SCM holds [p,q] in f1 iff
ex n being Nat st
p = (dl. 0,dl. 1,dl. 2) --> (i1(),n,i2()) & q = dl. 2 .--> F(n)) &
( for p,q being FinPartState of SCM holds [p,q] in f2 iff
ex n being Nat st
p = (dl. 0,dl. 1,dl. 2) --> (i1(),n,i2()) & q = dl. 2 .--> F(n))
holds f1 = f2;
definition
func powerSCMFunction -> PartFunc of FinPartSt SCM, FinPartSt SCM means
:: AMI_8:def 5
for p,q being FinPartState of SCM holds [p,q] in it iff
ex n being Nat st p = (dl. 0,dl. 1,dl. 2) --> ( 1,n, 1) & q = dl. 2 .--> (n!);
end;
theorem :: AMI_8:33
for p being object holds p in dom powerSCMFunction iff
ex n being Nat st p = (dl. 0,dl. 1,dl. 2) --> ( 1,n, 1);
theorem :: AMI_8:34
powerSCMFunction.((dl. 0,dl. 1,dl. 2) --> ( 1,n, 1)) = dl. 2 .--> (n!);
scheme :: AMI_8:sch 5
AutonomicSch
{ f() -> PartFunc of FinPartSt SCM, FinPartSt SCM,
I() -> Instruction of SCM,
F(object) -> Nat }:
for x being FinPartState of SCM st x in dom f() holds
Initialize x is IterativeAlgorithm(I())-autonomic
provided
I() = AddTo(dl. 2,dl. 1) or I() = SubFrom(dl. 2,dl. 1) or
I() = MultBy(dl. 2,dl. 1) and
for x being object st x in dom f()
ex n being Nat st x = (dl. 0,dl. 1,dl. 2) --> ( 1,n,F(n)) and
for P,Q being Instruction-Sequence of SCM st
IterativeAlgorithm(I()) c= P & IterativeAlgorithm(I()) c= Q
for x being FinPartState of SCM st x in dom f()
for s1,s2 being State of SCM st Initialize x c= s1 & Initialize x c= s2
for k being Nat holds Comput(P,s1,k).dl. 2 = Comput(Q,s2,k).dl. 2;
scheme :: AMI_8:sch 6
HaltedSch
{ f() -> PartFunc of FinPartSt SCM, FinPartSt SCM,
I() -> Instruction of SCM,
F(object) -> Nat }:
for x being FinPartState of SCM st x in dom f() holds
Initialize x is IterativeAlgorithm(I())-halted
provided
I() = AddTo(dl. 2,dl. 1) or I() = SubFrom(dl. 2,dl. 1) or
I() = MultBy(dl. 2,dl. 1) and
for x being object st x in dom f()
ex n being Nat st x = (dl. 0,dl. 1,dl. 2) --> ( 1,n,F(n));
scheme :: AMI_8:sch 7
AutonomySch
{ f() -> PartFunc of FinPartSt SCM, FinPartSt SCM,
I() -> Instruction of SCM,
F(object) -> Nat }:
for x being FinPartState of SCM st x in dom f() holds
Initialize x is Autonomy of IterativeAlgorithm(I())
provided
I() = AddTo(dl. 2,dl. 1) or I() = SubFrom(dl. 2,dl. 1) or
I() = MultBy(dl. 2,dl. 1) and
for x being object st x in dom f()
ex n being Nat st x = (dl. 0,dl. 1,dl. 2) --> ( 1,n,F(n)) and
for P,Q being Instruction-Sequence of SCM st
IterativeAlgorithm(I()) c= P & IterativeAlgorithm(I()) c= Q
for x being FinPartState of SCM st x in dom f()
for s1,s2 being State of SCM st Initialize x c= s1 & Initialize x c= s2
for k being Nat holds Comput(P,s1,k).dl. 2 = Comput(Q,s2,k).dl. 2;
theorem :: AMI_8:35
for x being FinPartState of SCM st x in dom powerSCMFunction holds
Initialize x is Autonomy of IterativeAlgorithm(MultBy(dl. 2,dl. 1));
theorem :: AMI_8:36
IterativeAlgorithm(MultBy(dl. 2,dl. 1)), Start-At( 0,SCM) computes
powerSCMFunction;
definition
func sumSCMFunction -> PartFunc of FinPartSt SCM, FinPartSt SCM means
:: AMI_8:def 6
for p,q being FinPartState of SCM holds [p,q] in it iff
ex n being Nat st p = (dl. 0,dl. 1,dl. 2) --> ( 1,n, 0) &
q = dl. 2 .--> Triangle n;
end;
theorem :: AMI_8:37
for p being object holds p in dom sumSCMFunction iff
ex n being Nat st p = (dl. 0,dl. 1,dl. 2) --> ( 1,n, 0);
theorem :: AMI_8:38
sumSCMFunction.((dl. 0,dl. 1,dl. 2) --> ( 1,n, 0)) = dl. 2 .--> Triangle n;
theorem :: AMI_8:39
for x being FinPartState of SCM st x in dom sumSCMFunction holds
Initialize x is Autonomy of IterativeAlgorithm(AddTo(dl. 2,dl. 1));
theorem :: AMI_8:40
IterativeAlgorithm(AddTo(dl. 2,dl. 1)), Start-At( 0,SCM) computes sumSCMFunction
;
¤ Dauer der Verarbeitung: 0.4 Sekunden
(vorverarbeitet am 2026-11-24)
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|