:: Analysis of Algorithms: An Example of a Sort Algorithm
:: by Grzegorz Bancerek
::
:: Received November 9, 2012
:: Copyright (c) 2012 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 3.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/3.0/.
environ
vocabularies INT_1, AOFA_A00, XBOOLE_0, STRUCT_0, RELAT_1, PBOOLE, MSAFREE4,
NAT_1, SUBSET_1, ORDINAL1, MSUALG_1, AOFA_000, ZF_MODEL, FUNCT_1,
INCPROJ, FUNCT_2, CARD_1, GRAPHSP, AOFA_I00, QC_LANG1, MSAFREE, AOFA_A01,
ARYTM_3, NEWTON, ABCMIZ_1, ZFMISC_1, XREAL_0, MSUALG_3, GROUP_6,
MSUALG_2, TARSKI, MARGREL1, XBOOLEAN, PARTFUN1, FINSEQ_1, XXREAL_0,
CARD_3, NUMBERS, FUNCT_7, ARYTM_1, PRELAMB, REALSET1, TREES_4, POWER,
PROB_2, FUNCT_6, PZFMISC1, ALGSTR_4, ORDINAL4, MEMBERED, FINSET_1,
XXREAL_2, AFINSQ_1, EXCHSORT, FUNCT_4, FUNCOP_1, FINSEQ_4, MODELC_3,
UNIALG_1, COMPUT_1, WELLORD1, ORDERS_2, LFUZZY_0, REARRAN1, SETLIM_2,
MCART_1, EQUATION, FOMODEL2, TREES_2;
notations TARSKI, XBOOLE_0, ZFMISC_1, SUBSET_1, FINSET_1, WELLORD2, MCART_1,
RELAT_1, FUNCT_1, PARTFUN1, FUNCT_2, MARGREL1, XTUPLE_0, FUNCT_4,
FUNCT_6, FUNCT_7, FUNCOP_1, FINSEQ_1, FINSEQ_2, FINSEQ_4, AFINSQ_1,
CARD_1, CARD_3, POWER, MEMBERED, STRUCT_0, ORDINAL1, NAT_1, BINOP_1,
PBOOLE, TREES_3, TREES_4, PZFMISC1, TREES_2, NUMBERS, XCMPLX_0, XXREAL_0,
XREAL_0, XXREAL_2, INT_1, NAT_D, NEWTON, TREES_1, PROB_2, ORDERS_2,
WAYBEL_0, LFUZZY_0, UNIALG_1, FREEALG, COMPUT_1, PUA2MSS1, MSUALG_1,
MSUALG_2, MSUALG_3, MSAFREE, MSAFREE1, MSUALG_6, MSAFREE3, MSATERM,
AOFA_000, EXCHSORT, MSAFREE4, AOFA_A00;
constructors XBOOLE_0, AOFA_000, AOFA_A00, SUBSET_1, BINOP_1, ORDINAL1, NAT_1,
INSTALG1, MSAFREE3, ZFMISC_1, NEWTON, XCMPLX_0, MSAFREE4, CATALG_1,
AUTALG_1, POWER, PUA2MSS1, MSUALG_3, FINSEQ_4, NUMBERS, RELSET_1, REAL_1,
MSAFREE1, PZFMISC1, PRALG_2, SQUARE_1, NAT_D, XXREAL_0, XXREAL_2,
EXCHSORT, AFINSQ_1, WELLORD2, FUNCT_4, PARTFUN1, COMPUT_1, LFUZZY_0,
MEMBERED, WAYBEL_0, MCART_1, MSATERM, TREES_9, TREES_2;
registrations AOFA_000, AOFA_A00, ORDINAL1, NUMBERS, PBOOLE, MSUALG_1,
INSTALG1, MSAFREE4, FUNCOP_1, RELSET_1, STRUCT_0, INT_1, XREAL_0,
MSUALG_2, FUNCT_1, FINSEQ_1, XBOOLEAN, MARGREL1, XBOOLE_0, NAT_1,
RELAT_1, PRE_POLY, MSUALG_9, POWER, MEMBERED, XXREAL_2, EXCHSORT,
FINSET_1, AFINSQ_1, CARD_1, UNIALG_1, COMPUT_1, LFUZZY_0, MSATERM,
TREES_3, TREES_2, VALUED_0;
requirements BOOLE, SUBSET, NUMERALS, ARITHM, REAL;
definitions TARSKI, MEMBERED, XBOOLE_0, RELAT_1, FUNCT_2, FINSEQ_1, XBOOLEAN,
MARGREL1, XXREAL_2, STRUCT_0, UNIALG_1, PBOOLE, PUA2MSS1, MSUALG_1,
MSUALG_3, AOFA_000, MSAFREE4, AOFA_A00;
theorems TARSKI, XBOOLE_0, XBOOLE_1, ZFMISC_1, INT_1, RELAT_1, XXREAL_0,
PARTFUN1, FUNCT_1, FUNCT_2, FINSEQ_1, FINSEQ_2, FINSEQ_3, FINSEQ_4,
FINSET_1, ORDINAL1, AFINSQ_1, FUNCOP_1, ORDINAL3, CARD_5, XBOOLEAN,
MARGREL1, POWER, NEWTON, FIB_NUM2, NAT_1, NAT_D, PRE_FF, FUNCT_4, INT_2,
XXREAL_2, TREES_4, MCART_1, TREES_1, CARD_3, FUNCT_7, PBOOLE, PRE_CIRC,
MSAFREE, MSSUBFAM, PRALG_2, EXTENS_1, MSAFREE3, MSAFREE4, EQUATION,
MSUALG_2, MSUALG_3, AOFA_000, AOFA_A00, EXCHSORT, MEMBERED, CARD_1,
XREAL_1, LFUZZY_0, MSAFREE1, INSTALG1, TREES_9, SUBSET_1;
schemes FUNCT_2, NAT_1, FINSEQ_1, RECDEF_1, AOFA_000, CLASSES1;
begin :: Exponentiation by squaring revisited
theorem Lem1:
1 mod 2 = 1 & 2 mod 2 = 0 by NAT_D:24,NAT_D:25;
theorem Lem2:
for S being non empty non void ManySortedSign
for A being MSAlgebra over S
for B being MSSubAlgebra of A
for s being SortSymbol of S
for a being set st a in (the Sorts of B).s
holds a in (the Sorts of A).s
proof
let S be non empty non void ManySortedSign;
let A be MSAlgebra over S;
let B be MSSubAlgebra of A;
let s be SortSymbol of S;
the Sorts of B is MSSubset of A by MSUALG_2:def 9;
then (the Sorts of B).s c= (the Sorts of A).s by PBOOLE:def 18,def 2;
hence thesis;
end;
theorem Lem3:
for I being non empty set, a,b,c being set, i being Element of I
holds c in (i-singleton a).b iff b = i & c = a
proof
let I be non empty set;
let a,b,c be set;
let i be Element of I;
A1: (i-singleton a).i = {a} & for b being set st b in I & b <> i holds
(i-singleton a).b = {} by AOFA_A00:6;
dom (i-singleton a) = I by PARTFUN1:def 2;
then
A2: for b being set st b nin I holds (i-singleton a).b = {} by FUNCT_1:def 2;
hereby
assume Z0: c in (i-singleton a).b;
thus b = i by Z0,A1,A2;
hence c = a by A1,Z0,TARSKI:def 1;
end;
thus thesis by A1,TARSKI:def 1;
end;
theorem Lem4:
for I being non empty set, a,b,c,d being set, i,j being Element of I
holds c in ((i-singleton a)(\/)(j-singleton d)).b iff
b = i & c = a or b = j & c = d
proof
let I be non empty set;
let a,b,c,d be set;
let i,j be Element of I;
hereby
assume Z0: c in ((i-singleton a)(\/)(j-singleton d)).b;
assume Z1: not (b = i & c = a);
b in dom((i-singleton a)(\/)(j-singleton d)) by Z0,FUNCT_1:def 2;
then b in I by PARTFUN1:def 2;
then c in ((i-singleton a).b)\/((j-singleton d).b) by Z0,PBOOLE:def 4;
then c in (i-singleton a).b or c in (j-singleton d).b by XBOOLE_0:def 3;
hence b = j & c = d by Z1,Lem3;
end;
assume Z2: b = i & c = a or b = j & c = d;
then c in (i-singleton a).b or c in (j-singleton d).b by Lem3;
then c in ((i-singleton a).b)\/((j-singleton d).b) by XBOOLE_0:def 3;
hence c in ((i-singleton a)(\/)(j-singleton d)).b by Z2,PBOOLE:def 4;
end;
definition
let S be (4,1) integer bool-correct non empty non void BoolSignature;
let A be non-empty MSAlgebra over S;
attr A is integer means: INT1:
ex C being image of A st C is (4,1) integer bool-correct MSAlgebra over S;
end;
theorem Th2:
for S being non empty non void ManySortedSign
for A being non-empty MSAlgebra over S
holds Image id the Sorts of A = the MSAlgebra of A
proof
let S be non empty non void ManySortedSign;
let A be non-empty MSAlgebra over S;
the MSAlgebra of A is strict non-empty MSSubAlgebra of A &
id the Sorts of A is_homomorphism A,A &
(id the Sorts of A).:.:the Sorts of A = the Sorts of A
by EQUATION:15,MSUALG_2:5,MSUALG_3:9;
hence Image id the Sorts of A = the MSAlgebra of A by MSUALG_3:def 12;
end;
theorem Th1:
for S being non empty non void ManySortedSign
for A being non-empty MSAlgebra over S
holds A is image of A
proof
let S be non empty non void ManySortedSign;
let A be non-empty MSAlgebra over S;
A is A-Image
proof
now
take B = A;
reconsider h = id the Sorts of A as ManySortedFunction of
the Sorts of A, the Sorts of B;
take h;
thus h is_homomorphism A,B by MSUALG_3:9;
thus the MSAlgebra of A = Image h by Th2;
end;
hence thesis by MSAFREE4:def 4;
end;
hence thesis;
end;
registration
let S be (4,1) integer bool-correct non empty non void BoolSignature;
cluster integer for non-empty MSAlgebra over S;
existence
proof
set C = the (4,1) integer bool-correct non-empty MSAlgebra over S;
reconsider C1 = C as image of C by Th1;
take C,C1; thus thesis;
end;
end;
registration
let S be (4,1) integer bool-correct non empty non void BoolSignature;
let A be integer non-empty MSAlgebra over S;
cluster bool-correct for image of A;
existence
proof
consider C being image of A such that
A1: C is (4,1) integer bool-correct MSAlgebra over S by INT1;
take C; thus thesis by A1;
end;
end;
registration
let S be (4,1) integer bool-correct non empty non void BoolSignature;
let A be integer non-empty MSAlgebra over S;
cluster (4,1) integer for bool-correct image of A;
existence
proof
ex C being image of A st
C is (4,1) integer bool-correct MSAlgebra over S by INT1;
hence thesis;
end;
end;
theorem Th3:
for S being non empty non void ManySortedSign
for A being non-empty MSAlgebra over S
for o being OperSymbol of S, a being set, r being SortSymbol of S
st o is_of_type a,r
holds Den(o,A) is Function of (the Sorts of A)#.a, (the Sorts of A).r &
Args(o,A) = (the Sorts of A)#.a & Result(o,A) = (the Sorts of A).r
proof
let S be non empty non void ManySortedSign;
let A be non-empty MSAlgebra over S;
let o be OperSymbol of S;
let a be set;
let r be SortSymbol of S;
assume Z0: (the Arity of S).o = a & (the ResultSort of S).o = r;
then
A1: ((the Sorts of A)#*the Arity of S).o = (the Sorts of A)#.a by FUNCT_2:15;
((the Sorts of A)*the ResultSort of S).o = (the Sorts of A).r
by Z0,FUNCT_2:15;
hence Den(o,A) is Function of (the Sorts of A)#.a, (the Sorts of A).r
by A1;
thus thesis by Z0,FUNCT_2:15;
end;
registration
let S be bool-correct non empty non void BoolSignature;
let A be bool-correct non-empty MSAlgebra over S;
cluster -> bool-correct for non-empty MSSubAlgebra of A;
coherence
proof
A1: (the Sorts of A).the bool-sort of S = BOOLEAN &
Den(In((the connectives of S).1, the carrier' of S), A).{} = TRUE &
for x,y be boolean set holds
Den(In((the connectives of S).2, the carrier' of S), A).<*x*> = 'not' x &
Den(In((the connectives of S).3, the carrier' of S), A).<*x,y*> = x '&' y
by AOFA_A00:def 32;
let B be non-empty MSSubAlgebra of A;
the Sorts of B is MSSubset of A by MSUALG_2:def 9;
hence (the Sorts of B).the bool-sort of S c= BOOLEAN
by A1,PBOOLE:def 18,def 2;
set o1 = In((the connectives of S).1, the carrier' of S),
o2 = In((the connectives of S).2, the carrier' of S);
set b = the bool-sort of S;
3 <= len the connectives of S by AOFA_A00:def 31;
then 1 <= len the connectives of S by XXREAL_0:2;
then 1 in dom the connectives of S by FINSEQ_3:25;
then o1 = (the connectives of S).1 by FUNCT_1:102,SUBSET_1:def 8;
then o1 is_of_type {},b by AOFA_A00:def 31;
then
A2: Den(o1,B) is Function of (the Sorts of B)#.{}, (the Sorts of B).b &
Args(o1,B) = (the Sorts of B)#.{} by Th3;
(the Sorts of B)#.<*>the carrier of S = {{}} by PRE_CIRC:2;
then
A3: {} in (the Sorts of B)#.{} by TARSKI:def 1;
B2: Den(o1,B).{} = Den(o1,A).{} by A2,A3,EQUATION:19
.= TRUE by AOFA_A00:def 32;
then
A7: TRUE in (the Sorts of B).the bool-sort of S by A2,A3,FUNCT_2:5;
A5: <*b*> in (the carrier of S)* by FINSEQ_1:def 11;
A6: dom the Sorts of B = the carrier of S by PARTFUN1:def 2;
3 <= len the connectives of S by AOFA_A00:def 31;
then 2 <= len the connectives of S by XXREAL_0:2;
then 2 in dom the connectives of S by FINSEQ_3:25;
then o2 = (the connectives of S).2 by FUNCT_1:102,SUBSET_1:def 8;
then o2 is_of_type <*b*>,b by AOFA_A00:def 31;
then
A8: Den(o2,B) is Function of (the Sorts of B)#.<*b*>, (the Sorts of B).b &
Args(o2,B) = (the Sorts of B)#.<*b*> by Th3;
then
A9: Args(o2,B) = product ((the Sorts of B)*<*b*>) by A5,FINSEQ_2:def 5
.= product <*(the Sorts of B).b*> by A6,FINSEQ_2:34;
then
B1: <*TRUE*> in Args(o2,B) by A7,FINSEQ_3:123;
Den(o2,B).<*TRUE*>
= Den(o2,A).<*TRUE*> by A9,A7,FINSEQ_3:123,EQUATION:19
.= 'not' TRUE by AOFA_A00:def 32 .= FALSE;
then FALSE in (the Sorts of B).b by A8,B1,FUNCT_2:5;
hence
B3: BOOLEAN c= (the Sorts of B).b by A7,ZFMISC_1:32;
thus Den(In((the connectives of S).1, the carrier' of S), B).{}
= TRUE by B2;
let x,y be boolean set;
A5: <*b,b*> in (the carrier of S)* by FINSEQ_1:def 11;
AB: x in BOOLEAN & y in BOOLEAN by MARGREL1:def 12;
thus Den(o2, B).<*x*> = Den(o2,A).<*x*>
by AB,B3,A9,FINSEQ_3:123,EQUATION:19
.= 'not' x by AOFA_A00:def 32;
set o3 = In((the connectives of S).3, the carrier' of S);
3 <= len the connectives of S by AOFA_A00:def 31;
then 3 in dom the connectives of S by FINSEQ_3:25;
then o3 = (the connectives of S).3 by FUNCT_1:102,SUBSET_1:def 8;
then o3 is_of_type <*b,b*>,b by AOFA_A00:def 31;
then
Den(o3,B) is Function of (the Sorts of B)#.<*b,b*>, (the Sorts of B).b &
Args(o3,B) = (the Sorts of B)#.<*b,b*> by Th3;
then
Args(o3,B) = product ((the Sorts of B)*<*b,b*>) by A5,FINSEQ_2:def 5
.= product <*(the Sorts of B).b,(the Sorts of B).b*> by A6,FINSEQ_2:125;
hence Den(o3, B).<*x,y*> = Den(o3,A).<*x,y*>
by B3,AB,FINSEQ_3:124,EQUATION:19
.= x '&' y by AOFA_A00:def 32;
end;
end;
registration
let S be (4,1) integer bool-correct non empty non void BoolSignature;
let A be (4,1) integer bool-correct non-empty MSAlgebra over S;
cluster -> (4,1) integer for non-empty MSSubAlgebra of A;
coherence
proof
let B be non-empty MSSubAlgebra of A;
set n = 4;
consider I being SortSymbol of S such that
A1: I = 1 & (the connectives of S).n is_of_type {},I &
(the Sorts of A).I = INT &
Den(In((the connectives of S).n, the carrier' of S), A).{} = 0 &
Den(In((the connectives of S).(n+1), the carrier' of S), A).{} = 1 &
for i,j being Integer holds
Den(In((the connectives of S).(n+2), the carrier' of S), A).<*i*> = -i &
Den(In((the connectives of S).(n+3), the carrier' of S), A).<*i,j*> = i+j &
Den(In((the connectives of S).(n+4), the carrier' of S), A).<*i,j*> = i*j &
(j <> 0 implies
Den(In((the connectives of S).(n+5), the carrier' of S), A).<*i,j*>
= i div j) &
Den(In((the connectives of S).(n+6), the carrier' of S), A).<*i,j*>
= IFGT(i,j,FALSE,TRUE) by AOFA_A00:def 50;
reconsider I as integer SortSymbol of S by A1,AOFA_A00:def 40;
take I;
thus I = 1 & (the connectives of S).n is_of_type {},I by A1;
the Sorts of B is MSSubset of A by MSUALG_2:def 9;
hence (the Sorts of B).I c= INT by A1,PBOOLE:def 18,def 2;
n+6 <= len the connectives of S & 4 <= 10 by AOFA_A00:def 39;
then n <= len the connectives of S & n+1 <= len the connectives of S &
1 <= 5 by XXREAL_0:2;
then n in dom the connectives of S & n+1 in dom the connectives of S
by FINSEQ_3:25;
then reconsider o1 = (the connectives of S).n,
o2 = (the connectives of S).(n+1) as OperSymbol of S by FUNCT_1:102;
o1 is_of_type {},I & o2 is_of_type {},I by AOFA_A00:53;
then
A2: Den(o1,B) is Function of (the Sorts of B)#.{}, (the Sorts of B).I &
Den(o2,B) is Function of (the Sorts of B)#.{}, (the Sorts of B).I &
Args(o1,B) = (the Sorts of B)#.{} & Args(o2,B) = (the Sorts of B)#.{}
by Th3;
(the Sorts of B)#.<*>the carrier of S = {{}} by PRE_CIRC:2;
then
A3: {} in (the Sorts of B)#.{} by TARSKI:def 1;
then
A4: Den(o1,B).{} in (the Sorts of B).I & Den(o2,B).{} in (the Sorts of B).I
by A2,FUNCT_2:5;
B2: Den(o1,B).{} = Den(o1,A).{} by A2,A3,EQUATION:19
.= 0 by A1,SUBSET_1:def 8;
B3: Den(o2,B).{} = Den(o2,A).{} by A2,A3,EQUATION:19
.= 1 by A1,SUBSET_1:def 8;
defpred P[Nat] means $1 in (the Sorts of B).I & -$1 in (the Sorts of B).I;
C1: P[0] by A2,A3,B2,FUNCT_2:5;
n+6 <= len the connectives of S & 4 <= 10 by AOFA_A00:def 39;
then n+2 <= len the connectives of S & n+3 <= len the connectives of S &
1 <= 6 & 1 <= 7 by XXREAL_0:2;
then n+2 in dom the connectives of S & n+3 in dom the connectives of S
by FINSEQ_3:25;
then reconsider o3 = (the connectives of S).(n+2),
o4 = (the connectives of S).(n+3) as OperSymbol of S by FUNCT_1:102;
o3 is_of_type <*I*>,I & o4 is_of_type <*I,I*>,I by AOFA_A00:53;
then
A2: Den(o3,B) is Function of (the Sorts of B)#.<*I*>, (the Sorts of B).I &
Den(o4,B) is Function of (the Sorts of B)#.<*I,I*>, (the Sorts of B).I &
Args(o3,B) = (the Sorts of B)#.<*I*> &
Args(o4,B) = (the Sorts of B)#.<*I,I*> by Th3;
A6: dom the Sorts of B = the carrier of S by PARTFUN1:def 2;
<*I*> is Element of (the carrier of S)* by FINSEQ_1:def 11;
then
A5: Args(o3,B) = product ((the Sorts of B)*<*I*>) by A2,FINSEQ_2:def 5
.= product <*(the Sorts of B).I*> by A6,FINSEQ_2:34;
<*I,I*> is Element of (the carrier of S)* by FINSEQ_1:def 11;
then
A7: Args(o4,B) = product ((the Sorts of B)*<*I,I*>) by A2,FINSEQ_2:def 5
.= product <*(the Sorts of B).I,(the Sorts of B).I*> by A6,FINSEQ_2:125;
C2: for i being Nat st P[i] holds P[i+1]
proof let i be Nat;
assume
B7: P[i];
then
B6: <*i,1*> in Args(o4,B) by B3,A4,A7,FINSEQ_3:124;
Den(o4,B).<*i,1*> = Den(o4,A).<*i,1*>
by B7,B3,A4,A7,FINSEQ_3:124,EQUATION:19
.= Den(In(o4,the carrier' of S),A).<*i,1*> by SUBSET_1:def 8
.= i+1 by A1;
hence
B8: i+1 in (the Sorts of B).I by B6,A2,FUNCT_2:5;
then
B6: <*i+1*> in Args(o3,B) by A5,FINSEQ_3:123;
Den(o3,B).<*i+1*> = Den(o3,A).<*i+1*> by B8,A5,FINSEQ_3:123,EQUATION:19
.= Den(In(o3,the carrier' of S),A).<*i+1*> by SUBSET_1:def 8
.= -(i+1) by A1;
hence -(i+1) in (the Sorts of B).I by B6,A2,FUNCT_2:5;
end;
C3: for i being Nat holds P[i] from NAT_1:sch 2(C1,C2);
thus
C4: INT c= (the Sorts of B).I
proof let x be Integer;
x in INT by INT_1:def 2;
then consider n being Element of NAT such that
B7: x = n or x = -n by INT_1:def 1;
thus thesis by C3,B7;
end;
thus Den(In((the connectives of S).n, the carrier' of S), B).{} = 0 &
Den(In((the connectives of S).(n+1), the carrier' of S), B).{} = 1
by B2,B3,SUBSET_1:def 8;
let i,j be Integer;
BA: i in INT & j in INT by INT_1:def 2;
<*i*> in Args(o3,B) by BA,C4,A5,FINSEQ_3:123;
then <*i*> in Args(In(o3,the carrier' of S),B) by SUBSET_1:def 8;
hence
Den(In((the connectives of S).(n+2), the carrier' of S), B).<*i*>
= Den(In((the connectives of S).(n+2), the carrier' of S), A).<*i*>
by EQUATION:19 .= -i by A1;
<*i,j*> in Args(o4,B) by A7,BA,C4,FINSEQ_3:124;
then <*i,j*> in Args(In(o4,the carrier' of S),B) by SUBSET_1:def 8;
hence
Den(In((the connectives of S).(n+3), the carrier' of S), B).<*i,j*>
= Den(In((the connectives of S).(n+3), the carrier' of S), A).<*i,j*>
by EQUATION:19 .= i+j by A1;
n+6 <= len the connectives of S & 4 <= 10 by AOFA_A00:def 39;
then n+4 <= len the connectives of S & n+5 <= len the connectives of S &
1 <= 8 & 1 <= 9 by XXREAL_0:2;
then n+4 in dom the connectives of S & n+5 in dom the connectives of S
by FINSEQ_3:25;
then reconsider o5 = (the connectives of S).(n+4),
o6 = (the connectives of S).(n+5) as OperSymbol of S by FUNCT_1:102;
o5 is_of_type <*I,I*>,I & o6 is_of_type <*I,I*>,I by AOFA_A00:53;
then
A9: Args(o5,B) = (the Sorts of B)#.<*I,I*> &
Args(o6,B) = (the Sorts of B)#.<*I,I*> by Th3;
then <*i,j*> in Args(o5,B) by A2,A7,BA,C4,FINSEQ_3:124;
then <*i,j*> in Args(In(o5,the carrier' of S),B) by SUBSET_1:def 8;
hence
Den(In((the connectives of S).(n+4), the carrier' of S), B).<*i,j*>
= Den(In((the connectives of S).(n+4), the carrier' of S), A).<*i,j*>
by EQUATION:19 .= i*j by A1;
hereby assume
B7: j <> 0;
<*i,j*> in Args(o6,B) by A2,A7,BA,C4,A9,FINSEQ_3:124;
then <*i,j*> in Args(In(o6,the carrier' of S),B) by SUBSET_1:def 8;
hence
Den(In((the connectives of S).(n+5), the carrier' of S), B).<*i,j*>
= Den(In((the connectives of S).(n+5), the carrier' of S), A).<*i,j*>
by EQUATION:19 .= i div j by B7,A1;
end;
n+6 <= len the connectives of S & 4 <= 10 by AOFA_A00:def 39;
then n+6 in dom the connectives of S by FINSEQ_3:25;
then reconsider o7 = (the connectives of S).(n+6) as OperSymbol of S
by FUNCT_1:102;
o7 is_of_type <*I,I*>,the bool-sort of S by AOFA_A00:53;
then
Args(o7,B) = (the Sorts of B)#.<*I,I*> by Th3;
then <*i,j*> in Args(o7,B) by A2,A7,BA,C4,FINSEQ_3:124;
then <*i,j*> in Args(In(o7,the carrier' of S),B) by SUBSET_1:def 8;
hence
Den(In((the connectives of S).(n+6), the carrier' of S), B).<*i,j*>
= Den(In((the connectives of S).(n+6), the carrier' of S), A).<*i,j*>
by EQUATION:19 .= IFGT(i,j,FALSE,TRUE) by A1;
end;
end;
registration
let S be (4,1) integer bool-correct non empty non void BoolSignature;
let X be non-empty ManySortedSet of the carrier of S;
cluster Free(S,X) -> integer for non-empty MSAlgebra over S;
coherence
proof let F be non-empty MSAlgebra over S;
assume
A1: F = Free(S,X);
set A = the (4,1) integer bool-correct non-empty MSAlgebra over S;
reconsider G = FreeGen X as GeneratorSet of F by A1,MSAFREE3:31;
set f = the ManySortedFunction of G, the Sorts of A;
FreeGen X is free & F = FreeMSA X by A1,MSAFREE3:31;
then consider h being ManySortedFunction of F,A such that
A1: h is_homomorphism F,A & h||G = f by MSAFREE:def 5;
reconsider C = Image h as image of F by A1,MSAFREE4:def 4;
take C; thus C is (4,1) integer bool-correct MSAlgebra over S;
end;
end;
theorem Th4:
for S being non empty non void ManySortedSign
for A1,A2,B1 being MSAlgebra over S, B2 being non-empty MSAlgebra over S
st the MSAlgebra of A1 = the MSAlgebra of A2 &
the MSAlgebra of B1 = the MSAlgebra of B2
for h1 being ManySortedFunction of A1,B1
for h2 being ManySortedFunction of A2,B2 st h1 = h2 &
h1 is_epimorphism A1,B1 holds h2 is_epimorphism A2,B2
proof
let S be non empty non void ManySortedSign;
let A1,A2,B1 be MSAlgebra over S;
let B2 be non-empty MSAlgebra over S;
assume Z0: the MSAlgebra of A1 = the MSAlgebra of A2;
assume Z1: the MSAlgebra of B1 = the MSAlgebra of B2;
let h1 be ManySortedFunction of A1,B1;
let h2 be ManySortedFunction of A2,B2;
assume Z2: h1 = h2;
assume Z3: h1 is_homomorphism A1,B1 & h1 is "onto";
hence h2 is_homomorphism A2,B2 by Z0,Z1,Z2,MSAFREE4:30;
let i be set; assume i in the carrier of S;
hence thesis by Z1,Z2,Z3,MSUALG_3:def 3;
end;
registration
let S be (4,1) integer bool-correct non empty non void BoolSignature;
let X be non-empty ManySortedSet of the carrier of S;
cluster vf-free integer for (X,S)-terms non-empty VarMSAlgebra over S;
existence
proof
set A = Free(S,X);
consider V being ManySortedMSSet of the Sorts of A,the Sorts of A,
B being (X,S)-terms VarMSAlgebra over S such that
A1: B = VarMSAlgebra(#the Sorts of A, the Charact of A, V#) &
B is vf-free by AOFA_A00:39;
take B; thus B is vf-free by A1;
consider C being image of A such that
A2: C is (4,1) integer bool-correct MSAlgebra over S by INT1;
consider h being ManySortedFunction of A,C such that
A3: h is_epimorphism A,C by MSAFREE4:def 5;
reconsider g = h as ManySortedFunction of B,C by A1;
the MSAlgebra of C = the MSAlgebra of C;
then reconsider D = C as image of B by A1,A3,Th4,MSAFREE4:def 5;
take D; thus thesis by A2;
end;
end;
definition
let S be non empty non void ManySortedSign;
let X be non-empty ManySortedSet of the carrier of S;
let T be (X,S)-terms non-empty MSAlgebra over S;
func FreeGen T -> non-empty GeneratorSet of T equals FreeGen X;
coherence by MSAFREE4:44;
end;
registration
let S be non empty non void ManySortedSign;
let X0 be countable non-empty ManySortedSet of the carrier of S;
let T be (X0,S)-terms non-empty MSAlgebra over S;
cluster FreeGen T -> (Equations(S, T))-free non-empty;
coherence by MSAFREE4:74;
end;
definition
let S be non empty non void ManySortedSign;
let X be non-empty ManySortedSet of the carrier of S;
let T be (X,S)-terms MSAlgebra over S;
let G be GeneratorSet of T;
attr G is basic means: BASIC: FreeGen T c= G;
let s be SortSymbol of S;
let x be Element of G.s;
attr x is pure means: PURE: x in (FreeGen T).s;
end;
registration
let S be non empty non void ManySortedSign;
let X be non-empty ManySortedSet of the carrier of S;
let T be (X,S)-terms MSAlgebra over S;
cluster FreeGen T -> basic;
coherence
proof
thus FreeGen T c= FreeGen T;
end;
end;
registration
let S be non empty non void ManySortedSign;
let X be non-empty ManySortedSet of the carrier of S;
let T be (X,S)-terms MSAlgebra over S;
cluster basic for non-empty GeneratorSet of T;
existence
proof
reconsider G = FreeGen X as non-empty GeneratorSet of T by MSAFREE4:44;
take G; thus FreeGen T c= G;
end;
end;
registration
let S be non empty non void ManySortedSign;
let X be non-empty ManySortedSet of the carrier of S;
let T be (X,S)-terms MSAlgebra over S;
let G be basic GeneratorSet of T;
let s be SortSymbol of S;
cluster pure for Element of G.s;
existence
proof
set x = the Element of (FreeGen T).s;
x in (FreeGen T).s & (FreeGen T).s c= G.s by BASIC,PBOOLE:def 2;
then reconsider x as Element of G.s;
take x; thus x in (FreeGen T).s;
end;
end;
theorem
for S being non empty non void ManySortedSign
for X being non-empty ManySortedSet of the carrier of S
for T being (X,S)-terms MSAlgebra over S
for G being basic GeneratorSet of T
for s being SortSymbol of S
for a being set holds a is pure Element of G.s iff a in (FreeGen T).s
proof
let S be non empty non void ManySortedSign;
let X be non-empty ManySortedSet of the carrier of S;
let T be (X,S)-terms MSAlgebra over S;
let G be basic GeneratorSet of T;
let s be SortSymbol of S;
let a be set;
(FreeGen T).s c= G.s by BASIC,PBOOLE:def 2;
hence thesis by PURE;
end;
definition
let S be non empty non void ManySortedSign;
let X be non-empty ManySortedSet of the carrier of S;
let T be (X,S)-terms MSAlgebra over S;
let G be GeneratorSystem over S,X,T;
attr G is basic means: BASIC2: the generators of G is basic;
end;
registration
let S be non empty non void ManySortedSign;
let X be non-empty ManySortedSet of the carrier of S;
let T be (X,S)-terms MSAlgebra over S;
cluster basic for GeneratorSystem over S,X,T;
existence
proof
set Y = the basic non-empty GeneratorSet of T;
set SV = the ManySortedFunction of Y, FreeGen X;
set ST = the ManySortedMSSet of Y, the carrier of S;
take G = GeneratorSystem(#Y,SV,ST#);
thus the generators of G is basic;
end;
end;
registration
let S be non empty non void ManySortedSign;
let X be non-empty ManySortedSet of the carrier of S;
let T be (X,S)-terms MSAlgebra over S;
let G be basic GeneratorSystem over S,X,T;
cluster the generators of G -> basic;
coherence by BASIC2;
end;
reserve
S for (4,1) integer bool-correct non empty non void BoolSignature,
X for non-empty ManySortedSet of the carrier of S,
T for vf-free (X,S)-terms integer non-empty VarMSAlgebra over S,
C for (4,1) integer bool-correct non-empty image of T,
G for basic GeneratorSystem over S,X,T,
A for IfWhileAlgebra of the generators of G,
I for integer SortSymbol of S,
x,y,z,m for pure (Element of (the generators of G).I),
b for pure (Element of (the generators of G).the bool-sort of S),
t,t1,t2 for Element of T,I,
P for Algorithm of A,
s,s1,s2 for Element of C-States(the generators of G);
definition
let S be bool-correct non empty non void BoolSignature;
let A be non-empty MSAlgebra over S;
func \falseA -> Element of A, the bool-sort of S equals \not\trueA;
coherence;
end;
reserve
f for ExecutionFunction of A, C-States(the generators of G),
(\falseC)-States(the generators of G, b);
theorem Th21:
\falseC = FALSE
proof
\trueC = TRUE by AOFA_A00:def 32;
hence \falseC = 'not' TRUE by AOFA_A00:def 32 .= FALSE;
end;
definition
let S be bool-correct non empty non void BoolSignature;
let X be non-empty ManySortedSet of the carrier of S;
let T be (X,S)-terms MSAlgebra over S;
let G be GeneratorSystem over S,X,T;
let b be Element of (the generators of G).the bool-sort of S;
let C be image of T;
let A be preIfWhileAlgebra;
let f be ExecutionFunction of A, C-States(the generators of G),
(\falseC)-States(the generators of G, b);
let s be Element of C-States(the generators of G);
let P be Algorithm of A;
redefine func f.(s,P) -> Element of C-States(the generators of G);
coherence
proof
thus f.(s,P) is Element of C-States(the generators of G);
end;
end;
definition
let S be non empty non void ManySortedSign;
let T be non-empty MSAlgebra over S;
let G be non-empty GeneratorSet of T;
let s be SortSymbol of S;
let x be Element of G.s;
func @x -> Element of T,s equals x;
coherence
proof
G.s c= (the Sorts of T).s & x in G.s by PBOOLE:def 18,def 2;
hence x is Element of (the Sorts of T).s;
end;
end;
definition
let S,X,T,G,A,b,I,t1,t2;
func b leq(t1, t2, A) -> Algorithm of A equals b:=(leq(t1,t2),A);
coherence;
func b gt(t1, t2, A) -> Algorithm of A equals b:=(\not(leq(t1,t2)),A);
coherence;
end;
definition
let S,X,T,I;
func \2(T,I) -> Element of T,I equals \1(T,I)+\1(T,I);
coherence;
end;
definition
let S,X,T,G,A,b,I,t;
func t is_odd(b,A) -> Algorithm of A equals b gt(t mod \2(T,I),\0(T,I),A);
coherence;
func t is_even(b,A) -> Algorithm of A equals b leq(t mod \2(T,I),\0(T,I),A);
coherence;
end;
registration
let S,X,T,G,C,I,s;
let x be Element of (the generators of G).I;
cluster s.I.x -> integer;
coherence
proof
(the Sorts of C).I = INT & s is ManySortedFunction of the generators of G,
the Sorts of C by AOFA_A00:48,55;
then s.I is Function of (the generators of G).I, INT by PBOOLE:def 15;
then s.I.x in INT by FUNCT_2:5;
hence thesis;
end;
end;
registration
let S,X,T,G,C,I,s,t;
cluster t value_at(C,s) -> integer;
coherence
proof
(the Sorts of C).I = INT by AOFA_A00:55;
hence thesis;
end;
end;
reserve u for ManySortedFunction of FreeGen T, the Sorts of C;
registration
let S,X,T,C,I,u,t;
cluster t value_at(C,u) -> integer;
coherence
proof
(the Sorts of C).I = INT by AOFA_A00:55;
hence thesis;
end;
end;
registration
let S,X,T,G,C,s;
let t be Element of T, the bool-sort of S;
cluster t value_at(C,s) -> boolean;
coherence
proof
(the Sorts of C).the bool-sort of S = BOOLEAN by AOFA_A00:def 32;
hence thesis;
end;
end;
registration
let S,X,T,C,u;
let t be Element of T, the bool-sort of S;
cluster t value_at(C,u) -> boolean;
coherence
proof
(the Sorts of C).the bool-sort of S = BOOLEAN by AOFA_A00:def 32;
hence thesis;
end;
end;
theorem Th6t:
for o being OperSymbol of S st
o = In((the connectives of S).1, the carrier' of S)
holds o = (the connectives of S).1 &
the_arity_of o = {} & the_result_sort_of o = the bool-sort of S
proof
let o be OperSymbol of S;
assume Z0: o = In((the connectives of S).1, the carrier' of S);
4+6 <= len the connectives of S by AOFA_A00:def 39;
then 1 <= len the connectives of S by XXREAL_0:2;
then 1 in dom the connectives of S by FINSEQ_3:25;
hence o = (the connectives of S).1 by Z0,FUNCT_1:102,SUBSET_1:def 8;
then o is_of_type {}, the bool-sort of S by AOFA_A00:def 31;
hence the_arity_of o = {} & the_result_sort_of o = the bool-sort of S
by AOFA_A00:def 9;
end;
theorem Th6n:
for o being OperSymbol of S st
o = In((the connectives of S).2, the carrier' of S)
holds o = (the connectives of S).2 &
the_arity_of o = <*the bool-sort of S*> &
the_result_sort_of o = the bool-sort of S
proof
let o be OperSymbol of S;
assume Z0: o = In((the connectives of S).2, the carrier' of S);
4+6 <= len the connectives of S by AOFA_A00:def 39;
then 2 <= len the connectives of S by XXREAL_0:2;
then 2 in dom the connectives of S by FINSEQ_3:25;
hence o = (the connectives of S).2 by Z0,FUNCT_1:102,SUBSET_1:def 8;
then o is_of_type <*the bool-sort of S*>, the bool-sort of S
by AOFA_A00:def 31;
hence the_arity_of o = <*the bool-sort of S*> &
the_result_sort_of o = the bool-sort of S
by AOFA_A00:def 9;
end;
theorem Th6k:
for o being OperSymbol of S st
o = In((the connectives of S).3, the carrier' of S)
holds o = (the connectives of S).3 &
the_arity_of o = <*the bool-sort of S, the bool-sort of S*> &
the_result_sort_of o = the bool-sort of S
proof
let o be OperSymbol of S;
assume Z0: o = In((the connectives of S).3, the carrier' of S);
4+6 <= len the connectives of S by AOFA_A00:def 39;
then 3 <= len the connectives of S by XXREAL_0:2;
then 3 in dom the connectives of S by FINSEQ_3:25;
hence o = (the connectives of S).3 by Z0,FUNCT_1:102,SUBSET_1:def 8;
then o is_of_type <*the bool-sort of S, the bool-sort of S*>,
the bool-sort of S by AOFA_A00:def 31;
hence the_arity_of o = <*the bool-sort of S, the bool-sort of S*> &
the_result_sort_of o = the bool-sort of S
by AOFA_A00:def 9;
end;
theorem Th6a:
for o being OperSymbol of S st
o = In((the connectives of S).4, the carrier' of S)
holds the_arity_of o = {} & the_result_sort_of o = I
proof
let o be OperSymbol of S;
assume Z0: o = In((the connectives of S).4, the carrier' of S);
4+6 <= len the connectives of S by AOFA_A00:def 39;
then 4 <= len the connectives of S by XXREAL_0:2;
then 4 in dom the connectives of S by FINSEQ_3:25;
then o = (the connectives of S).4 by Z0,FUNCT_1:102,SUBSET_1:def 8;
then o is_of_type {}, I by AOFA_A00:53;
hence the_arity_of o = {} & the_result_sort_of o = I by AOFA_A00:def 9;
end;
theorem Th6:
for o being OperSymbol of S st
o = In((the connectives of S).5, the carrier' of S)
holds the_arity_of o = {} & the_result_sort_of o = I
proof
let o be OperSymbol of S;
assume Z0: o = In((the connectives of S).5, the carrier' of S);
4+6 <= len the connectives of S by AOFA_A00:def 39;
then 5 <= len the connectives of S by XXREAL_0:2;
then 5 in dom the connectives of S by FINSEQ_3:25;
then o = (the connectives of S).5 by Z0,FUNCT_1:102,SUBSET_1:def 8;
then o is_of_type {}, I by AOFA_A00:53;
hence the_arity_of o = {} & the_result_sort_of o = I by AOFA_A00:def 9;
end;
theorem Th6b:
for o being OperSymbol of S st
o = In((the connectives of S).6, the carrier' of S)
holds the_arity_of o = <*I*> & the_result_sort_of o = I
proof
let o be OperSymbol of S;
assume Z0: o = In((the connectives of S).6, the carrier' of S);
4+6 <= len the connectives of S by AOFA_A00:def 39;
then 6 <= len the connectives of S by XXREAL_0:2;
then 6 in dom the connectives of S by FINSEQ_3:25;
then o = (the connectives of S).6 by Z0,FUNCT_1:102,SUBSET_1:def 8;
then o is_of_type <*I*>, I by AOFA_A00:53;
hence the_arity_of o = <*I*> & the_result_sort_of o = I by AOFA_A00:def 9;
end;
theorem Th6c:
for o being OperSymbol of S st
o = In((the connectives of S).7, the carrier' of S)
holds the_arity_of o = <*I,I*> & the_result_sort_of o = I
proof
let o be OperSymbol of S;
assume Z0: o = In((the connectives of S).7, the carrier' of S);
4+6 <= len the connectives of S by AOFA_A00:def 39;
then 7 <= len the connectives of S by XXREAL_0:2;
then 7 in dom the connectives of S by FINSEQ_3:25;
then o = (the connectives of S).7 by Z0,FUNCT_1:102,SUBSET_1:def 8;
then o is_of_type <*I,I*>, I by AOFA_A00:53;
hence the_arity_of o = <*I,I*> & the_result_sort_of o = I
by AOFA_A00:def 9;
end;
theorem Th6d:
for o being OperSymbol of S st
o = In((the connectives of S).8, the carrier' of S)
holds the_arity_of o = <*I,I*> & the_result_sort_of o = I
proof
let o be OperSymbol of S;
assume Z0: o = In((the connectives of S).8, the carrier' of S);
4+6 <= len the connectives of S by AOFA_A00:def 39;
then 8 <= len the connectives of S by XXREAL_0:2;
then 8 in dom the connectives of S by FINSEQ_3:25;
then o = (the connectives of S).8 by Z0,FUNCT_1:102,SUBSET_1:def 8;
then o is_of_type <*I,I*>, I by AOFA_A00:53;
hence the_arity_of o = <*I,I*> & the_result_sort_of o = I
by AOFA_A00:def 9;
end;
theorem Th6e:
for o being OperSymbol of S st
o = In((the connectives of S).9, the carrier' of S)
holds the_arity_of o = <*I,I*> & the_result_sort_of o = I
proof
let o be OperSymbol of S;
assume Z0: o = In((the connectives of S).9, the carrier' of S);
4+6 <= len the connectives of S by AOFA_A00:def 39;
then 9 <= len the connectives of S by XXREAL_0:2;
then 9 in dom the connectives of S by FINSEQ_3:25;
then o = (the connectives of S).9 by Z0,FUNCT_1:102,SUBSET_1:def 8;
then o is_of_type <*I,I*>, I by AOFA_A00:53;
hence the_arity_of o = <*I,I*> & the_result_sort_of o = I
by AOFA_A00:def 9;
end;
theorem Th6f:
for o being OperSymbol of S st
o = In((the connectives of S).10, the carrier' of S)
holds the_arity_of o = <*I,I*> & the_result_sort_of o = the bool-sort of S
proof
let o be OperSymbol of S;
assume Z0: o = In((the connectives of S).10, the carrier' of S);
4+6 <= len the connectives of S by AOFA_A00:def 39;
then 10 in dom the connectives of S by FINSEQ_3:25;
then o = (the connectives of S).10 by Z0,FUNCT_1:102,SUBSET_1:def 8;
then o is_of_type <*I,I*>, the bool-sort of S by AOFA_A00:53;
hence the_arity_of o = <*I,I*> & the_result_sort_of o = the bool-sort of S
by AOFA_A00:def 9;
end;
theorem Th7:
for S being non empty non void ManySortedSign
for o being OperSymbol of S st the_arity_of o = {}
for A being MSAlgebra over S holds Args(o,A) = {{}}
proof
let S be non empty non void ManySortedSign;
let o be OperSymbol of S;
assume Z0: the_arity_of o = {};
let A be MSAlgebra over S;
thus Args(o,A) = product ((the Sorts of A)*the_arity_of o) by PRALG_2:3
.= {{}} by Z0,CARD_3:10;
end;
theorem Th7a:
for S being non empty non void ManySortedSign
for a being SortSymbol of S
for o being OperSymbol of S st the_arity_of o = <*a*>
for A being MSAlgebra over S holds
Args(o,A) = product <*(the Sorts of A).a*>
proof
let S be non empty non void ManySortedSign;
let a be SortSymbol of S;
let o be OperSymbol of S;
assume Z0: the_arity_of o = <*a*>;
let A be MSAlgebra over S;
A1: dom the Sorts of A = the carrier of S by PARTFUN1:def 2;
thus Args(o,A) = product ((the Sorts of A)*the_arity_of o) by PRALG_2:3
.= product <*(the Sorts of A).a*> by Z0,A1,FINSEQ_2:34;
end;
theorem Th7b:
for S being non empty non void ManySortedSign
for a,b being SortSymbol of S
for o being OperSymbol of S st the_arity_of o = <*a,b*>
for A being MSAlgebra over S holds
Args(o,A) = product <*(the Sorts of A).a, (the Sorts of A).b*>
proof
let S be non empty non void ManySortedSign;
let a,b be SortSymbol of S;
let o be OperSymbol of S;
assume Z0: the_arity_of o = <*a,b*>;
let A be MSAlgebra over S;
A1: dom the Sorts of A = the carrier of S by PARTFUN1:def 2;
thus Args(o,A) = product ((the Sorts of A)*the_arity_of o) by PRALG_2:3
.= product <*(the Sorts of A).a, (the Sorts of A).b*>
by Z0,A1,FINSEQ_2:125;
end;
theorem Th7c:
for S being non empty non void ManySortedSign
for a,b,c being SortSymbol of S
for o being OperSymbol of S st the_arity_of o = <*a,b,c*>
for A being MSAlgebra over S holds
Args(o,A) = product <*(the Sorts of A).a, (the Sorts of A).b,
(the Sorts of A).c*>
proof
let S be non empty non void ManySortedSign;
let a,b,c be SortSymbol of S;
let o be OperSymbol of S;
assume Z0: the_arity_of o = <*a,b,c*>;
let A be MSAlgebra over S;
A1: dom the Sorts of A = the carrier of S by PARTFUN1:def 2;
thus Args(o,A) = product ((the Sorts of A)*the_arity_of o) by PRALG_2:3
.= product <*(the Sorts of A).a, (the Sorts of A).b, (the Sorts of A).c*>
by Z0,A1,FINSEQ_2:126;
end;
theorem Th8a:
for S being non empty non void ManySortedSign
for A,B being non-empty MSAlgebra over S
for s being SortSymbol of S
for a being Element of A,s
for h being ManySortedFunction of A,B
for o being OperSymbol of S st the_arity_of o = <*s*>
for p being Element of Args(o,A)
st p = <*a*> holds h#p = <*h.s.a*>
proof
let S be non empty non void ManySortedSign;
let A,B be non-empty MSAlgebra over S;
let s be SortSymbol of S;
let a be Element of A,s;
let h be ManySortedFunction of A,B;
let o be OperSymbol of S such that
Z1: the_arity_of o = <*s*>;
let p be Element of Args(o,A);
assume Z0: p = <*a*>;
A0: dom p = dom the_arity_of o & dom(h#p) = dom the_arity_of o by MSUALG_3:6;
then
A1: dom(h#p) = Seg 1 by Z0,FINSEQ_1:38;
then
A2: len p = 1 & len (h#p) = 1 by A0,FINSEQ_1:def 3;
1 in Seg 1;
then (h#p).1 = h.((the_arity_of o)/.1).(p.1) by A0,A1,MSUALG_3:def 6
.= h.s.(p.1) by Z1,FINSEQ_4:16 .= h.s.a by Z0,FINSEQ_1:40;
hence h#p = <*h.s.a*> by A2,FINSEQ_1:40;
end;
theorem Th8:
for S being non empty non void ManySortedSign
for A,B being non-empty MSAlgebra over S
for s1,s2 being SortSymbol of S
for a being Element of A,s1, b being Element of A,s2
for h being ManySortedFunction of A,B
for o being OperSymbol of S st the_arity_of o = <*s1,s2*>
for p being Element of Args(o,A)
st p = <*a,b*> holds h#p = <*h.s1.a, h.s2.b*>
proof
let S be non empty non void ManySortedSign;
let A,B be non-empty MSAlgebra over S;
let s1,s2 be SortSymbol of S;
let a be Element of A,s1, b be Element of A,s2;
let h be ManySortedFunction of A,B;
let o be OperSymbol of S such that
Z1: the_arity_of o = <*s1,s2*>;
let p be Element of Args(o,A);
assume Z0: p = <*a,b*>;
A0: dom p = dom the_arity_of o & dom(h#p) = dom the_arity_of o by MSUALG_3:6;
then
A1: dom(h#p) = Seg 2 by Z0,FINSEQ_1:89;
then
A3: len <*a,b*> = 2 & len (h#p) = 2 by Z0,A0,FINSEQ_1:def 3;
1 in Seg 2;
then
A2: (h#p).1 = h.((the_arity_of o)/.1).(p.1) by A0,A1,MSUALG_3:def 6
.= h.s1.(p.1) by Z1,FINSEQ_4:17 .= h.s1.a by Z0,FINSEQ_1:44;
2 in Seg 2;
then (h#p).2 = h.((the_arity_of o)/.2).(p.2) by A0,A1,MSUALG_3:def 6
.= h.s2.(p.2) by Z1,FINSEQ_4:17 .= h.s2.b by Z0,FINSEQ_1:44;
hence h#p = <*h.s1.a, h.s2.b*> by A3,A2,FINSEQ_1:44;
end;
theorem Th8b:
for S being non empty non void ManySortedSign
for A,B being non-empty MSAlgebra over S
for s1,s2,s3 being SortSymbol of S
for a being Element of A,s1, b being Element of A,s2, c being Element of A,s3
for h being ManySortedFunction of A,B
for o being OperSymbol of S st the_arity_of o = <*s1,s2,s3*>
for p being Element of Args(o,A)
st p = <*a,b,c*> holds h#p = <*h.s1.a,h.s2.b,h.s3.c*>
proof
let S be non empty non void ManySortedSign;
let A,B be non-empty MSAlgebra over S;
let s1,s2,s3 be SortSymbol of S;
let a be Element of A,s1;
let b be Element of A,s2;
let c be Element of A,s3;
let h be ManySortedFunction of A,B;
let o be OperSymbol of S such that
Z1: the_arity_of o = <*s1,s2,s3*>;
let p be Element of Args(o,A);
assume Z0: p = <*a,b,c*>;
A0: dom p = dom the_arity_of o & dom(h#p) = dom the_arity_of o by MSUALG_3:6;
then
A1: dom(h#p) = Seg 3 by Z0,FINSEQ_1:89;
then
A2: len p = 3 & len (h#p) = 3 by A0,FINSEQ_1:def 3;
1 in Seg 3;
then
A3: (h#p).1 = h.((the_arity_of o)/.1).(p.1) by A0,A1,MSUALG_3:def 6
.= h.s1.(p.1) by Z1,FINSEQ_4:18 .= h.s1.a by Z0,FINSEQ_1:45;
2 in Seg 3;
then
A4: (h#p).2 = h.((the_arity_of o)/.2).(p.2) by A0,A1,MSUALG_3:def 6
.= h.s2.(p.2) by Z1,FINSEQ_4:18 .= h.s2.b by Z0,FINSEQ_1:45;
3 in Seg 3;
then (h#p).3 = h.((the_arity_of o)/.3).(p.3) by A0,A1,MSUALG_3:def 6
.= h.s3.(p.3) by Z1,FINSEQ_4:18 .= h.s3.c by Z0,FINSEQ_1:45;
hence h#p = <*h.s1.a,h.s2.b,h.s3.c*> by A2,A3,A4,FINSEQ_1:45;
end;
theorem Th9a:
for h being ManySortedFunction of T,C st h is_homomorphism T,C
for a being SortSymbol of S
for t being Element of T,a
holds t value_at(C,h||FreeGen T) = h.a.t
proof
let h be ManySortedFunction of T,C;
assume Z0: h is_homomorphism T,C;
set s = h||FreeGen T;
let a be SortSymbol of S;
let t be Element of T,a;
FreeGen T is_transformable_to the Sorts of C by MSAFREE4:21;
then
A4: doms s = FreeGen T by MSSUBFAM:17;
thus t value_at(C,s) = h.a.t by A4,Z0,AOFA_A00:def 21;
end;
theorem Th9:
for h being ManySortedFunction of T,C
st h is_homomorphism T,C & s = h||the generators of G
for a being SortSymbol of S
for t being Element of T,a
holds t value_at(C,s) = h.a.t
proof
let h be ManySortedFunction of T,C;
assume Z0: h is_homomorphism T,C;
assume Z1: s = h||the generators of G;
let a be SortSymbol of S;
let t be Element of T,a;
A3: s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
the generators of G is_transformable_to the Sorts of C by MSAFREE4:21;
then
A4: doms s = the generators of G by A3,MSSUBFAM:17;
thus t value_at(C,s) = h.a.t by A4,Z0,Z1,AOFA_A00:def 21;
end;
theorem Th10:
\trueT value_at(C,s) = TRUE
proof
A2: s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & s = f||(the generators of G) by AOFA_A00:def 19;
the generators of G is_transformable_to the Sorts of C
by MSAFREE4:21;
then
doms s = the generators of G by A2,MSSUBFAM:17;
then consider f being ManySortedFunction of T,C,
Q being GeneratorSet of T such that
A1: f is_homomorphism T,C & Q = doms s & s = f||Q &
\trueT value_at(C,s) = f.(the bool-sort of S).\trueT by A0,AOFA_A00:def 21;
set o = In((the connectives of S).1, the carrier' of S);
A5: o = (the connectives of S).1 &
the_arity_of o = {} & the_result_sort_of o = the bool-sort of S by Th6t;
then
Args(o,T) = {{}} by Th7;
then reconsider p = {} as Element of Args(o,T) by TARSKI:def 1;
dom p = {};
then dom(f#p) = {} & dom p = {} by A5,MSUALG_3:6;
then
A6: p = f#p;
f.(the bool-sort of S).\trueT
= \trueC by A6,A1,A5,MSUALG_3:def 7
.= TRUE by AOFA_A00:def 32;
hence thesis by A1;
end;
theorem Th11:
for t being Element of T, the bool-sort of S holds
\nott value_at(C,s) = \not(t value_at(C,s))
proof
let t be Element of T, the bool-sort of S;
s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & s = f||(the generators of G) by AOFA_A00:def 19;
A2: (\nott) value_at(C,s) = f.(the bool-sort of S).(\nott) by A0,Th9;
set o = In((the connectives of S).2, the carrier' of S);
A6: the_arity_of o = <*the bool-sort of S*> &
the_result_sort_of o = the bool-sort of S by Th6n;
then Args(o,T) = product <*(the Sorts of T).the bool-sort of S*> by Th7a;
then reconsider p = <*t*> as Element of Args(o,T) by FINSEQ_3:123;
thus (\nott) value_at(C,s) = Den(o,C).(f#p) by A0,A2,A6,MSUALG_3:def 7
.= Den(o,C).<*f.(the bool-sort of S).t*> by A6,Th8a
.= \not(t value_at(C,s)) by A0,Th9;
end;
theorem
for a being boolean set
for t being Element of T, the bool-sort of S holds
\nott value_at(C,s) = 'not' a iff t value_at(C,s) = a
proof
let a be boolean set;
let t be Element of T, the bool-sort of S;
hereby
assume \nott value_at(C,s) = 'not' a;
then \not(t value_at(C,s)) = 'not' a by Th11;
then 'not' (t value_at(C,s)) = 'not' a by AOFA_A00:def 32;
hence t value_at(C,s) = a;
end;
assume Z1: t value_at(C,s) = a;
\not(t value_at(C,s)) = \nott value_at(C,s) by Th11;
hence \nott value_at(C,s) = 'not' a by Z1,AOFA_A00:def 32;
end;
theorem Th11b:
for a being Element of C, the bool-sort of S
for x being boolean set holds
\nota = 'not' x iff a = x
proof
let a be Element of C, the bool-sort of S;
a in (the Sorts of C).the bool-sort of S;
then a in BOOLEAN by AOFA_A00:def 32;
then reconsider b = a as boolean set;
let x be boolean set;
hereby
assume \nota = 'not' x;
then 'not' b = 'not' x by AOFA_A00:def 32;
hence a = x;
end;
assume a = x;
hence \nota = 'not' x by AOFA_A00:def 32;
end;
theorem
(\falseT) value_at(C,s) = FALSE
proof
thus (\falseT) value_at(C,s) = \not((\trueT) value_at(C,s)) by Th11
.= 'not' ((\trueT) value_at(C,s)) by AOFA_A00:def 32 .= 'not' TRUE by Th10
.= FALSE;
end;
theorem
for t1,t2 being Element of T, the bool-sort of S holds
t1\andt2 value_at(C,s) = (t1 value_at(C,s))\and(t2 value_at(C,s))
proof
let t1,t2 be Element of T, the bool-sort of S;
s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & s = f||(the generators of G) by AOFA_A00:def 19;
A1: t1 value_at(C,s) = f.(the bool-sort of S).t1 by A0,Th9;
A3: t1\andt2 value_at(C,s) = f.(the bool-sort of S).(t1\andt2) by A0,Th9;
set o = In((the connectives of S).3, the carrier' of S);
A6: the_arity_of o = <*the bool-sort of S,the bool-sort of S*> &
the_result_sort_of o = the bool-sort of S by Th6k;
then Args(o,T) = product <*(the Sorts of T).the bool-sort of S,
(the Sorts of T).the bool-sort of S*> by Th7b;
then reconsider p = <*t1,t2*> as Element of Args(o,T) by FINSEQ_3:124;
thus (t1\andt2) value_at(C,s) = Den(o,C).(f#p)
by A0,A3,A6,MSUALG_3:def 7
.= Den(o,C).<*f.(the bool-sort of S).t1,f.(the bool-sort of S).t2*>
by A6,Th8
.= (t1 value_at(C,s))\and(t2 value_at(C,s)) by A1,A0,Th9;
end;
theorem Th13:
\0(T,I) value_at(C,s) = 0
proof
A2: s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & s = f||(the generators of G) by AOFA_A00:def 19;
the generators of G is_transformable_to the Sorts of C
by MSAFREE4:21;
then
doms s = the generators of G by A2,MSSUBFAM:17;
then consider f being ManySortedFunction of T,C,
Q being GeneratorSet of T such that
A1: f is_homomorphism T,C & Q = doms s & s = f||Q &
\0(T,I) value_at(C,s) = f.I.\0(T,I) by A0,AOFA_A00:def 21;
set o = In((the connectives of S).4, the carrier' of S);
A5: the_arity_of o = {} & the_result_sort_of o = I by Th6a;
then
Args(o,T) = {{}} by Th7;
then reconsider p = {} as Element of Args(o,T) by TARSKI:def 1;
dom p = {};
then dom(f#p) = {} & dom p = {} by A5,MSUALG_3:6;
then
A6: p = f#p;
f.I.\0(T,I)
= \0(C,I) by A6,A1,A5,MSUALG_3:def 7 .= 0 by AOFA_A00:55;
hence thesis by A1;
end;
theorem Th14:
\1(T,I) value_at(C,s) = 1
proof
A2: s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & s = f||(the generators of G) by AOFA_A00:def 19;
the generators of G is_transformable_to the Sorts of C
by MSAFREE4:21;
then
doms s = the generators of G by A2,MSSUBFAM:17;
then consider f being ManySortedFunction of T,C,
Q being GeneratorSet of T such that
A1: f is_homomorphism T,C & Q = doms s & s = f||Q &
\1(T,I) value_at(C,s) = f.I.\1(T,I) by A0,AOFA_A00:def 21;
set o = In((the connectives of S).5, the carrier' of S);
A5: the_arity_of o = {} & the_result_sort_of o = I by Th6;
then
Args(o,T) = {{}} by Th7;
then reconsider p = {} as Element of Args(o,T) by TARSKI:def 1;
dom p = {};
then dom(f#p) = {} & dom p = {} by A5,MSUALG_3:6;
then
A6: p = f#p;
f.I.\1(T,I)
= \1(C,I) by A6,A1,A5,MSUALG_3:def 7 .= 1 by AOFA_A00:55;
hence thesis by A1;
end;
theorem Th15:
(-t) value_at(C,s) = -(t value_at(C,s))
proof
A2: s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & s = f||(the generators of G) by AOFA_A00:def 19;
the generators of G is_transformable_to the Sorts of C
by MSAFREE4:21;
then
A3: doms s = the generators of G by A2,MSSUBFAM:17;
then consider f1 being ManySortedFunction of T,C,
Q1 being GeneratorSet of T such that
A1: f1 is_homomorphism T,C & Q1 = doms s & s = f1||Q1 &
t value_at(C,s) = f1.I.t by A0,AOFA_A00:def 21;
consider f2 being ManySortedFunction of T,C,
Q2 being GeneratorSet of T such that
A2: f2 is_homomorphism T,C & Q2 = doms s & s = f2||Q2 &
(-t) value_at(C,s) = f2.I.(-t) by A0,A3,AOFA_A00:def 21;
set o = In((the connectives of S).6, the carrier' of S);
A6: the_arity_of o = <*I*> & the_result_sort_of o = I by Th6b;
then Args(o,T) = product <*(the Sorts of T).I*> by Th7a;
then reconsider p = <*t*> as Element of Args(o,T) by FINSEQ_3:123;
thus (-t) value_at(C,s) = Den(o,C).(f2#p) by A2,A6,MSUALG_3:def 7
.= Den(o,C).<*f2.I.t*> by A6,Th8a
.= -(t value_at(C,s)) by A1,A2,EXTENS_1:19;
end;
theorem Th16:
(t1+t2) value_at(C,s) = (t1 value_at(C,s))+(t2 value_at(C,s))
proof
A2: s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & s = f||(the generators of G) by AOFA_A00:def 19;
the generators of G is_transformable_to the Sorts of C
by MSAFREE4:21;
then
A3: doms s = the generators of G by A2,MSSUBFAM:17;
then consider f1 being ManySortedFunction of T,C,
Q1 being GeneratorSet of T such that
A1: f1 is_homomorphism T,C & Q1 = doms s & s = f1||Q1 &
t1 value_at(C,s) = f1.I.t1 by A0,AOFA_A00:def 21;
consider f2 being ManySortedFunction of T,C,
Q2 being GeneratorSet of T such that
A2: f2 is_homomorphism T,C & Q2 = doms s & s = f2||Q2 &
t2 value_at(C,s) = f2.I.t2 by A0,A3,AOFA_A00:def 21;
consider f being ManySortedFunction of T,C,
Q being GeneratorSet of T such that
A4: f is_homomorphism T,C & Q = doms s & s = f||Q &
(t1+t2) value_at(C,s) = f.I.(t1+t2) by A0,A3,AOFA_A00:def 21;
A5: f = f1 & f = f2 by A1,A2,A4,EXTENS_1:19;
set o = In((the connectives of S).7, the carrier' of S);
A6: the_arity_of o = <*I,I*> & the_result_sort_of o = I by Th6c;
then Args(o,T) = product <*(the Sorts of T).I, (the Sorts of T).I*>
by Th7b;
then reconsider p = <*t1,t2*> as Element of Args(o,T) by FINSEQ_3:124;
thus (t1+t2) value_at(C,s) = Den(o,C).(f#p) by A4,A6,MSUALG_3:def 7
.= (t1 value_at(C,s))+(t2 value_at(C,s)) by A1,A2,A5,A6,Th8;
end;
theorem Th22:
\2(T,I) value_at (C,s) = 2
proof
A1: \1(T,I) value_at(C,s) = 1 by Th14;
thus \2(T,I) value_at(C,s)
= (\1(T,I) value_at(C,s))+(\1(T,I) value_at(C,s)) by Th16
.= 2 by A1,AOFA_A00:55;
end;
theorem Th23:
(t1-t2) value_at(C,s) = (t1 value_at(C,s))-(t2 value_at(C,s))
proof
thus (t1-t2) value_at(C,s) = (t1 value_at(C,s))+((-t2) value_at(C,s))
by Th16
.= (t1 value_at(C,s))-(t2 value_at(C,s)) by Th15;
end;
theorem Th17:
(t1*t2) value_at(C,s) = (t1 value_at(C,s))*(t2 value_at(C,s))
proof
s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & s = f||(the generators of G) by AOFA_A00:def 19;
A2: t2 value_at(C,s) = f.I.t2 by A0,Th9;
A4: (t1*t2) value_at(C,s) = f.I.(t1*t2) by A0,Th9;
set o = In((the connectives of S).8, the carrier' of S);
A6: the_arity_of o = <*I,I*> & the_result_sort_of o = I by Th6d;
then Args(o,T) = product <*(the Sorts of T).I, (the Sorts of T).I*>
by Th7b;
then reconsider p = <*t1,t2*> as Element of Args(o,T) by FINSEQ_3:124;
thus (t1*t2) value_at(C,s) = Den(o,C).(f#p) by A0,A4,A6,MSUALG_3:def 7
.= Den(o,C).<*f.I.t1,f.I.t2*> by A6,Th8
.= (t1 value_at(C,s))*(t2 value_at(C,s)) by A0,A2,Th9;
end;
theorem Th18:
(t1 div t2) value_at(C,s) = (t1 value_at(C,s))div(t2 value_at(C,s))
proof
A2: s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & s = f||(the generators of G) by AOFA_A00:def 19;
the generators of G is_transformable_to the Sorts of C
by MSAFREE4:21;
then
A3: doms s = the generators of G by A2,MSSUBFAM:17;
then consider f1 being ManySortedFunction of T,C,
Q1 being GeneratorSet of T such that
A1: f1 is_homomorphism T,C & Q1 = doms s & s = f1||Q1 &
t1 value_at(C,s) = f1.I.t1 by A0,AOFA_A00:def 21;
consider f2 being ManySortedFunction of T,C,
Q2 being GeneratorSet of T such that
A2: f2 is_homomorphism T,C & Q2 = doms s & s = f2||Q2 &
t2 value_at(C,s) = f2.I.t2 by A0,A3,AOFA_A00:def 21;
consider f being ManySortedFunction of T,C,
Q being GeneratorSet of T such that
A4: f is_homomorphism T,C & Q = doms s & s = f||Q &
(t1 div t2) value_at(C,s) = f.I.(t1 div t2) by A0,A3,AOFA_A00:def 21;
A5: f = f1 & f = f2 by A1,A2,A4,EXTENS_1:19;
set o = In((the connectives of S).9, the carrier' of S);
A6: the_arity_of o = <*I,I*> & the_result_sort_of o = I by Th6e;
then Args(o,T) = product <*(the Sorts of T).I, (the Sorts of T).I*>
by Th7b;
then reconsider p = <*t1,t2*> as Element of Args(o,T) by FINSEQ_3:124;
thus (t1 div t2) value_at(C,s) = Den(o,C).(f#p) by A4,A6,MSUALG_3:def 7
.= (t1 value_at(C,s))div(t2 value_at(C,s)) by A1,A2,A5,A6,Th8;
end;
theorem Th24:
(t1 mod t2) value_at(C,s) = (t1 value_at(C,s)) mod (t2 value_at(C,s))
proof
thus (t1 mod t2) value_at(C,s) = (t1-(t1 div t2)*t2) value_at(C,s)
.= (t1 value_at(C,s))-(((t1 div t2)*t2) value_at(C,s)) by Th23
.= (t1 value_at(C,s))-(((t1 div t2) value_at(C,s))*(t2 value_at(C,s)))
by Th17
.= (t1 value_at(C,s)) mod (t2 value_at(C,s)) by Th18;
end;
theorem Th19:
leq(t1,t2) value_at(C,s) = leq(t1 value_at(C,s), t2 value_at(C,s))
proof
A2: s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & s = f||(the generators of G) by AOFA_A00:def 19;
the generators of G is_transformable_to the Sorts of C
by MSAFREE4:21;
then
A3: doms s = the generators of G by A2,MSSUBFAM:17;
then consider f1 being ManySortedFunction of T,C,
Q1 being GeneratorSet of T such that
A1: f1 is_homomorphism T,C & Q1 = doms s & s = f1||Q1 &
t1 value_at(C,s) = f1.I.t1 by A0,AOFA_A00:def 21;
consider f2 being ManySortedFunction of T,C,
Q2 being GeneratorSet of T such that
A2: f2 is_homomorphism T,C & Q2 = doms s & s = f2||Q2 &
t2 value_at(C,s) = f2.I.t2 by A0,A3,AOFA_A00:def 21;
consider f being ManySortedFunction of T,C,
Q being GeneratorSet of T such that
A4: f is_homomorphism T,C & Q = doms s & s = f||Q &
leq(t1,t2) value_at(C,s) = f.(the bool-sort of S).leq(t1,t2)
by A0,A3,AOFA_A00:def 21;
A5: f = f1 & f = f2 by A1,A2,A4,EXTENS_1:19;
set o = In((the connectives of S).10, the carrier' of S);
A6: the_arity_of o = <*I,I*> & the_result_sort_of o = the bool-sort of S
by Th6f;
then Args(o,T) = product <*(the Sorts of T).I, (the Sorts of T).I*>
by Th7b;
then reconsider p = <*t1,t2*> as Element of Args(o,T) by FINSEQ_3:124;
thus leq(t1,t2) value_at(C,s) = Den(o,C).(f#p) by A4,A6,MSUALG_3:def 7
.= leq(t1 value_at(C,s), t2 value_at(C,s)) by A1,A2,A5,A6,Th8;
end;
theorem Th10a:
\trueT value_at(C,u) = TRUE
proof
consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & u = f||FreeGen T by MSAFREE4:45;
FreeGen T is_transformable_to the Sorts of C
by MSAFREE4:21;
then
doms u = FreeGen T by MSSUBFAM:17;
then consider f being ManySortedFunction of T,C,
Q being GeneratorSet of T such that
A1: f is_homomorphism T,C & Q = doms u & u = f||Q &
\trueT value_at(C,u) = f.(the bool-sort of S).\trueT by A0,AOFA_A00:def 21;
set o = In((the connectives of S).1, the carrier' of S);
A5: o = (the connectives of S).1 &
the_arity_of o = {} & the_result_sort_of o = the bool-sort of S by Th6t;
then
Args(o,T) = {{}} by Th7;
then reconsider p = {} as Element of Args(o,T) by TARSKI:def 1;
dom p = {};
then dom(f#p) = {} & dom p = {} by A5,MSUALG_3:6;
then
A6: p = f#p;
f.(the bool-sort of S).\trueT = \trueC by A6,A1,A5,MSUALG_3:def 7
.= TRUE by AOFA_A00:def 32;
hence thesis by A1;
end;
theorem Th11c:
for t being Element of T, the bool-sort of S holds
\nott value_at(C,u) = \not(t value_at(C,u))
proof
let t be Element of T, the bool-sort of S;
consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & u = f||FreeGen T by MSAFREE4:45;
A2: (\nott) value_at(C,u) = f.(the bool-sort of S).(\nott) by A0,Th9a;
set o = In((the connectives of S).2, the carrier' of S);
A6: the_arity_of o = <*the bool-sort of S*> &
the_result_sort_of o = the bool-sort of S by Th6n;
then Args(o,T) = product <*(the Sorts of T).the bool-sort of S*> by Th7a;
then reconsider p = <*t*> as Element of Args(o,T) by FINSEQ_3:123;
thus (\nott) value_at(C,u) = Den(o,C).(f#p) by A0,A2,A6,MSUALG_3:def 7
.= Den(o,C).<*f.(the bool-sort of S).t*> by A6,Th8a
.= \not(t value_at(C,u)) by A0,Th9a;
end;
theorem
for a being boolean set
for t being Element of T, the bool-sort of S holds
\nott value_at(C,u) = 'not' a iff t value_at(C,u) = a
proof
let a be boolean set;
let t be Element of T, the bool-sort of S;
hereby
assume \nott value_at(C,u) = 'not' a;
then \not(t value_at(C,u)) = 'not' a by Th11c;
then 'not' (t value_at(C,u)) = 'not' a by AOFA_A00:def 32;
hence t value_at(C,u) = a;
end;
assume Z1: t value_at(C,u) = a;
\not(t value_at(C,u)) = \nott value_at(C,u) by Th11c;
hence \nott value_at(C,u) = 'not' a by Z1,AOFA_A00:def 32;
end;
theorem
(\falseT) value_at(C,u) = FALSE
proof
thus (\falseT) value_at(C,u) = \not((\trueT) value_at(C,u)) by Th11c
.= 'not' ((\trueT) value_at(C,u)) by AOFA_A00:def 32 .= 'not' TRUE by Th10a
.= FALSE;
end;
theorem
for t1,t2 being Element of T, the bool-sort of S holds
t1\andt2 value_at(C,u) = (t1 value_at(C,u))\and(t2 value_at(C,u))
proof
let t1,t2 be Element of T, the bool-sort of S;
consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & u = f||FreeGen T by MSAFREE4:45;
A1: t1 value_at(C,u) = f.(the bool-sort of S).t1 by A0,Th9a;
A3: t1\andt2 value_at(C,u) = f.(the bool-sort of S).(t1\andt2) by A0,Th9a;
set o = In((the connectives of S).3, the carrier' of S);
A6: the_arity_of o = <*the bool-sort of S,the bool-sort of S*> &
the_result_sort_of o = the bool-sort of S by Th6k;
then Args(o,T) = product <*(the Sorts of T).the bool-sort of S,
(the Sorts of T).the bool-sort of S*> by Th7b;
then reconsider p = <*t1,t2*> as Element of Args(o,T) by FINSEQ_3:124;
thus (t1\andt2) value_at(C,u) = Den(o,C).(f#p)
by A0,A3,A6,MSUALG_3:def 7
.= Den(o,C).<*f.(the bool-sort of S).t1,f.(the bool-sort of S).t2*>
by A6,Th8
.= (t1 value_at(C,u))\and(t2 value_at(C,u)) by A1,A0,Th9a;
end;
theorem
\0(T,I) value_at(C,u) = 0
proof
consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & u = f||FreeGen T by MSAFREE4:45;
FreeGen T is_transformable_to the Sorts of C
by MSAFREE4:21;
then
doms u = FreeGen T by MSSUBFAM:17;
then consider f being ManySortedFunction of T,C,
Q being GeneratorSet of T such that
A1: f is_homomorphism T,C & Q = doms u & u = f||Q &
\0(T,I) value_at(C,u) = f.I.\0(T,I) by A0,AOFA_A00:def 21;
set o = In((the connectives of S).4, the carrier' of S);
A5: the_arity_of o = {} & the_result_sort_of o = I by Th6a;
then
Args(o,T) = {{}} by Th7;
then reconsider p = {} as Element of Args(o,T) by TARSKI:def 1;
dom p = {};
then dom(f#p) = {} & dom p = {} by A5,MSUALG_3:6;
then
A6: p = f#p;
f.I.\0(T,I) = \0(C,I) by A6,A1,A5,MSUALG_3:def 7 .= 0 by AOFA_A00:55;
hence thesis by A1;
end;
theorem Th14a:
\1(T,I) value_at(C,u) = 1
proof
consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & u = f||FreeGen T by MSAFREE4:45;
FreeGen T is_transformable_to the Sorts of C
by MSAFREE4:21;
then
doms u = FreeGen T by MSSUBFAM:17;
then consider f being ManySortedFunction of T,C,
Q being GeneratorSet of T such that
A1: f is_homomorphism T,C & Q = doms u & u = f||Q &
\1(T,I) value_at(C,u) = f.I.\1(T,I) by A0,AOFA_A00:def 21;
set o = In((the connectives of S).5, the carrier' of S);
A5: the_arity_of o = {} & the_result_sort_of o = I by Th6;
then
Args(o,T) = {{}} by Th7;
then reconsider p = {} as Element of Args(o,T) by TARSKI:def 1;
dom p = {};
then dom(f#p) = {} & dom p = {} by A5,MSUALG_3:6;
then
A6: p = f#p;
f.I.\1(T,I) = \1(C,I) by A6,A1,A5,MSUALG_3:def 7 .= 1 by AOFA_A00:55;
hence thesis by A1;
end;
theorem Th15a:
(-t) value_at(C,u) = -(t value_at(C,u))
proof
consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & u = f||FreeGen T by MSAFREE4:45;
FreeGen T is_transformable_to the Sorts of C
by MSAFREE4:21;
then
A3: doms u = FreeGen T by MSSUBFAM:17;
then consider f1 being ManySortedFunction of T,C,
Q1 being GeneratorSet of T such that
A1: f1 is_homomorphism T,C & Q1 = doms u & u = f1||Q1 &
t value_at(C,u) = f1.I.t by A0,AOFA_A00:def 21;
consider f2 being ManySortedFunction of T,C,
Q2 being GeneratorSet of T such that
A2: f2 is_homomorphism T,C & Q2 = doms u & u = f2||Q2 &
(-t) value_at(C,u) = f2.I.(-t) by A0,A3,AOFA_A00:def 21;
set o = In((the connectives of S).6, the carrier' of S);
A6: the_arity_of o = <*I*> & the_result_sort_of o = I by Th6b;
then Args(o,T) = product <*(the Sorts of T).I*> by Th7a;
then reconsider p = <*t*> as Element of Args(o,T) by FINSEQ_3:123;
thus (-t) value_at(C,u) = Den(o,C).(f2#p) by A2,A6,MSUALG_3:def 7
.= Den(o,C).<*f2.I.t*> by A6,Th8a
.= -(t value_at(C,u)) by A1,A2,EXTENS_1:19;
end;
theorem Th16a:
(t1+t2) value_at(C,u) = (t1 value_at(C,u))+(t2 value_at(C,u))
proof
consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & u = f||FreeGen T by MSAFREE4:45;
FreeGen T is_transformable_to the Sorts of C
by MSAFREE4:21;
then
A3: doms u = FreeGen T by MSSUBFAM:17;
then consider f1 being ManySortedFunction of T,C,
Q1 being GeneratorSet of T such that
A1: f1 is_homomorphism T,C & Q1 = doms u & u = f1||Q1 &
t1 value_at(C,u) = f1.I.t1 by A0,AOFA_A00:def 21;
consider f2 being ManySortedFunction of T,C,
Q2 being GeneratorSet of T such that
A2: f2 is_homomorphism T,C & Q2 = doms u & u = f2||Q2 &
t2 value_at(C,u) = f2.I.t2 by A0,A3,AOFA_A00:def 21;
consider f being ManySortedFunction of T,C,
Q being GeneratorSet of T such that
A4: f is_homomorphism T,C & Q = doms u & u = f||Q &
(t1+t2) value_at(C,u) = f.I.(t1+t2) by A0,A3,AOFA_A00:def 21;
A5: f = f1 & f = f2 by A1,A2,A4,EXTENS_1:19;
set o = In((the connectives of S).7, the carrier' of S);
A6: the_arity_of o = <*I,I*> & the_result_sort_of o = I by Th6c;
then Args(o,T) = product <*(the Sorts of T).I, (the Sorts of T).I*>
by Th7b;
then reconsider p = <*t1,t2*> as Element of Args(o,T) by FINSEQ_3:124;
thus (t1+t2) value_at(C,u) = Den(o,C).(f#p) by A4,A6,MSUALG_3:def 7
.= Den(o,C).<*f.I.t1,f.I.t2*> by A6,Th8
.= (t1 value_at(C,u))+(t2 value_at(C,u)) by A1,A2,A5;
end;
theorem
\2(T,I) value_at (C,u) = 2
proof
A1: \1(T,I) value_at(C,u) = 1 by Th14a;
thus \2(T,I) value_at(C,u)
= (\1(T,I) value_at(C,u))+(\1(T,I) value_at(C,u)) by Th16a
.= 2 by A1,AOFA_A00:55;
end;
theorem Th23a:
(t1-t2) value_at(C,u) = (t1 value_at(C,u))-(t2 value_at(C,u))
proof
thus (t1-t2) value_at(C,u) = (t1 value_at(C,u))+((-t2) value_at(C,u))
by Th16a
.= (t1 value_at(C,u))-(t2 value_at(C,u)) by Th15a;
end;
theorem Th17a:
(t1*t2) value_at(C,u) = (t1 value_at(C,u))*(t2 value_at(C,u))
proof
consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & u = f||FreeGen T by MSAFREE4:45;
A2: t2 value_at(C,u) = f.I.t2 by A0,Th9a;
A4: (t1*t2) value_at(C,u) = f.I.(t1*t2) by A0,Th9a;
set o = In((the connectives of S).8, the carrier' of S);
A6: the_arity_of o = <*I,I*> & the_result_sort_of o = I by Th6d;
then Args(o,T) = product <*(the Sorts of T).I, (the Sorts of T).I*>
by Th7b;
then reconsider p = <*t1,t2*> as Element of Args(o,T) by FINSEQ_3:124;
thus (t1*t2) value_at(C,u) = Den(o,C).(f#p) by A0,A4,A6,MSUALG_3:def 7
.= Den(o,C).<*f.I.t1,f.I.t2*> by A6,Th8
.= (t1 value_at(C,u))*(t2 value_at(C,u)) by A0,A2,Th9a;
end;
theorem Th18a:
(t1 div t2) value_at(C,u) = (t1 value_at(C,u))div(t2 value_at(C,u))
proof
consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & u = f||FreeGen T by MSAFREE4:45;
FreeGen T is_transformable_to the Sorts of C
by MSAFREE4:21;
then
A3: doms u = FreeGen T by MSSUBFAM:17;
then consider f1 being ManySortedFunction of T,C,
Q1 being GeneratorSet of T such that
A1: f1 is_homomorphism T,C & Q1 = doms u & u = f1||Q1 &
t1 value_at(C,u) = f1.I.t1 by A0,AOFA_A00:def 21;
consider f2 being ManySortedFunction of T,C,
Q2 being GeneratorSet of T such that
A2: f2 is_homomorphism T,C & Q2 = doms u & u = f2||Q2 &
t2 value_at(C,u) = f2.I.t2 by A0,A3,AOFA_A00:def 21;
consider f being ManySortedFunction of T,C,
Q being GeneratorSet of T such that
A4: f is_homomorphism T,C & Q = doms u & u = f||Q &
(t1 div t2) value_at(C,u) = f.I.(t1 div t2) by A0,A3,AOFA_A00:def 21;
A5: f = f1 & f = f2 by A1,A2,A4,EXTENS_1:19;
set o = In((the connectives of S).9, the carrier' of S);
A6: the_arity_of o = <*I,I*> & the_result_sort_of o = I by Th6e;
then Args(o,T) = product <*(the Sorts of T).I, (the Sorts of T).I*>
by Th7b;
then reconsider p = <*t1,t2*> as Element of Args(o,T) by FINSEQ_3:124;
thus (t1 div t2) value_at(C,u) = Den(o,C).(f#p) by A4,A6,MSUALG_3:def 7
.= (t1 value_at(C,u))div(t2 value_at(C,u)) by A1,A2,A5,A6,Th8;
end;
theorem
(t1 mod t2) value_at(C,u) = (t1 value_at(C,u)) mod (t2 value_at(C,u))
proof
thus (t1 mod t2) value_at(C,u) = (t1-(t1 div t2)*t2) value_at(C,u)
.= (t1 value_at(C,u))-(((t1 div t2)*t2) value_at(C,u)) by Th23a
.= (t1 value_at(C,u))-(((t1 div t2) value_at(C,u))*(t2 value_at(C,u)))
by Th17a
.= (t1 value_at(C,u)) mod (t2 value_at(C,u)) by Th18a;
end;
theorem
leq(t1,t2) value_at(C,u) = leq(t1 value_at(C,u), t2 value_at(C,u))
proof
consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & u = f||FreeGen T by MSAFREE4:45;
FreeGen T is_transformable_to the Sorts of C
by MSAFREE4:21;
then
A3: doms u = FreeGen T by MSSUBFAM:17;
then consider f1 being ManySortedFunction of T,C,
Q1 being GeneratorSet of T such that
A1: f1 is_homomorphism T,C & Q1 = doms u & u = f1||Q1 &
t1 value_at(C,u) = f1.I.t1 by A0,AOFA_A00:def 21;
consider f2 being ManySortedFunction of T,C,
Q2 being GeneratorSet of T such that
A2: f2 is_homomorphism T,C & Q2 = doms u & u = f2||Q2 &
t2 value_at(C,u) = f2.I.t2 by A0,A3,AOFA_A00:def 21;
consider f being ManySortedFunction of T,C,
Q being GeneratorSet of T such that
A4: f is_homomorphism T,C & Q = doms u & u = f||Q &
leq(t1,t2) value_at(C,u) = f.(the bool-sort of S).leq(t1,t2)
by A0,A3,AOFA_A00:def 21;
A5: f = f1 & f = f2 by A1,A2,A4,EXTENS_1:19;
set o = In((the connectives of S).10, the carrier' of S);
A6: the_arity_of o = <*I,I*> & the_result_sort_of o = the bool-sort of S
by Th6f;
then Args(o,T) = product <*(the Sorts of T).I, (the Sorts of T).I*>
by Th7b;
then reconsider p = <*t1,t2*> as Element of Args(o,T) by FINSEQ_3:124;
thus leq(t1,t2) value_at(C,u) = Den(o,C).(f#p) by A4,A6,MSUALG_3:def 7
.= leq(t1 value_at(C,u), t2 value_at(C,u)) by A1,A2,A5,A6,Th8;
end;
theorem Th20:
for a being SortSymbol of S
for x being Element of (the generators of G).a holds
@x value_at(C,s) = s.a.x
proof
let a be SortSymbol of S;
let x be Element of (the generators of G).a;
s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider h being ManySortedFunction of T,C such that
A1: h is_homomorphism T,C & s = h||the generators of G by AOFA_A00:def 19;
@x value_at(C,s) = h.a.x by A1,Th9 .= ((h.a)|((the generators of G).a)).x
by FUNCT_1:49;
hence @x value_at(C,s) = s.a.x by A1,MSAFREE:def 1;
end;
theorem Th20a:
for a being SortSymbol of S
for x being pure Element of (the generators of G).a
for u being ManySortedFunction of FreeGen T, the Sorts of C holds
@x value_at(C,u) = u.a.x
proof
let a be SortSymbol of S;
let x be pure Element of (the generators of G).a;
let u be ManySortedFunction of FreeGen T, the Sorts of C;
consider h being ManySortedFunction of T,C such that
A1: h is_homomorphism T,C & u = h||FreeGen T by MSAFREE4:45;
FreeGen T is_transformable_to the Sorts of C by MSAFREE4:21;
then
A4: doms u = FreeGen T by MSSUBFAM:17;
then consider f being ManySortedFunction of T,C,
Q being GeneratorSet of T such that
A3: f is_homomorphism T,C & Q = doms u & u = f||Q & @x value_at(C,u) = f.a.@x
by A1,AOFA_A00:def 21;
@x value_at(C,u) = h.a.x by A1,A4,A3,EXTENS_1:19
.= ((h.a)|((FreeGen T).a)).x by PURE,FUNCT_1:49;
hence @x value_at(C,u) = u.a.x by A1,MSAFREE:def 1;
end;
theorem Th27:
for i,j being Integer, a,b being Element of C,I st a = i & b = j
holds a-b = i-j
proof
let i,j be Integer;
let a,b be Element of C,I;
assume Z0: a = i;
assume b = j;
then -b = -j by AOFA_A00:55;
then a+-b = i+-j by Z0,AOFA_A00:55;
hence a-b = i-j;
end;
theorem Th26:
for i,j being Integer, a,b being Element of C,I st a = i & b = j & j <> 0
holds a mod b = i mod j
proof
let i,j be Integer;
let a,b be Element of C,I;
assume Z0: a = i;
assume Z1: b = j;
assume Z2: j <> 0;
then a div b = i div j by Z0,Z1,AOFA_A00:55;
then (a div b)*b = (i div j)*j by Z1,AOFA_A00:55;
then a-(a div b)*b = i-(i div j)*j by Z0,Th27;
hence a mod b = i mod j by Z2,INT_1:def 10;
end;
theorem Th25:
G is C-supported & f in C-Execution(A,b,\falseC) implies
for a being SortSymbol of S, x being pure Element of (the generators of G).a
for t being Element of T,a
holds
f.(s,x:=(t,A)).a.x = t value_at(C,s) &
(for z being pure Element of (the generators of G).a st z <> x
holds f.(s, x:=(t,A)).a.z = s.a.z) &
for b being SortSymbol of S st a <> b holds
(for z being pure Element of (the generators of G).b holds
f.(s, x:=(t,A)).b.z = s.b.z)
proof
assume
A0: G is C-supported;
assume
A1: f in C-Execution(A,b,\falseC);
let a be SortSymbol of S;
let x be pure Element of (the generators of G).a;
let t be Element of T,a;
reconsider x0 = @x as Element of G,a by AOFA_A00:def 22;
thus
f.(s, x:=(t,A)).a.x = succ(s,x0,t value_at(C,s)).a.x by A1,AOFA_A00:def 28
.= t value_at(C,s) by A0,AOFA_A00:def 27;
hereby
let z be pure Element of (the generators of G).a; assume
A3: z <> x;
A5: x in (FreeGen T).a & z in (FreeGen T).a &
FreeGen X is ManySortedSubset of the generators of G
by A0,PURE,AOFA_A00:def 26;
then vf @x = a-singleton(x) & FreeGen X c= the generators of G
by AOFA_A00:41,PBOOLE:def 18;
then (vf @x).a = {x} & (FreeGen X).a c= (the generators of G).a
by AOFA_A00:6,PBOOLE:def 2;
then
A4: z nin (vf @x).a & @x is Element of G,a
by A3,TARSKI:def 1,AOFA_A00:def 22;
thus f.(s, x:=(t,A)).a.z = succ(s,x0,t value_at(C,s)).a.z
by A1,AOFA_A00:def 28
.= s.a.z by A0,A3,A4,A5,AOFA_A00:def 27;
end;
let b be SortSymbol of S; assume
A3: a <> b;
hereby
let z be pure Element of (the generators of G).b;
A5: x in (FreeGen T).a & z in (FreeGen T).b &
FreeGen X is ManySortedSubset of the generators of G
by A0,PURE,AOFA_A00:def 26;
then vf @x = a-singleton(x) & FreeGen X c= the generators of G
by AOFA_A00:41,PBOOLE:def 18;
then
A4: z nin (vf @x).b & @x is Element of G,a
by A3,AOFA_A00:6,AOFA_A00:def 22;
thus f.(s, x:=(t,A)).b.z = succ(s,x0,t value_at(C,s)).b.z
by A1,AOFA_A00:def 28
.= s.b.z by A0,A3,A4,A5,AOFA_A00:def 27;
end;
end;
theorem Th38:
G is C-supported & f in C-Execution(A,b,\falseC) implies
(t1 value_at(C,s) < t2 value_at(C,s) iff
f.(s, b gt(t2,t1,A)) in (\falseC)-States(the generators of G,b)) &
(t1 value_at(C,s) <= t2 value_at(C,s) iff
f.(s, b leq(t1,t2,A)) in (\falseC)-States(the generators of G,b)) &
(for x holds f.(s, b gt(t1,t2,A)).I.x = s.I.x &
f.(s, b leq(t1,t2,A)).I.x = s.I.x) &
for c being pure Element of (the generators of G).the bool-sort of S
st c <> b holds
f.(s, b gt(t1,t2,A)).(the bool-sort of S).c = s.(the bool-sort of S).c &
f.(s, b leq(t1,t2,A)).(the bool-sort of S).c = s.(the bool-sort of S).c
proof assume
A0: G is C-supported & f in C-Execution(A,b,\falseC);
BA: f.(s, b gt(t2,t1,A)) is ManySortedFunction of the generators of G,
the Sorts of C by AOFA_A00:48;
A3: s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
reconsider b0 = @b as Element of G, the bool-sort of S
by AOFA_A00:def 22;
A8: \not(leq(t2,t1)) value_at (C,s)
= \not(leq(t2,t1) value_at(C,s)) by Th11
.= \not(leq(t2 value_at(C,s), t1 value_at(C,s))) by Th19;
then
AB: f.(s, b gt(t2,t1,A)).(the bool-sort of S).b
= succ(s, b0, \not(leq(t2 value_at(C,s), t1 value_at(C,s)))).
(the bool-sort of S).b by A0,AOFA_A00:def 28
.= \not(leq(t2 value_at(C,s), t1 value_at(C,s))) by A0,AOFA_A00:def 27;
A9: 'not' FALSE = TRUE & TRUE <> FALSE &
for x being boolean set holds x <> FALSE iff x = TRUE
by XBOOLEAN:def 3;
\trueC = TRUE by AOFA_A00:def 32;
then
AC: \falseC = 'not' TRUE by AOFA_A00:def 32 .= FALSE;
t1 value_at(C,s) < t2 value_at(C,s) iff
leq(t2 value_at(C,s), t1 value_at(C,s)) = FALSE by AOFA_A00:55;
then t1 value_at(C,s) < t2 value_at(C,s) iff
\notleq(t2 value_at(C,s), t1 value_at(C,s)) <> \falseC by AC,A8,A9,Th11b;
hence (t1 value_at(C,s) < t2 value_at(C,s) iff
f.(s, b gt(t2,t1,A)) in (\falseC)-States(the generators of G,b))
by BA,AB,AOFA_A00:def 20;
BB: f.(s, b leq(t1,t2,A)) is ManySortedFunction of the generators of G,
the Sorts of C by AOFA_A00:48;
leq(t1,t2) value_at (C,s)
= leq(t1 value_at(C,s), t2 value_at(C,s)) by Th19;
then
AB: f.(s, b leq(t1,t2,A)).(the bool-sort of S).b
= succ(s, b0, leq(t1 value_at(C,s), t2 value_at(C,s))).
(the bool-sort of S).b by A0,AOFA_A00:def 28
.= leq(t1 value_at(C,s), t2 value_at(C,s)) by A0,AOFA_A00:def 27;
\trueC = TRUE by AOFA_A00:def 32;
then
AC: \falseC = 'not' TRUE by AOFA_A00:def 32 .= FALSE;
t1 value_at(C,s) <= t2 value_at(C,s) iff
leq(t1 value_at(C,s), t2 value_at(C,s)) <> \falseC
by AC,AOFA_A00:55;
hence t1 value_at(C,s) <= t2 value_at(C,s) iff
f.(s, b leq(t1,t2,A)) in (\falseC)-States(the generators of G,b)
by BB,AB,AOFA_A00:def 20;
b in (FreeGen T).the bool-sort of S by PURE;
then
E1: vf b0 = (the bool-sort of S)-singleton(b) by AOFA_A00:41;
hereby let x;
D1: I <> the bool-sort of S by AOFA_A00:53;
D2: x in (FreeGen T).I by PURE;
D3: x nin (vf b0).I by E1,D1,AOFA_A00:6;
thus f.(s, b gt(t1,t2,A)).I.x
= succ(s,b0,\notleq(t1,t2)value_at(C,s)).I.x by A0,AOFA_A00:def 28
.= s.I.x by D1,D2,D3,A0,AOFA_A00:def 27;
thus f.(s, b leq(t1,t2,A)).I.x
= succ(s,b0,leq(t1,t2)value_at(C,s)).I.x by A0,AOFA_A00:def 28
.= s.I.x by D1,D2,D3,A0,AOFA_A00:def 27;
end;
let c be pure Element of (the generators of G).the bool-sort of S;
assume Z3: c <> b;
(vf b0).the bool-sort of S = {b} by E1,AOFA_A00:6;
then
D4: c nin (vf b0).the bool-sort of S by Z3,TARSKI:def 1;
D5: c in (FreeGen T).the bool-sort of S by PURE;
thus f.(s, b gt(t1,t2,A)).(the bool-sort of S).c
= succ(s,b0,\notleq(t1,t2)value_at(C,s)).(the bool-sort of S).c
by A0,AOFA_A00:def 28
.= s.(the bool-sort of S).c by Z3,D4,D5,A0,AOFA_A00:def 27;
thus f.(s, b leq(t1,t2,A)).(the bool-sort of S).c
= succ(s,b0,leq(t1,t2)value_at(C,s)).(the bool-sort of S).c
by A0,AOFA_A00:def 28
.= s.(the bool-sort of S).c by Z3,D4,D5,A0,AOFA_A00:def 27;
end;
registration
let i,j be real set;
let a,b be boolean set;
cluster IFGT(i,j,a,b) -> boolean;
coherence by XXREAL_0:def 11;
end;
theorem Th49:
G is C-supported & f in C-Execution(A,b,\falseC) implies
f.(s, t is_odd(b,A)).(the bool-sort of S).b = (t value_at(C,s)) mod 2 &
f.(s, t is_even(b,A)).(the bool-sort of S).b = ((t value_at(C,s))+1) mod 2 &
for z holds f.(s, t is_odd(b,A)).I.z = s.I.z &
f.(s, t is_even(b,A)).I.z = s.I.z
proof assume
A0: G is C-supported & f in C-Execution(A,b,\falseC);
reconsider b0 = @b as Element of G,the bool-sort of S by AOFA_A00:def 22;
A1: \2(T,I) value_at(C,s) = 2 & \0(T,I) value_at(C,s) = 0 by Th13,Th22;
then
BA: (t value_at(C,s)) mod (\2(T,I) value_at(C,s))
= (t value_at(C,s)) mod 2 by Th26;
then
A2: leq((t value_at(C,s)) mod (\2(T,I) value_at(C,s)),
\0(T,I) value_at(C,s))
= IFGT((t value_at(C,s)) mod 2, 0, FALSE, TRUE) by A1,AOFA_A00:55;
A3: f.(s, t is_odd(b,A)).(the bool-sort of S).b
= succ(s,b0,\notleq(t mod \2(T,I),\0(T,I)) value_at(C,s))
.(the bool-sort of S).b by A0,AOFA_A00:def 28
.= \notleq(t mod \2(T,I),\0(T,I)) value_at(C,s) by A0,AOFA_A00:def 27
.= \not(leq(t mod \2(T,I),\0(T,I)) value_at(C,s)) by Th11
.= \notleq((t mod \2(T,I)) value_at(C,s),\0(T,I) value_at(C,s)) by Th19
.= \notleq((t value_at(C,s)) mod (\2(T,I) value_at(C,s)),
\0(T,I) value_at(C,s)) by Th24
.= 'not' IFGT((t value_at(C,s)) mod 2, 0, FALSE, TRUE)
by A2,AOFA_A00:def 32;
hereby
per cases by PRE_FF:6;
suppose
S1: (t value_at(C,s)) mod 2 = 0;
hence f.(s, t is_odd(b,A)).(the bool-sort of S).b
= 'not' TRUE by A3,XXREAL_0:def 11
.= (t value_at(C,s)) mod 2 by S1;
end;
suppose
S2: (t value_at(C,s)) mod 2 = 1;
hence f.(s, t is_odd(b,A)).(the bool-sort of S).b
= 'not' FALSE by A3,XXREAL_0:def 11
.= (t value_at(C,s)) mod 2 by S2;
end;
end;
A4: f.(s, t is_even(b,A)).(the bool-sort of S).b
= succ(s,b0,leq(t mod \2(T,I),\0(T,I)) value_at(C,s))
.(the bool-sort of S).b by A0,AOFA_A00:def 28
.= leq(t mod \2(T,I),\0(T,I)) value_at(C,s) by A0,AOFA_A00:def 27
.= leq((t mod \2(T,I)) value_at(C,s),\0(T,I) value_at(C,s)) by Th19
.= leq((t value_at(C,s)) mod (\2(T,I) value_at(C,s)),
\0(T,I) value_at(C,s)) by Th24
.= IFGT((t value_at(C,s)) mod 2, 0, FALSE, TRUE) by BA,A1,AOFA_A00:55;
hereby
per cases by PRE_FF:6;
suppose
S1: (t value_at(C,s)) mod 2 = 0;
hence f.(s, t is_even(b,A)).(the bool-sort of S).b
= (0+1) mod 2 by Lem1,A4,XXREAL_0:def 11
.= ((t value_at(C,s))+1) mod 2 by S1,Lem1,NAT_D:66;
end;
suppose
S2: (t value_at(C,s)) mod 2 = 1;
hence f.(s, t is_even(b,A)).(the bool-sort of S).b
= 1+1 mod 2 by Lem1,A4,XXREAL_0:def 11
.= ((t value_at(C,s))+1) mod 2 by S2,Lem1,NAT_D:66;
end;
end;
let z;
A5: I <> the bool-sort of S by AOFA_A00:53;
b in (FreeGen T).the bool-sort of S by PURE;
then (vf @b) = (the bool-sort of S)-singleton(b) by AOFA_A00:41;
then
A6: z nin (vf @b).I by A5,AOFA_A00:6;
A7: z in (FreeGen T).I by PURE;
thus f.(s, t is_odd(b,A)).I.z
= succ(s,b0,\notleq(t mod \2(T,I),\0(T,I)) value_at(C,s)).I.z
by A0,AOFA_A00:def 28
.= s.I.z by A0,A5,A6,A7,AOFA_A00:def 27;
thus f.(s, t is_even(b,A)).I.z
= succ(s,b0,leq(t mod \2(T,I),\0(T,I)) value_at(C,s)).I.z
by A0,AOFA_A00:def 28
.= s.I.z by A0,A5,A6,A7,AOFA_A00:def 27;
end;
definition
let S,X,T,G,A;
attr A is elementary means
rng the assignments of A c= ElementaryInstructions A;
end;
theorem Th71:
A is elementary implies
for a being SortSymbol of S
for x being Element of (the generators of G).a
for t being Element of T,a holds
x:=(t,A) in ElementaryInstructions A
proof assume
A1: rng the assignments of A c= ElementaryInstructions A;
let a be SortSymbol of S;
let x be Element of (the generators of G).a;
let t be Element of T,a;
[x,t] in [:(the generators of G).a,(the Sorts of T).a:] by ZFMISC_1:87;
then [x,t] in [|the generators of G, the Sorts of T|].a &
dom [|the generators of G, the Sorts of T|] = the carrier of S
by PARTFUN1:def 2,PBOOLE:def 16;
then x:=(t,A) in rng the assignments of A by FUNCT_2:4,CARD_5:2;
hence thesis by A1;
end;
registration
let S,X,T,G;
cluster elementary for strict IfWhileAlgebra of the generators of G;
existence
proof
set W = the infinite IfWhileAlgebra of the generators of G;
set f = the Function of Union [|the generators of G, the Sorts of T|],
ElementaryInstructions W;
reconsider f as Function of Union [|the generators of G, the Sorts of T|],
the carrier of W by FUNCT_2:7;
set A = ProgramAlgStr(#the carrier of W, the charact of W, f#);
set X = the generators of G;
set J = S;
A is partial quasi_total non-empty non empty
proof
thus the charact of A is homogeneous;
thus the charact of A is quasi_total;
thus the charact of A <> {} & the charact of A is non-empty;
thus the carrier of A is non empty;
end; then
reconsider A as partial quasi_total non-empty non empty strict
ProgramAlgStr over J,T,X;
A is with_empty-instruction with_catenation with_if-instruction
with_while-instruction
proof
thus 1 in dom the charact of A &
(the charact of A).1 is 0-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A
by AOFA_000:def 10;
thus 2 in dom the charact of A &
(the charact of A).2 is 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A
by AOFA_000:def 11;
thus 3 in dom the charact of A &
(the charact of A).3 is 3-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A
by AOFA_000:def 12;
thus 4 in dom the charact of A &
(the charact of A).4 is 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A
by AOFA_000:def 13;
end; then
reconsider A as with_empty-instruction with_catenation with_if-instruction
with_while-instruction
partial quasi_total non-empty non empty strict ProgramAlgStr over J,T,X;
A is non degenerated well_founded ECIW-strict infinite
proof
hereby let I1,I2 be Element of A;
reconsider J1 = I1, J2 = I2 as Element of W;
EmptyIns A = EmptyIns W & I1\;I2 = J1\;J2;
hence (I1 <> EmptyIns A implies I1\;I2 <> I2) &
(I2 <> EmptyIns A implies I1\;I2 <> I1) &
(I1 <> EmptyIns A or I2 <> EmptyIns A implies I1\;I2 <> EmptyIns A)
by AOFA_000:def 24;
end;
hereby let C,I1,I2 be Element of A;
reconsider C1 = C, J1 = I1, J2 = I2 as Element of W;
if-then-else(C,I1,I2) = if-then-else(C1,J1,J2) &
EmptyIns W = EmptyIns A;
hence if-then-else(C,I1,I2) <> EmptyIns A by AOFA_000:def 24;
end;
hereby let C,I be Element of A;
reconsider C1 = C, J = I as Element of W;
EmptyIns A = EmptyIns W & while(C,I) = while(C1,J);
hence while(C,I) <> EmptyIns A by AOFA_000:def 24;
end;
hereby let I1,I2,C,J1,J2 be Element of A;
reconsider C1 = C, K1 = I1, K2 = I2, L1 = J1, L2 = J2 as Element of W;
if-then-else(C,J1,J2) = if-then-else(C1,L1,L2) & I1\;I2 = K1\;K2 &
EmptyIns W = EmptyIns A;
hence I1 = EmptyIns A or I2 = EmptyIns A or
I1\;I2 <> if-then-else(C,J1,J2) by AOFA_000:def 24;
end;
hereby let I1,I2,C,J be Element of A;
reconsider C1 = C, K1 = I1, K2 = I2, L = J as Element of W;
EmptyIns W = EmptyIns A & I1\;I2 = K1\;K2 & while(C,J) = while(C1,L);
hence I1 <> EmptyIns A & I2 <> EmptyIns A implies I1\;I2 <> while(C,J)
by AOFA_000:def 24;
end;
hereby let C1,I1,I2,C2,J be Element of A;
reconsider C3 = C1, K1 = I1, K2 = I2, C4 = C2, L = J as Element of W;
while(C2,J) = while(C4,L) &
if-then-else(C1,I1,I2) = if-then-else(C3,K1,K2);
hence if-then-else(C1,I1,I2) <> while(C2,J) by AOFA_000:def 24;
end;
thus A is well_founded
proof
A8: the UAStr of W = the UAStr of A; then
ElementaryInstructions W = ElementaryInstructions A &
ElementaryInstructions W is GeneratorSet of W
by AOFA_A00:43,AOFA_000:def 25;
hence ElementaryInstructions A is GeneratorSet of A
by A8,AOFA_A00:46;
end;
the UAStr of A = the UAStr of W; then
signature A = signature W by AOFA_A00:47;
hence signature A = ECIW-signature by AOFA_000:def 27;
the UAStr of A = the UAStr of W;
hence ElementaryInstructions A is infinite by AOFA_A00:43;
end;
then reconsider A as infinite strict IfWhileAlgebra of X;
take A;
the UAStr of A = the UAStr of W; then
ElementaryInstructions A = ElementaryInstructions W by AOFA_A00:43;
hence rng the assignments of A c= ElementaryInstructions A
by RELAT_1:def 19;
end;
end;
registration
let S,X,T,G;
let A be elementary IfWhileAlgebra of the generators of G;
let a be SortSymbol of S;
let x be Element of (the generators of G).a;
let t be Element of T,a;
cluster x:=(t,A) -> absolutely-terminating;
coherence
proof
x:=(t,A) in ElementaryInstructions A by Th71;
hence thesis by AOFA_000:95;
end;
end;
theorem
for A being elementary IfWhileAlgebra of the generators of G
for f being ExecutionFunction of A, C-States(the generators of G),
(\falseC)-States(the generators of G,b) holds
G is C-supported & f in C-Execution(A,b,\falseC) &
(ex d being Function st d.x = 1 & d.y = 2 & d.m = 3) implies
y:=(\1(T,I),A)\;
while(b gt(@m, \0(T,I), A),
if-then(@m is_odd(b,A), y:=(@y*@x,A))\;
m:=(@m div \2(T,I),A)\; x:=(@x*@x,A))
is_terminating_wrt f, {s: s.I.m >= 0}
proof
let A be elementary IfWhileAlgebra of the generators of G;
let f be ExecutionFunction of A, C-States(the generators of G),
(\falseC)-States(the generators of G,b);
assume
ZZ: G is C-supported & f in C-Execution(A,b,\falseC);
set ST = C-States(the generators of G);
set TV = (\falseC)-States(the generators of G,b);
set P = {s: s.I.m >= 0};
given d being Function such that
A1: d.x = 1 and
A2: d.y = 2 and
A3: d.m = 3;
A4: I <> the bool-sort of S by AOFA_A00:53;
set W = b gt(@m, \0(T,I),A);
A5: y:=(\1(T,I),A) is_terminating_wrt f, P by AOFA_000:107;
deffunc F(Element of ST) = In($1.I.m, NAT);
defpred R[Element of ST] means $1.I.m > 0;
set K = if-then(@m is_odd(b,A), y:=(@y*@x,A));
set J = K\; m:=(@m div \2(T,I),A)\; x:=(@x*@x,A);
A6: f complies_with_if_wrt TV by AOFA_000:def 32;
A7: P is_invariant_wrt W,f
proof
let s be Element of ST;
assume s in P;
then
A8: ex s1 being Element of ST st s = s1 & s1.I.m >= 0;
f.(s, W).I.m = s.I.m by ZZ,Th38;
hence f.(s, W) in P by A8;
end;
A9: for s being Element of ST st s in P & f.(f.(s,J),W) in TV
holds f.(s,J) in P
proof
let s be Element of ST such that
s in P;
B2: \0(T,I) value_at(C,f.(s,J)) = 0 by Th13;
assume f.(f.(s,J),W) in TV;
then @m value_at(C,f.(s,J)) > \0(T,I) value_at(C,f.(s,J)) by ZZ,Th38;
then f.(s,J).I.m > 0 by B2,Th20;
hence thesis;
end;
A10: m <> y by A3,A2;
A11: P is_invariant_wrt y:=(\1(T,I),A), f
proof
let s;
assume s in P;
then
A12: ex s9 being Element of ST st s = s9 & s9.I.m >= 0;
f.(s, y:=(\1(T,I),A)).I.m = s.I.m by A10,ZZ,Th25;
hence f.(s, y:=(\1(T,I),A)) in P by A12;
end;
A13: m <> x by A3,A1;
A14: for s st f.(s,W) in P holds f iteration_terminates_for J\;W, f.(s,W)
proof
A15: for s being Element of ST st R[s] holds (R[f.(s,J\;W)] iff f.(s,J\;W)
in TV) & F(f.(s,J\;W)) < F(s)
proof
let s be Element of ST such that
A16: s.I.m > 0;
A17: F(s) = s.I.m by A16,SUBSET_1:def 8,INT_1:3;
set q1 = f.(s,K);
set q0 = f.(s, @m is_odd(b,A));
set sJ = f.(s,J);
set sC = f.(sJ,W);
A18: f.(s,J\;W) = sC by AOFA_000:def 29;
B5: sC.I.m = sJ.I.m & \0(T,I) value_at(C,sC) = 0 by Th13,A4,ZZ,Th25;
B6: @m value_at(C,sJ) = sJ.I.m & \0(T,I) value_at(C,sJ) = 0 by Th13,Th20;
thus R[f.(s,J\;W)] iff f.(s,J\;W) in TV by B5,A18,B6,ZZ,Th38;
set q2 = f.(q1,m:=(@m div \2(T,I),A));
set q3 = f.(q2,x:=(@x*@x,A));
A20: q1 = f.(q0, y:=(@y*@x,A)) or q1 = f.(q0, EmptyIns A)
by A6,AOFA_000:def 30;
B3: @m value_at(C,q1) = q1.I.m by Th20;
B4: \2(T,I) value_at(C,q1) = 2 by Th22;
q2 = f.(s,K\;m:=(@m div \2(T,I),A)) by AOFA_000:def 29;
then q3 = f.(s,J) by AOFA_000:def 29;
then
A21: sJ.I.m = q2.I.m by A13,ZZ,Th25
.= (@m div \2(T,I)) value_at(C,q1) by ZZ,Th25
.= (@m value_at(C,q1)) div (\2(T,I) value_at(C,q1)) by Th18
.= (q1.I.m) div 2 by B3,B4,AOFA_A00:55
.= (q0.I.m) div 2 by A10,A20,ZZ,Th25,AOFA_000:def 28
.= (s.I.m) div 2 by A4,Th25,ZZ;
A22: sC.I.m = sJ.I.m by ZZ,Th38;
then sC.I.m in NAT by A16,A21,INT_1:3,61;
then F(sC) = sC.I.m by SUBSET_1:def 8;
hence thesis by A16,A22,A18,A21,A17,INT_1:56;
end;
let s0 be Element of ST such that
f.(s0,W) in P;
set s1 = f.(s0,W);
B7: s0.I.m = @m value_at(C,s0) & \0(T,I) value_at(C,s0) = 0 by Th13,Th20;
then
A23: s0.I.m <= 0 implies s1 nin TV by ZZ,Th38;
s0.I.m > 0 implies s1 in TV by B7,ZZ,Th38;
then
A24: f.(s0,W) in TV iff R[f.(s0,W)] by A23,ZZ,Th38;
thus f iteration_terminates_for J\;W, f.(s0,W) from AOFA_000:sch 3(A24,A15
);
end;
J is_terminating_wrt f,P by AOFA_000:107;
then while(b gt(@m, \0(T,I), A), if-then(@m is_odd(b,A), y:=(@y*@x,A))\;
m:=(@m div \2(T,I),A)\; x:=(@x*@x,A) )
is_terminating_wrt f, P by A7,A9,A14,AOFA_000:104,118;
hence thesis by A5,A11,AOFA_000:111;
end;
theorem
G is C-supported &
(ex d being Function st d.b = 0 & d.x = 1 & d.y = 2 & d.m = 3) implies
for s being Element of C-States(the generators of G)
for n being Nat st n = s.I.m holds
f in C-Execution(A,b,\falseC) implies
f.(s, y:=(\1(T,I),A)\;
while(b gt(@m, \0(T,I), A),
if-then(@m is_odd(b,A), y:=(@y*@x,A))\;
m:=(@m div \2(T,I),A)\; x:=(@x*@x,A)) ).I.y
= (s.I.x)|^n
proof
assume
A0: G is C-supported;
given d being Function such that
ZZ: d.b = 0 & d.x = 1 & d.y = 2 & d.m = 3;
let s;
let n be Nat;
assume that
Z0: n = s.I.m and
Z1: f in C-Execution(A,b,\falseC);
set Q = S;
set S = C-States(the generators of G);
set W = T; set g = f;
set T = (\falseC)-States(the generators of G, b);
set s0 = f.(s, y:=(\1(W,I),A));
A1: f complies_with_if_wrt T by AOFA_000:def 32;
defpred R[Element of S] means $1.I.m > 0;
set Z = C;
set C = b gt(@m, \0(W,I), A);
defpred P[Element of S] means
(s.I.x)|^n = ($1.I.y)*(($1.I.x)to_power($1.I.m)) &
$1.I.m >= 0;
deffunc F(Element of S) = In($1.I.m, NAT);
set Y = I;
set I = if-then(@m is_odd(b,A), y:=(@y*@x,A));
set J = I\; m:=(@m div \2(W,Y),A)\; x:=(@x*@x,A);
A6: m <> y by ZZ;
then
A7: s0.Y.m = s.Y.m by A0,Z1,Th25;
A8: for s being Element of S st P[s] holds P[g.(s,C) qua Element of S] &
(g.(s,C) in T iff R[g.(s,C) qua Element of S])
proof
let s be Element of S such that
A9: P[s];
set s1 = g.(s, C);
A10: s1.Y.x = s.Y.x by A0,Z1,Th38;
s1.Y.m = s.Y.m by A0,Z1,Th38;
hence P[g.(s,C) qua Element of S] by A0,Z1,A9,A10,Th38;
B1: \0(W,Y) value_at(Z,s) = 0 & @m value_at(Z,s) = s.Y.m by Th13,Th20;
then
A11: s.Y.m <= 0 implies s1 nin T by A0,Z1,Th38;
s.Y.m > 0 implies s1 in T by B1,A0,Z1,Th38;
hence thesis by A0,Z1,A11,Th38;
end;
A12: s0.Y.y = \1(W,Y) value_at(Z,s) by A0,Z1,Th25 .= 1 by Th14;
set fs = g.(s0, while(C,J));
set s1 = g.(s0,C);
A14: (fs.Y.x) to_power 0 = 1 by POWER:24;
A15: m <> x by ZZ;
A16: for s being Element of S st R[s] holds (R[g.(s,J\;C) qua Element of S] iff
g.(s,J\;C) in T) & F(g.(s,J\;C) qua Element of S) < F(s)
proof
let s be Element of S such that
A17: s.Y.m > 0;
A18: F(s) = s.Y.m by A17,SUBSET_1:def 8,INT_1:3;
set q1 = g.(s,I);
set q0 = g.(s, @m is_odd(b,A));
set sJ = g.(s,J);
set sC = g.(sJ,C);
A19: g.(s,J\;C) = sC by AOFA_000:def 29;
B1: \0(W,Y) value_at(Z,sJ) = 0 & @m value_at(Z,sJ) = sJ.Y.m by Th13,Th20;
then
A20: sJ.Y.m <= 0 implies sC nin T by A0,Z1,Th38;
sJ.Y.m > 0 implies sC in T by B1,A0,Z1,Th38;
hence R[g.(s,J\;C) qua Element of S] iff g.(s,J\;C) in T
by A20,A19,A0,Z1,Th38;
set q2 = g.(q1,m:=(@m div \2(W,Y), A));
set q3 = g.(q2,x:=(@x*@x,A));
A21: q1 = g.(q0, y:=(@y*@x,A)) or q1 = g.(q0, EmptyIns A)
by A1,AOFA_000:def 30;
AA: @m value_at(Z,q1) = q1.Y.m & \2(W,Y)value_at(Z,q1) = 2 by Th20,Th22;
q2 = g.(s,I\;m:=(@m div \2(W,Y), A)) by AOFA_000:def 29;
then q3 = g.(s,J) by AOFA_000:def 29;
then
A22: sJ.Y.m = q2.Y.m by A0,Z1,A15,Th25
.= (@m div \2(W,Y))value_at(Z,q1) by A0,Z1,Th25
.= (@m value_at(Z,q1)) div (\2(W,Y)value_at(Z,q1)) by Th18
.= (q1.Y.m) div 2 by AA,AOFA_A00:55
.= (q0.Y.m) div 2 by A0,Z1,A6,A21,Th25,AOFA_000:def 28
.= (s.Y.m) div 2 by A0,Z1,Th49;
A23: sC.Y.m = sJ.Y.m by A0,Z1,Th38;
then sC.Y.m in NAT by A17,A22,INT_1:3,61;
then F(sC qua Element of S) = sC.Y.m by SUBSET_1:def 8;
hence thesis by A17,A23,A19,A22,A18,INT_1:56;
end;
set q = s;
A24: x <> y by ZZ;
A25: for s being Element of S st P[s] & s in T & R[s]
holds P[g.(s,J) qua Element of S]
proof
let s be Element of S such that
A26: P[s] and
s in T and
R[s];
reconsider sm = s.Y.m as Element of NAT by A26,INT_1:3;
s.Y.m = ((sm) div 2)*2+((sm) mod 2) by NEWTON:66;
then
A27: (q.Y.x)|^n = (s.Y.y)*(((s.Y.x)to_power((sm div 2)*2))*
((s.Y.x)to_power(sm mod 2))) by A26,FIB_NUM2:5
.= (s.Y.y)*((s.Y.x)to_power(sm mod 2))*((s.Y.x)to_power((sm div 2)*2))
.= (s.Y.y)*((s.Y.x)to_power(sm mod 2))*
(((s.Y.x)to_power 2) to_power (sm div 2)) by NEWTON:9
.= (s.Y.y)*((s.Y.x)to_power(sm mod 2))*
(((s.Y.x)*(s.Y.x)) to_power (sm div 2)) by NEWTON:81;
set q1 = g.(s,I);
set q0 = g.(s, @m is_odd(b,A));
set sJ = g.(s,J);
set q2 = g.(q1,m:=(@m div \2(W,Y), A));
set q3 = g.(q2,x:=(@x*@x,A));
A28: q1 = g.(q0, y:=(@y*@x,A)) or q1 = g.(q0, EmptyIns A)
by A1,AOFA_000:def 30;
A29: q2.Y.x = q1.Y.x by A0,Z1,A15,Th25
.= q0.Y.x by A0,Z1,A24,A28,Th25,AOFA_000:def 28;
A30: q2.Y.y = q1.Y.y by A0,Z1,A6,Th25;
A31: q0.Y.y = s.Y.y by A0,Z1,Th49;
A32: q0.Y.x = s.Y.x by A0,Z1,Th49;
q2 = g.(s,I\;m:=(@m div \2(W,Y), A)) by AOFA_000:def 29;
then
A33: q3 = g.(s,J) by AOFA_000:def 29;
then
A34: sJ.Y.y = q2.Y.y by A0,Z1,A24,Th25;
A35: sm div 2 = s.Y.m div 2;
A36: now
C1: @m value_at(Z,s) = s.Y.m by Th20;
then
A37: q0.(the bool-sort of Q).b = (s.Y.m) mod 2 by A0,Z1,Th49;
per cases by A35,A37,NAT_D:12;
suppose
A38: q0.(the bool-sort of Q).b = FALSE;
q0 is ManySortedFunction of the generators of G, the Sorts of Z &
\falseZ = FALSE by Th21,AOFA_A00:48;
then q0 nin T by A38,AOFA_A00:def 20;
then q1 = g.(q0, EmptyIns A) by A1,AOFA_000:def 30;
then
A39: q1.Y.y = q0.Y.y by AOFA_000:def 28;
A40: (s.Y.y)*1 = s.Y.y;
(s.Y.x)to_power 0 = 1 by POWER:24;
hence (s.Y.y)*((s.Y.x)to_power(sm mod 2)) = sJ.Y.y
by A0,Z1,C1,A34,A30,A31,A38,A39,A40,Th49;
end;
suppose
A41: q0.(the bool-sort of Q).b = TRUE;
D1: @y value_at(Z,q0) = q0.Y.y & @x value_at(Z,q0) = q0.Y.x by Th20;
q0 is ManySortedFunction of the generators of G, the Sorts of Z &
\falseZ = FALSE by Th21,AOFA_A00:48;
then q0 in T by A41,AOFA_A00:def 20;
then q1 = g.(q0, y:=(@y*@x,A)) by A1,AOFA_000:def 30;
then
A42: q1.Y.y = (@y*@x) value_at(Z,q0) by A0,Z1,Th25
.= (@y value_at(Z,q0))*(@x value_at(Z,q0)) by Th17
.= (q0.Y.y)*(q0.Y.x) by D1,AOFA_A00:55;
(s.Y.x)to_power 1 = s.Y.x & @m value_at(Z,s) = s.Y.m
by Th20,POWER:25;
hence (s.Y.y)*((s.Y.x)to_power(sm mod 2)) = sJ.Y.y
by A0,Z1,A32,A34,A30,A31,A41,A42,Th49;
end;
end;
D2: @m value_at(Z,q1) = q1.Y.m & \2(W,Y) value_at(Z,q1) = 2 by Th20,Th22;
D4: sJ.Y.m = q2.Y.m by A0,Z1,A15,A33,Th25
.= (@m div \2(W,Y)) value_at(Z,q1) by A0,Z1,Th25
.= (@m value_at(Z,q1))div(\2(W,Y) value_at(Z,q1)) by Th18
.= (q1.Y.m) div 2 by D2,AOFA_A00:55
.= (q0.Y.m) div 2 by A0,Z1,A6,A28,Th25,AOFA_000:def 28
.= (s.Y.m) div 2 by A0,Z1,Th49;
D5: @x value_at(Z,q2) = q2.Y.x by Th20;
sJ.Y.x = (@x*@x) value_at(Z,q2) by A0,Z1,A33,Th25
.= (@x value_at(Z,q2))*(@x value_at(Z,q2)) by Th17
.= (q2.Y.x)*(q2.Y.x) by D5,AOFA_A00:55;
hence thesis by D4,A27,A29,A32,A36,NAT_1:2;
end;
@m value_at(Z,s0) = s0.Y.m & \0(W,Y) value_at(Z,s0) = 0 &
s1.Y.m = s0.Y.m by A0,Z1,Th13,Th20,Th38;
then
A44: g.(s0,C) in T iff R[g.(s0,C) qua Element of S] by A0,Z1,Th38;
A45: g iteration_terminates_for J\;C, g.(s0,C) from AOFA_000:sch 3(A44, A16);
s0.Y.x = s.Y.x by A0,Z1,A24,Th25;
then
A46: P[s0 qua Element of S] by Z0,A7,NAT_1:2,A12,POWER:41;
A47: P[g.(s0,while(C,J)) qua Element of S] &
not R[g.(s0,while(C,J)) qua Element of S]
from AOFA_000:sch 5(A46,A45,A25,A8);
then fs.Y.m = 0 by XXREAL_0:1;
hence thesis by A47,A14,AOFA_000:def 29;
end;
begin :: Calculation of maximum
registration
let X be non empty set;
let f be FinSequence of X^omega;
let x be Nat;
cluster f.x -> Sequence-like finite Function-like Relation-like;
coherence
proof
x in dom f or x nin dom f;
then f.x in X^omega or f.x = <%>X by FUNCT_1:def 2,102;
hence thesis;
end;
end;
registration
let X be non empty set;
cluster -> Function-yielding for FinSequence of X^omega;
coherence;
end;
registration
let i be Nat;
let f be i-based finite array;
let a,x be set;
cluster f+*(a,x) -> i-based finite segmental;
coherence
proof
A1: dom(f+*(a,x)) = dom f by FUNCT_7:30;
then
(for b being Ordinal st b in dom (f+*(a,x)) holds i in dom f & i c= b) &
ex c,b being Ordinal st dom (f+*(a,x)) = c\b by EXCHSORT:def 1,def 2;
hence thesis by A1,FINSET_1:10,EXCHSORT:def 1,def 2;
end;
end;
registration
let X be non empty set;
let f be X-valued Function;
let a be set;
let x be Element of X;
cluster f+*(a,x) -> X-valued;
coherence
proof
let y be element; assume y in rng (f+*(a,x));
then consider z being element such that
A1: z in dom (f+*(a,x)) & y = (f+*(a,x)).z by FUNCT_1:def 3;
A2: dom (f+*(a,x)) = dom f & (z = a or z <> a) by FUNCT_7:30;
then y = x or y = f.z by A1,FUNCT_7:31,32;
hence thesis by A1,A2,FUNCT_1:102;
end;
end;
scheme Sch1{X()->non empty set,
j()->Nat,
B()->set,
F(set,set,set)->set,
A(set)->set}:
ex f being FinSequence of X()^omega st
len f = j() & (f.1 = B() or j() = 0) &
for i being Nat st 1 <= i & i < j() holds f.(i+1) = F(f.i,i,A(i))
provided
A1: for a being 0-based finite array of X()
for i being Nat st 1 <= i & i < j()
for x being Element of X() holds
F(a,i,x) is 0-based finite array of X()
and
A2: B() is 0-based finite array of X()
and
A3: for i being Nat st i < j() holds A(i) in X()
proof
defpred P[set,set,set] means $3 = F($2,$1,A($1));
A7: for n being Nat st 1 <= n & n < j()
for x being set ex y being set st P[n,x,y];
consider f being FinSequence such that
A6: len f = j() & (f.1 = B() or j() = 0) &
for i being Nat st 1 <= i & i < j() holds P[i,f.i,f.(i+1)]
from RECDEF_1:sch 3(A7);
defpred Q[Nat] means 1 <= $1 & $1 <= j() implies f.$1 in X()^omega;
A4: Q[0];
A5: now let i be Nat;
assume
AB: Q[i];
thus Q[i+1]
proof
assume
A8: 1 <= i+1 & i+1 <= j();
reconsider x = A(i) as Element of X() by A3,A8,NAT_1:13;
per cases by NAT_1:3;
suppose i = 0;
hence f.(i+1) in X()^omega by A2,A6,A8,AFINSQ_1:def 7;
end;
suppose i > 0;
then
AA: i >= 1+0 & i in NAT by NAT_1:13,ORDINAL1:def 12;
f.(i+1) = F(f.i,i,x) & f.i is 0-based finite array of X()
by AB,AA,A6,A8,NAT_1:13;
then f.(i+1) is 0-based finite array of X() by A1,A8,AA,NAT_1:13;
hence f.(i+1) in X()^omega by AFINSQ_1:def 7;
end;
end;
end;
AC: for i being Nat holds Q[i] from NAT_1:sch 2(A4,A5);
rng f c= X()^omega
proof
let x be element;
assume x in rng f;
then consider y being element such that
A2: y in dom f & x = f.y by FUNCT_1:def 3;
reconsider y as Nat by A2;
1 <= y & y <= j() by A2,A6,FINSEQ_3:25;
hence x in X()^omega by AC,A2;
end;
then reconsider f as FinSequence of X()^omega by FINSEQ_1:def 4;
take f;
thus len f = j() & (f.1 = B() or j() = 0) by A6;
let i be Nat;
assume 1 <= i & i < j();
hence thesis by A6;
end;
theorem Th31:
for S being (11,1,1)-array non empty non void BoolSignature
for J,L being set, K being SortSymbol of S
st (the connectives of S).11 is_of_type <*J,L*>, K
holds J = the_array_sort_of S &
for I being integer SortSymbol of S holds the_array_sort_of S <> I
proof
let S be (11,1,1)-array non empty non void BoolSignature;
let J0,L0 be set, K0 be SortSymbol of S;
assume Z0: (the connectives of S).11 is_of_type <*J0,L0*>, K0;
consider J,K,L being Element of S such that
A1: L = 1 & K = 1 & J <> L & J <> K &
(the connectives of S).11 is_of_type <*J,K*>, L &
(the connectives of S).(11+1) is_of_type <*J,K,L*>, J &
(the connectives of S).(11+2) is_of_type <*J*>, K &
(the connectives of S).(11+3) is_of_type <*K,L*>, J by AOFA_A00:def 51;
A2: the_array_sort_of S = J by A1,AOFA_A00:def 9;
thus J0 = <*J0,L0*>.1 by FINSEQ_1:44
.= (the Arity of S).((the connectives of S).11).1 by Z0,AOFA_A00:def 9
.= <*J,K*>.1 by A1,AOFA_A00:def 9
.= the_array_sort_of S by A2,FINSEQ_1:44;
thus thesis by A1,A2,AOFA_A00:def 40;
end;
theorem Th30:
for S being 1-1-connectives (4,1) integer (11,1,1)-array 11 array-correct
bool-correct non empty non void BoolSignature
for I being integer SortSymbol of S
for A being (4,1) integer (11,1,1)-array bool-correct non-empty
MSAlgebra over S
for a,b being Element of A,I st a = 0
holds init.array(a,b) = {}
proof
let S be 1-1-connectives (4,1) integer (11,1,1)-array 11 array-correct
bool-correct non empty non void BoolSignature;
let I be integer SortSymbol of S;
let A be (4,1) integer (11,1,1)-array bool-correct non-empty
MSAlgebra over S;
let a,b be Element of A,I;
assume Z0: a = 0;
set o = (the connectives of S).14;
consider J,K being Element of S such that
A1: K = 1 & (the connectives of S).11 is_of_type <*J,1*>, K &
(the Sorts of A).J = ((the Sorts of A).K)^omega &
(the Sorts of A).1 = INT &
(for a being 0-based finite array of (the Sorts of A).K holds
(for i being Integer st i in dom a holds
Den((the connectives of S)/.11,A).<*a,i*> = a.i &
for x being Element of A,K holds
Den((the connectives of S)/.(11+1),A).<*a,i,x*> = a+*(i,x)) &
Den((the connectives of S)/.(11+2),A).<*a*> = card a) &
for i being Integer, x being Element of A,K st i >= 0 holds
Den((the connectives of S)/.(11+3),A).<*i,x*> = i-->x by AOFA_A00:def 52;
A2: I = 1 by AOFA_A00:def 40;
11+3 <= len the connectives of S by AOFA_A00:def 51;
then 14 in dom the connectives of S by FINSEQ_3:25;
then o = (the connectives of S)/.14 & o in the carrier' of S
by FUNCT_1:102,PARTFUN1:def 6;
hence init.array(a,b) = Den((the connectives of S)/.14, A).<*a,b*>
by SUBSET_1:def 8
.= 0 qua set-->b by Z0,A1,A2
.= {};
end;
theorem Th32:
for S being (11,1,1)-array 11 array-correct bool-correct non empty non void
BoolSignature
for I being integer SortSymbol of S holds
the_array_sort_of S <> I &
(the connectives of S).11 is_of_type <*the_array_sort_of S,I*>, I &
(the connectives of S).(11+1) is_of_type <*the_array_sort_of S,I,I*>,
the_array_sort_of S &
(the connectives of S).(11+2) is_of_type <*the_array_sort_of S*>, I &
(the connectives of S).(11+3) is_of_type <*I,I*>, the_array_sort_of S
proof
let S be (11,1,1)-array 11 array-correct bool-correct non empty
non void BoolSignature;
let I be integer SortSymbol of S;
consider J,K,L being Element of S such that
A1: L = 1 & K = 1 & J <> L & J <> K &
(the connectives of S).11 is_of_type <*J,K*>, L &
(the connectives of S).(11+1) is_of_type <*J,K,L*>, J &
(the connectives of S).(11+2) is_of_type <*J*>, K &
(the connectives of S).(11+3) is_of_type <*K,L*>, J by AOFA_A00:def 51;
the_array_sort_of S = J & I = 1 by A1,Th31,AOFA_A00:def 40;
hence thesis by A1;
end;
theorem Th33:
for S being 1-1-connectives (11,1,1)-array 11 array-correct (4,1) integer
bool-correct non empty non void BoolSignature
for I being integer SortSymbol of S
for A being (11,1,1)-array (4,1) integer bool-correct non-empty
MSAlgebra over S
holds (the Sorts of A).the_array_sort_of S = INT^omega &
(for i,j being Element of A,I st i is non negative Integer
holds init.array(i,j) = i-->j) &
for a being Element of (the Sorts of A).the_array_sort_of S
holds length(a,I) = card a &
for i being Element of A,I
for f being Function st f = a & i in dom f
holds a.(i) = f.i &
for x being Element of A,I holds (a,i)<-x = f+*(i,x)
proof
let S be 1-1-connectives (11,1,1)-array 11 array-correct (4,1) integer
bool-correct non empty non void BoolSignature;
let I be integer SortSymbol of S;
let A be (11,1,1)-array (4,1) integer bool-correct non-empty
MSAlgebra over S;
consider J,K being Element of S such that
A1: K = 1 & (the connectives of S).11 is_of_type <*J,1*>, K &
(the Sorts of A).J = ((the Sorts of A).K)^omega &
(the Sorts of A).1 = INT &
(for a being 0-based finite array of (the Sorts of A).K holds
(for i being Integer st i in dom a holds
Den((the connectives of S)/.11,A).<*a,i*> = a.i &
for x being Element of A,K holds
Den((the connectives of S)/.(11+1),A).<*a,i,x*> = a+*(i,x)) &
Den((the connectives of S)/.(11+2),A).<*a*> = card a) &
for i being Integer, x being Element of A,K st i >= 0 holds
Den((the connectives of S)/.(11+3),A).<*i,x*> = i-->x by AOFA_A00:def 52;
thus (the Sorts of A).the_array_sort_of S = INT^omega by A1,Th31;
11+3 <= len the connectives of S by AOFA_A00:def 51;
then 11 <= len the connectives of S &
12 <= len the connectives of S &
13 <= len the connectives of S &
14 <= len the connectives of S by XXREAL_0:2;
then 11 in dom the connectives of S &
12 in dom the connectives of S &
13 in dom the connectives of S &
14 in dom the connectives of S by FINSEQ_3:25;
then
BA: (the connectives of S).11 in the carrier' of S &
(the connectives of S).12 in the carrier' of S &
(the connectives of S).13 in the carrier' of S &
(the connectives of S).14 in the carrier' of S &
(the connectives of S).11 = (the connectives of S)/.11 &
(the connectives of S).12 = (the connectives of S)/.12 &
(the connectives of S).13 = (the connectives of S)/.13 &
(the connectives of S).14 = (the connectives of S)/.14
by FUNCT_1:102,PARTFUN1:def 6;
A3: I = 1 by AOFA_A00:def 40;
hereby
let i,j be Element of A,I;
reconsider ii = i as Integer by A3;
assume
i is non negative Integer;
then
A4: ii >= 0 & I = K by A1,AOFA_A00:def 40,XXREAL_0:def 7;
thus init.array(i,j) = Den((the connectives of S)/.14,A).<*ii,j*>
by BA,SUBSET_1:def 8
.= i-->j by A1,A4;
end;
let a be Element of (the Sorts of A).the_array_sort_of S;
J = the_array_sort_of S by A1,Th31;
then reconsider b = a as XFinSequence of INT by A1;
thus length(a,I)
= Den((the connectives of S)/.13,A).<*b*> by BA,SUBSET_1:def 8
.= card a by A1;
let i be Element of A,I;
let f be Function;
assume Z1: f = a & i in dom f;
thus a.(i) = Den((the connectives of S)/.11,A).<*a,i*> by BA,SUBSET_1:def 8
.= b.i by A1,Z1,A3
.= f.i by Z1;
let x be Element of A,I;
thus (a,i)<-x = Den((the connectives of S)/.12,A).<*b,i,x*>
by BA,SUBSET_1:def 8
.= f+*(i,x) by A1,A3,Z1;
end;
registration
let a be 0-based finite array;
cluster len-a -> finite;
coherence
proof
len a = len-a by EXCHSORT:24;
hence thesis;
end;
end;
registration
let S be 1-1-connectives (4,1) integer (11,1,1)-array 11 array-correct
bool-correct non empty non void BoolSignature;
let A be (11,1,1)-array (4,1) integer bool-correct non-empty
MSAlgebra over S;
cluster -> (11,1,1)-array for non-empty MSSubAlgebra of A;
coherence
proof
let Q be non-empty MSSubAlgebra of A;
set I = the integer SortSymbol of S;
A0: (the Sorts of Q).I = INT by AOFA_A00:55;
then reconsider 00 = 0 as Element of Q,I by INT_1:def 2;
reconsider 0a = 00 as Element of A,I by Lem2;
consider J,K being Element of S such that
AX: K = 1 & (the connectives of S).11 is_of_type <*J,1*>, K &
(the Sorts of A).J = ((the Sorts of A).K)^omega &
(the Sorts of A).1 = INT &
(for a being 0-based finite array of (the Sorts of A).K holds
(for i being Integer st i in dom a holds
Den((the connectives of S)/.11,A).<*a,i*> = a.i &
for x being Element of A,K holds
Den((the connectives of S)/.(11+1),A).<*a,i,x*> = a+*(i,x)) &
Den((the connectives of S)/.(11+2),A).<*a*> = card a) &
for i being Integer, x being Element of A,K st i >= 0 holds
Den((the connectives of S)/.(11+3),A).<*i,x*> = i-->x by AOFA_A00:def 52;
consider J1,K1,L1 being Element of S such that
AV: L1 = 1 & K1 = 1 & J1 <> L1 & J1 <> K1 &
(the connectives of S).11 is_of_type <*J1,K1*>, L1 &
(the connectives of S).(11+1) is_of_type <*J1,K1,L1*>, J1 &
(the connectives of S).(11+2) is_of_type <*J1*>, K1 &
(the connectives of S).(11+3) is_of_type <*K1,L1*>, J1 by AOFA_A00:def 51;
AY: I = 1 by AOFA_A00:def 40;
AZ: the_array_sort_of S = J & the_array_sort_of S = J1 by AV,AX,Th31;
AS: for a being 0-based finite array of INT holds
a in (the Sorts of Q).the_array_sort_of S
proof
let a be 0-based finite array of INT;
set o = In((the connectives of S).14, the carrier' of S);
11+3 <= len the connectives of S by AOFA_A00:def 51;
then 14 in dom the connectives of S by FINSEQ_3:25;
then o = (the connectives of S).14 by FUNCT_1:102,SUBSET_1:def 8;
then the_arity_of o = <*K,K*> by AV,AX,AOFA_A00:def 9;
then
BA: Args(o,Q) = product <*INT,INT*> & 0 in INT
by AX,AY,A0,Th7b,INT_1:def 2;
per cases;
suppose len a = 0;
then a = <%>INT;
then a = init.array(0a,0a) by Th30
.= init.array(00,00) by BA,FINSEQ_3:124,EQUATION:19;
hence a in (the Sorts of Q).the_array_sort_of S;
end;
suppose
S1: len a <> 0;
deffunc F(array, Integer, set) = $1+*($2,$3);
deffunc G(Integer) = a.($1);
set j = len a;
A1: for a being 0-based finite array of INT
for i being Nat st 1 <= i & i < j
for x being Element of INT holds
F(a,i,x) is 0-based finite array of INT;
set B = (len a qua set)-->a.0;
A2: B is 0-based finite array of INT
proof
reconsider i = a.0 as Element of INT by S1,ORDINAL3:8,FUNCT_1:102;
len-a qua finite set-->i is Sequence-like INT-valued;
hence thesis;
end;
Aa: for i being Nat st i 0 implies len (f.$1) = j) &
for i being Nat st i < $1 holds a.i = f.$1.i;
A4: Q[0] by NAT_1:2;
A5: now let i be Nat; assume
B1: Q[i];
thus Q[i+1]
proof assume
B2: i+1 <= len a;
per cases by NAT_1:3;
suppose
B3: i = 0;
thus i+1 <> 0 implies len(f.(i+1)) = j
by A3,B2,B3,FUNCOP_1:13;
let k be Nat;
assume k < i+1;
then k <= 0 & k >= 0 by B3,NAT_1:2,13;
then
B4: k = 0 by XXREAL_0:1;
then k < len a by B2,B3,NAT_1:13;
hence a.k = f.(i+1).k by B3,A3,B4,FUNCOP_1:7,NAT_1:44;
end;
suppose
B5: i > 0;
then
B8: i >= 0+1 & i < j by B2,NAT_1:13;
then
B6: f.(i+1) = F(f.i,i,G(i)) by A3;
thus i+1 <> 0 implies len(f.(i+1)) = j
by B1,B5,B6,B2,NAT_1:13,FUNCT_7:30;
let k be Nat;
assume k < i+1;
then
B7: k <= i & k < j by B2,XXREAL_0:2,NAT_1:13;
per cases by B7,XXREAL_0:1;
suppose k = i;
then f.(i+1) = f.i+*(k,a.k) & k in dom (f.i)
by B1,A3,B8,NAT_1:44;
hence a.k = f.(i+1).k by FUNCT_7:31;
end;
suppose
BB: k < i;
BC: f.(i+1) = f.i+*(i,a.i) & k in dom (f.i)
by B8,A3,B1,B7,NAT_1:44;
thus a.k = (f.i).k by B1,BB,B2,NAT_1:13 .= f.(i+1).k
by BB,BC,FUNCT_7:32;
end;
end;
end;
end;
AJ: for i being Nat holds Q[i] from NAT_1:sch 2(A4,A5);
then
(len a <> 0 implies len (f.len a) = j)
& for i being Nat st i < len a holds a.i = (f.len a).i;
then
AB: f.len a = a by S1,AFINSQ_1:9;
defpred R[Nat] means 1 <= $1 & $1 <= len a implies
f.$1 in (the Sorts of Q).the_array_sort_of S;
A6: R[0];
A7: now let i be Nat;
assume
A8: R[i];
thus R[i+1]
proof
assume
BA: 1 <= i+1 & i+1 <= len a;
then
AB: i < len a by NAT_1:13;
per cases by NAT_1:14;
suppose
A9: i >= 1;
then reconsider fi = f.i as Element of Q, the_array_sort_of S
by A8,BA,NAT_1:13;
fi in (the Sorts of A).J by AZ,Lem2;
then reconsider ff = fi as finite Sequence of INT by AX;
reconsider ii = i as Element of (the Sorts of Q).I
by A0,INT_1:def 2;
reconsider a = G(i) as Element of (the Sorts of Q).I
by A0,Aa,BA,NAT_1:13;
reconsider b = a, ia = ii as Element of (the Sorts of A).I
by Lem2;
reconsider fj = fi as Element of A, the_array_sort_of S by Lem2;
f.(i+1) = F(f.i,i,G(i)) & (1=0+1 implies i > 0) &
f.i in (the Sorts of Q).the_array_sort_of S
by A8,A9,A3,BA,NAT_1:13;
then
len (f.i) = j by AB,AJ;
then
AC: i in dom ff by AB,NAT_1:44;
11+3 <= len the connectives of S by AOFA_A00:def 51;
then 12 <= len the connectives of S by XXREAL_0:2;
then 12 in dom the connectives of S by FINSEQ_3:25;
then
AF: (the connectives of S).12 = (the connectives of S)/.12 &
(the connectives of S).12 in the carrier' of S
by PARTFUN1:def 6,FUNCT_1:102;
then the_arity_of ((the connectives of S)/.12)
= <*the_array_sort_of S, I, I*> by AV,AZ,AY,AOFA_A00:def 9;
then
BC: Args((the connectives of S)/.12, Q) = product <*(the Sorts of Q)
.the_array_sort_of S, (the Sorts of Q).I, (the Sorts of Q).I*>
by Th7c;
f.(i+1) = ff+*(i,a) by A9,A3,BA,NAT_1:13
.= Den((the connectives of S)/.12, A).<*fj,ia,b*>
by AY,AX,AC
.= Den((the connectives of S)/.12, Q).<*fi,ii,a*>
by BC,FINSEQ_3:125,EQUATION:19
.= (fi,ii)<-a by AF,SUBSET_1:def 8;
hence f.(i+1) in (the Sorts of Q).the_array_sort_of S;
end;
suppose
BB: i = 0;
reconsider a0 = a.0, ii = j as Element of Q, I
by A0,S1,ORDINAL3:8,INT_1:def 2,FUNCT_1:102;
reconsider b0 = a0, ia = ii as Element of A, I by Lem2;
11+3 <= len the connectives of S by AOFA_A00:def 51;
then 14 in dom the connectives of S by FINSEQ_3:25;
then
AF: (the connectives of S).14 = (the connectives of S)/.14 &
(the connectives of S).14 in the carrier' of S
by PARTFUN1:def 6,FUNCT_1:102;
then the_arity_of ((the connectives of S)/.14) = <*I, I*>
by AV,AY,AOFA_A00:def 9;
then
BD: Args((the connectives of S)/.14, Q)
= product <*(the Sorts of Q).I, (the Sorts of Q).I*>
by Th7b;
f.(i+1) = Den((the connectives of S)/.14, A).<*ia,b0*>
by BB,A3,S1,AY,AX,NAT_1:2
.= Den((the connectives of S)/.14, Q).<*ii,a0*>
by BD,FINSEQ_3:124,EQUATION:19
.= init.array(ii,a0) by AF,SUBSET_1:def 8;
hence thesis;
end;
end;
end;
Ac: for i being Nat holds R[i] from NAT_1:sch 2(A6,A7);
0 < len a by S1,NAT_1:3;
then 0+1 <= len a by NAT_1:13;
hence a in (the Sorts of Q).the_array_sort_of S by AB,Ac;
end;
end;
take J,K;
thus K = 1 by AX;
thus (the connectives of S).11 is_of_type <*J,1*>, K by AX;
the Sorts of Q is MSSubset of A by MSUALG_2:def 9;
hence (the Sorts of Q).J c= ((the Sorts of Q).K)^omega
by A0,AY,AX,PBOOLE:def 2,def 18;
thus
K1: ((the Sorts of Q).K)^omega c= (the Sorts of Q).J
proof
let x be element;
assume x in ((the Sorts of Q).K)^omega;
hence thesis by AZ,AS,A0,AY,AX;
end;
thus (the Sorts of Q).1 = INT by AOFA_A00:55,AY;
hereby
let a be 0-based finite array of (the Sorts of Q).K;
EE: a in ((the Sorts of Q).K)^omega by AFINSQ_1:def 7;
hereby let i be Integer; assume
E1: i in dom a;
E3: i in INT by INT_1:def 2;
11+3 <= len the connectives of S by AOFA_A00:def 51;
then 11 <= len the connectives of S by XXREAL_0:2;
then 11 in dom the connectives of S by FINSEQ_3:25;
then
(the connectives of S).11 = (the connectives of S)/.11 &
(the connectives of S).11 in the carrier' of S
by PARTFUN1:def 6,FUNCT_1:102;
then the_arity_of ((the connectives of S)/.11)
= <*the_array_sort_of S, I*> by AV,AZ,AY,AOFA_A00:def 9;
then
EF: Args((the connectives of S)/.11, Q) = product <*(the Sorts of Q)
.the_array_sort_of S, (the Sorts of Q).I*> by Th7b;
thus Den((the connectives of S)/.11,Q).<*a,i*>
= Den((the connectives of S)/.11,A).<*a,i*>
by EF,EE,K1,E3,AZ,A0,FINSEQ_3:124,EQUATION:19
.= a.i by E1,A0,AY,AX;
let x be Element of Q,K;
11+3 <= len the connectives of S by AOFA_A00:def 51;
then 12 <= len the connectives of S by XXREAL_0:2;
then 12 in dom the connectives of S by FINSEQ_3:25;
then
(the connectives of S).12 = (the connectives of S)/.12 &
(the connectives of S).12 in the carrier' of S
by PARTFUN1:def 6,FUNCT_1:102;
then the_arity_of ((the connectives of S)/.12)
= <*the_array_sort_of S, I, I*> by AV,AZ,AY,AOFA_A00:def 9;
then
AF: Args((the connectives of S)/.12, Q) = product <*(the Sorts of Q)
.the_array_sort_of S, (the Sorts of Q).I, (the Sorts of Q).I*>
by Th7c;
thus Den((the connectives of S)/.(11+1),Q).<*a,i,x*>
= Den((the connectives of S)/.(11+1),A).<*a,i,x*>
by AF,A0,EE,K1,AX,AZ,AY,E3,FINSEQ_3:125,EQUATION:19
.= a+*(i,x) by A0,AY,AX,E1;
end;
11+3 <= len the connectives of S by AOFA_A00:def 51;
then 13 <= len the connectives of S by XXREAL_0:2;
then 13 in dom the connectives of S by FINSEQ_3:25;
then
(the connectives of S).13 = (the connectives of S)/.13 &
(the connectives of S).13 in the carrier' of S
by PARTFUN1:def 6,FUNCT_1:102;
then the_arity_of ((the connectives of S)/.13)
= <*the_array_sort_of S*> by AV,AZ,AOFA_A00:def 9;
then
EF: Args((the connectives of S)/.13, Q) = product <*(the Sorts of Q)
.the_array_sort_of S*> by Th7a;
thus Den((the connectives of S)/.(11+2),Q).<*a*>
= Den((the connectives of S)/.(11+2),A).<*a*>
by EF,EE,K1,AZ,FINSEQ_3:123,EQUATION:19
.= card a by A0,AY,AX;
end;
let i be Integer, x be Element of Q,K; assume
E4: i >= 0;
E3: i in INT by INT_1:def 2;
11+3 <= len the connectives of S by AOFA_A00:def 51;
then 14 in dom the connectives of S by FINSEQ_3:25;
then
(the connectives of S).14 = (the connectives of S)/.14 &
(the connectives of S).14 in the carrier' of S
by PARTFUN1:def 6,FUNCT_1:102;
then the_arity_of ((the connectives of S)/.14)
= <*I, K*> by AV,AX,AY,AOFA_A00:def 9;
then
EF: Args((the connectives of S)/.14, Q) = product <*(the Sorts of Q).I,
(the Sorts of Q).K*> by Th7b;
thus Den((the connectives of S)/.(11+3),Q).<*i,x*>
= Den((the connectives of S)/.(11+3),A).<*i,x*>
by EF,E3,A0,FINSEQ_3:124,EQUATION:19
.= i-->x by E4,A0,AY,AX;
end;
end;
definition
let S be 1-1-connectives (4,1) integer (11,1,1)-array 11 array-correct
bool-correct non empty non void BoolSignature;
let A be non-empty MSAlgebra over S;
attr A is integer-array means: INTARR:
ex C being image of A st
C is (4,1) integer (11,1,1)-array bool-correct MSAlgebra over S;
end;
registration
let S be 1-1-connectives (4,1) integer (11,1,1)-array 11 array-correct
bool-correct non empty non void BoolSignature;
let X be non-empty ManySortedSet of the carrier of S;
cluster Free(S,X) -> integer-array for non-empty MSAlgebra over S;
coherence
proof let F be non-empty MSAlgebra over S;
assume
A1: F = Free(S,X);
set A = the (4,1) integer (11,1,1)-array bool-correct non-empty
MSAlgebra over S;
reconsider G = FreeGen X as GeneratorSet of F by A1,MSAFREE3:31;
set f = the ManySortedFunction of G, the Sorts of A;
FreeGen X is free & F = FreeMSA X by A1,MSAFREE3:31;
then consider h being ManySortedFunction of F,A such that
A1: h is_homomorphism F,A & h||G = f by MSAFREE:def 5;
reconsider C = Image h as image of F by A1,MSAFREE4:def 4;
take C; thus thesis;
end;
end;
registration
let S be 1-1-connectives (4,1) integer (11,1,1)-array 11 array-correct
bool-correct non empty non void BoolSignature;
cluster integer-array -> integer for non-empty MSAlgebra over S;
coherence
proof
let A be non-empty MSAlgebra over S;
assume ex C being image of A st
C is (4,1) integer (11,1,1)-array bool-correct MSAlgebra over S;
hence ex C being image of A st
C is (4,1) integer bool-correct MSAlgebra over S;
end;
let X be non-empty ManySortedSet of the carrier of S;
cluster vf-free integer-array for (X,S)-terms non-empty strict
VarMSAlgebra over S;
existence
proof
set A = Free(S,X);
consider V being ManySortedMSSet of the Sorts of A,the Sorts of A,
B being (X,S)-terms VarMSAlgebra over S such that
A1: B = VarMSAlgebra(#the Sorts of A, the Charact of A, V#) &
B is vf-free by AOFA_A00:39;
reconsider B as (X,S)-terms strict VarMSAlgebra over S by A1;
take B; thus B is vf-free by A1;
consider C being image of A such that
A2: C is (4,1) integer (11,1,1)-array bool-correct MSAlgebra over S by INTARR;
consider h being ManySortedFunction of A,C such that
A3: h is_epimorphism A,C by MSAFREE4:def 5;
reconsider g = h as ManySortedFunction of B,C by A1;
the MSAlgebra of C = the MSAlgebra of C;
then reconsider D = C as image of B by A1,A3,Th4,MSAFREE4:def 5;
take D; thus thesis by A2;
end;
end;
registration
let S be 1-1-connectives (4,1) integer (11,1,1)-array 11 array-correct
bool-correct non empty non void BoolSignature;
cluster integer-array for non-empty MSAlgebra over S;
existence
proof
set A = the integer-array non-empty VarMSAlgebra over S;
take A;
thus thesis;
end;
end;
registration
let S be 1-1-connectives (4,1) integer (11,1,1)-array 11 array-correct
bool-correct non empty non void BoolSignature;
let A be integer-array non-empty MSAlgebra over S;
cluster (4,1) integer (11,1,1)-array for bool-correct image of A;
existence
proof
consider C being image of A such that
A1: C is (4,1) integer (11,1,1)-array bool-correct MSAlgebra over S by INTARR;
thus thesis by A1;
end;
end;
reserve
S for 1-1-connectives (4,1) integer (11,1,1)-array 11 array-correct
bool-correct non empty non void BoolSignature,
X for non-empty ManySortedSet of the carrier of S,
T for vf-free (X,S)-terms integer-array non-empty VarMSAlgebra over S,
C for (11,1,1)-array (4,1) integer bool-correct non-empty image of T,
G for basic GeneratorSystem over S,X,T,
A for IfWhileAlgebra of the generators of G,
I for integer SortSymbol of S,
x,y,m,i for pure (Element of (the generators of G).I),
M,N for pure (Element of (the generators of G).the_array_sort_of S),
b for pure (Element of (the generators of G).the bool-sort of S),
s,s1 for (Element of C-States(the generators of G));
registration
let S;
let A be (11,1,1)-array bool-correct non-empty MSAlgebra over S;
cluster -> Relation-like Function-like
for Element of (the Sorts of A).the_array_sort_of S;
coherence
proof
let M be Element of (the Sorts of A).the_array_sort_of S;
set I = the integer SortSymbol of S;
consider J,K being Element of S such that
A1: K = 1 & (the connectives of S).11 is_of_type <*J,1*>, K &
(the Sorts of A).J = ((the Sorts of A).K)^omega &
(the Sorts of A).1 = INT &
(for a being 0-based finite array of (the Sorts of A).K holds
(for i being Integer st i in dom a holds
Den((the connectives of S)/.11,A).<*a,i*> = a.i &
for x being Element of A,K holds
Den((the connectives of S)/.(11+1),A).<*a,i,x*> = a+*(i,x)) &
Den((the connectives of S)/.(11+2),A).<*a*> = card a) &
for i being Integer, x being Element of A,K st i >= 0 holds
Den((the connectives of S)/.(11+3),A).<*i,x*> = i-->x by AOFA_A00:def 52;
J = the_array_sort_of S by A1,Th31;
hence thesis by A1;
end;
end;
registration
let S;
let A be (11,1,1)-array bool-correct non-empty MSAlgebra over S;
cluster -> finite Sequence-like
for Element of (the Sorts of A).the_array_sort_of S;
coherence
proof
let M be Element of (the Sorts of A).the_array_sort_of S;
set I = the integer SortSymbol of S;
consider J,K being Element of S such that
A1: K = 1 & (the connectives of S).11 is_of_type <*J,1*>, K &
(the Sorts of A).J = ((the Sorts of A).K)^omega &
(the Sorts of A).1 = INT &
(for a being 0-based finite array of (the Sorts of A).K holds
(for i being Integer st i in dom a holds
Den((the connectives of S)/.11,A).<*a,i*> = a.i &
for x being Element of A,K holds
Den((the connectives of S)/.(11+1),A).<*a,i,x*> = a+*(i,x)) &
Den((the connectives of S)/.(11+2),A).<*a*> = card a) &
for i being Integer, x being Element of A,K st i >= 0 holds
Den((the connectives of S)/.(11+3),A).<*i,x*> = i-->x by AOFA_A00:def 52;
J = the_array_sort_of S by A1,Th31;
hence thesis by A1;
end;
end;
theorem Th6i:
for o being OperSymbol of S st
o = In((the connectives of S).11, the carrier' of S)
holds the_arity_of o = <*the_array_sort_of S,I*> &
the_result_sort_of o = I
proof
let o be OperSymbol of S;
assume Z0: o = In((the connectives of S).11, the carrier' of S);
11+3 <= len the connectives of S by AOFA_A00:def 51;
then 11 <= len the connectives of S by XXREAL_0:2;
then 11 in dom the connectives of S by FINSEQ_3:25;
then o = (the connectives of S).11 by Z0,FUNCT_1:102,SUBSET_1:def 8;
then o is_of_type <*the_array_sort_of S,I*>, I by Th32;
hence the_arity_of o = <*the_array_sort_of S,I*> &
the_result_sort_of o = I by AOFA_A00:def 9;
end;
theorem Th6j:
for o being OperSymbol of S st
o = In((the connectives of S).12, the carrier' of S)
holds the_arity_of o = <*the_array_sort_of S,I,I*> &
the_result_sort_of o = the_array_sort_of S
proof
let o be OperSymbol of S;
assume Z0: o = In((the connectives of S).12, the carrier' of S);
11+3 <= len the connectives of S by AOFA_A00:def 51;
then 12 <= len the connectives of S by XXREAL_0:2;
then 12 in dom the connectives of S by FINSEQ_3:25;
then o = (the connectives of S).12 by Z0,FUNCT_1:102,SUBSET_1:def 8;
then o is_of_type <*the_array_sort_of S,I,I*>, the_array_sort_of S
by Th32;
hence the_arity_of o = <*the_array_sort_of S,I,I*> &
the_result_sort_of o = the_array_sort_of S by AOFA_A00:def 9;
end;
theorem Th6l:
for o being OperSymbol of S st
o = In((the connectives of S).13, the carrier' of S)
holds the_arity_of o = <*the_array_sort_of S*> &
the_result_sort_of o = I
proof
let o be OperSymbol of S;
assume Z0: o = In((the connectives of S).13, the carrier' of S);
11+3 <= len the connectives of S by AOFA_A00:def 51;
then 13 <= len the connectives of S by XXREAL_0:2;
then 13 in dom the connectives of S by FINSEQ_3:25;
then o = (the connectives of S).13 by Z0,FUNCT_1:102,SUBSET_1:def 8;
then o is_of_type <*the_array_sort_of S*>, I by Th32;
hence the_arity_of o = <*the_array_sort_of S*> &
the_result_sort_of o = I by AOFA_A00:def 9;
end;
theorem Th6m:
for o being OperSymbol of S st
o = In((the connectives of S).14, the carrier' of S)
holds the_arity_of o = <*I,I*> &
the_result_sort_of o = the_array_sort_of S
proof
let o be OperSymbol of S;
assume Z0: o = In((the connectives of S).14, the carrier' of S);
11+3 <= len the connectives of S by AOFA_A00:def 51;
then 14 in dom the connectives of S by FINSEQ_3:25;
then o = (the connectives of S).14 by Z0,FUNCT_1:102,SUBSET_1:def 8;
then o is_of_type <*I,I*>, the_array_sort_of S by Th32;
hence the_arity_of o = <*I,I*> &
the_result_sort_of o = the_array_sort_of S by AOFA_A00:def 9;
end;
theorem Th41:
for t being Element of T, the_array_sort_of S holds
for t1 being Element of T, I holds
t.(t1) value_at(C,s) = (t value_at(C,s)).(t1 value_at(C,s))
proof
let t be Element of T, the_array_sort_of S;
let t1 be Element of T, I;
set o = In((the connectives of S).11, the carrier' of S);
s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & s = f||(the generators of G) by AOFA_A00:def 19;
A3: t value_at(C,s) = f.(the_array_sort_of S).t by A0,Th9;
A4: (t.t1) value_at(C,s) = f.I.(t.t1) by A0,Th9;
A6: the_arity_of o = <*the_array_sort_of S,I*> &
the_result_sort_of o = I by Th6i;
then Args(o,T) = product <*(the Sorts of T).the_array_sort_of S,
(the Sorts of T).I*> by Th7b;
then reconsider p = <*t,t1*> as Element of Args(o,T) by FINSEQ_3:124;
thus (t.t1) value_at(C,s) = Den(o,C).(f#p) by A0,A4,A6,MSUALG_3:def 7
.= Den(o,C).<*f.(the_array_sort_of S).t,f.I.t1*> by A6,Th8
.= (t value_at(C,s)).(t1 value_at(C,s)) by A0,A3,Th9;
end;
theorem Th40:
for t being Element of T, the_array_sort_of S holds
for t1,t2 being Element of T, I holds
(t,t1)<-t2 value_at(C,s) =
(t value_at(C,s), t1 value_at(C,s))<-(t2 value_at(C,s))
proof
let t be Element of T, the_array_sort_of S;
let t1,t2 be Element of T, I;
set o = In((the connectives of S).12, the carrier' of S);
s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & s = f||(the generators of G) by AOFA_A00:def 19;
A2: t2 value_at(C,s) = f.I.t2 by A0,Th9;
A3: t value_at(C,s) = f.(the_array_sort_of S).t by A0,Th9;
A4: (t,t1)<-t2 value_at(C,s) = f.(the_array_sort_of S).((t,t1)<-t2) by A0,Th9;
A6: the_arity_of o = <*the_array_sort_of S,I,I*> &
the_result_sort_of o = the_array_sort_of S by Th6j;
then Args(o,T) = product <*(the Sorts of T).the_array_sort_of S,
(the Sorts of T).I, (the Sorts of T).I*> by Th7c;
then reconsider p = <*t,t1,t2*> as Element of Args(o,T) by FINSEQ_3:125;
thus (t,t1)<-t2 value_at(C,s) = Den(o,C).(f#p) by A0,A4,A6,MSUALG_3:def 7
.= Den(o,C).<*f.(the_array_sort_of S).t,f.I.t1,f.I.t2*> by A6,Th8b
.= (t value_at(C,s), t1 value_at(C,s))<-(t2 value_at(C,s)) by A0,A2,A3,Th9;
end;
theorem Th42:
for t being Element of T, the_array_sort_of S holds
length(t,I) value_at(C,s) = length(t value_at(C,s), I)
proof
let t be Element of T, the_array_sort_of S;
set o = In((the connectives of S).13, the carrier' of S);
s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & s = f||(the generators of G) by AOFA_A00:def 19;
A4: length(t,I) value_at(C,s) = f.I.(length(t,I)) by A0,Th9;
A6: the_arity_of o = <*the_array_sort_of S*> &
the_result_sort_of o = I by Th6l;
then Args(o,T) = product <*(the Sorts of T).the_array_sort_of S*> by Th7a;
then reconsider p = <*t*> as Element of Args(o,T) by FINSEQ_3:123;
thus (length(t,I)) value_at(C,s) = Den(o,C).(f#p)
by A0,A4,A6,MSUALG_3:def 7
.= Den(o,C).<*f.(the_array_sort_of S).t*> by A6,Th8a
.= length(t value_at(C,s),I) by A0,Th9;
end;
theorem
for t1,t2 being Element of T, I holds
init.array(t1,t2) value_at(C,s) =
init.array(t1 value_at(C,s), t2 value_at(C,s))
proof
let t1,t2 be Element of T, I;
set o = In((the connectives of S).14, the carrier' of S);
s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & s = f||(the generators of G) by AOFA_A00:def 19;
A2: t2 value_at(C,s) = f.I.t2 by A0,Th9;
A4: init.array(t1,t2) value_at(C,s) = f.(the_array_sort_of S)
.(init.array(t1,t2)) by A0,Th9;
A6: the_arity_of o = <*I,I*> &
the_result_sort_of o = the_array_sort_of S by Th6m;
then Args(o,T) = product <*(the Sorts of T).I, (the Sorts of T).I*>
by Th7b;
then reconsider p = <*t1,t2*> as Element of Args(o,T) by FINSEQ_3:124;
thus (init.array(t1,t2)) value_at(C,s) = Den(o,C).(f#p)
by A0,A4,A6,MSUALG_3:def 7
.= Den(o,C).<*f.I.t1,f.I.t2*> by A6,Th8
.= init.array(t1 value_at(C,s),t2 value_at(C,s)) by A0,A2,Th9;
end;
reserve u for ManySortedFunction of FreeGen T, the Sorts of C;
theorem
for t being Element of T, the_array_sort_of S holds
for t1 being Element of T, I holds
t.(t1) value_at(C,u) = (t value_at(C,u)).(t1 value_at(C,u))
proof
let t be Element of T, the_array_sort_of S;
let t1 be Element of T, I;
set o = In((the connectives of S).11, the carrier' of S);
consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & u = f||FreeGen T by MSAFREE4:45;
A3: t value_at(C,u) = f.(the_array_sort_of S).t by A0,Th9a;
A4: (t.t1) value_at(C,u) = f.I.(t.t1) by A0,Th9a;
A6: the_arity_of o = <*the_array_sort_of S,I*> &
the_result_sort_of o = I by Th6i;
then Args(o,T) = product <*(the Sorts of T).the_array_sort_of S,
(the Sorts of T).I*> by Th7b;
then reconsider p = <*t,t1*> as Element of Args(o,T) by FINSEQ_3:124;
thus (t.t1) value_at(C,u) = Den(o,C).(f#p) by A0,A4,A6,MSUALG_3:def 7
.= Den(o,C).<*f.(the_array_sort_of S).t,f.I.t1*> by A6,Th8
.= (t value_at(C,u)).(t1 value_at(C,u)) by A0,A3,Th9a;
end;
theorem Th40a:
for t being Element of T, the_array_sort_of S holds
for t1,t2 being Element of T, I holds
(t,t1)<-t2 value_at(C,u) =
(t value_at(C,u), t1 value_at(C,u))<-(t2 value_at(C,u))
proof
let t be Element of T, the_array_sort_of S;
let t1,t2 be Element of T, I;
set o = In((the connectives of S).12, the carrier' of S);
consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & u = f||FreeGen T by MSAFREE4:45;
A2: t2 value_at(C,u) = f.I.t2 by A0,Th9a;
A3: t value_at(C,u) = f.(the_array_sort_of S).t by A0,Th9a;
A4: (t,t1)<-t2 value_at(C,u) = f.(the_array_sort_of S).((t,t1)<-t2) by A0,Th9a;
A6: the_arity_of o = <*the_array_sort_of S,I,I*> &
the_result_sort_of o = the_array_sort_of S by Th6j;
then Args(o,T) = product <*(the Sorts of T).the_array_sort_of S,
(the Sorts of T).I, (the Sorts of T).I*> by Th7c;
then reconsider p = <*t,t1,t2*> as Element of Args(o,T) by FINSEQ_3:125;
thus (t,t1)<-t2 value_at(C,u) = Den(o,C).(f#p) by A0,A4,A6,MSUALG_3:def 7
.= Den(o,C).<*f.(the_array_sort_of S).t,f.I.t1,f.I.t2*> by A6,Th8b
.= (t value_at(C,u), t1 value_at(C,u))<-(t2 value_at(C,u))
by A0,A2,A3,Th9a;
end;
theorem
for t being Element of T, the_array_sort_of S holds
length(t,I) value_at(C,u) = length(t value_at(C,u), I)
proof
let t be Element of T, the_array_sort_of S;
set o = In((the connectives of S).13, the carrier' of S);
consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & u = f||FreeGen T by MSAFREE4:45;
A4: length(t,I) value_at(C,u) = f.I.(length(t,I)) by A0,Th9a;
A6: the_arity_of o = <*the_array_sort_of S*> &
the_result_sort_of o = I by Th6l;
then Args(o,T) = product <*(the Sorts of T).the_array_sort_of S*> by Th7a;
then reconsider p = <*t*> as Element of Args(o,T) by FINSEQ_3:123;
thus (length(t,I)) value_at(C,u) = Den(o,C).(f#p)
by A0,A4,A6,MSUALG_3:def 7
.= Den(o,C).<*f.(the_array_sort_of S).t*> by A6,Th8a
.= length(t value_at(C,u),I) by A0,Th9a;
end;
theorem
for t1,t2 being Element of T, I holds
init.array(t1,t2) value_at(C,u) =
init.array(t1 value_at(C,u), t2 value_at(C,u))
proof
let t1,t2 be Element of T, I;
set o = In((the connectives of S).14, the carrier' of S);
consider f being ManySortedFunction of T,C such that
A0: f is_homomorphism T,C & u = f||FreeGen T by MSAFREE4:45;
A2: t2 value_at(C,u) = f.I.t2 by A0,Th9a;
A4: init.array(t1,t2) value_at(C,u) = f.(the_array_sort_of S)
.(init.array(t1,t2)) by A0,Th9a;
A6: the_arity_of o = <*I,I*> &
the_result_sort_of o = the_array_sort_of S by Th6m;
then Args(o,T) = product <*(the Sorts of T).I, (the Sorts of T).I*>
by Th7b;
then reconsider p = <*t1,t2*> as Element of Args(o,T) by FINSEQ_3:124;
thus (init.array(t1,t2)) value_at(C,u) = Den(o,C).(f#p)
by A0,A4,A6,MSUALG_3:def 7
.= Den(o,C).<*f.I.t1,f.I.t2*> by A6,Th8
.= init.array(t1 value_at(C,u),t2 value_at(C,u)) by A0,A2,Th9a;
end;
Lem1:
now
let S,X,T,I;
let i be integer set;
let f1 being Function of INT, (the Sorts of T).I such that
A1: f1.0 = \0(T,I) &
for j being Nat, t being Element of T,I st f1.j = t
holds f1.(j+1) = t+\1(T,I) & f1.(-(j+1)) = -(t+\1(T,I));
let f2 being Function of INT, (the Sorts of T).I such that
A2: f2.0 = \0(T,I) &
for j being Nat, t being Element of T,I st f2.j = t
holds f2.(j+1) = t+\1(T,I) & f2.(-(j+1)) = -(t+\1(T,I));
defpred P[Nat] means f1.$1 = f2.$1;
A3: P[0] by A1,A2;
A4: for i being Nat st P[i] holds P[i+1]
proof
let i be Nat;
assume
B1: P[i];
reconsider j = i as Element of INT by INT_1:def 2;
thus f1.(i+1) = (f1.j)+\1(T,I) by A1 .= f2.(i+1) by A2,B1;
end;
A5: for i being Nat holds P[i] from NAT_1:sch 2(A3,A4);
now let i be Element of INT;
consider n being Element of NAT such that
B2: i = n or i = -n by INT_1:def 1;
per cases by B2;
suppose i = n or i = -n & n = 0;
hence f1.i = f2.i by A5;
end;
suppose
B4: i = -n & n <> 0;
then consider m being Nat such that
B3: n = m+1 by NAT_1:6;
reconsider m0 = m, m1 = m+1 as Element of INT by INT_1:def 2;
thus f1.i = -(f1.m0+\1(T,I)) by A1,B3,B4
.= -(f2.m0+\1(T,I)) by A5 .= f2.i by A2,B3,B4;
end;
end;
hence f1 = f2 by FUNCT_2:def 7;
end;
definition
let S,X,T,I;
let i be integer set;
func ^(i,T,I) -> Element of T,I means: CTERM:
ex f being Function of INT, (the Sorts of T).I st
it = f.i & f.0 = \0(T,I) &
for j being Nat, t being Element of T,I st f.j = t
holds f.(j+1) = t+\1(T,I) & f.(-(j+1)) = -(t+\1(T,I));
existence
proof
deffunc F(Nat,Element of T,I) = $2+\1(T,I);
consider f being Function of NAT,(the Sorts of T).I such that
A2: f.0 = \0(T,I) & for i being Nat holds f.(i+1) = F(i,f.i) from NAT_1:sch 12;
set X = {-j where j is Nat: j <> 0};
-1 in X;
then reconsider X as non empty set;
X is integer-membered
proof
let x be element;
assume x in X;
then ex j being Nat st x = -j & j <> 0;
hence thesis;
end;
then reconsider X as non empty integer-membered set;
deffunc G(Integer) = -(f.In(-$1,NAT));
consider g being Function of X,(the Sorts of T).I such that
A3: for i being Element of X holds g.i = G(i) from FUNCT_2:sch 4;
set h = f+*g;
A4: dom h = (dom f) \/ dom g by FUNCT_4:def 1
.= NAT \/ dom g by FUNCT_2:def 1 .= NAT \/ X by FUNCT_2:def 1;
A6: NAT \/ X = INT
proof
thus NAT \/ X c= INT by MEMBERED:5;
let x be Integer; assume x in INT;
then consider n being Element of NAT such that
A5: x = n or x = -n by INT_1:def 1;
per cases by A5;
suppose x = n;
hence thesis by XBOOLE_0:def 3;
end;
suppose x = -n & n = 0;
hence thesis by XBOOLE_0:def 3;
end;
suppose x = -n & n <> 0;
then x in X;
hence thesis by XBOOLE_0:def 3;
end;
end;
rng f c= (the Sorts of T).I & rng g c= (the Sorts of T).I
by RELAT_1:def 19;
then rng h c= (rng f)\/rng g & (rng f)\/rng g c= (the Sorts of T).I
by XBOOLE_1:8,FUNCT_4:17;
then reconsider h as Function of INT,(the Sorts of T).I
by A4,A6,FUNCT_2:2,XBOOLE_1:1;
reconsider j = i as Element of INT by INT_1:def 2;
reconsider t = h.j as Element of T,I;
take t, h; thus t = h.i;
-0 nin X
proof
assume -0 in X;
then ex n being Nat st -0 = -n & n <> 0;
hence contradiction;
end;
then 0 nin dom g by FUNCT_2:def 1;
hence h.0 = \0(T,I) by A2,FUNCT_4:11;
let j be Nat, t be Element of T,I; assume
A9: h.j = t;
j nin X
proof
assume j in X;
then consider n being Nat such that
B1: j = -n & n <> 0;
j in NAT by ORDINAL1:def 12;
hence contradiction by B1,INT_2:6;
end;
then j nin dom g by FUNCT_2:def 1;
then
A1: h.j = f.j by FUNCT_4:11;
j+1 nin X
proof
assume j+1 in X;
then consider n being Nat such that
B1: j+1 = -n & n <> 0;
thus contradiction by B1;
end;
then j+1 nin dom g by FUNCT_2:def 1;
hence h.(j+1) = f.(j+1) by FUNCT_4:11 .= t+\1(T,I) by A2,A9,A1;
X1: -(j+1) in X;
then -(j+1) in dom g by FUNCT_2:def 1;
hence h.(-(j+1)) = g.(-(j+1)) by FUNCT_4:13 .= G(-(j+1)) by X1,A3
.= -(f.(j+1)) by ORDINAL1:def 12,SUBSET_1:def 8
.= -(t+\1(T,I)) by A2,A9,A1;
end;
uniqueness by Lem1;
end;
theorem Th60:
^(0,T,I) = \0(T,I)
proof
ex f being Function of INT, (the Sorts of T).I st
^(0,T,I) = f.0 & f.0 = \0(T,I) &
for j being Nat, t being Element of T,I st f.j = t
holds f.(j+1) = t+\1(T,I) & f.(-(j+1)) = -(t+\1(T,I)) by CTERM;
hence thesis;
end;
theorem Th61:
for n being Nat holds ^(n+1,T,I) = ^(n,T,I)+\1(T,I) &
^(-(n+1),T,I) = - ^(n+1,T,I)
proof
let n be Nat;
consider f being Function of INT, (the Sorts of T).I such that
A1: ^(n+1,T,I) = f.(n+1) & f.0 = \0(T,I) &
for j being Nat, t being Element of T,I st f.j = t
holds f.(j+1) = t+\1(T,I) & f.(-(j+1)) = -(t+\1(T,I)) by CTERM;
consider g being Function of INT, (the Sorts of T).I such that
A2: ^(n,T,I) = g.n & g.0 = \0(T,I) &
for j being Nat, t being Element of T,I st g.j = t
holds g.(j+1) = t+\1(T,I) & g.(-(j+1)) = -(t+\1(T,I)) by CTERM;
consider h being Function of INT, (the Sorts of T).I such that
A3: ^(-(n+1),T,I) = h.(-(n+1)) & h.0 = \0(T,I) &
for j being Nat, t being Element of T,I st h.j = t
holds h.(j+1) = t+\1(T,I) & h.(-(j+1)) = -(t+\1(T,I)) by CTERM;
A6: f = g by A1,A2,Lem1;
^(n,T,I) = f.n by A1,A2,Lem1;
hence
A5: ^(n+1,T,I) = ^(n,T,I)+\1(T,I) by A1;
f = h by A1,A3,Lem1;
hence ^(-(n+1),T,I) = - ^(n+1,T,I) by A3,A5,A6,A2;
end;
theorem
^(1,T,I) = \0(T,I)+\1(T,I)
proof 1 = 0+1;
hence ^(1,T,I) = ^(0,T,I)+\1(T,I) by Th61 .= \0(T,I)+\1(T,I) by Th60;
end;
theorem Th65:
for i being integer set holds ^(i,T,I) value_at(C,s) = i
proof
let i be integer set;
defpred P[Nat] means ^($1,T,I) value_at(C,s) = $1;
^(0,T,I) = \0(T,I) by Th60;
then
A1: P[0] by Th13;
A2: now let i be Nat;
assume
B1: P[i];
B2: \1(T,I) value_at(C,s) = 1 by Th14;
^(i+1,T,I) = ^(i,T,I)+\1(T,I) by Th61;
then ^(i+1,T,I) value_at(C,s)
= (^(i,T,I) value_at(C,s))+(\1(T,I) value_at(C,s)) by Th16
.= (^(i,T,I) value_at(C,s))+1 by B2,AOFA_A00:55;
hence P[i+1] by B1;
end;
A3: for i being Nat holds P[i] from NAT_1:sch 2(A1,A2);
i in INT by INT_1:def 2;
then consider n being Element of NAT such that
A4: i = n or i = -n by INT_1:def 1;
per cases by A4;
suppose i = n or i = -n & n = 0;
hence thesis by A3;
end;
suppose
C1: i = -n & n <> 0;
then consider m being Nat such that
C2: n = m+1 by NAT_1:6;
\1(T,I) value_at(C,s) = 1 & ^(m,T,I) value_at(C,s) = m by A3,Th14;
then
C3: (^(m,T,I) value_at(C,s))+(\1(T,I) value_at(C,s)) = m+1 by AOFA_A00:55;
^(i,T,I) = - ^(m+1,T,I) by C1,C2,Th61;
hence ^(i,T,I) value_at(C,s)
= -(^(m+1,T,I) value_at(C,s)) by Th15
.= -((^(m,T,I)+\1(T,I)) value_at(C,s)) by Th61
.= -((^(m,T,I) value_at(C,s))+(\1(T,I) value_at(C,s))) by Th16
.= i by C1,C2,C3,AOFA_A00:55;
end;
end;
definition
let S,X,T,G,I,M;
let i be integer set;
func M.(i,I) -> Element of T,I equals @M.(^(i,T,I));
coherence;
end;
registration
let S,X,T,G,C,s,M;
cluster s.(the_array_sort_of S).M -> Function-like Relation-like;
coherence
proof
s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then s.(the_array_sort_of S) is Function of (the generators of G)
.the_array_sort_of S, (the Sorts of C).the_array_sort_of S
by PBOOLE:def 15;
then
A1: s.(the_array_sort_of S).M in (the Sorts of C).the_array_sort_of S
by FUNCT_2:5;
thus thesis by A1;
end;
end;
registration
let S,X,T,G,C,s,M;
cluster s.(the_array_sort_of S).M -> finite Sequence-like INT-valued;
coherence
proof
s is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then s.(the_array_sort_of S) is Function of (the generators of G)
.the_array_sort_of S, (the Sorts of C).the_array_sort_of S
by PBOOLE:def 15;
then
A1: s.(the_array_sort_of S).M in (the Sorts of C).the_array_sort_of S
by FUNCT_2:5;
(the Sorts of C).the_array_sort_of S = INT^omega by Th33;
hence thesis by A1;
end;
end;
registration
let S,X,T,G,C,s,M;
cluster rng (s.(the_array_sort_of S).M) -> finite integer-membered;
coherence
proof
rng (s.(the_array_sort_of S).M) c= INT by RELAT_1:def 19;
hence thesis;
end;
end;
theorem
for j being Integer st j in dom (s.(the_array_sort_of S).M) &
M.(j,I) in (the generators of G).I
holds s.(the_array_sort_of S).M.j = s.I.(M.(j,I))
proof
let j be Integer;
assume
Z0: j in dom (s.(the_array_sort_of S).M);
assume
Z1: M.(j,I) in (the generators of G).I;
reconsider s1 = s as ManySortedFunction of the generators of G,
the Sorts of C by AOFA_A00:48;
consider h being ManySortedFunction of T,C such that
A1: h is_homomorphism T,C & s1 = h||the generators of G by AOFA_A00:def 19;
A2: ^(j,T,I) value_at(C,s) = j & @M value_at(C,s) = s.(the_array_sort_of S).M
by Th20,Th65;
s.I.(M.(j,I)) = (h.I)|((the generators of G).I).(M.(j,I))
by A1,MSAFREE:def 1
.= h.I.(@M.(^(j,T,I))) by Z1,FUNCT_1:49
.= @M.(^(j,T,I)) value_at(C,s) by A1,Th9
.= (@M value_at(C,s)).(^(j,T,I) value_at(C,s)) by Th41
.= (s1.(the_array_sort_of S).M).j by Z0,A2,Th33;
hence s.(the_array_sort_of S).M.j = s.I.(M.(j,I));
end;
theorem
for j being Integer st j in dom (s.(the_array_sort_of S).M) &
@M.(@i) in (the generators of G).I & j = @i value_at(C,s) holds
s.(the_array_sort_of S).M.(@i value_at(C,s)) = s.I.(@M.(@i))
proof
let j be Integer;
assume Z0: j in dom (s.(the_array_sort_of S).M);
assume Z1: @M.(@i) in (the generators of G).I;
assume Z2: j = @i value_at(C,s);
reconsider s1 = s as ManySortedFunction of the generators of G,
the Sorts of C by AOFA_A00:48;
consider h being ManySortedFunction of T,C such that
A1: h is_homomorphism T,C & s1 = h||the generators of G by AOFA_A00:def 19;
s.(the_array_sort_of S).M = @M value_at(C,s) by Th20;
hence s.(the_array_sort_of S).M.(@i value_at(C,s))
= (@M value_at(C,s)).(@i value_at(C,s)) by Z0,Z2,Th33
.= @M.@i value_at(C,s) by Th41
.= h.I.(@M.@i) by A1,Th9
.= ((h.I)|((the generators of G).I)).(@M.@i) by Z1,FUNCT_1:49
.= s.I.(@M.(@i)) by A1,MSAFREE:def 1;
end;
registration
let X be non empty set;
cluster X^omega -> infinite;
coherence
proof
set x = the Element of X;
set Y = {n-->x where n is Nat: not contradiction};
A1: Y c= X^omega
proof
let a be element;
assume a in Y;
then ex n being Nat st a = n qua set-->x;
hence thesis by AFINSQ_1:def 7;
end;
defpred P[element,element] means
ex z being set st z = $1 & $2 = card z;
A2: for e being element st e in Y ex u being element st P[e,u]
proof
let e be element such that e in Y;
reconsider e as set by TARSKI:1;
take card e;
thus thesis;
end;
consider f being Function such that
A3: dom f = Y & for a being element st a in Y holds P[a,f.a]
from CLASSES1:sch 1(A2);
rng f = NAT
proof
thus rng f c= NAT
proof
let a be element; assume a in rng f;
then consider b being element such that
A7: b in dom f & a = f.b by FUNCT_1:def 3;
consider n being Nat such that
A8: b = n-->x by A3,A7;
ex z being set st z = b & f.b = card z by A3,A7;
then a = card dom(n-->x) by A7,A8,CARD_1:62
.= card n by FUNCOP_1:13 .= n by CARD_1:def 2;
hence a in NAT by ORDINAL1:def 12;
end;
let n be Nat;
assume n in NAT;
A4: n-->x in Y;
then ex z being set st z = n-->x & f.(n-->x) = card z by A3;
then f.(n-->x) = card dom (n-->x) by CARD_1:62
.= card n by FUNCOP_1:13 .= n by CARD_1:def 2;
hence n in rng f by A3,A4,FUNCT_1:def 3;
end;
hence thesis by A1,A3,FINSET_1:8;
end;
end;
theorem
for f being ExecutionFunction of A, C-States(the generators of G),
(\falseC)-States(the generators of G, b) st
f in C-Execution(A,b,\falseC) & G is C-supported & i <> m &
s.(the_array_sort_of S).M <> {} holds
for n being Nat st
f.(s, m:=(\0(T,I),A)\;
for-do(i:=(\1(T,I),A), b gt(length(@M,I),@i,A), i:=(@i+\1(T,I),A),
if-then(b gt(@M.(@i), @M.(@m), A), m:=(@i,A)))).I.m = n
for X being non empty finite integer-membered set
st X = rng (s.(the_array_sort_of S).M)
holds (M.(n,I)) value_at(C,s) = max X
proof let f be ExecutionFunction of A, C-States(the generators of G),
(\falseC)-States(the generators of G, b) such that
ZZ: f in C-Execution(A,b,\falseC) & G is C-supported & i <> m and
Z9: s.(the_array_sort_of S).M <> {};
let n be Nat;
assume
Z0: f.(s, m:=(\0(T,I),A)\;
for-do(i:=(\1(T,I),A), b gt(length(@M,I),@i,A), i:=(@i+\1(T,I),A),
if-then(b gt(@M.(@i), @M.(@m), A), m:=(@i,A)
)
)
).I.m = n;
let X be non empty finite integer-membered set;
assume
Z1: X = rng (s.(the_array_sort_of S).M);
set ST = C-States(the generators of G);
set TV = (\falseC)-States(the generators of G, b);
defpred R[Element of ST] means
s.(the_array_sort_of S).M = $1.(the_array_sort_of S).M;
reconsider sm = s as ManySortedFunction of the generators of G,
the Sorts of C by AOFA_A00:48;
reconsider z = sm.(the_array_sort_of S).M as 0-based finite array of INT;
defpred P[Element of ST] means R[$1] &
$1.I.i in NAT & $1.I.m in NAT & $1.I.i <= len z & $1.I.m < $1.I.i &
$1.I.m < len z &
for mx being Integer st mx = $1.I.m
for j being Nat st j < $1.I.i
holds z.j <= z.mx;
defpred Q[Element of ST] means R[$1] &
$1.I.i < (length(@M,I)) value_at(C,s);
set s0 = s;
set s1 = f.(s,m:=(\0(T,I),A));
set s2 = f.(s1,i:=(\1(T,I),A));
set W = b gt(length(@M,I),@i,A);
set K = i:=(@i+\1(T,I),A);
set s3 = f.(s2,W);
set CJ = b gt(@M.(@i), @M.(@m), A);
set IJ = m:=(@i,A);
set J = if-then(CJ, IJ);
set a = the_array_sort_of S;
A7: I <> the bool-sort of S by AOFA_A00:53;
A8: f complies_with_if_wrt TV by AOFA_000:def 32;
G1: s1.I.m = \0(T,I) value_at(C,s) by ZZ,Th25;
G1a:\0(T,I) value_at(C,s) = 0 by Th13;
G2: s2.I.m = s1.I.m by ZZ,Th25;
G3: s2.I.i = \1(T,I) value_at(C,s1) by ZZ,Th25 .= 1 by Th14;
G5: s3.I.i = s2.I.i by ZZ,A7,Th25;
consider J1,K1,L1 being Element of S such that
AV: L1 = 1 & K1 = 1 & J1 <> L1 & J1 <> K1 &
(the connectives of S).11 is_of_type <*J1,K1*>, L1 &
(the connectives of S).(11+1) is_of_type <*J1,K1,L1*>, J1 &
(the connectives of S).(11+2) is_of_type <*J1*>, K1 &
(the connectives of S).(11+3) is_of_type <*K1,L1*>, J1 by AOFA_A00:def 51;
H5: (the Sorts of C).the_array_sort_of S = INT^omega &
(the Sorts of C).the bool-sort of S = BOOLEAN by Th33,AOFA_A00:def 32;
H3: the bool-sort of S <> I by AOFA_A00:53;
H1: the_array_sort_of S <> I by AV,Th31;
then
G8: s1.(the_array_sort_of S).M = s.(the_array_sort_of S).M by ZZ,Th25;
G9: s3.(the_array_sort_of S).M = s2.(the_array_sort_of S).M by H5,ZZ,Th25;
A1: P[s2]
proof
thus R[s2] by H1,ZZ,Th25,G8;
thus s2.I.i in NAT & s2.I.m in NAT by G1,G1a,G2,G3;
0 < len z & 0+1 = 1 by Z9,NAT_1:3;
hence s2.I.i <= len z & s2.I.m < s2.I.i & s2.I.m < len z
by G1,G1a,G2,G3,NAT_1:13;
let mx be Integer; assume
Z2: mx = s2.I.m;
let j be Nat; assume
Z3: j < s2.I.i;
1=0+1;
then j <= 0 & j >= 0 by Z3,G3,NAT_1:2,13;
then
B1: j = 0 by XXREAL_0:1;
thus z.j <= z.mx by B1,Z2,G1a,G2,ZZ,Th25;
end;
deffunc F(Element of ST)
= In((len(s0.(the_array_sort_of S).M))-$1.I.i,NAT);
C1: f.(s2,W) in TV iff Q[f.(s2,W)]
proof
D2: @i value_at(C,s2) < length(@M,I) value_at(C,s2) iff f.(s2, W) in TV
by ZZ,Th38;
length(@M,I) value_at(C,s2) = length(@M value_at(C,s2),I) by Th42
.= len (@M value_at(C,s2)) by Th33
.= len(s2.(the_array_sort_of S).M) by Th20
.= len(s0.(the_array_sort_of S).M) by H1,ZZ,Th25,G8
.= len(@M value_at(C,s0)) by Th20
.= length(@M value_at(C,s0), I) by Th33
.= length(@M,I) value_at(C,s0) by Th42;
hence thesis by H1,ZZ,Th25,G8,G9,G5,D2,Th20;
end;
C5a: len(@M value_at(C,s0))
= length(@M value_at(C,s0),I) by Th33
.= length(@M,I) value_at(C,s0) by Th42;
C2: for s being Element of ST st Q[s]
holds (Q[f.(s,J\;K\;W)] iff f.(s,J\;K\;W) in TV) & F(f.(s,J\;K\;W)) < F(s)
proof
let s be Element of ST;
assume Z3: Q[s];
C3: f.(s,J\;K\;W) = f.(f.(s, J\;K), W) & f.(s,J\;K) = f.(f.(s,J),K)
by AOFA_000:def 29;
hereby
C4: f.(s,J\;K\;W).I.i = f.(s,J\;K).I.i by H3,C3,ZZ,Th25;
D1: s.a.M = f.(s,CJ).a.M by H5,ZZ,Th25;
D2: s.I.i = f.(s,CJ).I.i by H3,ZZ,Th25;
C7: now
per cases;
suppose f.(s,CJ) in TV;
then f.(s,J) = f.(f.(s,CJ),IJ) by A8,AOFA_000:def 30;
hence f.(s,J).a.M = s.a.M & f.(s,J).I.i = s.I.i
by H1,ZZ,D1,D2,Th25;
end;
suppose f.(s,CJ) nin TV;
then f.(s,J) = f.(f.(s,CJ),EmptyIns A) by A8,AOFA_000:def 30;
hence f.(s,J).a.M = s.a.M & f.(s,J).I.i = s.I.i
by D1,D2,AOFA_000:def 28;
end;
end;
C8a: (f.(s,J\;K).(the_array_sort_of S).M)
= (s.(the_array_sort_of S).M) by C7,C3,H1,ZZ,Th25;
length(@M,I) value_at(C,f.(s,J\;K))
= length(@M value_at(C,f.(s,J\;K)),I) by Th42
.= len(@M value_at(C,f.(s,J\;K))) by Th33
.= len(f.(s,J\;K).(the_array_sort_of S).M) by Th20
.= len(@M value_at(C,s0)) by C8a,Z3,Th20;
then
Q[f.(s,J\;K\;W)] iff @i value_at(C,f.(s,J\;K)) <
length(@M,I) value_at(C,f.(s,J\;K))
by Z3,C4,C5a,C8a,C3,H5,ZZ,Th25,Th20;
hence Q[f.(s,J\;K\;W)] iff f.(s,J\;K\;W) in TV
by ZZ,C3,Th38;
end;
reconsider sJ = f.(s,J) as ManySortedFunction of the generators of G,
the Sorts of C by AOFA_A00:48;
reconsider a = sJ.I.i as Element of C,I;
A8: @i value_at(C,f.(s,J)) = f.(s,J).I.i &
\1(T,I) value_at(C,f.(s,J)) = 1 by Th14,Th20;
f.(s,J\;K\;W) = f.(f.(s,J\;K),W) by AOFA_000:def 29
.= f.(f.(f.(s,J),K),W) by AOFA_000:def 29;
then
AE: f.(s,J\;K\;W).I.i
= f.(f.(s,J),K).I.i by ZZ,Th25,H3
.= (@i+\1(T,I)) value_at(C,f.(s,J)) by ZZ,Th25
.= (@i value_at(C,f.(s,J)))+(\1(T,I) value_at(C,f.(s,J))) by Th16
.= f.(s,J).I.i + 1 by A8,AOFA_A00:55;
@M value_at(C,s0) = s0.(the_array_sort_of S).M &
s.I.i < (length(@M,I)) value_at(C,s0) &
(length(@M,I)) value_at(C,s0) = length(@M value_at(C,s0),I)
by Z3,Th20,Th42;
then
BA: s.I.i < len(s0.(the_array_sort_of S).M) by Th33;
then
AA: (len(s0.(the_array_sort_of S).M))-s.I.i > 0 by XREAL_1:50;
(len(s0.(the_array_sort_of S).M))-s.I.i >= 0+1 by BA,XREAL_1:50,INT_1:7;
then
BB: (len(s0.(the_array_sort_of S).M))-s.I.i-1 >= 1-1 by XREAL_1:9;
per cases;
suppose @M.(@i) value_at(C,s) > @M.(@m) value_at(C,s);
then f.(s,CJ) in TV & f complies_with_if_wrt TV
by ZZ,Th38,AOFA_000:def 32;
then
A9: f.(s,J).I.i = f.(f.(s,CJ),IJ).I.i by AOFA_000:def 30
.= f.(s,CJ).I.i by ZZ,Th25
.= s.I.i by H3,ZZ,Th25;
F(f.(s,J\;K\;W)) = (len(s0.(the_array_sort_of S).M))-s.I.i-1
by AE,A9,BB,INT_1:3,SUBSET_1:def 8;
then F(f.(s,J\;K\;W)) = F(s)-1 by AA,INT_1:3,SUBSET_1:def 8;
hence F(f.(s,J\;K\;W)) < F(s) by XREAL_1:44;
end;
suppose @M.(@i) value_at(C,s) <= @M.(@m) value_at(C,s);
then f.(s,CJ) nin TV & f complies_with_if_wrt TV
by ZZ,Th38,AOFA_000:def 32;
then f.(s,J) = f.(f.(s,CJ),EmptyIns A) by AOFA_000:def 30
.= f.(s,CJ) by AOFA_000:def 28;
then f.(s,J).I.i = s.I.i by ZZ,Th25,H3;
then F(f.(s,J\;K\;W))
= len(s0.(the_array_sort_of S).M)-s.I.i-1
by AE,BB,INT_1:3,SUBSET_1:def 8
.= F(s)-1 by AA,INT_1:3,SUBSET_1:def 8;
hence F(f.(s,J\;K\;W)) < F(s) by XREAL_1:44;
end;
end;
A2: f iteration_terminates_for J\;K\;W, f.(s2,W) from AOFA_000:sch 3(C1,C2);
A3: for s being Element of ST st P[s] & s in TV & Q[s]
holds P[f.(s,J\;K)]
proof
let s be Element of ST;
assume Z2: P[s];
assume s in TV;
assume Z4: Q[s];
D1: s.a.M = f.(s,CJ).a.M by H5,ZZ,Th25;
thus R[f.(s,J\;K)]
proof
per cases;
suppose f.(s,CJ) in TV;
then f.(s,J) = f.(f.(s,CJ),IJ) by A8,AOFA_000:def 30;
then
D2: f.(s,J).a.M = s0.a.M by Z2,H1,ZZ,D1,Th25;
f.(s,J\;K) = f.(f.(s,J),K) by AOFA_000:def 29;
hence thesis by D2,H1,ZZ,Th25;
end;
suppose f.(s,CJ) nin TV;
then f.(s,J) = f.(f.(s,CJ),EmptyIns A) by A8,AOFA_000:def 30;
then
D2: f.(s,J).a.M = s0.a.M by Z2,D1,AOFA_000:def 28;
f.(s,J\;K) = f.(f.(s,J),K) by AOFA_000:def 29;
hence thesis by D2,H1,ZZ,Th25;
end;
end;
F3: @i value_at(C,f.(s,J)) = f.(s,J).I.i & @i value_at(C,s) = s.I.i &
@m value_at(C,s) = s.I.m & \1(T,I) value_at(C,f.(s,J)) = 1
by Th20,Th14;
F4: f.(s,J\;K) = f.(f.(s,J),K) by AOFA_000:def 29;
then
F5: f.(s,J\;K).I.i = (@i+\1(T,I)) value_at(C,f.(s,J)) by ZZ,Th25
.= (@i value_at(C,f.(s,J)))+(\1(T,I) value_at(C,f.(s,J))) by Th16
.= f.(s,J).I.i+1 by F3,AOFA_A00:55;
F6: f.(s,J\;K).I.m = f.(s,J).I.m by F4,ZZ,Th25;
F8: f.(s,CJ).I.i = s.I.i & f.(s,CJ).I.m = s.I.m &
f.(s,CJ).a.M = s.a.M by H5,H3,ZZ,Th25;
J0: s.I.i is Nat & @M value_at(C,s) = s.a.M & @M value_at(C,s0) = s0.a.M
by Z2,Th20;
then
J1: @i value_at(C,s) in dom (@M value_at(C,s)) by F3,C5a,Z4,NAT_1:44;
J2: @m value_at(C,s) in dom (@M value_at(C,s)) by J0,F3,Z2,NAT_1:44;
F9: z.(s.I.i) = (@M value_at(C,s)).(s.I.i) by Z2,Th20
.= (@M value_at(C,s) qua Function).(@i value_at(C,s))
by Th20
.= (@M value_at(C,s)).(@i value_at(C,s)) by J1,Th33
.= @M.(@i) value_at(C,s) by Th41;
FA: z.(s.I.m) = (@M value_at(C,s)).(s.I.m) by Z2,Th20
.= (@M value_at(C,s) qua Function).(@m value_at(C,s))
by Th20
.= (@M value_at(C,s)).(@m value_at(C,s)) by J2,Th33
.= @M.(@m) value_at(C,s) by Th41;
FB: now per cases;
case
z.(s.I.i) > z.(s.I.m);
then f.(s,CJ) in TV by ZZ,F9,FA,Th38;
then
J4: f.(s,J) = f.(f.(s,CJ),IJ) by A8,AOFA_000:def 30;
hence f.(s,J).I.i = s.I.i by F8,ZZ,Th25;
thus f.(s,J).I.m = @i value_at(C,f.(s,CJ)) by J4,ZZ,Th25
.= s.I.i by F8,Th20;
thus f.(s,J).a.M = s.a.M by J4,F8,ZZ,H1,Th25;
end;
case
z.(s.I.i) <= z.(s.I.m);
then f.(s,CJ) nin TV by ZZ,F9,FA,Th38;
then
J4: f.(s,J) = f.(f.(s,CJ),EmptyIns A) by A8,AOFA_000:def 30;
hence f.(s,J).I.i = s.I.i by F8,AOFA_000:def 28;
thus f.(s,J).I.m = s.I.m by J4,F8,AOFA_000:def 28;
thus f.(s,J).a.M = s.a.M by J4,F8,AOFA_000:def 28;
end;
end;
reconsider sIi = s.I.i as Element of NAT by Z2;
I1: f.(s,J\;K).I.i = sIi+1 & sIi+1 in NAT by F5,FB,ORDINAL1:def 12;
thus f.(s,J\;K).I.i in NAT & f.(s,J\;K).I.m in NAT
by FB,Z2,F4,ZZ,Th25,F5,ORDINAL1:def 12;
len z = length(@M,I) value_at(C,s0) by C5a,Th20;
hence
f.(s,J\;K).I.i <= len z by FB,F5,Z4,INT_1:7;
thus f.(s,J\;K).I.m < f.(s,J\;K).I.i by FB,F5,F6,Z2,NAT_1:13;
thus f.(s,J\;K).I.m < len z by C5a,Th20,FB,F6,Z2,Z4;
let mx be Integer;
assume
F1: mx = f.(s,J\;K).I.m;
let j be Nat; assume
F2: j < f.(s,J\;K).I.i;
per cases by F2,I1,NAT_1:22;
suppose
j < s.I.i & z.(s.I.i) <= z.(s.I.m);
hence z.j <= z.mx by F1,Z2,FB,F6;
end;
suppose
j < s.I.i & z.(s.I.i) > z.(s.I.m);
then z.j <= z.(s.I.m) by Z2;
hence z.j <= z.mx by F1,FB,F6,XXREAL_0:2;
end;
suppose
j = s.I.i & z.(s.I.i) <= z.(s.I.m);
hence z.j <= z.mx by F1,FB,F4,ZZ,Th25;
end;
suppose
j = s.I.i & z.(s.I.i) > z.(s.I.m);
hence z.j <= z.mx by F1,FB,F4,ZZ,Th25;
end;
end;
A4: for s being Element of ST st P[s] holds
P[f.(s,W)] &
(f.(s,W) in TV iff Q[f.(s,W)])
proof
let s be Element of ST;
assume Z5: P[s];
thus R[f.(s,W)] by Z5,ZZ,H5,Th25;
I3: f.(s,W).I.i = s.I.i & f.(s,W).I.m = s.I.m by ZZ,H3,Th25;
thus f.(s,W).I.i in NAT & f.(s,W).I.m in NAT by Z5,ZZ,H3,Th25;
thus f.(s,W).I.i <= len z & f.(s,W).I.m < f.(s,W).I.i by I3,Z5;
thus f.(s,W).I.m < len z by ZZ,H3,Th25,Z5;
thus for mx being Integer st mx = f.(s,W).I.m
for j being Nat st j < f.(s,W).I.i holds z.j <= z.mx by I3,Z5;
C5c: length(@M,I) value_at(C,s)
= length(@M value_at(C,s),I) by Th42
.= len(@M value_at(C,s)) by Th33
.= len(s.(the_array_sort_of S).M) by Th20
.= len(@M value_at(C,s0)) by Z5,Th20;
hereby
assume f.(s,W) in TV;
then @i value_at(C,s) < length(@M,I) value_at(C,s) &
s.I.i = @i value_at(C,s) by ZZ,Th38,Th20;
hence Q[f.(s,W)] by Z5,ZZ,H3,Th25,H5,C5a,C5c;
end;
assume Q[f.(s,W)];
then @i value_at(C,s) < length(@M,I) value_at(C,s)
by I3,C5a,C5c,Th20;
hence f.(s,W) in TV by ZZ,Th38;
end;
A5: P[f.(s2, while(W, J\;K))] &
not Q[f.(s2, while(W, J\;K))]
from AOFA_000:sch 5(A1,A2,A3,A4);
AR: f.(s, m:=(\0(T,I),A)\;for-do(i:=(\1(T,I),A),W,K,J))
= f.(s1, for-do(i:=(\1(T,I),A),W,K,J)) by AOFA_000:def 29
.= f.(f.(s1, i:=(\1(T,I),A)), while(W, J\;K)) by AOFA_000:def 29;
then
X2: n in dom z by A5,Z0,NAT_1:44;
X4: ^(n,T,I) value_at(C,s) = n by Th65;
X3: z = @M value_at(C,s) by Th20;
X1: z.(f.(s, m:=(\0(T,I),A)\;for-do(i:=(\1(T,I),A),W,K,J)).I.m)
= (@M value_at(C,s)).(^(n,T,I) value_at(C,s)) by X2,X3,X4,Th33,Z0
.= (@M. ^(n,T,I)) value_at(C,s) by Th41;
A6: (M.(n,I)) value_at(C,s) is UpperBound of X
proof
let x be ext-real number;
assume x in X;
then consider j being element such that
A7: j in dom z & x = z.j by Z1,FUNCT_1:def 3;
reconsider j as Nat by A7;
f.(s,m:=(\0(T,I),A)\;for-do(i:=(\1(T,I),A),W,K,J)).I.i <= len z &
f.(s,m:=(\0(T,I),A)\;for-do(i:=(\1(T,I),A),W,K,J)).I.i >= len z
by C5a,Th20,A5,AR;
then f.(s,m:=(\0(T,I),A)\;for-do(i:=(\1(T,I),A),W,K,J)).I.i = len z &
j < len z by A7,NAT_1:44,XXREAL_0:1;
hence thesis by X1,A7,A5,AR;
end;
for x being UpperBound of X holds (M.(n,I)) value_at(C,s) <= x
proof
let x be UpperBound of X;
n in dom z & M.(n,I) value_at(C,s) = z.n by A5,AR,X1,Z0,NAT_1:44;
then M.(n,I) value_at(C,s) in X by Z1,FUNCT_1:def 3;
hence (M.(n,I)) value_at(C,s) <= x by XXREAL_2:def 1;
end;
hence (M.(n,I)) value_at(C,s) = max X by A6,XXREAL_2:def 3;
end;
theorem Th72:
for A being elementary IfWhileAlgebra of the generators of G
for f being ExecutionFunction of A, C-States(the generators of G),
(\falseC)-States(the generators of G,b) st
f in C-Execution(A,b,\falseC) & G is C-supported
for t0,t1 being Element of T,I for J being Algorithm of A
for P being set st
P is_invariant_wrt i:=(t0,A),f &
P is_invariant_wrt b gt(t1,@i,A),f &
P is_invariant_wrt i:=(@i+\1(T,I),A),f &
P is_invariant_wrt J,f & J is_terminating_wrt f,P &
for s holds f.(s,J).I.i = s.I.i & f.(s,b gt(t1,@i,A)).I.i = s.I.i &
t1 value_at(C,f.(s, b gt(t1,@i,A))) = t1 value_at(C,s) &
t1 value_at(C,f.(s, J\;i:=(@i+\1(T,I),A))) =
t1 value_at(C,s)
holds
for-do(i:=(t0,A),b gt(t1,@i,A),i:=(@i+\1(T,I),A), J) is_terminating_wrt f, P
proof
let A be elementary IfWhileAlgebra of the generators of G;
let f be ExecutionFunction of A, C-States(the generators of G),
(\falseC)-States(the generators of G,b);
assume
ZZ: f in C-Execution(A,b,\falseC) & G is C-supported;
let t0,t1 be Element of T,I;
let J be Algorithm of A;
let P be set;
assume Z0: P is_invariant_wrt i:=(t0,A),f;
assume Z1: P is_invariant_wrt b gt(t1,@i,A),f;
assume Z2: P is_invariant_wrt i:=(@i+\1(T,I),A),f;
assume Z3: P is_invariant_wrt J,f;
assume Z4: J is_terminating_wrt f,P;
set W = b gt(t1,@i,A);
set L = i:=(@i+\1(T,I),A);
set K = i:=(t0,A);
set ST = C-States(the generators of G);
set TV = (\falseC)-States(the generators of G, b);
assume Z5: for s holds f.(s,J).I.i = s.I.i & f.(s,W).I.i = s.I.i &
t1 value_at(C,f.(s, W)) = t1 value_at(C,s) &
t1 value_at(C,f.(s, J\;L)) = t1 value_at(C,s);
A1: K is_terminating_wrt f, P by AOFA_000:107;
L is_terminating_wrt f,P by AOFA_000:107;
then
A2: W is_terminating_wrt f & J\;L is_terminating_wrt f,P
by Z3,Z4,AOFA_000:104,111;
A3: for s st s in P & f.(f.(s,J\;L),W) in TV holds f.(s,J\;L) in P
by Z3,Z2,AOFA_000:109,def 39;
for s st f.(s,W) in P holds f iteration_terminates_for J\;L\;W, f.(s,W)
proof let s; assume
f.(s,W) in P;
defpred P[Element of ST] means $1.I.i < t1 value_at(C,$1);
deffunc F(Element of ST) = In((t1 value_at(C,$1))-$1.I.i, NAT);
@i value_at(C,s) = s.I.i &
f.(s,W).I.i = s.I.i & t1 value_at(C,f.(s,W)) = t1 value_at(C,s)
by Z5,Th20;
then
A4: f.(s,W) in TV iff P[f.(s,W)] by ZZ,Th38;
A5: for s being Element of ST st P[s]
holds (P[f.(s,J\;L\;W)] iff f.(s,J\;L\;W) in TV) &
F(f.(s,J\;L\;W)) < F(s)
proof
let s; assume
A7: P[s];
A6: f.(s,J\;L\;W) = f.(f.(s, J\;L), W) by AOFA_000:def 29;
then @i value_at(C,f.(s,J\;L)) = f.(s,J\;L).I.i &
f.(s,J\;L\;W).I.i = f.(s,J\;L).I.i &
t1 value_at(C,f.(s,J\;L\;W)) = t1 value_at(C,f.(s,J\;L))
by Z5,Th20;
hence P[f.(s,J\;L\;W)] iff f.(s,J\;L\;W) in TV by A6,ZZ,Th38;
AR: s.I.i+1 <= t1 value_at(C,s) by A7,INT_1:7;
A9: (@i value_at(C,f.(s,J)))+(\1(T,I)value_at(C,f.(s,J)))
= (@i value_at(C,f.(s,J)) qua Integer)+(\1(T,I)value_at(C,f.(s,J)))
by AOFA_A00:55;
F(f.(s,J\;L\;W))
= In((t1 value_at(C,f.(f.(s,J\;L),W)))-f.(s,J\;L\;W).I.i, NAT)
by AOFA_000:def 29
.= In((t1 value_at(C,f.(s,J\;L)))-f.(s,J\;L\;W).I.i, NAT) by Z5
.= In((t1 value_at(C,s))-f.(s,J\;L\;W).I.i, NAT) by Z5
.= In((t1 value_at(C,s))-f.(f.(s,J\;L),W).I.i, NAT) by AOFA_000:def 29
.= In((t1 value_at(C,s))-f.(s,J\;L).I.i, NAT) by Z5
.= In((t1 value_at(C,s))-f.(f.(s,J),L).I.i, NAT) by AOFA_000:def 29
.= In((t1 value_at(C,s) qua Integer)
-((@i+\1(T,I))value_at(C,f.(s,J))), NAT) by ZZ,Th25
.= In((t1 value_at(C,s))-((@i value_at(C,f.(s,J)) qua Integer)+
(\1(T,I)value_at(C,f.(s,J)))), NAT) by A9,Th16
.= In((t1 value_at(C,s))-(f.(s,J).I.i+
(\1(T,I)value_at(C,f.(s,J)))), NAT) by Th20
.= In((t1 value_at(C,s))-(s.I.i+(\1(T,I)value_at(C,f.(s,J)))), NAT)
by Z5
.= In((t1 value_at(C,s))-(s.I.i+1), NAT) by Th14
.= (t1 value_at(C,s))-s.I.i-1 by AR,INT_1:5,SUBSET_1:def 8
.= F(s)-1 by A7,INT_1:5,SUBSET_1:def 8;
hence F(f.(s,J\;L\;W)) < F(s) by XREAL_1:44;
end;
thus f iteration_terminates_for J\;L\;W, f.(s,W)
from AOFA_000:sch 3(A4,A5);
end;
then while(W,J\;L) is_terminating_wrt f, P by Z1,A2,A3,AOFA_000:118;
hence for-do(K,W,L, J) is_terminating_wrt f, P by Z0,A1,AOFA_000:111;
end;
theorem
for A being elementary IfWhileAlgebra of the generators of G
for f being ExecutionFunction of A, C-States(the generators of G),
(\falseC)-States(the generators of G,b) holds
f in C-Execution(A,b,\falseC) & G is C-supported & i <> m implies
m:=(\0(T,I),A)\;
for-do(i:=(\1(T,I),A), b gt(length(@M,I),@i,A), i:=(@i+\1(T,I),A),
if-then(b gt(@M.(@i), @M.(@m), A), m:=(@i,A)))
is_terminating_wrt f, {s: s.(the_array_sort_of S).M <> {}}
proof
let A be elementary IfWhileAlgebra of the generators of G;
let f be ExecutionFunction of A, C-States(the generators of G),
(\falseC)-States(the generators of G,b);
assume Z0: f in C-Execution(A,b,\falseC);
assume Z1: G is C-supported;
assume Z2: i <> m;
set J = m:=(\0(T,I),A);
set K = i:=(\1(T,I),A);
set W = b gt(length(@M,I),@i,A);
set L = i:=(@i+\1(T,I),A);
set N = b gt(@M.(@i), @M.(@m), A);
set O = m:=(@i,A);
set a = the_array_sort_of S;
set P = {s: s.(a).M <> {}};
AR: (the Sorts of C).the bool-sort of S = BOOLEAN &
(the Sorts of C).a = INT^omega by Th33,AOFA_A00:def 32;
then
A4: the bool-sort of S <> a & I <> a & the bool-sort of S <> I
by Th32,AOFA_A00:53;
A2: P is_invariant_wrt J, f
proof
let s; assume s in P;
then consider s1 such that
A3: s = s1 & s1.a.M <> {};
f.(s,J).a.M = s.a.M by Z0,Z1,A4,Th25;
hence thesis by A3;
end;
A5: P is_invariant_wrt K,f
proof
let s; assume s in P;
then consider s1 such that
A3: s = s1 & s1.a.M <> {};
f.(s,K).a.M = s.a.M by Z0,Z1,A4,Th25;
hence thesis by A3;
end;
A6: P is_invariant_wrt W,f
proof
let s; assume s in P;
then consider s1 such that
A3: s = s1 & s1.a.M <> {};
f.(s,W).a.M = s.a.M by Z0,Z1,AR,Th25;
hence thesis by A3;
end;
A7: P is_invariant_wrt L,f
proof
let s; assume s in P;
then consider s1 such that
A3: s = s1 & s1.a.M <> {};
f.(s,L).a.M = s.a.M by Z0,Z1,A4,Th25;
hence thesis by A3;
end;
A8: P is_invariant_wrt N,f
proof
let s; assume s in P;
then consider s1 such that
A3: s = s1 & s1.a.M <> {};
f.(s,N).a.M = s.a.M by Z0,Z1,AR,Th25;
hence thesis by A3;
end;
A9: P is_invariant_wrt O,f
proof
let s; assume s in P;
then consider s1 such that
A3: s = s1 & s1.a.M <> {};
f.(s,O).a.M = s.a.M by Z0,Z1,A4,Th25;
hence thesis by A3;
end;
set ST = C-States(the generators of G);
set TV = (\falseC)-States(the generators of G, b);
AA: f complies_with_if_wrt TV by AOFA_000:def 32;
A10: P is_invariant_wrt if-then(N,O), f
proof
let s; assume s in P;
then
B2: f.(s,N) in P by A8,AOFA_000:def 39;
per cases;
suppose f.(s, N) in TV;
then f.(s,if-then(N,O)) = f.(f.(s,N),O) by AA,AOFA_000:def 30;
hence thesis by B2,A9,AOFA_000:def 39;
end;
suppose f.(s, N) nin TV;
then f.(s,if-then(N,O)) = f.(f.(s,N),EmptyIns A) by AA,AOFA_000:def 30;
hence thesis by B2,AOFA_000:def 28;
end;
end;
AC: J is_terminating_wrt f,P by AOFA_000:107;
for s holds f.(s,if-then(N,O)).I.i = s.I.i & f.(s,W).I.i = s.I.i &
length(@M,I) value_at(C,f.(s,W)) = length(@M,I) value_at(C,s) &
length(@M,I) value_at(C,f.(s,if-then(N,O)\;L)) =
length(@M,I) value_at(C,s)
proof
let s;
hereby
per cases;
suppose f.(s,N) in TV;
then f.(s,if-then(N,O)) = f.(f.(s,N),O) by AA,AOFA_000:def 30;
hence f.(s,if-then(N,O)).I.i = f.(s,N).I.i by Z0,Z1,Z2,Th25
.= s.I.i by Z0,Z1,A4,Th25;
end;
suppose f.(s,N) nin TV;
then f.(s,if-then(N,O)) = f.(f.(s,N),EmptyIns A)
by AA,AOFA_000:def 30;
hence f.(s,if-then(N,O)).I.i = f.(s,N).I.i by AOFA_000:def 28
.= s.I.i by Z0,Z1,A4,Th25;
end;
end;
B4: now
per cases;
suppose f.(s,N) in TV;
then f.(s,if-then(N,O)) = f.(f.(s,N),O) by AA,AOFA_000:def 30;
hence f.(s,if-then(N,O)).a.M = f.(s,N).a.M by Z0,Z1,A4,Th25
.= s.a.M by Z0,Z1,AR,Th25;
end;
suppose f.(s,N) nin TV;
then f.(s,if-then(N,O)) = f.(f.(s,N),EmptyIns A)
by AA,AOFA_000:def 30;
hence f.(s,if-then(N,O)).a.M = f.(s,N).a.M by AOFA_000:def 28
.= s.a.M by Z0,Z1,AR,Th25;
end;
end;
thus f.(s,W).I.i = s.I.i by Z0,Z1,A4,Th25;
B3: @M value_at(C,f.(s,if-then(N,O)\;L))
= f.(s,if-then(N,O)\;L).a.M &
@M value_at(C,f.(s,W)) = f.(s,W).a.M & @M value_at(C,s) = s.a.M by Th20;
thus length(@M,I) value_at(C,f.(s,W))
= length(@M value_at(C,f.(s,W)),I) by Th42
.= len(f.(s,W).a.M) by B3,Th33
.= len(s.a.M) by Z0,Z1,AR,Th25
.= length(@M value_at(C,s),I) by B3,Th33
.= length(@M,I) value_at(C,s) by Th42;
thus length(@M,I) value_at(C,f.(s,if-then(N,O)\;L))
= length(@M value_at(C,f.(s,if-then(N,O)\;L)),I) by Th42
.= len(f.(s,if-then(N,O)\;L).a.M) by B3,Th33
.= len(f.(f.(s,if-then(N,O)),L).a.M) by AOFA_000:def 29
.= len(f.(s,if-then(N,O)).a.M) by Z0,Z1,A4,Th25
.= length(@M value_at(C,s),I) by B3,B4,Th33
.= length(@M,I) value_at(C,s) by Th42;
end;
then for-do(K,W,L,if-then(N,O)) is_terminating_wrt f, P
by Z0,Z1,A5,A6,A7,A10,Th72,AOFA_000:107;
hence thesis by A2,AC,AOFA_000:111;
end;
begin :: Sorting by exchanging
reserve i1,i2 for pure Element of (the generators of G).I;
definition
let S,X,T,G;
attr G is integer-array means: INTARR2:
for I holds
{@M.t where t is Element of T,I: not contradiction}
c= (the generators of G).I &
for M for t being Element of T,I
for g being Element of G,I st g = @M.t
ex x st x nin (vf t).I & supp-var g = x &
(supp-term g).(the_array_sort_of S).M = (@M,t)<-@x &
for s being SortSymbol of S
for y st y in (vf g).s & (s = the_array_sort_of S implies y <> M)
holds (supp-term g).s.y = y;
end;
theorem Th81:
G is integer-array implies
for t being Element of T,I holds @M.t in (the generators of G).I
proof
assume
A0: G is integer-array;
let t be Element of T,I;
A1: @M.t in {@N.q where q is Element of T,I: not contradiction};
{@N.q where q is Element of T,I: not contradiction}
c= (the generators of G).I by A0,INTARR2;
hence @M.t in (the generators of G).I by A1;
end;
definition
func (#INT,<=#) -> strict real non empty Poset equals RealPoset INT;
coherence;
end;
definition
let S,X,T,G;
let A be elementary IfWhileAlgebra of the generators of G;
let a be SortSymbol of S;
let t1,t2 be Element of T,a such that
A: t1 in (the generators of G).a;
func t1:=(t2,A) -> absolutely-terminating Algorithm of A equals: ASSIG:
(the assignments of A).[t1,t2];
coherence
proof
reconsider x = t1 as Element of (the generators of G).a by A;
(the assignments of A).[t1,t2] = x:=(t2,A);
hence thesis;
end;
end;
theorem Th77:
for X being countable non-empty ManySortedSet of the carrier of S
for T being vf-free (X,S)-terms integer-array non-empty VarMSAlgebra over S
for G being basic GeneratorSystem over S,X,T
for M being pure Element of (the generators of G).the_array_sort_of S
for i,x being pure Element of (the generators of G).I holds
@M.@i <> x
proof
let X be countable non-empty ManySortedSet of the carrier of S;
let T be vf-free (X,S)-terms integer-array non-empty VarMSAlgebra over S;
let G be basic GeneratorSystem over S,X,T;
let M be pure Element of (the generators of G).the_array_sort_of S;
let i,x be pure Element of (the generators of G).I;
set C = the (11,1,1)-array (4,1) integer bool-correct non-empty image of T;
set ST = C-States the generators of G;
assume
A1: @M.@i = x;
set q = the ManySortedFunction of FreeGen T, the Sorts of C;
set g = q+*(I,x,0)+*(the_array_sort_of S,M,<%1%>)+*(I,i,0);
set a = the_array_sort_of S;
consider h being ManySortedFunction of T,C such that
A3: h is_homomorphism T,C & h||FreeGen T = g by MSAFREE4:def 9;
reconsider s = h||the generators of G as Element of ST
by A3,AOFA_A00:def 19;
A2: the_array_sort_of S <> I by Th32;
A4: @M value_at(C,s) = s.(the_array_sort_of S).M &
@i value_at(C,s) = s.I.i &
@M.@i value_at(C,s) = (@M value_at(C,s)).(@i value_at(C,s)) by Th41,Th20;
A5: i in (FreeGen T).I & x in (FreeGen T).I & M in (FreeGen T).a by PURE;
A7: dom ((q+*(I,x,0)+*(a,M,<%1%>)).I) = (FreeGen T).I &
0 in INT & INT = (the Sorts of C).I
by INT_1:def 2,AOFA_A00:55,FUNCT_2:def 1;
((h.I)|((the generators of G).I)).i = h.I.i by FUNCT_1:49;
then
A6: s.I.i = h.I.i by MSAFREE:def 1
.= ((h.I)|((FreeGen T).I)).i by PURE,FUNCT_1:49
.= g.I.i by A3,MSAFREE:def 1
.= (((q+*(I,x,0)+*(a,M,<%1%>)).I)+*(i,0)).i by A5,A7,AOFA_A00:def 2
.= 0 by PURE,A7,FUNCT_7:31;
reconsider 01 = 1 as Element of INT by INT_1:def 2;
A8: <%01%> in INT^omega & (the Sorts of C).a = INT^omega &
dom ((q+*(I,x,0)).a) = (FreeGen T).a & dom (q.I) = (FreeGen T).I &
dom ((q+*(I,x,0)+*(a,M,<%1%>)).a) = (FreeGen T).a
by Th33,AFINSQ_1:def 7,FUNCT_2:def 1;
A9: s.a.M = ((h.a)|((the generators of G).a)).M by MSAFREE:def 1
.= h.a.M by FUNCT_1:49
.= ((h.a)|((FreeGen T).a)).M by PURE,FUNCT_1:49
.= g.a.M by A3,MSAFREE:def 1
.= (q+*(I,x,0)+*(a,M,<%1%>)).a.M by A5,A7,A2,AOFA_A00:def 2
.= (q+*(I,x,0)).a+*(M,<%1%>).M by A8,A5,AOFA_A00:def 2
.= <%1%> by PURE,A8,FUNCT_7:31;
s.I.i in 1 by A6,NAT_1:44;
then s.I.i in dom(s.a.M) by A9,AFINSQ_1:33;
then @x value_at(C,s) = s.a.M.(s.I.i) by A1,A4,Th33;
then
AB: s.I.x = <%1%>.(s.I.i) by A9,Th20
.= 1 by A6,AFINSQ_1:34;
s.I.x = ((h.I)|((the generators of G).I)).x by MSAFREE:def 1
.= h.I.x by FUNCT_1:49
.= ((h.I)|((FreeGen T).I)).x by PURE,FUNCT_1:49
.= g.I.x by A3,MSAFREE:def 1
.= ((q+*(I,x,0)+*(a,M,<%1%>)).I+*(i,0)).x by A5,A7,AOFA_A00:def 2
.= (q+*(I,x,0)+*(a,M,<%1%>)).I.x by A6,AB,FUNCT_7:32
.= (q+*(I,x,0)).I.x by A2,A5,A8,AOFA_A00:def 2
.= ((q.I)+*(x,0)).x by A5,A7,AOFA_A00:def 2
.= 0 by PURE,A8,FUNCT_7:31;
hence contradiction by AB;
end;
registration
let S be non empty non void ManySortedSign;
let A be disjoint_valued MSAlgebra over S;
cluster the Sorts of A -> disjoint_valued;
coherence by MSAFREE1:def 2;
end;
definition
let S,X;
let T be (X,S)-terms MSAlgebra over S;
attr T is array-degenerated means: ADEG:
ex I st
ex M being Element of (FreeGen T).the_array_sort_of S st
ex t being Element of T,I st
@M.t <> Sym(In((the connectives of S).11, the carrier' of S),X)-tree<*M,t*>;
end;
registration
let S,X;
cluster Free(S,X) -> non array-degenerated;
coherence
proof set T = Free(S,X);
let I;
let M be Element of (FreeGen T).the_array_sort_of S;
let t be Element of T,I;
set o = In((the connectives of S).11, the carrier' of S);
A1: Free(S,X) = FreeMSA X by MSAFREE3:31;
consider J1,K1,L1 being Element of S such that
AV: L1 = 1 & K1 = 1 & J1 <> L1 & J1 <> K1 &
(the connectives of S).11 is_of_type <*J1,K1*>, L1 &
(the connectives of S).(11+1) is_of_type <*J1,K1,L1*>, J1 &
(the connectives of S).(11+2) is_of_type <*J1*>, K1 &
(the connectives of S).(11+3) is_of_type <*K1,L1*>, J1 by AOFA_A00:def 51;
AY: I = 1 by AOFA_A00:def 40;
AZ: the_array_sort_of S = J1 by AV,Th31;
11+3 <= len the connectives of S by AOFA_A00:def 51;
then 11 <= len the connectives of S by XXREAL_0:2;
then 11 in dom the connectives of S by FINSEQ_3:25;
then (the connectives of S).11 = o by FUNCT_1:102,SUBSET_1:def 8;
then the_arity_of o = <*the_array_sort_of S, I*>
by AV,AZ,AY,AOFA_A00:def 9;
then
Args(o, T) = product <*(the Sorts of T).the_array_sort_of S,
(the Sorts of T).I*> by Th7b;
then
<*@M,t*> in Args(o,T) by FINSEQ_3:124;
then
@M.t = [In((the connectives of S).11, the carrier' of S),the carrier of S]
-tree<*M,t*> by A1,INSTALG1:3;
hence thesis by MSAFREE:def 9;
end;
end;
registration
let S,X;
cluster non array-degenerated for (X,S)-terms MSAlgebra over S;
existence
proof
take Free(S,X);
thus thesis;
end;
end;
theorem Th78:
T is non array-degenerated implies
vf (@M.@i) = (I-singleton i) (\/) ((the_array_sort_of S)-singleton M)
proof set t = @M.@i;
assume
Z0: T is non array-degenerated;
reconsider N = M as Element of (FreeGen T).the_array_sort_of S by PURE;
@N = @M; then
A2: @M.@i = Sym(In((the connectives of S).11, the carrier' of S),X)-tree<*M,i*>
by Z0,ADEG;
A7: <*M,i*>.(0+1) = M & <*M,i*>.(1+1) = i & len <*M,i*> = 2 by FINSEQ_1:44;
then
A3: t|<*0*> = M & t|<*1*> = i by A2,TREES_4:def 4;
M in (FreeGen T).the_array_sort_of S by PURE;
then M in FreeGen(the_array_sort_of S, X) by MSAFREE:def 16;
then consider m being set such that
A4: m in X.the_array_sort_of S & M = root-tree[m,the_array_sort_of S]
by MSAFREE:def 15;
i in (FreeGen T).I by PURE;
then i in FreeGen(I, X) by MSAFREE:def 16;
then consider j being set such that
A5: j in X.I & i = root-tree[j,I] by MSAFREE:def 15;
(t|<*0*>).{} = [m,the_array_sort_of S] & (t|<*1*>).{} = [j,I]
by A3,A4,A5,TREES_4:3;
then
A6: ((t|<*0*>).{})`2 = the_array_sort_of S & ((t|<*1*>).{})`2 = I by MCART_1:7;
{} in dom root-tree[m,the_array_sort_of S] & {} in dom root-tree[j,I]
by TREES_1:22;
then <*0*>^{} in dom t & <*1*>^{} in dom t by A2,A4,A5,A7,TREES_4:11;
then
A8: <*0*> in dom t & <*1*> in dom t by FINSEQ_1:34;
B6: the_array_sort_of S <> I by Th32;
C1: {M} = (vf t).the_array_sort_of S
proof
set A = {t|p where p is Element of dom t: ((t|p).{})`2
= the_array_sort_of S};
B1: M in A & A = (vf t).the_array_sort_of S
by A3,A6,A8,AOFA_A00:def 12;
hence {M} c= (vf t).the_array_sort_of S by ZFMISC_1:31;
let x be element; assume x in (vf t).the_array_sort_of S;
then consider p being Element of dom t such that
B2: x = t|p & ((t|p).{})`2 = the_array_sort_of S by B1;
per cases by A2,TREES_4:11;
suppose p = {};
then t|p = t by TREES_9:1;
then (t|p).{} = Sym(In((the connectives of S).11, the carrier' of S),X)
by A2,TREES_4:def 4
.= [In((the connectives of S).11, the carrier' of S), the carrier of S]
by MSAFREE:def 9;
then ((t|p).{})`2 = the carrier of S &
the_array_sort_of S in the carrier of S by MCART_1:7;
hence thesis by B2;
end;
suppose ex k being Nat, T being DecoratedTree,
q being Node of T st k < len <*M,i*> & T = <*M,i*>.(k+1) & p = <*k*>^q;
then consider k being Nat, Q being DecoratedTree,
q being Element of dom Q such that
B3: k < len <*M,i*> & Q = <*M,i*>.(k+1) & p = <*k*>^q;
B4: k = 0 or k = 1 by A7,B3,NAT_1:23;
then q in dom root-tree [m,the_array_sort_of S] or
q in dom root-tree [j,I] by B3,A4,A5,A7;
then q in {{}} by TREES_4:3,TREES_1:29;
then q = {} by TARSKI:def 1;
then p = <*0*> by B2,B4,B6,A6,B3,FINSEQ_1:34;
hence x in {M} by B2,A3,TARSKI:def 1;
end;
end;
C2: {i} = (vf t).I
proof
set A = {t|p where p is Element of dom t: ((t|p).{})`2 = I};
B1: i in A & A = (vf t).I by A3,A6,A8,AOFA_A00:def 12;
hence {i} c= (vf t).I by ZFMISC_1:31;
let x be element; assume x in (vf t).I;
then consider p being Element of dom t such that
B2: x = t|p & ((t|p).{})`2 = I by B1;
per cases by A2,TREES_4:11;
suppose p = {};
then t|p = t by TREES_9:1;
then (t|p).{} = Sym(In((the connectives of S).11, the carrier' of S),X)
by A2,TREES_4:def 4
.= [In((the connectives of S).11, the carrier' of S), the carrier of S]
by MSAFREE:def 9;
then ((t|p).{})`2 = the carrier of S & I in the carrier of S
by MCART_1:7;
hence thesis by B2;
end;
suppose ex k being Nat, T being DecoratedTree,
q being Node of T st k < len <*M,i*> & T = <*M,i*>.(k+1) & p = <*k*>^q;
then consider k being Nat, Q being DecoratedTree,
q being Element of dom Q such that
B3: k < len <*M,i*> & Q = <*M,i*>.(k+1) & p = <*k*>^q;
B4: k = 0 or k = 1 by A7,B3,NAT_1:23;
then q in dom root-tree [m,the_array_sort_of S] or
q in dom root-tree [j,I] by B3,A4,A5,A7;
then q in {{}} by TREES_4:3,TREES_1:29;
then q = {} by TARSKI:def 1;
then p = <*1*> by B2,B4,B6,A6,B3,FINSEQ_1:34;
hence x in {i} by B2,A3,TARSKI:def 1;
end;
end;
C3: for s being SortSymbol of S st s <> the_array_sort_of S & s <> I
holds {} = (vf t).s
proof
let s be SortSymbol of S;
assume Z0: s <> the_array_sort_of S;
assume Z1: s <> I;
set A = {t|p where p is Element of dom t: ((t|p).{})`2 = s};
B1: A = (vf t).s by AOFA_A00:def 12;
thus {} c= (vf t).s by XBOOLE_1:2;
let x be element; assume x in (vf t).s;
then consider p being Element of dom t such that
B2: x = t|p & ((t|p).{})`2 = s by B1;
per cases by A2,TREES_4:11;
suppose p = {};
then t|p = t by TREES_9:1;
then (t|p).{} = Sym(In((the connectives of S).11, the carrier' of S),X)
by A2,TREES_4:def 4
.= [In((the connectives of S).11, the carrier' of S), the carrier of S]
by MSAFREE:def 9;
then ((t|p).{})`2 = the carrier of S & s in the carrier of S
by MCART_1:7;
hence thesis by B2;
end;
suppose ex k being Nat, T being DecoratedTree,
q being Node of T st k < len <*M,i*> & T = <*M,i*>.(k+1) & p = <*k*>^q;
then consider k being Nat, Q being DecoratedTree,
q being Element of dom Q such that
B3: k < len <*M,i*> & Q = <*M,i*>.(k+1) & p = <*k*>^q;
B4: k = 0 or k = 1 by A7,B3,NAT_1:23;
then q in dom root-tree [m,the_array_sort_of S] or
q in dom root-tree [j,I] by B3,A4,A5,A7;
then q in {{}} by TREES_4:3,TREES_1:29;
then q = {} by TARSKI:def 1;
hence thesis by B2,B4,A6,Z0,Z1,B3,FINSEQ_1:34;
end;
end;
let a be SortSymbol of S;
per cases;
suppose
C4: a = the_array_sort_of S;
thus (vf t).a
= {} \/ ((the_array_sort_of S)-singleton M).a by C1,C4,AOFA_A00:6
.= ((I-singleton i).a)\/((the_array_sort_of S)-singleton M).a
by C4,B6,AOFA_A00:6
.= ((I-singleton i) (\/) ((the_array_sort_of S)-singleton M)).a
by PBOOLE:def 4;
end;
suppose
C4: a = I;
hence (vf t).a = (I-singleton i).a \/ {} by C2,AOFA_A00:6
.= ((I-singleton i).a)\/((the_array_sort_of S)-singleton M).a
by C4,Th32,AOFA_A00:6
.= ((I-singleton i) (\/) ((the_array_sort_of S)-singleton M)).a
by PBOOLE:def 4;
end;
suppose
C4: a <> the_array_sort_of S & a <> I;
hence (vf t).a = {} by C3
.= (I-singleton i).a \/ {} by C4,AOFA_A00:6
.= ((I-singleton i).a)\/((the_array_sort_of S)-singleton M).a
by C4,AOFA_A00:6
.= ((I-singleton i) (\/) ((the_array_sort_of S)-singleton M)).a
by PBOOLE:def 4;
end;
end;
theorem Th79:
for A being elementary IfWhileAlgebra of the generators of G
for f being ExecutionFunction of A, C-States(the generators of G),
(\falseC)-States(the generators of G, b) st
G is integer-array C-supported & f in C-Execution(A,b,\falseC) &
X is countable & T is non array-degenerated
for t being Element of T,I holds
f.(s,@M.@i:=(t,A)) = f.(s,M:=((@M,@i)<-t,A))
proof
let A be elementary IfWhileAlgebra of the generators of G;
let f be ExecutionFunction of A, C-States(the generators of G),
(\falseC)-States(the generators of G, b);
assume Z0: G is integer-array;
assume Z1: G is C-supported;
assume Z2: f in C-Execution(A,b,\falseC);
assume Z3: X is countable;
assume Z5: T is non array-degenerated;
let t be Element of T,I;
reconsider H = FreeGen T as ManySortedSubset of the generators of G
by BASIC,PBOOLE:def 18;
set v = t value_at(C,s);
reconsider p = @M.@i as Element of G,I by Z0,Th81,AOFA_A00:def 22;
reconsider g = s as ManySortedFunction of the generators of G,
the Sorts of C by AOFA_A00:48;
reconsider g1 = f.(s,@M.@i:=(t,A)), g2 = f.(s,M:=((@M,@i)<-t,A))
as ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
reconsider Mi = @M.@i as Element of (the generators of G).I by Z0,Th81;
M in (the generators of G).the_array_sort_of S &
(the generators of G).the_array_sort_of S
c= (the Sorts of T).the_array_sort_of S by PBOOLE:def 2,def 18;
then reconsider m = M as Element of G,the_array_sort_of S
by AOFA_A00:def 22;
Mi:=(t,A) = @M.@i:=(t,A) by ASSIG;
then
A5: g1 = succ(s,p,v) & g2 = succ(s,m,(@M,@i)<-t value_at(C,s))
by Z2,AOFA_A00:def 28;
A6: vf p = ((the_array_sort_of S)-singleton M)(\/)(I-singleton i) by Z5,Th78;
M in (FreeGen T).the_array_sort_of S by PURE;
then
A7: vf @M = (the_array_sort_of S)-singleton M by AOFA_A00:41;
i in (FreeGen T).I by PURE;
then
A7a:vf @i = I-singleton i by AOFA_A00:41;
consider x such that
A9: x nin (vf @i).I & supp-var p = x &
(supp-term p).(the_array_sort_of S).M = (@M,@i)<-@x &
for s being SortSymbol of S
for y st y in (vf p).s & (s = the_array_sort_of S implies y <> M)
holds (supp-term p).s.y = y by Z0,INTARR2;
g1 = g2
proof
let a be SortSymbol of S;
BY: now
let a be SortSymbol of S;
B0: (vf @M).a c= (vf p).a by A6,A7,PBOOLE:14,def 2;
let b be Element of (the generators of G).a;
assume
BZ: b in (FreeGen T).a;
per cases by BZ;
suppose
B1: b in (FreeGen T).a & b nin (vf p).a;
then
B2: b nin (vf @M).a by B0;
B3: now
assume a = the_array_sort_of S;
then (vf @M).a = {M} by A7,AOFA_A00:6;
hence b <> m by B2,TARSKI:def 1;
end;
b is pure by B1,PURE;
then a = I implies b <> p by Z3,Th77;
then g1.a.b = s.a.b & g2.a.b = s.a.b
by Z1,A5,B1,B2,B3,AOFA_A00:def 27;
hence g1.a.b = g2.a.b;
end;
suppose
B1: b in (FreeGen T).a & b in (vf p).a & b nin (vf @M).a;
B3: now
assume a = the_array_sort_of S;
then (vf @M).a = {M} by A7,AOFA_A00:6;
hence b <> m by B1,TARSKI:def 1;
end;
consider u being ManySortedFunction of FreeGen T, the Sorts of C
such that
B2: u = (g||H)+*(I,supp-var p,v);
B4a: a = I & b = i or a = the_array_sort_of S & b = M by A6,B1,Lem4;
B5: (supp-term p).a.b = @i by B4a,B1,B3,A9;
B6a: i in (vf @i).a by B4a,A7,B1,Lem3,A7a;
b is pure by B1,PURE;
then a = I implies b <> p by Z3,Th77;
then g1.a.b = @i value_at(C,u)
by Z1,A5,B1,B2,B4a,B5,A7,Lem3,AOFA_A00:def 27
.= u.a.i by B4a,A7,B1,Lem3,Th20a
.= (((g||H).a)+*(supp-var p,v)).b by B2,B4a,A7,B1,Lem3,AOFA_A00:def 2
.= (g||H).a.b by B4a,B6a,A9,A7,B1,Lem3,FUNCT_7:32
.= ((g.a)|(H.a)).b by MSAFREE:def 1
.= g.a.b by B1,FUNCT_1:49;
hence g1.a.b = g2.a.b by Z1,A5,B1,B3,AOFA_A00:def 27;
end;
suppose
B1: b in (FreeGen T).a & b in (vf p).a & b in (vf @M).a;
then
B2: b = M & a = the_array_sort_of S by A7,Lem3;
B3: I <> the_array_sort_of S by Th32;
set u = (g||H)+*(I,supp-var p,v);
reconsider uIx = u.I.x as Element of C,I by PURE,FUNCT_2:5;
B7: dom((g||H).I) = (FreeGen T).I by FUNCT_2:def 1;
(vf @i).I = {i} by A7a,AOFA_A00:6;
then
B8: i in (vf @i).I by TARSKI:def 1;
BA: uIx = ((g||H).I+*(x,v)).x by A9,AOFA_A00:def 2
.= v by PURE,B7,FUNCT_7:31;
BC: @M value_at(C,u) = u.(the_array_sort_of S).M by Th20a
.= (g||H).a.b by B2,B3,AOFA_A00:def 2
.= ((g.a)|(H.a)).b by MSAFREE:def 1
.= g.a.b by B1,FUNCT_1:49
.= @M value_at(C,s) by B2,Th20;
BD: @i value_at(C,u) = u.I.i by Th20a
.= ((g||H).I+*(x,v)).i by A9,AOFA_A00:def 2
.= (g||H).I.i by B8,A9,FUNCT_7:32
.= ((g.I)|(H.I)).i by MSAFREE:def 1
.= g.I.i by PURE,FUNCT_1:49
.= @i value_at(C,s) by Th20;
b is pure by B1,PURE;
then a = I implies b <> p by Z3,Th77;
then
BB: g1.a.b = (@M,@i)<-@x value_at(C,u)
by Z1,A5,B1,B2,A9,AOFA_A00:def 27
.= (@M value_at(C,u),@i value_at(C,u))<-(@x value_at(C,u)) by Th40a
.= (@M value_at(C,u),@i value_at(C,u))<-v by BA,Th20a;
g2.a.b = (@M,@i)<-t value_at(C,s) by B2,Z1,Z2,Th25
.= (@M value_at(C,s),@i value_at(C,s))<-(t value_at(C,s)) by Th40;
hence g1.a.b = g2.a.b by BB,BC,BD;
end;
end;
thus g1.a = g2.a
proof
let b be Element of (the generators of G).a;
per cases;
suppose b in (FreeGen T).a;
hence thesis by BY;
end;
suppose
b nin (FreeGen T).a;
consider h1 being ManySortedFunction of T,C such that
B2: h1 is_homomorphism T,C & g1 = h1||the generators of G
by AOFA_A00:def 19;
consider h2 being ManySortedFunction of T,C such that
B3: h2 is_homomorphism T,C & g2 = h2||the generators of G
by AOFA_A00:def 19;
h1||FreeGen T = h2||FreeGen T
proof
let a be SortSymbol of S;
thus (h1||FreeGen T).a = (h2||FreeGen T).a
proof
let b be Element of (FreeGen T).a;
B5: H.a c= (the generators of G).a & b in (FreeGen T).a
by PBOOLE:def 2,def 18;
thus (h1||FreeGen T).a.b
= ((h1.a)|((FreeGen T).a)).b by MSAFREE:def 1
.= h1.a.b by FUNCT_1:49
.= ((h1.a)|((the generators of G).a)).b by B5,FUNCT_1:49
.= g1.a.b by B2,MSAFREE:def 1
.= g2.a.b by B5,BY
.= ((h2.a)|((the generators of G).a)).b by B3,MSAFREE:def 1
.= h2.a.b by B5,FUNCT_1:49
.= ((h2.a)|((FreeGen T).a)).b by FUNCT_1:49
.= (h2||FreeGen T).a.b by MSAFREE:def 1;
end;
end;
hence thesis by B2,B3,EXTENS_1:19;
end;
end;
end;
hence f.(s,@M.@i:=(t,A)) = f.(s,M:=((@M,@i)<-t,A));
end;
registration
let S,X,T,G,C,s,b;
cluster s.(the bool-sort of S).b -> boolean;
coherence
proof
reconsider s as ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
(the Sorts of C).(the bool-sort of S) = BOOLEAN by AOFA_A00:def 32;
then s.(the bool-sort of S).b in BOOLEAN;
hence thesis;
end;
end;
theorem
for A being elementary IfWhileAlgebra of the generators of G
for f being ExecutionFunction of A, C-States(the generators of G),
(\falseC)-States(the generators of G, b) st
G is integer-array C-supported & f in C-Execution(A,b,\falseC) &
T is non array-degenerated & X is countable
for J being Algorithm of A st
for s holds f.(s,J).(the_array_sort_of S).M = s.(the_array_sort_of S).M &
for D being array of (#INT,<=#) st D = s.(the_array_sort_of S).M holds
(D <> {} implies f.(s,J).I.i1 in dom D & f.(s,J).I.i2 in dom D) &
(inversions D <> {} implies [f.(s,J).I.i1,f.(s,J).I.i2] in inversions D) &
(f.(s,J).(the bool-sort of S).b = TRUE iff inversions D <> {})
for D being 0-based finite array of (#INT,<=#)
st D = s.(the_array_sort_of S).M & y <> i1 & y <> i2
holds
f.(s,while(J, y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A))).
(the_array_sort_of S).M is ascending permutation of D &
(J is absolutely-terminating implies
while(J, y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A))
is_terminating_wrt f, {s1: s1.(the_array_sort_of S).M <> {}})
proof
let A be elementary IfWhileAlgebra of the generators of G;
let f be ExecutionFunction of A, C-States(the generators of G),
(\falseC)-States(the generators of G, b);
assume Z0: G is integer-array;
assume Z1: G is C-supported;
assume Z2: f in C-Execution(A,b,\falseC);
assume Z5: T is non array-degenerated;
assume Z4: X is countable;
let J be Algorithm of A;
assume Z3: for s
holds f.(s,J).(the_array_sort_of S).M = s.(the_array_sort_of S).M &
for D being array of (#INT,<=#) st D = s.(the_array_sort_of S).M
holds (D <> {} implies f.(s,J).I.i1 in dom D & f.(s,J).I.i2 in dom D) &
(inversions D <> {} implies [f.(s,J).I.i1,f.(s,J).I.i2] in inversions D) &
(f.(s,J).(the bool-sort of S).b = TRUE iff inversions D <> {});
let D be 0-based finite array of (#INT,<=#);
assume Z6: D = s.(the_array_sort_of S).M;
assume Z9: y <> i1 & y <> i2;
deffunc F(Nat,Element of C-States(the generators of G))
= f.($2,J\;y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A));
set ST = C-States(the generators of G);
A0: the_array_sort_of S <> I by Th32;
consider g being Function of NAT, ST such that
A1: g.0 = s & for i being Nat holds g.(i+1) = F(i,g.i qua Element of ST)
from NAT_1:sch 12;
B3: the carrier of (#INT,<=#) = INT by LFUZZY_0:def 3;
deffunc G(element) = g.In($1,NAT).(the_array_sort_of S).M;
A4: for x being element st x in NAT holds G(x) in INT^omega by AFINSQ_1:def 7;
consider h being Function of NAT, INT^omega such that
A5: for i being element st i in NAT holds h.i = G(i) from FUNCT_2:sch 2(A4);
B2: dom h = NAT & dom g = NAT by FUNCT_2:def 1;
then
B1: h is non empty Sequence by ORDINAL1:def 7;
then
B6: base-h = 0 by EXCHSORT:24;
then
A6: h.(base-h) = g.In(0,NAT).(the_array_sort_of S).M by A5
.= D by Z6,A1;
A7: for a being Ordinal st a in dom g holds h.a is array of (#INT,<=#)
proof
let a be Ordinal;
assume a in dom g;
then a in NAT by FUNCT_2:def 1;
then h.a in INT^omega by FUNCT_2:5;
hence h.a is array of (#INT,<=#) by B3;
end;
set TV = (\falseC)-States(the generators of G, b);
hereby per cases;
suppose
AC: D = {};
then inversions D = {};
then f.(s,J).(the bool-sort of S).b <> TRUE by Z3,Z6;
then
AE: f.(s,J).(the bool-sort of S).b = FALSE by XBOOLEAN:def 3
.= \falseC by Th21;
f.(s,J) is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
then f.(s,J) nin TV & f complies_with_while_wrt TV
by AE,AOFA_000:def 32,AOFA_A00:def 20;
then
AD: f.(s, while(J, y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A))) =
f.(s,J) by AOFA_000:def 31;
f.(s,J).(the_array_sort_of S).M = D by Z3,Z6;
hence f.(s,while(J, y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A))).
(the_array_sort_of S).M is ascending permutation of D
by AC,AD,EXCHSORT:38;
end;
suppose
AY: D <> {};
defpred T[Nat] means h.$1 <> {};
AF: T[0] by AY,A6,B1,EXCHSORT:24;
AG: for i being Nat holds T[i] implies T[i+1]
proof
let i be Nat;
assume J0: T[i];
J3: I <> the_array_sort_of S by Th32;
J7: h.i = g.(In(i,NAT)).(the_array_sort_of S).M by A5
.= g.i.(the_array_sort_of S).M;
reconsider R = h.i as array of (#INT,<=#) by A7,B2,ORDINAL1:def 12;
J2: h.(i+1) = g.(In(i+1,NAT)).(the_array_sort_of S).M by A5
.= f.(g.i, J\;y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A))
.(the_array_sort_of S).M by A1
.= f.(f.(g.i, J\;y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)),@M.@i2:=(@y,A))
.(the_array_sort_of S).M by AOFA_000:def 29
.= f.(f.(f.(g.i, J\;y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),@M.@i2:=(@y,A))
.(the_array_sort_of S).M by AOFA_000:def 29
.= f.(f.(f.(f.(g.i, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),
@M.@i2:=(@y,A)).(the_array_sort_of S).M by AOFA_000:def 29;
@i1 value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A)))
= f.(f.(g.i, J),y:=(@M.@i1,A)).I.i1 by Th20
.= f.(g.i, J).I.i1 by Z1,Z2,Z9,Th25;
then
J5: @i1 value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A))) in dom R by Z3,J0,J7;
J8: @M value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A)))
= f.(f.(g.i, J),y:=(@M.@i1,A)).(the_array_sort_of S).M by Th20;
f.(g.i, J).(the_array_sort_of S).M = g.i.(the_array_sort_of S).M by Z3;
then
J4a: (f.(f.(g.i, J),y:=(@M.@i1,A))).(the_array_sort_of S).M
= g.i.(the_array_sort_of S).M by Z1,Z2,J3,Th25;
f.(f.(f.(g.i, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))
.(the_array_sort_of S).M
= f.(f.(f.(g.i, J),y:=(@M.@i1,A)),M:=((@M,@i1)<-(@M.@i2),A))
.(the_array_sort_of S).M by Z0,Z1,Z2,Z5,Z4,Th79
.= (@M,@i1)<-(@M.@i2) value_at(C, f.(f.(g.i, J),y:=(@M.@i1,A)))
by Z1,Z2,Th25
.= (@M value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A))),
@i1 value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A))))
<-(@M.@i2 value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A)))) by Th40
.= (f.(f.(g.i, J),y:=(@M.@i1,A)).(the_array_sort_of S).M)+*
(@i1 value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A))),
(@M.@i2 value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A)))))
by J5,J4a,J7,J8,Th33;
then
K1: dom (f.(f.(f.(g.i, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))
.(the_array_sort_of S).M)
= dom (g.i.(the_array_sort_of S).M) by J4a,FUNCT_7:30;
K2: @M value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)))
= f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)).
(the_array_sort_of S).M by Th20;
@i2 value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)))
= f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)).I.i2 by Th20
.= f.(f.(f.(g.i,J),y:=(@M.@i1,A)),M:=((@M,@i1)<-(@M.@i2),A)).I.i2
by Z0,Z1,Z2,Z5,Z4,Th79
.= f.(f.(g.i,J),y:=(@M.@i1,A)).I.i2 by Z1,Z2,Th32,Th25
.= (f.(g.i,J)).I.i2 by Z1,Z2,Z9,Th25;
then
K4: @i2 value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)))
in dom R by Z3,J0,J7;
K6: f.(f.(f.(f.(g.i, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),
@M.@i2:=(@y,A)).(the_array_sort_of S).M
= f.(f.(f.(f.(g.i, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),
M:=((@M,@i2)<-@y,A)).(the_array_sort_of S).M by Z0,Z1,Z2,Z5,Z4,Th79
.= (@M,@i2)<-@y value_at(C,f.(f.(f.(g.i, J),y:=(@M.@i1,A)),
@M.@i1:=(@M.@i2,A))) by Z1,Z2,Th25
.= (@M value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))),
@i2 value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))))
<-(@y value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))))
by Th40
.= (@M value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))))
+*(@i2 value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))),
@y value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))))
by K1,K2,K4,J7,Th33;
dom((@M value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),
@M.@i1:=(@M.@i2,A))))
+*(@i2 value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))),
@y value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)))))
= dom (f.(f.(f.(g.i, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))
.(the_array_sort_of S).M) by K2,FUNCT_7:30;
hence h.(i+1) <> {} by K6,J2,J7,J0,K1;
end;
AH: for i being Nat holds T[i] from NAT_1:sch 2(AF,AG);
AX: for a being Nat
for R being (array of (#INT,<=#)) st R = h.a
for s st g.a = s
ex x,y being set st x = f.(s,J).I.i1 & y = f.(s,J).I.i2 &
x in dom R & y in dom R & h.(a+1) = Swap(R,x,y)
proof
let a be Nat;
let R be array of (#INT,<=#) such that
Z7: R = h.a;
let s1 such that
Z8: g.a = s1;
reconsider i = a as Element of NAT by ORDINAL1:def 12;
reconsider s = g.i as Element of ST;
set y1 = f.(s,J).I.i1, y2 = f.(s,J).I.i2;
take y1,y2; thus y1 = f.(s1,J).I.i1 & y2 = f.(s1,J).I.i2 by Z8;
In(i,NAT) = i;
then
B4: h.i = g.i.(the_array_sort_of S).M by A5;
R <> {} by AH,Z7;
hence
C3: y1 in dom R & y2 in dom R by B4,Z3,Z7;
B5: succ a = i+1 & In(i+1,NAT) = i+1 by NAT_1:38;
then
B7: h.succ a = g.(i+1).(the_array_sort_of S).M by A5;
B8: g.(i+1) = f.(s, J\;y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A))
by A1
.= f.(f.(s, J\;y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)),@M.@i2:=(@y,A))
by AOFA_000:def 29
.= f.(f.(f.(s, J\;y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),@M.@i2:=(@y,A))
by AOFA_000:def 29
.= f.(f.(f.(f.(s, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),@M.@i2:=(@y,A))
by AOFA_000:def 29
.= f.(f.(f.(f.(s, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),
M:=((@M,@i2)<-@y,A)) by Z0,Z1,Z2,Z5,Z4,Th79
.= f.(f.(f.(f.(s, J),y:=(@M.@i1,A)),M:=((@M,@i1)<-(@M.@i2),A)),
M:=((@M,@i2)<-@y,A)) by Z0,Z1,Z2,Z5,Z4,Th79;
set s1 = f.(s,J);
set s2 = f.(s1,y:=(@M.@i1,A));
set s3 = f.(s2,M:=((@M,@i1)<-(@M.@i2),A));
set s4 = f.(s3,M:=((@M,@i2)<-@y,A));
C4: @i1 value_at(C,f.(s,J)) = f.(s,J).I.i1 by Th20;
A1aM: s1.(the_array_sort_of S).M = s.(the_array_sort_of S).M by Z3;
B9: @M value_at(C,s1) = s1.(the_array_sort_of S).M by Th20
.= s.(the_array_sort_of S).M by Z3;
C5: s2.I.y = @M.@i1 value_at(C,s1) by Z1,Z2,Th25
.= (@M value_at(C,s1)).(@i1 value_at(C,s1)) by Th41
.= R.y1 by Z7,C3,C4,B4,B9,Th33;
A2Ii1: s2.I.i1 = y1 by Z1,Z2,Z9,Th25;
A2Ii2: s2.I.i2 = y2 by Z1,Z2,Z9,Th25;
A2aM: s2.(the_array_sort_of S).M = s1.(the_array_sort_of S).M
by Z1,Z2,A0,Th25;
A3Iy: s3.I.y = s2.I.y by Z1,Z2,Th32,Th25;
A3Ii2: s3.I.i2 = s2.I.i2 by Z1,Z2,Th32,Th25;
C6: @M value_at(C,s2) = s2.(the_array_sort_of S).M by Th20;
C7: @i1 value_at(C,s2) = s2.I.i1 by Th20;
C8: @i2 value_at(C,s2) = s2.I.i2 by Th20;
A3aM: s3.(the_array_sort_of S).M = (@M,@i1)<-(@M.@i2) value_at(C,s2)
by Z1,Z2,Th25
.= (@M value_at(C,s2),@i1 value_at(C,s2))<-(@M.@i2 value_at(C,s2))
by Th40
.= R+*(@i1 value_at(C,s2),@M.@i2 value_at(C,s2))
by Z7,C6,C7,A1aM,A2aM,A2Ii1,C3,B4,Th33;
D1: @M value_at(C,s3) = s3.(the_array_sort_of S).M by Th20;
D3: @i2 value_at(C,s3) = s3.I.i2 by Th20;
D5: @y value_at(C,s3) = s3.I.y by Th20;
D4: dom R = dom(R+*(y1,@M.@i2 value_at(C,s2))) by FUNCT_7:30;
A4aM: s4.(the_array_sort_of S).M = (@M,@i2)<-@y value_at(C,s3) by Z1,Z2,Th25
.= (@M value_at(C,s3),@i2 value_at(C,s3))<-(@y value_at(C,s3))
by Th40
.= R+*(y1,@M.@i2 value_at(C,s2))+*(y2, @y value_at(C,s3))
by D1,D3,D4,C7,C3,A3aM,A2Ii1,A3Ii2,A2Ii2,Th33;
@M.@i2 value_at(C,s2) = (@M value_at(C,s2)).(@i2 value_at(C,s2))
by Th41 .= R.y2 by Z7,C3,C6,C8,A2Ii2,A2aM,A1aM,B4,Th33;
hence h.(a+1) = Swap(R,y1,y2)
by B5,B7,B8,C3,D5,A4aM,A3Iy,C5,FUNCT_7:def 12;
end;
defpred Q[Nat] means h.$1 is permutation of D;
A8: Q[0] by A6,B6,EXCHSORT:38;
A9: now
let i be Nat; assume
C1: Q[i];
thus Q[i+1]
proof
reconsider R = h.i as array of (#INT,<=#) by A7,B2,ORDINAL1:def 12;
reconsider s = g.i as Element of ST;
consider x,y being set such that
x = f.(s,J).I.i1 & y = f.(s,J).I.i2 and
C2: x in dom R & y in dom R & h.(i+1) = Swap(R,x,y) by AX;
thus h.(i+1) is permutation of D by C1,C2,EXCHSORT:44;
end;
end;
AA: for i being Nat holds Q[i] from NAT_1:sch 2(A8,A9);
defpred P[Nat] means
g.$1.(the_array_sort_of S).M is ascending permutation of D;
A2: ex i being Nat st P[i]
proof
assume
A3: not thesis;
for a being Ordinal st a in dom h & succ a in dom h
ex R being (array of (#INT,<=#)), x,y being set
st [x,y] in inversions R & h.a = R & h.succ a = Swap(R,x,y)
proof
let a be Ordinal;
assume Z7: a in dom h;
assume succ a in dom h;
reconsider i = a as Element of NAT by Z7,FUNCT_2:def 1;
reconsider R = h.i as array of (#INT,<=#) by B3;
reconsider s = g.i as Element of ST;
set y1 = f.(s,J).I.i1, y2 = f.(s,J).I.i2;
take R, y1,y2;
In(i,NAT) = i;
then
B4: Q[i] & not P[i] & h.i = g.i.(the_array_sort_of S).M by AA,A3,A5;
then inversions R <> {} by EXCHSORT:48;
hence [y1,y2] in inversions R by B4,Z3;
thus h.a = R;
consider x,y being set such that
C3: x = f.(s,J).I.i1 & y = f.(s,J).I.i2 &
x in dom R & y in dom R & h.(i+1) = Swap(R,x,y) by AX;
thus h.succ a = Swap(R,y1,y2) by C3,NAT_1:38;
end;
then h is 0-based arr_computation of D by B1,B2,A6,A7,EXCHSORT:def 14;
then h is finite by EXCHSORT:76;
hence contradiction by B2;
end;
consider B being Nat such that
A3: P[B] & for i being Nat st P[i] holds B <= i from NAT_1:sch 5(A2);
reconsider h as Sequence of INT^omega by B2,ORDINAL1:def 7;
reconsider c = h|succ B as array of INT^omega;
deffunc H(Nat) = f.(g.($1-1),J);
consider r being FinSequence such that
E1: len r = B+1 &
for i being Nat st i in dom r holds r.i = H(i) from FINSEQ_1:sch 2;
rng r c= ST
proof
let x be element; assume x in rng r;
then consider y being element such that
E2: y in dom r & x = r.y by FUNCT_1:def 3;
reconsider y as Nat by E2;
consider i being Nat such that
E3: y = 1+i by E2,FINSEQ_3:25,NAT_1:10;
x = H(y) by E1,E2 .= f.(g.i,J) by E3;
hence thesis;
end;
then reconsider r as non empty FinSequence of ST by E1,FINSEQ_1:def 4;
E7a: 1 <= B+1 by NAT_1:11;
E5: r.1 = f.(g.(1-1),J) by E1,E7a,FINSEQ_3:25 .= f.(s,J) by A1;
E6: r.len r = f.(g.(B+1-1),J) by E1,E7a,FINSEQ_3:25 .= f.(g.B,J);
reconsider R = g.B.(the_array_sort_of S).M as ascending permutation of D
by A3;
E9: f.(g.B,J).(the_array_sort_of S).M = R by Z3;
E8: f.(g.B,J) is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
inversions R = {} by EXCHSORT:48;
then f.(g.B,J).(the bool-sort of S).b <> TRUE by Z3;
then f.(g.B,J).(the bool-sort of S).b = FALSE by XBOOLEAN:def 3
.= \falseC by Th21;
then
E4: r.len r nin TV by E6,E8,AOFA_A00:def 20;
for i being Nat st 1 <= i & i < len r
holds r.i in TV &
r.(i+1) = f.(r.i, y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A)\;J)
proof
let i be Nat;
assume Z7: 1 <= i;
assume Z8: i < len r;
consider j being Nat such that
F2: i = 1+j by Z7,NAT_1:10;
F3: r.i = H(i) by E1,Z7,Z8,FINSEQ_3:25 .= f.(g.j,J) by F2;
In(j,NAT) = j;
then h.j = g.j.(the_array_sort_of S).M by A5;
then reconsider R = g.j.(the_array_sort_of S).M as permutation of D
by AA;
F5: f.(g.j,J) is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
i <= B by E1,Z8,NAT_1:13;
then R is not ascending by A3,F2,NAT_1:13;
then inversions R <> {} by EXCHSORT:48;
then f.(g.j,J).(the bool-sort of S).b <> FALSE & FALSE = \falseC
by Z3,Th21;
hence r.i in TV by F3,F5,AOFA_A00:def 20;
1 <= i+1 & i+1 <= len r by Z8,NAT_1:11,13;
hence r.(i+1) = H(i+1) by E1,FINSEQ_3:25
.= f.(f.(g.j,J\;y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A)),J)
by A1,F2
.= f.(f.(f.(g.j,J\;y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)),@M.@i2:=(@y,A)),
J) by AOFA_000:def 29
.= f.(f.(f.(f.(g.j,J\;y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),
@M.@i2:=(@y,A)),J) by AOFA_000:def 29
.= f.(f.(f.(f.(f.(g.j,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),
@M.@i2:=(@y,A)),J) by AOFA_000:def 29
.= f.(f.(f.(f.(g.j,J),y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)),
@M.@i2:=(@y,A)),J) by AOFA_000:def 29
.= f.(f.(f.(g.j,J),y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A)),
J) by AOFA_000:def 29
.= f.(r.i,y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A)\;J)
by F3,AOFA_000:def 29;
end;
hence f.(s,while(J, y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A))).
(the_array_sort_of S).M is ascending permutation of D
by E6,E9,E5,E4,AOFA_000:86;
end;
end;
assume
Z10:J is absolutely-terminating;
let s; assume s in {s1: s1.(the_array_sort_of S).M <> {}};
then consider s1 such that
AZ: s = s1 & s1.(the_array_sort_of S).M <> {};
B3: the carrier of (#INT,<=#) = INT by LFUZZY_0:def 3;
reconsider D = s.(the_array_sort_of S).M as 0-based finite non empty
array of (#INT,<=#) by B3,AZ;
consider g being Function of NAT, ST such that
A1: g.0 = s & for i being Nat holds g.(i+1) = F(i,g.i qua Element of ST)
from NAT_1:sch 12;
deffunc G(element) = g.In($1,NAT).(the_array_sort_of S).M;
A4: for x being element st x in NAT holds G(x) in INT^omega by AFINSQ_1:def 7;
consider h being Function of NAT, INT^omega such that
A5: for i being element st i in NAT holds h.i = G(i) from FUNCT_2:sch 2(A4);
B2: dom h = NAT & dom g = NAT by FUNCT_2:def 1;
then
B1: h is non empty Sequence by ORDINAL1:def 7;
then
B6: base-h = 0 by EXCHSORT:24;
then
A6: h.(base-h) = g.In(0,NAT).(the_array_sort_of S).M by A5
.= D by A1;
A7: for a being Ordinal st a in dom g holds h.a is array of (#INT,<=#)
proof
let a be Ordinal;
assume a in dom g;
then a in NAT by FUNCT_2:def 1;
then h.a in INT^omega by FUNCT_2:5;
hence h.a is array of (#INT,<=#) by B3;
end;
defpred T[Nat] means h.$1 <> {};
AF: T[0] by A6,B1,EXCHSORT:24;
AG: for i being Nat holds T[i] implies T[i+1]
proof
let i be Nat;
assume J0: T[i];
J3: I <> the_array_sort_of S by Th32;
J7: h.i = g.(In(i,NAT)).(the_array_sort_of S).M by A5
.= g.i.(the_array_sort_of S).M;
reconsider R = h.i as array of (#INT,<=#) by A7,B2,ORDINAL1:def 12;
J2: h.(i+1) = g.(In(i+1,NAT)).(the_array_sort_of S).M by A5
.= f.(g.i, J\;y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A))
.(the_array_sort_of S).M by A1
.= f.(f.(g.i, J\;y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)),@M.@i2:=(@y,A))
.(the_array_sort_of S).M by AOFA_000:def 29
.= f.(f.(f.(g.i, J\;y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),@M.@i2:=(@y,A))
.(the_array_sort_of S).M by AOFA_000:def 29
.= f.(f.(f.(f.(g.i, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),
@M.@i2:=(@y,A)).(the_array_sort_of S).M by AOFA_000:def 29;
@i1 value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A)))
= f.(f.(g.i, J),y:=(@M.@i1,A)).I.i1 by Th20
.= f.(g.i, J).I.i1 by Z1,Z2,Z9,Th25;
then
J5: @i1 value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A))) in dom R by Z3,J0,J7;
J8: @M value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A)))
= f.(f.(g.i, J),y:=(@M.@i1,A)).(the_array_sort_of S).M by Th20;
f.(g.i, J).(the_array_sort_of S).M = g.i.(the_array_sort_of S).M by Z3;
then
J4a: (f.(f.(g.i, J),y:=(@M.@i1,A))).(the_array_sort_of S).M
= g.i.(the_array_sort_of S).M by Z1,Z2,J3,Th25;
f.(f.(f.(g.i, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))
.(the_array_sort_of S).M
= f.(f.(f.(g.i, J),y:=(@M.@i1,A)),M:=((@M,@i1)<-(@M.@i2),A))
.(the_array_sort_of S).M by Z0,Z1,Z2,Z5,Z4,Th79
.= (@M,@i1)<-(@M.@i2) value_at(C, f.(f.(g.i, J),y:=(@M.@i1,A)))
by Z1,Z2,Th25
.= (@M value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A))),
@i1 value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A))))
<-(@M.@i2 value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A)))) by Th40
.= (f.(f.(g.i, J),y:=(@M.@i1,A)).(the_array_sort_of S).M)+*
(@i1 value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A))),
(@M.@i2 value_at(C,f.(f.(g.i, J),y:=(@M.@i1,A)))))
by J5,J4a,J7,J8,Th33;
then
K1: dom (f.(f.(f.(g.i, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))
.(the_array_sort_of S).M)
= dom (g.i.(the_array_sort_of S).M) by J4a,FUNCT_7:30;
K2: @M value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)))
= f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)).
(the_array_sort_of S).M by Th20;
@i2 value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)))
= f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)).I.i2 by Th20
.= f.(f.(f.(g.i,J),y:=(@M.@i1,A)),M:=((@M,@i1)<-(@M.@i2),A)).I.i2
by Z0,Z1,Z2,Z5,Z4,Th79
.= f.(f.(g.i,J),y:=(@M.@i1,A)).I.i2 by Z1,Z2,Th32,Th25
.= (f.(g.i,J)).I.i2 by Z1,Z2,Z9,Th25;
then
K4: @i2 value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)))
in dom R by Z3,J0,J7;
K6: f.(f.(f.(f.(g.i, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),
@M.@i2:=(@y,A)).(the_array_sort_of S).M
= f.(f.(f.(f.(g.i, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),
M:=((@M,@i2)<-@y,A)).(the_array_sort_of S).M by Z0,Z1,Z2,Z5,Z4,Th79
.= (@M,@i2)<-@y value_at(C,f.(f.(f.(g.i, J),y:=(@M.@i1,A)),
@M.@i1:=(@M.@i2,A))) by Z1,Z2,Th25
.= (@M value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))),
@i2 value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))))
<-(@y value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))))
by Th40
.= (@M value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))))
+*(@i2 value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))),
@y value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))))
by K1,K2,K4,J7,Th33;
dom((@M value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),
@M.@i1:=(@M.@i2,A))))
+*(@i2 value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))),
@y value_at(C,f.(f.(f.(g.i,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)))))
= dom (f.(f.(f.(g.i, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A))
.(the_array_sort_of S).M) by K2,FUNCT_7:30;
hence h.(i+1) <> {} by K6,J2,K1,J7,J0;
end;
AH: for i being Nat holds T[i] from NAT_1:sch 2(AF,AG);
AX: for a being Nat
for R being (array of (#INT,<=#)) st R = h.a
for s st g.a = s
ex x,y being set st x = f.(s,J).I.i1 & y = f.(s,J).I.i2 &
x in dom R & y in dom R & h.(a+1) = Swap(R,x,y)
proof
let a be Nat;
let R be array of (#INT,<=#) such that
Z7: R = h.a;
let s1 such that
Z8: g.a = s1;
reconsider i = a as Element of NAT by ORDINAL1:def 12;
reconsider s = g.i as Element of ST;
set y1 = f.(s,J).I.i1, y2 = f.(s,J).I.i2;
take y1,y2; thus y1 = f.(s1,J).I.i1 & y2 = f.(s1,J).I.i2 by Z8;
In(i,NAT) = i;
then
B4: h.i = g.i.(the_array_sort_of S).M by A5;
R <> {} by Z7,AH;
hence
C3: y1 in dom R & y2 in dom R by B4,Z3,Z7;
B5: succ a = i+1 & In(i+1,NAT) = i+1 by NAT_1:38;
then
B7: h.succ a = g.(i+1).(the_array_sort_of S).M by A5;
B8: g.(i+1) = f.(s, J\;y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A))
by A1
.= f.(f.(s, J\;y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)),@M.@i2:=(@y,A))
by AOFA_000:def 29
.= f.(f.(f.(s, J\;y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),@M.@i2:=(@y,A))
by AOFA_000:def 29
.= f.(f.(f.(f.(s, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),@M.@i2:=(@y,A))
by AOFA_000:def 29
.= f.(f.(f.(f.(s, J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),
M:=((@M,@i2)<-@y,A)) by Z0,Z1,Z2,Z5,Z4,Th79
.= f.(f.(f.(f.(s, J),y:=(@M.@i1,A)),M:=((@M,@i1)<-(@M.@i2),A)),
M:=((@M,@i2)<-@y,A)) by Z0,Z1,Z2,Z5,Z4,Th79;
set s1 = f.(s,J);
set s2 = f.(s1,y:=(@M.@i1,A));
set s3 = f.(s2,M:=((@M,@i1)<-(@M.@i2),A));
set s4 = f.(s3,M:=((@M,@i2)<-@y,A));
C4: @i1 value_at(C,f.(s,J)) = f.(s,J).I.i1 by Th20;
A1aM: s1.(the_array_sort_of S).M = s.(the_array_sort_of S).M by Z3;
B9: @M value_at(C,s1) = s1.(the_array_sort_of S).M by Th20
.= s.(the_array_sort_of S).M by Z3;
C5: s2.I.y = @M.@i1 value_at(C,s1) by Z1,Z2,Th25
.= (@M value_at(C,s1)).(@i1 value_at(C,s1)) by Th41
.= R.y1 by Z7,C3,C4,B4,B9,Th33;
A2Ii1: s2.I.i1 = y1 by Z1,Z2,Z9,Th25;
A2Ii2: s2.I.i2 = y2 by Z1,Z2,Z9,Th25;
A2aM: s2.(the_array_sort_of S).M = s1.(the_array_sort_of S).M
by Z1,Z2,A0,Th25;
A3Iy: s3.I.y = s2.I.y by Z1,Z2,Th32,Th25;
A3Ii2:s3.I.i2 = s2.I.i2 by Z1,Z2,Th32,Th25;
C6: @M value_at(C,s2) = s2.(the_array_sort_of S).M by Th20;
C7: @i1 value_at(C,s2) = s2.I.i1 by Th20;
C8: @i2 value_at(C,s2) = s2.I.i2 by Th20;
A3aM: s3.(the_array_sort_of S).M = (@M,@i1)<-(@M.@i2) value_at(C,s2)
by Z1,Z2,Th25
.= (@M value_at(C,s2),@i1 value_at(C,s2))<-(@M.@i2 value_at(C,s2))
by Th40
.= R+*(@i1 value_at(C,s2),@M.@i2 value_at(C,s2))
by Z7,C6,C7,A1aM,A2aM,A2Ii1,C3,B4,Th33;
D1: @M value_at(C,s3) = s3.(the_array_sort_of S).M by Th20;
D3: @i2 value_at(C,s3) = s3.I.i2 by Th20;
D5: @y value_at(C,s3) = s3.I.y by Th20;
D4: dom R = dom(R+*(y1,@M.@i2 value_at(C,s2))) by FUNCT_7:30;
A4aM: s4.(the_array_sort_of S).M = (@M,@i2)<-@y value_at(C,s3) by Z1,Z2,Th25
.= (@M value_at(C,s3),@i2 value_at(C,s3))<-(@y value_at(C,s3))
by Th40
.= R+*(y1,@M.@i2 value_at(C,s2))+*(y2, @y value_at(C,s3))
by D1,D3,D4,C7,C3,A3aM,A2Ii1,A3Ii2,A2Ii2,Th33;
@M.@i2 value_at(C,s2) = (@M value_at(C,s2)).(@i2 value_at(C,s2))
by Th41 .= R.y2 by Z7,C3,C6,C8,A2Ii2,A2aM,A1aM,B4,Th33;
hence h.(a+1) = Swap(R,y1,y2)
by B5,B7,B8,C3,D5,A4aM,A3Iy,C5,FUNCT_7:def 12;
end;
defpred Q[Nat] means h.$1 is permutation of D;
A8: Q[0] by A6,B6,EXCHSORT:38;
A9: now
let i be Nat; assume
C1: Q[i];
thus Q[i+1]
proof
reconsider R = h.i as array of (#INT,<=#) by A7,B2,ORDINAL1:def 12;
reconsider s = g.i as Element of ST;
consider x,y being set such that
x = f.(s,J).I.i1 & y = f.(s,J).I.i2 and
C2: x in dom R & y in dom R & h.(i+1) = Swap(R,x,y) by AX;
thus h.(i+1) is permutation of D by C1,C2,EXCHSORT:44;
end;
end;
AA: for i being Nat holds Q[i] from NAT_1:sch 2(A8,A9);
defpred P[Nat] means
g.$1.(the_array_sort_of S).M is ascending permutation of D;
A2: ex i being Nat st P[i]
proof
assume
A3: not thesis;
for a being Ordinal st a in dom h & succ a in dom h
ex R being (array of (#INT,<=#)), x,y being set
st [x,y] in inversions R & h.a = R & h.succ a = Swap(R,x,y)
proof
let a be Ordinal;
assume Z7: a in dom h;
assume succ a in dom h;
reconsider i = a as Element of NAT by Z7,FUNCT_2:def 1;
reconsider R = h.i as array of (#INT,<=#) by B3;
reconsider s = g.i as Element of ST;
set y1 = f.(s,J).I.i1, y2 = f.(s,J).I.i2;
take R, y1,y2;
In(i,NAT) = i;
then
B4: Q[i] & not P[i] & h.i = g.i.(the_array_sort_of S).M by AA,A3,A5;
then inversions R <> {} by EXCHSORT:48;
hence [y1,y2] in inversions R by B4,Z3;
thus h.a = R;
consider x,y being set such that
C3: x = f.(s,J).I.i1 & y = f.(s,J).I.i2 &
x in dom R & y in dom R & h.(i+1) = Swap(R,x,y) by AX;
thus h.succ a = Swap(R,y1,y2) by C3,NAT_1:38;
end;
then h is 0-based arr_computation of D by B1,B2,A6,A7,EXCHSORT:def 14;
then h is finite by EXCHSORT:76;
hence contradiction by B2;
end;
consider B being Nat such that
A3: P[B] & for i being Nat st P[i] holds B <= i from NAT_1:sch 5(A2);
reconsider h as Sequence of INT^omega by B2,ORDINAL1:def 7;
reconsider c = h|succ B as array of INT^omega;
set TV = (\falseC)-States(the generators of G, b);
deffunc H(Nat) = f.(g.($1-1),J);
consider r being FinSequence such that
E1: len r = B+1 &
for i being Nat st i in dom r holds r.i = H(i) from FINSEQ_1:sch 2;
rng r c= ST
proof
let x be element; assume x in rng r;
then consider y being element such that
E2: y in dom r & x = r.y by FUNCT_1:def 3;
reconsider y as Nat by E2;
consider i being Nat such that
E3: y = 1+i by E2,FINSEQ_3:25,NAT_1:10;
x = H(y) by E1,E2 .= f.(g.i,J) by E3;
hence thesis;
end;
then reconsider r as non empty FinSequence of ST by E1,FINSEQ_1:def 4;
E7a:1 <= B+1 by NAT_1:11;
E5: r.1 = f.(g.(1-1),J) by E1,E7a,FINSEQ_3:25 .= f.(s,J) by A1;
E6: r.len r = f.(g.(B+1-1),J) by E1,E7a,FINSEQ_3:25 .= f.(g.B,J);
reconsider R = g.B.(the_array_sort_of S).M as ascending permutation of D
by A3;
E8: f.(g.B,J) is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
inversions R = {} by EXCHSORT:48;
then f.(g.B,J).(the bool-sort of S).b <> TRUE by Z3;
then f.(g.B,J).(the bool-sort of S).b = FALSE by XBOOLEAN:def 3
.= \falseC by Th21;
then
E4: r.len r nin TV by E6,E8,AOFA_A00:def 20;
for i being Nat st 1 <= i & i < len r
holds r.i in TV &
r.(i+1) = f.(r.i, y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A)\;J)
proof
let i be Nat;
assume Z7: 1 <= i;
assume Z8: i < len r;
consider j being Nat such that
F2: i = 1+j by Z7,NAT_1:10;
F3: r.i = H(i) by E1,Z7,Z8,FINSEQ_3:25 .= f.(g.j,J) by F2;
In(j,NAT) = j;
then h.j = g.j.(the_array_sort_of S).M by A5;
then reconsider R = g.j.(the_array_sort_of S).M as permutation of D
by AA;
F5: f.(g.j,J) is ManySortedFunction of the generators of G, the Sorts of C
by AOFA_A00:48;
i <= B by E1,Z8,NAT_1:13;
then R is not ascending by A3,F2,NAT_1:13;
then inversions R <> {} by EXCHSORT:48;
then f.(g.j,J).(the bool-sort of S).b <> FALSE & FALSE = \falseC
by Z3,Th21;
hence r.i in TV by F3,F5,AOFA_A00:def 20;
1 <= i+1 & i+1 <= len r by Z8,NAT_1:11,13;
hence r.(i+1) = H(i+1) by E1,FINSEQ_3:25
.= f.(f.(g.j,J\;y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A)),J)
by A1,F2
.= f.(f.(f.(g.j,J\;y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)),@M.@i2:=(@y,A)),J)
by AOFA_000:def 29
.= f.(f.(f.(f.(g.j,J\;y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),
@M.@i2:=(@y,A)),J) by AOFA_000:def 29
.= f.(f.(f.(f.(f.(g.j,J),y:=(@M.@i1,A)),@M.@i1:=(@M.@i2,A)),
@M.@i2:=(@y,A)),J) by AOFA_000:def 29
.= f.(f.(f.(f.(g.j,J),y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)),
@M.@i2:=(@y,A)),J) by AOFA_000:def 29
.= f.(f.(f.(g.j,J),y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A)),J)
by AOFA_000:def 29
.= f.(r.i,y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A)\;J)
by F3,AOFA_000:def 29;
end;
hence [s,while(J, y:=(@M.@i1,A)\;@M.@i1:=(@M.@i2,A)\;@M.@i2:=(@y,A))]
in TerminatingPrograms(A,ST,TV,f) by Z10,E5,E4,AOFA_000:def 33,101;
end;