:: Mizar Analysis of Algorithms: Preliminaries
:: by Grzegorz Bancerek
::
:: Received July 9, 2007
:: Copyright (c) 2007-2016 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 NUMBERS, FUNCT_1, TARSKI, RELAT_1, XBOOLE_0, FINSEQ_1, ORDINAL4,
UNIALG_1, BINOP_1, GROUP_1, FINSEQ_2, SUBSET_1, FUNCOP_1, PARTFUN1,
NAT_1, FUNCT_2, CARD_1, COMPUT_1, TREES_3, TREES_4, FINSET_1, TREES_1,
MEMBERED, XXREAL_0, ARYTM_3, FUNCT_4, FUNCT_7, STRUCT_0, INCPROJ, CARD_3,
FREEALG, DTCONSTR, TREES_2, LANG1, TDGROUP, MSUALG_1, ORDINAL1, MSAFREE,
NEWTON, ZFMISC_1, UNIALG_2, PRELAMB, CQC_SIM1, MSUALG_3, WELLORD1,
MCART_1, SUPINF_1, ARYTM_1, SUPINF_2, MESFUNC1, FUNCT_5, SETFAM_1,
AOFA_000;
notations TARSKI, XBOOLE_0, ZFMISC_1, SUBSET_1, ENUMSET1, SETFAM_1, ORDINAL1,
MEMBERED, RELAT_1, FUNCT_1, RELSET_1, PARTFUN1, FUNCT_2, FINSET_1, LANG1,
BINOP_1, CARD_1, CARD_3, FINSEQ_1, FINSEQ_2, XXREAL_2, NUMBERS, XCMPLX_0,
XXREAL_0, TREES_1, TREES_2, TREES_3, NAT_1, NAT_D, SUPINF_1, MESFUNC1,
FUNCOP_1, FUNCT_4, FUNCT_5, FUNCT_7, ABIAN, MARGREL1, STRUCT_0, UNIALG_1,
UNIALG_2, ALG_1, FREEALG, PUA2MSS1, COMPUT_1, SUPINF_2, TREES_4,
DTCONSTR, FINSEQ_4, RECDEF_1;
constructors PUA2MSS1, COMPUT_1, BORSUK_1, SUPINF_2, FINSEQ_4, FACIRC_1,
ALG_1, FREEALG, FINSEQOP, WELLORD2, CAT_2, ABIAN, RECDEF_1, MESFUNC1,
SUPINF_1, NAT_D, MARGREL1, FUNCT_5, XTUPLE_0;
registrations FUNCT_1, FINSEQ_2, FUNCT_2, FINSEQ_1, UNIALG_1, NAT_1, STRUCT_0,
PUA2MSS1, DTCONSTR, FREEALG, FUNCT_7, SUBSET_1, XXREAL_0, XREAL_0,
TREES_2, TREES_3, MEMBERED, XBOOLE_0, FINSET_1, TREES_1, FACIRC_1,
RELAT_1, VALUED_0, CARD_1, XXREAL_2, RELSET_1, FINSEQ_3, MARGREL1,
XTUPLE_0, ORDINAL1;
requirements BOOLE, SUBSET, NUMERALS, ARITHM, REAL;
definitions MEMBERED, TARSKI, FUNCT_1, FREEALG, RELAT_1, FINSEQ_1, UNIALG_1,
UNIALG_2, COMPUT_1, XBOOLE_0, MARGREL1;
equalities SUBSET_1, TREES_4, PUA2MSS1, MESFUNC1, FREEALG, RELAT_1, FINSEQ_1,
UNIALG_2, BINOP_1, SUPINF_2;
expansions TARSKI, FUNCT_1, FINSEQ_1, UNIALG_2, COMPUT_1, MARGREL1;
theorems XBOOLE_1, ZFMISC_1, RELAT_1, RELSET_1, FUNCT_2, FUNCOP_1, COMPUT_1,
UNIALG_1, FINSEQ_1, FINSEQ_2, TARSKI, XBOOLE_0, FINSEQ_3, XREAL_1,
FUNCT_7, NAT_1, ORDINAL1, PARTFUN1, FUNCT_3, DTCONSTR, FUNCT_4, FREEALG,
TREES_4, FUNCT_1, LANG1, CARD_1, CARD_5, TREES_3, ENUMSET1, FINSEQ_5,
WELLORD2, UNIALG_2, FINSET_1, STIRL2_1, FUNCT_5, FUNCT_6, MSUALG_1,
ALG_1, XREAL_0, XXREAL_0, SETFAM_1, MSUALG_8, XXREAL_2, NAT_D, XXREAL_3,
MARGREL1, XTUPLE_0, SUBSET_1;
schemes NAT_1, FUNCT_1, RECDEF_1, FINSEQ_2, CIRCCMB3, PRE_CIRC, XBOOLE_0,
CLASSES1, ALTCAT_2, FINSEQ_1;
begin :: Binary operations, orbits, and iterations
notation
let x be object,y be set;
antonym x nin y for x in y;
end;
theorem Th1:
for f,g,h being Function
for A being set st A c= dom f & A c= dom g & rng h c= A &
for x being set st x in A holds f.x = g.x holds f*h = g*h
proof
let f,g,h be Function;
let A be set such that
A1: A c= dom f and
A2: A c= dom g and
A3: rng h c= A and
A4: for x being set st x in A holds f.x = g.x;
A5: dom (f*h) = dom h by A1,A3,RELAT_1:27,XBOOLE_1:1;
A6: dom (g*h) = dom h by A2,A3,RELAT_1:27,XBOOLE_1:1;
now
let x be object;
assume
A7: x in dom h;
then
A8: (f*h).x = f.(h.x) by FUNCT_1:13;
A9: (g*h).x = g.(h.x) by A7,FUNCT_1:13;
h.x in rng h by A7,FUNCT_1:3;
hence (f*h).x = (g*h).x by A3,A4,A8,A9;
end;
hence thesis by A5,A6;
end;
registration
let x,y be non empty set;
cluster <*x,y*> -> non-empty;
coherence
proof
assume {} in rng <*x,y*>;
then {} in {x,y} by FINSEQ_2:127;
hence thesis by TARSKI:def 2;
end;
end;
registration
let p,q be non-empty FinSequence;
cluster p^q -> non-empty;
coherence
proof
assume {} in rng (p^q);
then {} in (rng p) \/ rng q by FINSEQ_1:31;
then {} in rng p or {} in rng q by XBOOLE_0:def 3;
hence thesis;
end;
end;
definition
let f be homogeneous Function;
let x be set;
pred x is_a_unity_wrt f means
for y,z being set st <*y,z*> in dom f or <*z,y*> in dom f
holds <*x,y*> in dom f & f.<*x,y*> = y & <*y,x*> in dom f & f.<*y,x*> = y;
end;
definition
let f be homogeneous Function;
attr f is associative means
:
Def2: for x,y,z being set st <*x,y*> in dom f & <*y,z*> in dom f &
<*f.<*x,y*>,z*> in dom f & <*x,f.<*y,z*>*> in dom f
holds f.<*f.<*x,y*>,z*> = f.<*x,f.<*y,z*>*>;
attr f is unital means
: Def3:
ex x being set st x is_a_unity_wrt f;
end;
definition
let X be set;
let Y be non empty set;
let Z be FinSequenceSet of X;
let y be Element of Y;
redefine func Z --> y -> PartFunc of X*,Y;
coherence
proof
A1: dom (Z --> y) = Z by FUNCOP_1:13;
rng (Z --> y) c= {y} by FUNCOP_1:13;
hence thesis by A1,FINSEQ_2:90,RELSET_1:4;
end;
end;
registration
let X be non empty set;
let x be Element of X;
let n be Nat;
cluster (n-tuples_on X) --> x ->
non empty quasi_total homogeneous for PartFunc of X*, X;
coherence
proof
reconsider m = n as Element of NAT by ORDINAL1:def 12;
set f = (n-tuples_on X) --> x;
A1: dom f = m-tuples_on X by FUNCOP_1:13;
then reconsider f as non empty homogeneous PartFunc of X*, X
by COMPUT_1:16;
arity f = m by A1,COMPUT_1:24;
hence thesis by A1,COMPUT_1:22;
end;
end;
theorem Th2:
for X being non empty set, x being Element of X
for n being Nat holds arity ((n-tuples_on X) --> x) = n
proof
let X be non empty set;
let x be Element of X;
let n be Nat;
reconsider m = n as Element of NAT by ORDINAL1:def 12;
set f = (n-tuples_on X) --> x;
dom f = m-tuples_on X by FUNCOP_1:13;
hence thesis by COMPUT_1:24;
end;
Lm1: for X be non empty set, x be Element of X, n be Nat
holds (n-tuples_on X) --> x is n-ary by Th2;
registration
let X be non empty set;
let x be Element of X;
let n be Nat;
cluster (n-tuples_on X) --> x -> n-ary for homogeneous PartFunc of X*, X;
coherence by Lm1;
end;
registration
let X be non empty set;
cluster 2-ary associative unital
for non empty quasi_total homogeneous PartFunc of X*, X;
existence
proof
set x = the Element of X;
deffunc F((Element of X), Element of X) = IFEQ($1,x,$2,$1);
(ex f being Function of 2-tuples_on X, X st
for x,y being Element of X holds f.<*x,y*> = F(x,y)) &
for f1,f2 being Function of 2-tuples_on X, X st
(for x,y being Element of X holds f1.<*x,y*> = F(x,y)) &
(for x,y being Element of X holds f2.<*x,y*> = F(x,y))
holds f1 = f2 from CIRCCMB3:sch 7;
then consider f being Function of 2-tuples_on X, X such that
A1: for a,b being Element of X holds f.<*a,b*> = IFEQ(a,x,b,a);
A2: rng f c= X;
A3: dom f = 2-tuples_on X by FUNCT_2:def 1;
then reconsider f as non empty homogeneous PartFunc of X*, X
by A2,COMPUT_1:16,FINSEQ_2:134,RELSET_1:4;
arity f = 2 by A3,COMPUT_1:24;
then reconsider f as non empty quasi_total homogeneous PartFunc of X*, X
by A3,COMPUT_1:22;
take f;
thus arity f = 2 by A3,COMPUT_1:24;
hereby
let u,y,z be set;
assume that
A4: <*u,y*> in dom f and
A5: <*y,z*> in dom f;
reconsider u9 = u, y9 = y, z9 = z as Element of X by A3,A4,A5,
FINSEQ_2:138;
assume that <*f.<*u,y*>,z*> in dom f and <*u,f.<*y,z*>*> in dom f;
A6: u = x implies IFEQ(u,x,y,u) = y by FUNCOP_1:def 8;
A7: u <> x implies IFEQ(u,x,y,u) = u by FUNCOP_1:def 8;
A8: u = x implies IFEQ(u,x,IFEQ(y,x,z,y),u) = IFEQ(y,x,z,y) by FUNCOP_1:def 8
;
A9: u <> x implies IFEQ(u,x,IFEQ(y,x,z,y),u) = u by FUNCOP_1:def 8;
A10: u <> x implies IFEQ(u,x,z,u) = u by FUNCOP_1:def 8;
thus f.<*f.<*u,y*>,z*> = f.<*IFEQ(u9,x,y9,u9),z9*> by A1
.= IFEQ(IFEQ(u,x,y,u),x,z,IFEQ(u,x,y,u)) by A1
.= f.<*u9,IFEQ(y9,x,z9,y9)*> by A1,A6,A7,A8,A9,A10
.= f.<*u,f.<*y,z*>*> by A1;
end;
take x;
let y,z be set;
assume <*y,z*> in dom f or <*z,y*> in dom f;
then reconsider y9 = y as Element of X by A3,FINSEQ_2:138;
<*x,y9*> in 2-tuples_on X by FINSEQ_2:137;
hence <*x,y*> in dom f by FUNCT_2:def 1;
thus f.<*x,y*> = IFEQ(x,x,y9,x) by A1
.= y by FUNCOP_1:def 8;
<*y9,x*> in 2-tuples_on X by FINSEQ_2:137;
hence <*y,x*> in dom f by FUNCT_2:def 1;
A11: x = y or x <> y;
thus f.<*y,x*> = IFEQ(y9,x,x,y9) by A1
.= y by A11,FUNCOP_1:def 8;
end;
cluster 0-ary for non empty quasi_total homogeneous PartFunc of X*, X;
existence
proof
set x = the Element of X;
set f = (0-tuples_on X) --> x;
take f;
thus arity f = 0 by Th2;
end;
cluster 3-ary for non empty quasi_total homogeneous PartFunc of X*, X;
existence
proof
set x = the Element of X;
set f = (3-tuples_on X) --> x;
take f;
thus arity f = 3 by Th2;
end;
end;
theorem Th3:
for X being non empty set for p being FinSequence of FinTrees X
for x,t being set st t in rng p holds t <> x-tree p
proof
let X be non empty set;
let p be FinSequence of FinTrees X;
let x,t be set;
assume
A1: t in rng p;
then reconsider T = t as Element of FinTrees X;
reconsider A = dom T as finite Tree;
defpred P[set] means not contradiction;
deffunc F(Element of A) = len $1;
{F(e) where e is Element of A: P[e]} is finite from PRE_CIRC:sch 1;
then reconsider B = {F(e) where e is Element of A: P[e]} as finite set;
set e = the Element of A;
A2: F(e) in B;
B is real-membered
proof
let a be object;
assume a in B;
then ex e being Element of A st a = F(e);
hence thesis;
end;
then reconsider B as non empty finite real-membered set by A2;
max B in B by XXREAL_2:def 8;
then consider e being Element of A such that
A3: max B = len e;
consider i being object such that
A4: i in dom p and
A5: t = p.i by A1,FUNCT_1:def 3;
reconsider i as Nat by A4;
i >= 1 by A4,FINSEQ_3:25;
then consider j being Nat such that
A6: i = 1+j by NAT_1:10;
i <= len p by A4,FINSEQ_3:25;
then
A7: j < len p by A6,NAT_1:13;
A8: <*j*>^e in dom (x-tree p) by A5,A6,A7,TREES_4:11;
len (<*j*>^e) = 1+len e by FINSEQ_5:8;
then len (<*j*>^e) > max B by A3,NAT_1:13;
then len (<*j*>^e) nin B by XXREAL_2:def 8;
hence thesis by A8;
end;
definition
let f,g be Function;
let X be set;
func (f,X)+*g -> Function equals
g+*(f|X);
coherence;
end;
theorem Th4:
for f,g being Function, x,X being set holds
x in X & X c= dom f implies ((f,X)+*g).x = f.x
proof
let f,g be Function;
let x,X be set;
assume
A1: x in X;
assume
A2: X c= dom f;
dom (f|X) = dom f /\ X by RELAT_1:61;
then
A3: x in dom (f|X) by A1,A2,XBOOLE_0:def 4;
then (f|X).x = f.x by FUNCT_1:47;
hence thesis by A3,FUNCT_4:13;
end;
theorem Th5:
for f,g being Function, x,X being set holds
x nin X & x in dom g implies ((f,X)+*g).x = g.x
proof
let f,g be Function;
let x,X be set;
assume x nin X;
then x nin dom f /\ X by XBOOLE_0:def 4;
then x nin dom (f|X) by RELAT_1:61;
hence thesis by FUNCT_4:11;
end;
definition
let X,Y be non empty set;
let f,g be Element of Funcs(X,Y);
let A be set;
redefine func (f,A)+*g -> Element of Funcs(X,Y);
coherence
proof
dom g = X by FUNCT_2:92;
then dom g \/ dom (f|A) = X by XBOOLE_1:12;
then
A1: dom ((f,A)+*g) = X by FUNCT_4:def 1;
rng ((f,A)+*g) c= rng g \/ rng (f|A) by FUNCT_4:17;
then rng ((f,A)+*g) c= Y by XBOOLE_1:1;
hence thesis by A1,FUNCT_2:def 2;
end;
end;
definition
let X,Y,Z be non empty set;
let f be Element of Funcs(X,Y);
let g be Element of Funcs(Y,Z);
redefine func g*f -> Element of Funcs(X,Z);
coherence
proof
g*f is Function of X,Z;
hence thesis by FUNCT_2:8;
end;
end;
definition
let f be Function;
let x be object;
func f orbit x -> set equals
{iter(f,n).x where n is Element of NAT: x in dom iter(f,n)};
coherence;
end;
theorem Th6:
for f being Function, x being set st x in dom f holds x in f orbit x
proof
let f be Function;
let x be set;
assume x in dom f;
then
A1: x in dom f \/ rng f by XBOOLE_0:def 3;
A2: iter(f,0) = id (field f) by FUNCT_7:68;
then
A3: iter(f,0).x = x by A1,FUNCT_1:17;
dom iter(f,0) = dom f \/ rng f by A2;
hence thesis by A1,A3;
end;
theorem
for f being Function, x,y being set
st rng f c= dom f & y in f orbit x holds f.y in f orbit x
proof
let f be Function;
let x,y be set;
assume
A1: rng f c= dom f;
assume y in f orbit x;
then consider n being Element of NAT such that
A2: y = iter(f,n).x and
A3: x in dom iter(f,n);
A4: iter(f,n+1) = f*iter(f,n) by FUNCT_7:71;
then
A5: f.y = iter(f,n+1).x by A2,A3,FUNCT_1:13;
A6: y in rng iter(f,n) by A2,A3,FUNCT_1:def 3;
A7: rng iter(f,n) c= field f by FUNCT_7:72;
field f = dom f by A1,XBOOLE_1:12;
then x in dom iter(f,n+1) by A2,A3,A4,A6,A7,FUNCT_1:11;
hence thesis by A5;
end;
theorem
for f being Function, x being set st x in dom f holds f.x in f orbit x
proof
let f be Function;
let x be set;
assume
A1: x in dom f;
iter(f,1) = f by FUNCT_7:70;
hence thesis by A1;
end;
theorem Th9:
for f being Function, x being set st x in dom f
holds f orbit (f.x) c= f orbit x
proof
let f be Function;
let x be set;
assume that
A1: x in dom f;
let a be object;
assume a in f orbit (f.x);
then consider n being Element of NAT such that
A2: a = iter(f,n).(f.x) and
A3: f.x in dom iter(f,n);
A4: iter(f,n+1) = iter(f,n)*f by FUNCT_7:69;
then
A5: a = iter(f,n+1).x by A1,A2,FUNCT_1:13;
x in dom iter(f,n+1) by A1,A3,A4,FUNCT_1:11;
hence thesis by A5;
end;
definition
let f be Function such that
A1: rng f c= dom f;
let A be set;
let x be set;
defpred T[Nat] means
for a being set st a in dom f holds a in dom iter(f,$1);
A2: field f = dom f by A1,XBOOLE_1:12;
then iter(f,0) = id dom f by FUNCT_7:68;
then
A3: T[0];
A4: now
let i be Nat;
assume
A5: T[i];
thus T[i+1]
proof
let a be set;
assume a in dom f;
then
A6: a in dom iter(f,i) by A5;
then
A7: iter(f,i).a in rng iter(f,i) by FUNCT_1:def 3;
A8: rng iter(f,i) c= dom f by A2,FUNCT_7:72;
iter(f,i+1) = f*iter(f,i) by FUNCT_7:71;
hence thesis by A6,A7,A8,FUNCT_1:11;
end;
end;
A9: for i being Nat holds T[i] from NAT_1:sch 2(A3,A4);
func (A,x) iter f -> Function means
dom it = dom f &
for a being set st a in dom f holds (f orbit a c= A implies it.a = x) &
for n being Nat st iter(f,n).a nin A &
for i being Nat st i < n holds iter(f,i).a in A holds it.a = iter(f,n).a;
existence
proof
defpred P[object] means f orbit $1 c= A;
consider Z being set such that
A10: for a being object holds a in Z iff a in dom f & P[a] from XBOOLE_0:sch 1
;
A11: Z c= dom f
by A10;
defpred Q[object,object] means
ex n being Nat st $2 = iter(f,n).$1 & $2 nin A &
for i being Nat st i < n holds iter(f,i).$1 in A;
A12: for a being object st a in (dom f) \ Z ex b being object st Q[a,b]
proof
let a be object;
assume
A13: a in (dom f) \ Z;
then a nin Z by XBOOLE_0:def 5;
then not f orbit a c= A by A10,A13;
then consider y being object such that
A14: y in f orbit a and
A15: y nin A;
A16: ex n1 being Element of NAT st ( y = iter(f,n1).a)&( a in dom
iter(f,n1)) by A14;
defpred R[Nat] means iter(f,$1).a nin A;
A17: ex n being Nat st R[n] by A15,A16;
consider n being Nat such that
A18: R[n] and
A19: for m being Nat st R[m] holds n <= m from NAT_1:sch 5(A17);
take b = iter(f,n).a, n;
thus b = iter(f,n).a & b nin A by A18;
let i be Nat;
thus thesis by A19;
end;
consider h being Function such that
A20: dom h = (dom f) \ Z and
A21: for a being object st a in (dom f) \ Z holds Q[a,h.a]
from CLASSES1:sch 1(
A12
);
take g = (Z-->x)+*h;
dom (Z-->x) = Z by FUNCOP_1:13;
hence dom g = Z \/ (dom f \ Z) by A20,FUNCT_4:def 1
.= dom f by A11,XBOOLE_1:45;
let a be set;
assume
A22: a in dom f;
hereby
assume f orbit a c= A;
then
A23: a in Z by A10,A22;
then
A24: a nin dom f \ Z by XBOOLE_0:def 5;
(Z-->x).a = x by A23,FUNCOP_1:7;
hence g.a = x by A20,A24,FUNCT_4:11;
end;
let n be Nat;
assume that
A25: iter(f,n).a nin A and
A26: for i being Nat st i < n holds iter(f,i).a in A;
A27: n in NAT by ORDINAL1:def 12;
a in dom iter(f,n) by A9,A22;
then iter(f,n).a in f orbit a by A27;
then not f orbit a c= A by A25;
then a nin Z by A10;
then
A28: a in dom f \ Z by A22,XBOOLE_0:def 5;
then consider n2 being Nat such that
A29: h.a = iter(f,n2).a and
A30: h.a nin A and
A31: for i being Nat st i < n2 holds iter(f,i).a in A by A21;
A32: n <= n2 by A26,A29,A30;
n2 <= n by A25,A31;
then n = n2 by A32,XXREAL_0:1;
hence thesis by A20,A28,A29,FUNCT_4:13;
end;
uniqueness
proof
let f1,f2 be Function such that
A33: dom f1 = dom f and
A34: for a being set st a in dom f holds (f orbit a c= A implies f1.a = x) &
for n being Nat st iter(f,n).a nin A &
for i being Nat st i < n holds iter(f,i).a in A
holds f1.a = iter(f,n).a and
A35: dom f2 = dom f and
A36: for a being set st a in dom f holds (f orbit a c= A implies f2.a = x) &
for n being Nat st iter(f,n).a nin A &
for i being Nat st i < n holds iter(f,i).a in A holds f2.a = iter(f,n).a;
now
let a be object;
assume
A37: a in dom f;
per cases;
suppose
A38: f orbit a c= A;
hence f1.a = x by A34,A37
.= f2.a by A36,A37,A38;
end;
suppose not f orbit a c= A;
then consider y being object such that
A39: y in f orbit a and
A40: y nin A;
A41: ex n1 being Element of NAT st ( y = iter(f,n1).a)&( a in dom
iter(f,n1)) by A39;
defpred R[Nat] means iter(f,$1).a nin A;
A42: ex n being Nat st R[n] by A40,A41;
consider n being Nat such that
A43: R[n] and
A44: for m being Nat st R[m] holds n <= m from NAT_1:sch 5(A42);
A45: for i be Nat holds i < n implies iter(f,i).a in A by A44;
hence f1.a = iter(f,n).a by A34,A37,A43
.= f2.a by A36,A37,A43,A45;
end;
end;
hence thesis by A33,A35;
end;
end;
definition
let f be Function such that
A1: rng f c= dom f;
let A be set;
let g be Function;
defpred T[Nat] means
for a being set st a in dom f holds a in dom iter(f,$1);
A2: field f = dom f by A1,XBOOLE_1:12;
then iter(f,0) = id dom f by FUNCT_7:68;
then
A3: T[0];
A4: now
let i be Nat;
assume
A5: T[i];
thus T[i+1]
proof
let a be set;
assume a in dom f;
then
A6: a in dom iter(f,i) by A5;
then
A7: iter(f,i).a in rng iter(f,i) by FUNCT_1:def 3;
A8: rng iter(f,i) c= dom f by A2,FUNCT_7:72;
iter(f,i+1) = f*iter(f,i) by FUNCT_7:71;
hence thesis by A6,A7,A8,FUNCT_1:11;
end;
end;
A9: for i being Nat holds T[i] from NAT_1:sch 2(A3,A4);
func (A,g) iter f -> Function means
: Def7:
dom it = dom f &
for a being set st a in dom f holds (f orbit a c= A implies it.a = g.a) &
for n being Nat st iter(f,n).a nin A &
for i being Nat st i < n holds iter(f,i).a in A holds it.a = iter(f,n).a;
existence
proof
defpred P[object] means f orbit $1 c= A;
consider Z being set such that
A10: for a being object holds a in Z iff a in dom f & P[a] from XBOOLE_0:sch 1
;
A11: Z c= dom f
by A10;
defpred Q[object,object] means
ex n being Nat st $2 = iter(f,n).$1 & $2 nin A &
for i being Nat st i < n holds iter(f,i).$1 in A;
A12: for a being object st a in (dom f) \ Z ex b being object st Q[a,b]
proof
let a be object;
assume
A13: a in (dom f) \ Z;
then a nin Z by XBOOLE_0:def 5;
then not f orbit a c= A by A10,A13;
then consider y being object such that
A14: y in f orbit a and
A15: y nin A;
A16: ex n1 being Element of NAT st ( y = iter(f,n1).a)&( a in dom
iter(f,n1)) by A14;
defpred R[Nat] means iter(f,$1).a nin A;
A17: ex n being Nat st R[n] by A15,A16;
consider n being Nat such that
A18: R[n] and
A19: for m being Nat st R[m] holds n <= m from NAT_1:sch 5(A17);
take b = iter(f,n).a, n;
thus b = iter(f,n).a & b nin A by A18;
let i be Nat;
thus thesis by A19;
end;
consider h being Function such that
A20: dom h = (dom f) \ Z and
A21: for a being object st a in (dom f) \ Z holds Q[a,h.a]
from CLASSES1:sch 1(
A12
);
take i = (Z-->0)+*(g|Z)+*h;
dom (Z-->0) = Z by FUNCOP_1:13;
then dom ((Z-->0)+*(g|Z)) = Z \/ dom(g|Z) by FUNCT_4:def 1
.= Z by RELAT_1:58,XBOOLE_1:12;
hence dom i = Z \/ (dom f \ Z) by A20,FUNCT_4:def 1
.= dom f by A11,XBOOLE_1:45;
let a be set;
assume
A22: a in dom f;
hereby
assume f orbit a c= A;
then
A23: a in Z by A10,A22;
then a nin dom f \ Z by XBOOLE_0:def 5;
then
A24: i.a = ((Z-->0)+*(g|Z)).a by A20,FUNCT_4:11;
per cases;
suppose a in dom(g|Z);
then i.a = (g|Z).a by A24,FUNCT_4:13;
hence i.a = g.a by A23,FUNCT_1:49;
end;
suppose
A25: a nin dom(g|Z);
then
A26: i.a = (Z-->0).a by A24,FUNCT_4:11;
A27: (Z-->0).a = 0 by A23,FUNCOP_1:7;
a nin dom g by A23,A25,RELAT_1:57;
hence i.a = g.a by A26,A27,FUNCT_1:def 2;
end;
end;
let n be Nat;
reconsider n9 = n as Element of NAT by ORDINAL1:def 12;
assume that
A28: iter(f,n).a nin A and
A29: for i being Nat st i < n holds iter(f,i).a in A;
a in dom iter(f,n9) by A9,A22;
then iter(f,n).a in f orbit a;
then not f orbit a c= A by A28;
then a nin Z by A10;
then
A30: a in dom f \ Z by A22,XBOOLE_0:def 5;
then consider n2 being Nat such that
A31: h.a = iter(f,n2).a and
A32: h.a nin A and
A33: for i being Nat st i < n2 holds iter(f,i).a in A by A21;
A34: n <= n2 by A29,A31,A32;
n2 <= n by A28,A33;
then n = n2 by A34,XXREAL_0:1;
hence thesis by A20,A30,A31,FUNCT_4:13;
end;
uniqueness
proof
let f1,f2 be Function such that
A35: dom f1 = dom f and
A36: for a being set st a in dom f holds (f orbit a c= A implies f1.a = g.a) &
for n being Nat st iter(f,n).a nin A &
for i being Nat st i < n holds iter(f,i).a in A
holds f1.a = iter(f,n).a and
A37: dom f2 = dom f and
A38: for a being set st a in dom f holds (f orbit a c= A implies f2.a = g.a) &
for n being Nat st iter(f,n).a nin A &
for i being Nat st i < n holds iter(f,i).a in A holds f2.a = iter(f,n).a;
now
let a be object;
assume
A39: a in dom f;
per cases;
suppose
A40: f orbit a c= A;
hence f1.a = g.a by A36,A39
.= f2.a by A38,A39,A40;
end;
suppose not f orbit a c= A;
then consider y being object such that
A41: y in f orbit a and
A42: y nin A;
A43: ex n1 being Element of NAT st ( y = iter(f,n1).a)&( a in dom
iter(f,n1)) by A41;
defpred R[Nat] means iter(f,$1).a nin A;
A44: ex n being Nat st R[n] by A42,A43;
consider n being Nat such that
A45: R[n] and
A46: for m being Nat st R[m] holds n <= m from NAT_1:sch 5(A44);
A47: for i be Nat holds i < n implies iter(f,i).a in A by A46;
hence f1.a = iter(f,n).a by A36,A39,A45
.= f2.a by A38,A39,A45,A47;
end;
end;
hence thesis by A35,A37;
end;
end;
theorem Th10:
for f,g being Function, a,A being set st rng f c= dom f & a in dom f holds
not f orbit a c= A implies
ex n being Nat st ((A,g) iter f).a = iter(f,n).a & iter(f,n).a nin A &
for i being Nat st i < n holds iter(f,i).a in A
proof
let f,g be Function;
let a,A be set;
assume
A1: rng f c= dom f;
assume
A2: a in dom f;
assume not f orbit a c= A;
then consider y being object such that
A3: y in f orbit a and
A4: y nin A;
A5: ex n1 being Element of NAT st ( y = iter(f,n1).a)&( a in dom
iter(f,n1)) by A3;
defpred R[Nat] means iter(f,$1).a nin A;
A6: ex n being Nat st R[n] by A4,A5;
consider n being Nat such that
A7: R[n] and
A8: for m being Nat st R[m] holds n <= m from NAT_1:sch 5(A6);
take n;
for i being Nat holds i < n implies iter(f,i).a in A by A8;
hence ((A,g) iter f).a = iter(f,n).a by A1,A2,A7,Def7;
thus thesis by A7,A8;
end;
theorem Th11:
for f,g being Function, a,A being set
st rng f c= dom f & a in dom f & g*f = g holds
a in A implies ((A,g) iter f).a = ((A,g) iter f).(f.a)
proof
let f,g be Function;
let a,A be set;
assume that
A1: rng f c= dom f and
A2: a in dom f and
A3: g*f = g and
A4: a in A;
A5: f.a in rng f by A2,FUNCT_1:def 3;
A6: f orbit (f.a) c= f orbit a by A2,Th9;
per cases;
suppose
A7: f orbit a c= A;
then f orbit (f.a) c= A by A6;
then ((A,g) iter f).(f.a) = g.(f.a) by A1,A5,Def7
.= g.a by A2,A3,FUNCT_1:13;
hence thesis by A1,A2,A7,Def7;
end;
suppose not f orbit a c= A;
then consider n being Nat such that
A8: ((A,g) iter f).a = iter(f,n).a and
A9: iter(f,n).a nin A and
A10: for i being Nat st i < n holds iter(f,i).a in A by A1,A2,Th10;
field f = dom f by A1,XBOOLE_1:12;
then iter(f,0) = id dom f by FUNCT_7:68;
then n <> 0 by A2,A4,A9,FUNCT_1:18;
then n >= 0+1 by NAT_1:13;
then consider i being Nat such that
A11: n = 1+i by NAT_1:10;
iter(f,n) = iter(f,i)*f by A11,FUNCT_7:69;
then
A12: iter(f,n).a = iter(f,i).(f.a) by A2,FUNCT_1:13;
now
let j be Nat;
assume j < i;
then
A13: j+1 < n by A11,XREAL_1:8;
A14: iter(f,j+1) = iter(f,j)*f by FUNCT_7:69;
iter(f,j+1).a in A by A10,A13;
hence iter(f,j).(f.a) in A by A2,A14,FUNCT_1:13;
end;
hence thesis by A1,A5,A8,A9,A12,Def7;
end;
end;
theorem Th12:
for f,g being Function, a,A being set st rng f c= dom f & a in dom f holds
a nin A implies ((A,g) iter f).a = a
proof
let f,g be Function;
let a,A be set;
assume that
A1: rng f c= dom f and
A2: a in dom f and
A3: a nin A;
field f = dom f by A1,XBOOLE_1:12;
then iter(f,0) = id dom f by FUNCT_7:68;
then
A4: a = iter(f,0).a by A2,FUNCT_1:18;
for i being Nat st i < 0 holds iter(f,i).a in A;
hence thesis by A1,A2,A3,A4,Def7;
end;
definition
let X be non empty set;
let f be Element of Funcs(X,X);
let A be set;
let g be Element of Funcs(X,X);
redefine func (A,g) iter f -> Element of Funcs(X,X);
coherence
proof
A1: dom f = X by FUNCT_2:def 1;
A2: rng f c= X;
then
A3: dom ((A,g) iter f) = dom f by A1,Def7;
rng ((A,g) iter f) c= X
proof
let a be object;
assume a in rng ((A,g) iter f);
then consider b being object such that
A4: b in dom ((A,g) iter f) and
A5: a = ((A,g) iter f).b by FUNCT_1:def 3;
reconsider b as Element of X by A1,A2,A4,Def7;
per cases;
suppose f orbit b c= A;
then a = g.b by A1,A2,A5,Def7;
hence thesis;
end;
suppose not f orbit b c= A;
then consider n being Nat such that
A6: ((A,g) iter f).b = iter(f,n).b and iter(f,n).b nin A
and for i being Nat st i < n holds iter(f,i).b in A by A1,A2,Th10;
A7: dom iter(f,n) = dom f by A1,A2,FUNCT_7:74;
a in rng iter(f,n) by A1,A5,A6,A7,FUNCT_1:3;
hence thesis;
end;
end;
hence thesis by A1,A3,FUNCT_2:def 2;
end;
end;
begin :: Free universal algebras
theorem Th13:
for X being non empty set, S being non empty FinSequence of NAT
ex A being Universal_Algebra st the carrier of A = X & signature A = S
proof
let X be non empty set;
let S be non empty FinSequence of NAT;
A1: dom S = Seg len S by FINSEQ_1:def 3;
set x = the Element of X;
defpred P[object,object] means
ex i,j being Nat st $1 = i & j = S.i & $2 = (j-tuples_on X)--> x;
A2: for y being object st y in dom S ex z being object st P[y,z]
proof
let y be object;
assume y in dom S;
then reconsider i = y as Element of NAT;
reconsider j = S.i as Element of NAT;
take (j-tuples_on X)--> x, i, j;
thus thesis;
end;
consider ch being Function such that
A3: dom ch = dom S & for y being object st y in dom S holds P[y,ch.y]
from CLASSES1:sch 1(A2);
reconsider ch as FinSequence by A1,A3,FINSEQ_1:def 2;
rng ch c= PFuncs(X*,X)
proof
let y be object;
assume y in rng ch;
then consider xi being object such that
A4: xi in dom ch and
A5: y = ch.xi by FUNCT_1:def 3;
consider i,j being Nat such that
xi = i and j = S.i and
A6: y = (j-tuples_on X)--> x by A3,A4,A5;
A7: dom ((j-tuples_on X)--> x) = (j-tuples_on X) by FUNCOP_1:13;
rng ((j-tuples_on X)--> x) c= {x} by FUNCOP_1:13;
hence thesis by A6,A7,PARTFUN1:def 3;
end;
then reconsider ch as PFuncFinSequence of X by FINSEQ_1:def 4;
set A = UAStr(#X,ch#);
A8: A is quasi_total
proof
let n be Nat, h be PartFunc of (the carrier of A)*, the carrier of A;
assume that
A9: n in dom the charact of A and
A10: h = (the charact of A).n;
ex i,j being Nat st n = i & j = S.i & h = (j-tuples_on X)--> x by A3,A9,A10
;
hence thesis;
end;
A11: A is non-empty
proof
thus the charact of A <> {} by A3;
assume {} in rng the charact of A;
then consider a being object such that
A12: a in dom ch and
A13: {} = ch.a by FUNCT_1:def 3;
ex i,j being Nat st a = i & j = S.i & {} = (j-tuples_on X)--> x by A3,A12
,A13;
hence thesis;
end;
A is partial
proof
let n be Nat, h be PartFunc of (the carrier of A)*, the carrier of A;
assume that
A14: n in dom the charact of A and
A15: h = (the charact of A).n;
ex i,j being Nat st n = i & j = S.i & h = (j-tuples_on X)--> x by A3,A14
,A15;
hence thesis;
end;
then reconsider A as Universal_Algebra by A8,A11;
take A;
thus the carrier of A = X;
A16: len ch = len S by A3,FINSEQ_3:29;
now
let n be Nat such that
A17: n in dom S;
let h be homogeneous non empty PartFunc of (the carrier of A)*,
the carrier of A;
assume h = (the charact of A).n;
then consider i,j being Nat such that
A18: n = i and
A19: j = S.i and
A20: h = (j-tuples_on X)--> x by A3,A17;
set z = the Element of j-tuples_on X;
A21: dom h = j-tuples_on X by A20,FUNCOP_1:13;
len z = j by CARD_1:def 7;
hence S.n = arity h by A18,A19,A21,MARGREL1:def 25;
end;
hence thesis by A16,UNIALG_1:def 4;
end;
theorem Th14:
for S being non empty FinSequence of NAT
ex A being Universal_Algebra st the carrier of A = NAT & signature A = S &
for i,j being Nat st i in dom S & j = S.i
holds (the charact of A).i = (j-tuples_on NAT) --> i
proof
set X = NAT;
let S be non empty FinSequence of NAT;
A1: dom S = Seg len S by FINSEQ_1:def 3;
defpred P[object,object] means
ex i,j being Element of NAT st $1 = i & j = S.i & $2 = (j-tuples_on X)-->i;
A2: for y being object st y in dom S ex z being object st P[y,z]
proof
let y be object;
assume y in dom S;
then reconsider i = y as Element of NAT;
reconsider j = S.i as Element of NAT;
take (j-tuples_on X)--> i, i, j;
thus thesis;
end;
consider ch being Function such that
A3: dom ch = dom S & for y being object st y in dom S holds P[y,ch.y]
from CLASSES1:sch 1(A2);
reconsider ch as FinSequence by A1,A3,FINSEQ_1:def 2;
rng ch c= PFuncs(X*,X)
proof
let y be object;
assume y in rng ch;
then consider xi being object such that
A4: xi in dom ch and
A5: y = ch.xi by FUNCT_1:def 3;
consider i,j being Element of NAT such that
xi = i and j = S.i and
A6: y = (j-tuples_on X)--> i by A3,A4,A5;
A7: dom ((j-tuples_on X)--> i) = (j-tuples_on X) by FUNCOP_1:13;
rng ((j-tuples_on X)--> i) c= X;
hence thesis by A6,A7,PARTFUN1:def 3;
end;
then reconsider ch as PFuncFinSequence of X by FINSEQ_1:def 4;
set A = UAStr(#X,ch#);
A8: A is quasi_total
proof
let n be Nat, h be PartFunc of (the carrier of A)*, the carrier of A;
assume that
A9: n in dom the charact of A and
A10: h = (the charact of A).n;
ex i,j being Element of NAT st
n = i & j = S.i & h = (j-tuples_on X)--> i by A3,A9,A10;
hence thesis;
end;
A11: A is non-empty
proof
thus the charact of A <> {} by A3;
assume {} in rng the charact of A;
then consider a being object such that
A12: a in dom ch and
A13: {} = ch.a by FUNCT_1:def 3;
ex i,j being Element of NAT st
a = i & j = S.i & {} = (j-tuples_on X)--> i by A3,A12,A13;
hence thesis;
end;
A is partial
proof
let n be Nat, h be PartFunc of (the carrier of A)*, the carrier of A;
assume that
A14: n in dom the charact of A and
A15: h = (the charact of A).n;
ex i,j being Element of NAT st
n = i & j = S.i & h = (j-tuples_on X)--> i by A3,A14,A15;
hence thesis;
end;
then reconsider A as Universal_Algebra by A8,A11;
take A;
thus the carrier of A = X;
A16: len ch = len S by A3,FINSEQ_3:29;
now
let n be Nat such that
A17: n in dom S;
let h be homogeneous non empty PartFunc of (the carrier of A)*,
the carrier of A;
assume h = (the charact of A).n;
then consider i,j being Element of NAT such that
A18: n = i and
A19: j = S.i and
A20: h = (j-tuples_on X)--> i by A3,A17;
set z = the Element of j-tuples_on X;
A21: dom h = j-tuples_on X by A20,FUNCOP_1:13;
len z = j by CARD_1:def 7;
hence S.n = arity h by A18,A19,A21,MARGREL1:def 25;
end;
hence signature A = S by A16,UNIALG_1:def 4;
let i,j be Nat;
assume i in dom S;
then ex i1,j being Element of NAT st
i = i1 & j = S.i1 & ch.i = (j-tuples_on X)--> i1 by A3;
hence thesis;
end;
theorem
for S being non empty FinSequence of NAT
for i,j being Nat st i in dom S & j = S.i
for X being non empty set, f being Function of j-tuples_on X, X
ex A being Universal_Algebra st the carrier of A = X & signature A = S &
(the charact of A).i = f
proof
let S be non empty FinSequence of NAT;
let i,j be Nat;
reconsider j9 = j as Element of NAT by ORDINAL1:def 12;
assume that
A1: i in dom S and
A2: j = S.i;
let X be non empty set;
consider A0 being Universal_Algebra such that
A3: the carrier of A0 = X and
A4: signature A0 = S by Th13;
let f be Function of j-tuples_on X, X;
j9-tuples_on X c= X* by FINSEQ_2:134;
then reconsider f0 = f as PartFunc of X*,X by RELSET_1:7;
set z = the Element of j-tuples_on X;
A5: dom f0 = j-tuples_on X by FUNCT_2:def 1;
f0 is homogeneous
by A5;
then reconsider f0 as homogeneous non empty PartFunc of X*,X;
A6: len z = j by CARD_1:def 7;
then
A7: arity f0 = j by A5,MARGREL1:def 25;
set ch = (the charact of A0)+*(i,f0);
f0 in PFuncs(X*, X) by PARTFUN1:45;
then
A8: {f0} c= PFuncs(X*,X) by ZFMISC_1:31;
A9: rng ch c= (rng the charact of A0) \/ {f0} by FUNCT_7:100;
(rng the charact of A0) \/ {f0} c= PFuncs(X*, X) by A3,A8,XBOOLE_1:8;
then rng ch c= PFuncs(X*, X) by A9;
then reconsider ch as FinSequence of PFuncs(X*,X) by FINSEQ_1:def 4;
A10: dom ch = dom the charact of A0 by FUNCT_7:30;
set A = UAStr(#X,ch#);
A11: A is quasi_total
proof
let n be Nat, h be PartFunc of (the carrier of A)*, the carrier of A;
assume that
A12: n in dom the charact of A and
A13: h = (the charact of A).n;
A14: n = i implies h = f0 by A10,A12,A13,FUNCT_7:31;
n <> i implies h = (the charact of A0).n by A13,FUNCT_7:32;
hence thesis by A3,A5,A7,A10,A12,A14,COMPUT_1:22,MARGREL1:def 24;
end;
A15: A is non-empty
proof
thus the charact of A <> {};
assume {} in rng the charact of A;
then consider a being object such that
A16: a in dom ch and
A17: {} = ch.a by FUNCT_1:def 3;
reconsider a as Element of NAT by A16;
a <> i implies {} = (the charact of A0).a by A17,FUNCT_7:32;
hence thesis by A10,A16,A17,FUNCT_7:31;
end;
A is partial
proof
let n be Nat, h be PartFunc of (the carrier of A)*, the carrier of A;
assume that
A18: n in dom the charact of A and
A19: h = (the charact of A).n;
n <> i implies h = (the charact of A0).n by A19,FUNCT_7:32;
hence thesis by A10,A18,A19,FUNCT_7:31;
end;
then reconsider A as Universal_Algebra by A11,A15;
take A;
thus the carrier of A = X;
A20: len S = len the charact of A0 by A4,UNIALG_1:def 4;
then
A21: dom S = dom the charact of A0 by FINSEQ_3:29;
A22: len S = len the charact of A by A10,A20,FINSEQ_3:29;
now
let n be Nat;
assume
A23: n in dom S;
let h be homogeneous non empty PartFunc of (the carrier of A )*,
the carrier of A;
assume
A24: h = (the charact of A).n;
then
A25: n = i implies h = f0 by A21,A23,FUNCT_7:31;
n <> i implies h = (the charact of A0).n by A24,FUNCT_7:32;
hence S.n = arity h by A2,A3,A4,A5,A6,A23,A25,MARGREL1:def 25
,UNIALG_1:def 4;
end;
hence signature A = S by A22,UNIALG_1:def 4;
thus thesis by A1,A21,FUNCT_7:31;
end;
registration
let f be non empty FinSequence of NAT;
let D be non empty disjoint_with_NAT set;
cluster -> Relation-like Function-like for Element of FreeUnivAlgNSG(f,D);
coherence;
end;
registration
let f be non empty FinSequence of NAT;
let D be non empty disjoint_with_NAT set;
cluster -> DecoratedTree-like for Element of FreeUnivAlgNSG(f,D);
coherence;
cluster -> DTree-yielding for FinSequence of FreeUnivAlgNSG(f,D);
coherence;
end;
theorem Th16:
for G being non empty DTConstrStr for t being set st t in TS G holds
(ex d being Symbol of G st d in Terminals G & t = root-tree d) or
ex o being Symbol of G, p being FinSequence of TS G
st o ==> roots p & t = o-tree p
proof
let G be non empty DTConstrStr;
let t be set;
assume that
A1: t in TS G and
A2: not ex d being Symbol of G st d in Terminals G & t = root-tree d and
A3: not ex o being Symbol of G, p being FinSequence of TS G
st o ==> roots p & t = o-tree p;
A4: (TS G) \ {t} c= TS G by XBOOLE_1:36;
reconsider Y = (TS G) \ {t} as Subset of FinTrees the carrier of G;
A5: now
let d be Symbol of G;
assume
A6: d in Terminals G;
then
A7: root-tree d in TS G by DTCONSTR:def 1;
root-tree d <> t by A2,A6;
hence root-tree d in Y by A7,ZFMISC_1:56;
end;
now
let o be Symbol of G, p be FinSequence of Y;
rng p c= Y by FINSEQ_1:def 4;
then rng p c= TS G by A4;
then reconsider q = p as FinSequence of TS G by FINSEQ_1:def 4;
assume
A8: o ==> roots p;
then
A9: o-tree q in TS G by DTCONSTR:def 1;
t <> o-tree q by A3,A8;
hence o-tree p in Y by A9,ZFMISC_1:56;
end;
then TS G c= Y by A5,DTCONSTR:def 1;
then t nin {t} by A1,XBOOLE_0:def 5;
hence contradiction by TARSKI:def 1;
end;
theorem Th17:
for X being disjoint_with_NAT non empty set
for S being non empty FinSequence of NAT for i being Nat st i in dom S
for p being FinSequence of FreeUnivAlgNSG(S,X) st len p = S.i holds
Den(In(i, dom the charact of FreeUnivAlgNSG(S,X)),FreeUnivAlgNSG(S,X)).p
= i-tree p
proof
let X be disjoint_with_NAT non empty set;
let S be non empty FinSequence of NAT;
reconsider S9 = S as non empty FinSequence of omega;
set G = DTConUA(S,X);
set A = FreeUnivAlgNSG(S,X);
let i be Nat;
assume
A1: i in dom S;
then
A2: S9/.i = S.i by PARTFUN1:def 6;
let p be FinSequence of A;
assume len p = S.i;
then p is Element of (S9/.i)-tuples_on TS G by A2,FINSEQ_2:92;
then p in (S9/.i)-tuples_on TS G;
then
A3: p in dom FreeOpNSG(i,S,X) by A1,FREEALG:def 10;
len the charact of A = len S by FREEALG:def 11;
then dom the charact of A = dom S by FINSEQ_3:29;
then In(i, dom the charact of A) = i by A1,SUBSET_1:def 8;
hence Den(In(i, dom the charact of A), A).p
= FreeOpNSG(i,S,X).p by FREEALG:def 11
.= Sym(i,S,X)-tree p by A1,A3,FREEALG:def 10
.= i-tree p by A1,FREEALG:def 9;
end;
definition
let A be non-empty UAStr;
let B be Subset of A;
let n be natural Number;
func B|^n -> Subset of A means
: Def8:
ex F being sequence of bool the carrier of A st it = F.n & F.0 = B &
for n being Nat holds F.(n+1) = F.n \/
{Den(o,A).p where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= F.n};
existence
proof
defpred P[set,set,set] means
$3 = $2 \/ {Den(o,A).p where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= $2};
A1: for n being Nat
for B1 being Subset of A ex B2 being Subset of A st P[n,B1,B2]
proof
let n be Nat, B1 be Subset of A;
set B2 = B1 \/ {Den(o,A).p where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= B1};
B2 c= the carrier of A
proof
let x be object;
assume that
A2: x in B2 and
A3: not x in the carrier of A;
x in B1 implies x in the carrier of A;
then x in {Den(o,A).p where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= B1}
by A2,A3,XBOOLE_0:def 3;
then consider o being (Element of dom the charact of A), p being
Element of (the carrier of A)* such that
A4: x = Den(o,A).p and
A5: p in dom Den(o,A) and rng p c= B1;
x in rng Den(o,A) by A4,A5,FUNCT_1:def 3;
hence contradiction by A3;
end;
then reconsider B2 as Subset of A;
take B2;
thus thesis;
end;
consider F being sequence of bool the carrier of A such that
A6: F.0 = B & for n being Nat holds P[n,F.n,F.(n+1)]
from RECDEF_1:sch 2(A1);
reconsider n9 = n as Element of NAT by ORDINAL1:def 12;
take a = F.n9, F;
thus a = F.n & F.0 = B by A6;
let n be Nat;
thus thesis by A6;
end;
uniqueness
proof
let C1,C2 be Subset of A;
deffunc Rec(set,set) = $2 \/
{Den(o,A).p where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= $2};
given F1 being sequence of bool the carrier of A such that
A7: C1 = F1.n and
A8: F1.0 = B and
A9: for n being Nat holds F1.(n+1) = Rec(n,F1.n);
given F2 being sequence of bool the carrier of A such that
A10: C2 = F2.n and
A11: F2.0 = B and
A12: for n being Nat holds F2.(n+1) = Rec(n,F2.n);
A13: dom F1 = NAT by FUNCT_2:def 1;
A14: F1.0 = B by A8;
A15: for n being Nat holds F1.(n+1) = Rec(n,F1.n) by A9;
A16: dom F2 = NAT by FUNCT_2:def 1;
A17: F2.0 = B by A11;
A18: for n being Nat holds F2.(n+1) = Rec(n,F2.n) by A12;
F1 = F2 from NAT_1:sch 15(A13,A14,A15,A16,A17,A18);
hence thesis by A7,A10;
end;
end;
theorem Th18:
for A being Universal_Algebra, B being Subset of A holds B|^0 = B
proof
let A be Universal_Algebra;
let B be Subset of A;
ex F being sequence of bool the carrier of A st B|^0 = F.0 & F.0 = B &
for n being Nat holds F.(n+1) = F.n \/ {Den(o,A).p where o is (Element of
dom the charact of A), p is Element of (the carrier of A)*: p in dom
Den(o,A) & rng p c= F.n} by Def8;
hence thesis;
end;
theorem Th19:
for A being Universal_Algebra, B being Subset of A for n being Nat
holds B|^(n+1) = (B|^n) \/ {Den(o,A).p
where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= B|^n}
proof
let A be Universal_Algebra;
let B be Subset of A;
let n be Nat;
deffunc Rec(set,set) = $2 \/
{Den(o,A).p where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= $2};
consider F1 being sequence of bool the carrier of A such that
A1: B|^(n) = F1.(n) and
A2: F1.0 = B and
A3: for n being Nat holds F1.(n+1) = Rec(n,F1.n) by Def8;
consider F2 being sequence of bool the carrier of A such that
A4: B|^(n+1) = F2.(n+1) and
A5: F2.0 = B and
A6: for n being Nat holds F2.(n+1) = Rec(n,F2.n) by Def8;
A7: dom F1 = NAT by FUNCT_2:def 1;
A8: F1.0 = B by A2;
A9: for n being Nat holds F1.(n+1) = Rec(n,F1.n) by A3;
A10: dom F2 = NAT by FUNCT_2:def 1;
A11: F2.0 = B by A5;
A12: for n being Nat holds F2.(n+1) = Rec(n,F2.n) by A6;
F1 = F2 from NAT_1:sch 15(A7,A8,A9,A10,A11,A12);
hence thesis by A1,A3,A4;
end;
theorem Th20:
for A being Universal_Algebra, B being Subset of A for n being Nat
for x being set holds x in B|^(n+1) iff x in B|^n or
ex o being Element of dom the charact of A st
ex p being Element of (the carrier of A)*
st x = Den(o,A).p & p in dom Den(o,A) & rng p c= B|^n
proof
let A be Universal_Algebra;
let B be Subset of A;
let n be Nat;
set Z = {Den(o,A).p where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= B|^n};
let x be set;
B|^(n+1) = (B|^n) \/ Z by Th19;
then x in B|^(n+1) iff x in B|^n or x in Z by XBOOLE_0:def 3;
hence thesis;
end;
theorem Th21:
for A being Universal_Algebra, B being Subset of A
for n,m being Nat st n <= m holds B|^n c= B|^m
proof
let A be Universal_Algebra;
let B be Subset of A;
let n,m be Nat;
assume n <= m;
then
A1: ex i being Nat st ( m = n+i) by NAT_1:10;
defpred P[Nat] means B|^n c= B|^(n+$1);
A2: P[0];
A3: now
let i be Nat;
assume
A4: P[i];
deffunc Rec(set,set) = $2 \/
{Den(o,A).p where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= $2};
B|^(n+i+1) = Rec(n,B|^(n+i)) by Th19;
then B|^(n+i) c= B|^(n+(i+1)) by XBOOLE_1:7;
hence P[i+1] by A4,XBOOLE_1:1;
end;
for i being Nat holds P[i] from NAT_1:sch 2(A2,A3);
hence thesis by A1;
end;
theorem Th22:
for A being Universal_Algebra for B1,B2 being Subset of A st B1 c= B2
for n being Nat holds B1|^n c= B2|^n
proof
let A be Universal_Algebra;
let B1,B2 be Subset of A such that
A1: B1 c= B2;
defpred P[Nat] means B1|^$1 c= B2|^$1;
B1|^0 = B1 by Th18;
then
A2: P[0] by A1,Th18;
A3: now
let n be Nat;
assume
A4: P[n];
thus P[n+1]
proof
let x be object;
assume that
A5: x in B1|^(n+1) and
A6: x nin B2|^(n+1);
reconsider a = x as Element of A by A5;
a nin B1|^n by A4,A6,Th20;
then consider o being (Element of dom the charact of A),
p being Element of (the carrier of A)* such that
A7: a = Den(o,A).p and
A8: p in dom Den(o,A) and
A9: rng p c= B1|^n by A5,Th20;
rng p c= B2|^n by A4,A9,XBOOLE_1:1;
hence contradiction by A6,A7,A8,Th20;
end;
end;
for n being Nat holds P[n] from NAT_1:sch 2(A2,A3);
hence thesis;
end;
theorem Th23:
for A being Universal_Algebra, B being Subset of A for n being Nat
for x being set holds x in B|^(n+1) iff x in B or
ex o being Element of dom the charact of A st
ex p being Element of (the carrier of A)*
st x = Den(o,A).p & p in dom Den(o,A) & rng p c= B|^n
proof
let A be Universal_Algebra;
let B be Subset of A;
defpred P[Nat] means for x being set st x in B|^($1+1) holds x in B or
ex o being Element of dom the charact of A st
ex p being Element of (the carrier of A)*
st x = Den(o,A).p & p in dom Den(o,A) & rng p c= B|^$1;
A1: B|^0 = B by Th18;
then
A2: P[0] by Th20;
A3: now
let n be Nat such that
A4: P[n];
thus P[n+1]
proof
let x be set;
assume x in B|^(n+1+1);
then
A5: x in B|^(n+1) or ex o being Element of dom the charact of A st
ex p being Element of (the carrier of A)*
st x = Den(o,A).p & p in dom Den(o,A) & rng p c= B|^(n+1) by Th20;
now
given o being (Element of dom the charact of A),
p being Element of (the carrier of A)* such that
A6: x = Den(o,A).p and
A7: p in dom Den(o,A) and
A8: rng p c= B|^n;
take o,p;
n <= n+1 by NAT_1:13;
then B|^n c= B|^(n+1) by Th21;
hence x = Den(o,A).p & p in dom Den(o,A) & rng p c= B|^(n+1)
by A6,A7,A8;
end;
hence thesis by A4,A5;
end;
end;
A9: for n being Nat holds P[n] from NAT_1:sch 2(A2,A3);
let n be Nat;
let x be set;
B c= B|^n by A1,Th21;
hence thesis by A9,Th20;
end;
scheme MaxVal{A() -> non empty set, B() -> set, P[object,object]}:
ex n being Nat st
for x being Element of A() st x in B() holds P[x,n]
provided
A1: B() is finite and
A2: for x being Element of A() st x in B() ex n being Nat st P[x,n] and
A3: for x being Element of A()
for n,m being Nat st P[x,n] & n <= m holds P[x,m]
proof
A4: for x being object st x in A()/\B()
ex y being object st y in NAT & P[x,y]
proof
let x be object;
assume
A5: x in A()/\B();
then reconsider x as Element of A() by XBOOLE_0:def 4;
x in B() by A5,XBOOLE_0:def 4;
then consider n being Nat such that
A6: P[x,n] by A2;
n is Element of NAT by ORDINAL1:def 12;
hence thesis by A6;
end;
consider f being Function such that
A7: dom f = A()/\B() & rng f c= NAT and
A8: for x being object st x in A()/\B() holds P[x,f.x]
from FUNCT_1:sch 6(A4);
reconsider Z = rng f as finite Subset of NAT by A1,A7,FINSET_1:8;
consider n being Nat such that
A9: for i being Nat st i in Z holds i <= n by STIRL2_1:56;
take n;
let x be Element of A();
assume x in B();
then
A10: x in A()/\B() by XBOOLE_0:def 4;
then
A11: f.x in rng f by A7,FUNCT_1:def 3;
then reconsider i = f.x as Element of NAT by A7;
i <= n by A9,A11;
hence thesis by A3,A8,A10;
end;
theorem Th24:
for A being Universal_Algebra, B being Subset of A ex C being Subset of A
st C = union the set of all B|^n where n is Element of NAT &
C is opers_closed
proof
let A be Universal_Algebra;
let B be Subset of A;
set X = the set of all B|^n where n is Element of NAT;
set C = union X;
A1: union bool the carrier of A = the carrier of A by ZFMISC_1:81;
X c= bool the carrier of A
proof
let x be object;
assume x in X;
then ex n being Element of NAT st x = B|^n;
hence thesis;
end;
then reconsider C as Subset of A by A1,ZFMISC_1:77;
take C;
thus
C = union the set of all B|^n where n is Element of NAT;
let o be Element of Operations A;
consider s being object such that
A2: s in dom the charact of A and
A3: o = (the charact of A).s by FUNCT_1:def 3;
reconsider s as OperSymbol of A by A2;
A4: dom o = (arity o)-tuples_on the carrier of A by MARGREL1:22;
let p be FinSequence of C;
assume len p = arity o;
then p is Element of dom Den(s,A) by A3,A4,FINSEQ_2:92;
then
A5: p in dom Den(s,A);
defpred P[set,Nat] means $1 in B|^$2;
A6: rng p is finite;
A7: for x being Element of A st x in rng p ex n being Nat st P[x,n]
proof
let x be Element of A;
assume
A8: x in rng p;
rng p c= C by FINSEQ_1:def 4;
then consider Y being set such that
A9: x in Y and
A10: Y in X by A8,TARSKI:def 4;
consider n being Element of NAT such that
A11: Y = B|^n by A10;
take n;
thus thesis by A9,A11;
end;
A12: for x being Element of A for n,m being Nat st P[x,n] & n <= m holds P[x,m]
proof
let x be Element of A;
let n,m be Nat;
assume
A13: P[x,n];
assume n <= m;
then B|^n c= B|^m by Th21;
hence thesis by A13;
end;
consider n being Nat such that
A14: for x being Element of A st x in rng p holds P[x,n] from MaxVal(A6,A7
,A12
);
rng p c= B|^n
by A14;
then Den(s,A).p in {Den(a,A).r where a is (Element of dom the charact of A
), r is Element of (the carrier of A)*: r in dom Den(a,A) & rng r c= B|^n}
by A5;
then o.p in (B|^n)\/{Den(a,A).r where a is (Element of dom the charact of A),
r is Element of (the carrier of A)*: r in dom Den(a,A) & rng r c= B|^n} &
n+1 in NAT by A3,XBOOLE_0:def 3;
then
A15: o.p in B|^(n+1) by Th19;
B|^(n+1) in X;
hence thesis by A15,TARSKI:def 4;
end;
theorem Th25:
for A being Universal_Algebra, B,C being Subset of A
st C is opers_closed & B c= C
holds union the set of all B|^n where n is Element of NAT c= C
proof
let A be Universal_Algebra;
let B,C be Subset of A;
assume
A1: C is opers_closed;
assume
A2: B c= C;
let z be object;
assume z in union the set of all B|^n where n is Element of NAT;
then consider Y being set such that
A3: z in Y and
A4: Y in the set of all B|^n where n is Element of NAT by TARSKI:def 4;
consider n being Element of NAT such that
A5: Y = B|^n by A4;
defpred P[Nat] means B|^$1 c= C;
A6: P[0] by A2,Th18;
A7: now
let n be Nat;
assume
A8: P[n];
thus P[n+1]
proof
let x be object;
assume that
A9: x in B|^(n+1) and
A10: x nin C;
x in (B|^n)\/{Den(o,A).p where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= B|^n}
by A9,Th19;
then x in B|^n or
x in {Den(o,A).p where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= B|^n}
by XBOOLE_0:def 3;
then consider o being (Element of dom the charact of A), p being Element
of (the carrier of A)* such that
A11: x = Den(o,A).p and
A12: p in dom Den(o,A) and
A13: rng p c= B|^n by A8,A10;
rng p c= C by A8,A13,XBOOLE_1:1;
then reconsider p as FinSequence of C by FINSEQ_1:def 4;
reconsider oo = Den(o,A) as Element of Operations A;
A14: len p = arity oo by A12,MARGREL1:def 25;
C is_closed_on oo by A1;
hence thesis by A10,A11,A14;
end;
end;
for n being Nat holds P[n] from NAT_1:sch 2(A6,A7);
then P[n];
hence thesis by A3,A5;
end;
definition
let A be Universal_Algebra;
func Generators A -> Subset of A equals
(the carrier of A) \
union the set of all rng o where o is Element of Operations A;
coherence;
end;
theorem Th26:
for A being Universal_Algebra, a being Element of A holds
a in Generators A iff not ex o being Element of Operations A st a in rng o
proof
let A be Universal_Algebra;
set Z = the set of all rng o where o is Element of Operations A;
let a be Element of A;
hereby
assume a in Generators A;
then
A1: a nin union Z by XBOOLE_0:def 5;
given o being Element of Operations A such that
A2: a in rng o;
rng o in Z;
hence contradiction by A1,A2,TARSKI:def 4;
end;
assume
A3: not ex o being Element of Operations A st a in rng o;
assume a nin Generators A;
then a in union Z by XBOOLE_0:def 5;
then consider X being set such that
A4: a in X and
A5: X in Z by TARSKI:def 4;
ex o being Element of Operations A st X = rng o by A5;
hence contradiction by A3,A4;
end;
theorem
for A being Universal_Algebra for B being Subset of A st B is opers_closed
holds Constants A c= B
proof
let A be Universal_Algebra;
let B be Subset of A such that
A1: B is opers_closed;
let x be object;
assume x in Constants A;
then consider a being Element of A such that
A2: x = a and
A3: ex o being Element of Operations A st arity o = 0 & a in rng o;
consider o being Element of Operations A such that
A4: arity o = 0 and
A5: a in rng o by A3;
consider s being object such that
A6: s in dom o and
A7: a = o.s by A5,FUNCT_1:def 3;
A8: dom o = 0-tuples_on the carrier of A by A4,MARGREL1:22;
reconsider s as Element of (the carrier of A)* by A6;
A9: len s = 0 by A6,A8;
s = {} by A6,A8;
then rng s c= B;
then
A10: s is FinSequence of B by FINSEQ_1:def 4;
B is_closed_on o by A1;
hence thesis by A2,A4,A7,A9,A10;
end;
theorem Th28:
for A being Universal_Algebra st Constants A = {} holds {} A is opers_closed
proof
let A be Universal_Algebra such that
A1: Constants A = {};
let o be Element of Operations A;
let s be FinSequence of {} A;
assume
A2: len s = arity o;
A3: s is Element of (arity o)-tuples_on the carrier of A by A2,FINSEQ_2:92;
dom o = (arity o)-tuples_on the carrier of A by MARGREL1:22;
then
A4: o.s in rng o by A3,FUNCT_1:def 3;
then reconsider a = o.s as Element of A;
a nin Constants A by A1;
then s <> {} by A2,A4;
hence thesis;
end;
theorem
for A being Universal_Algebra st Constants A = {}
for G being GeneratorSet of A holds G <> {}
proof
let A be Universal_Algebra such that
A1: Constants A = {};
let G be GeneratorSet of A;
assume
A2: G = {};
then G = {} A;
then G is opers_closed by A1,Th28;
hence thesis by A2,FREEALG:def 4;
end;
theorem Th30:
for A being Universal_Algebra for G being Subset of A
holds G is GeneratorSet of A iff
for I being Element of A ex n being Nat st I in G|^n
proof
let A be Universal_Algebra;
let B be Subset of A;
set X = the set of all B|^n where n is Element of NAT;
consider C being Subset of A such that
A1: C = union X and
A2: C is opers_closed by Th24;
B|^0 = B by Th18;
then
A3: B in X;
thus B is GeneratorSet of A implies for I being Element of A
ex n being Nat st I in B|^n
proof
assume for D being Subset of A st D is opers_closed & B c= D
holds D = the carrier of A;
then
A4: C = the carrier of A by A1,A2,A3,ZFMISC_1:74;
let I be Element of A;
consider Y being set such that
A5: I in Y and
A6: Y in X by A1,A4,TARSKI:def 4;
ex n being Element of NAT st Y = B|^n by A6;
hence thesis by A5;
end;
assume
A7: for I being Element of A ex n being Nat st I in B|^n;
let D be Subset of A;
assume that
A8: D is opers_closed and
A9: B c= D;
A10: union X c= D by A8,A9,Th25;
thus D c= the carrier of A;
let x be object;
assume x in the carrier of A;
then reconsider I = x as Element of A;
consider n being Nat such that
A11: I in B|^n by A7;
reconsider n as Element of NAT by ORDINAL1:def 12;
B|^n in X;
then I in union X by A11,TARSKI:def 4;
hence thesis by A10;
end;
theorem Th31:
for A being Universal_Algebra for B being Subset of A
for G being GeneratorSet of A st G c= B holds B is GeneratorSet of A
proof
let A be Universal_Algebra;
let B be Subset of A;
let G be GeneratorSet of A such that
A1: G c= B;
now
let a be Element of A;
consider n being Nat such that
A2: a in G|^n by Th30;
take n;
G|^n c= B|^n by A1,Th22;
hence a in B|^n by A2;
end;
hence thesis by Th30;
end;
theorem Th32:
for A being Universal_Algebra for G being GeneratorSet of A
for a being Element of A
st not ex o being Element of Operations A st a in rng o holds a in G
proof
let A be Universal_Algebra;
let G be GeneratorSet of A;
let a be Element of A;
assume
A1: for o being Element of Operations A holds a nin rng o;
defpred P[Nat] means a nin G|^$1;
assume a nin G;
then
A2: P[0] by Th18;
A3: now
let n be Nat;
assume
A4: P[n];
thus P[n+1]
proof
assume a in G|^(n+1);
then a in (G|^n) \/ {Den(o,A).p
where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= G|^n}
by Th19;
then a in {Den(o,A).p where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= G|^n}
by A4,XBOOLE_0:def 3;
then consider o being (Element of dom the charact of A), p being
Element of (the carrier of A)* such that
A5: a = Den(o,A).p and
A6: p in dom Den(o,A) and rng p c= G|^n;
a in rng Den(o,A) by A5,A6,FUNCT_1:def 3;
hence contradiction by A1;
end;
end;
for n being Nat holds P[n] from NAT_1:sch 2(A2,A3);
hence contradiction by Th30;
end;
theorem
for A being Universal_Algebra, G being GeneratorSet of A
holds Generators A c= G
proof
let A be Universal_Algebra;
let G be GeneratorSet of A;
let a be object;
assume
A1: a in Generators A;
then
A2: a nin union the set of all rng o where o is Element of
Operations A by XBOOLE_0:def 5;
reconsider I = a as Element of A by A1;
assume a nin G;
then consider o0 being Element of Operations A such that
A3: I in rng o0 by Th32;
rng o0 in the set of all rng o where o is Element of Operations A;
hence contradiction by A2,A3,TARSKI:def 4;
end;
theorem Th34:
for A being free Universal_Algebra for G being free GeneratorSet of A
holds G = Generators A
proof
let A be free Universal_Algebra;
let G be free GeneratorSet of A;
reconsider S = signature A as non empty FinSequence of NAT by MSUALG_1:4;
consider B being Universal_Algebra such that
A1: the carrier of B = NAT and
A2: signature B = S and
A3: for i,j being Nat st i in dom S & j = S.i
holds (the charact of B).i = (j-tuples_on NAT) --> i by Th14;
reconsider f = G --> 0 as Function of G, the carrier of B by A1;
A,B are_similar by A2;
then consider h being Function of A,B such that
A4: h is_homomorphism and
A5: h|G = f by FREEALG:def 5;
A6: len S = len the charact of B by A2,UNIALG_1:def 4;
A7: len S = len the charact of A by UNIALG_1:def 4;
A8: dom S = dom the charact of B by A6,FINSEQ_3:29;
A9: dom S = dom the charact of A by A7,FINSEQ_3:29;
thus G c= Generators A
proof
let a be object;
assume
A10: a in G;
then reconsider I = a as Element of A;
assume not thesis;
then I in union the set of all rng o where o is Element of Operations A
by XBOOLE_0:def 5;
then consider Y being set such that
A11: I in Y and
A12: Y in the set of all rng o where o is Element of Operations A
by TARSKI:def 4;
consider o being Element of Operations A such that
A13: Y = rng o by A12;
consider i being object such that
A14: i in dom the charact of A and
A15: o = (the charact of A).i by FUNCT_1:def 3;
reconsider i as Element of NAT by A14;
reconsider j = S.i as Element of NAT;
reconsider o2 = (the charact of B).i as Element of Operations B
by A8,A9,A14,FUNCT_1:def 3;
consider x being object such that
A16: x in dom o and
A17: I = o.x by A11,A13,FUNCT_1:def 3;
A18: dom o = (arity o)-tuples_on the carrier of A by MARGREL1:22;
reconsider x as FinSequence of A by A16,FINSEQ_1:def 11;
reconsider hx = h*x as FinSequence of NAT by A1;
len (h*x) = len x by FINSEQ_2:33
.= arity o by A16,A18,CARD_1:def 7
.= j by A9,A14,A15,UNIALG_1:def 4;
then
A19: hx is Element of j-tuples_on NAT by FINSEQ_2:92;
0 = f.I by A10,FUNCOP_1:7
.= h.(o.x) by A5,A10,A17,FUNCT_1:49
.= o2.(h*x) by A4,A14,A15,A16,ALG_1:def 1
.= ((j-tuples_on NAT) --> i).(h*x) by A3,A9,A14
.= i by A19,FUNCOP_1:7;
hence contradiction by A14,FINSEQ_3:25;
end;
let a be object;
assume
A20: a in Generators A;
then
A21: a nin union the set of all rng o where o is Element of Operations A
by XBOOLE_0:def 5;
reconsider I = a as Element of A by A20;
assume a nin G;
then consider o0 being Element of Operations A such that
A22: I in rng o0 by Th32;
rng o0 in the set of all rng o where o is Element of Operations A;
hence contradiction by A21,A22,TARSKI:def 4;
end;
registration
let A be free Universal_Algebra;
cluster Generators A -> free for GeneratorSet of A;
coherence
proof
set G = the free GeneratorSet of A;
Generators A = G by Th34;
hence thesis;
end;
end;
definition
let A be free Universal_Algebra;
redefine func Generators A -> GeneratorSet of A;
coherence
proof
set G = the free GeneratorSet of A;
Generators A = G by Th34;
hence thesis;
end;
end;
registration
let A,B be set;
cluster [:A,B:] -> disjoint_with_NAT;
coherence
proof
now
let z be object;
assume that
A1: z in [:A,B:] and
A2: z in NAT;
ex a,b being object st a in A & b in B & z = [a,b] by A1,ZFMISC_1:def 2;
hence contradiction by A2;
end;
hence [:A,B:] misses NAT by XBOOLE_0:3;
end;
end;
theorem
for A being free Universal_Algebra for G being GeneratorSet of A
for B being Universal_Algebra for h1,h2 being Function of A,B
st h1 is_homomorphism & h2 is_homomorphism & h1|G = h2|G
holds h1 = h2
proof
let A be free Universal_Algebra;
let G be GeneratorSet of A;
let B be Universal_Algebra;
let h1,h2 be Function of A,B such that
A1: h1 is_homomorphism and
A2: h2 is_homomorphism and
A3: h1|G = h2|G;
defpred P[Nat] means
for a being Element of A st a in G|^$1 holds h1.a = h2.a;
A4: P[0]
proof
let a be Element of A;
assume a in G|^0;
then
A5: a in G by Th18;
then h1.a = (h1|G).a by FUNCT_1:49;
hence thesis by A3,A5,FUNCT_1:49;
end;
A6: for n being Nat st P[n] holds P[n+1]
proof
let n be Nat such that
A7: P[n];
let a be Element of A;
assume that
A8: a in G|^(n+1) and
A9: h1.a <> h2.a;
a nin G|^n by A7,A9;
then consider o being (Element of dom the charact of A),
p being Element of (the carrier of A)* such that
A10: a = Den(o,A).p and
A11: p in dom Den(o,A) and
A12: rng p c= G|^n by A8,Th20;
A,B are_similar by A1,ALG_1:def 1;
then len the charact of A = len the charact of B by UNIALG_2:1;
then reconsider o9 = o as Element of dom the charact of B by FINSEQ_3:29;
A13: Operations A = rng the charact of A;
A14: Operations B = rng the charact of B;
then
A15: h1.a = Den(o9,B).(h1*p) by A1,A10,A11,A13,ALG_1:def 1;
A16: h2.a = Den(o9,B).(h2*p) by A2,A10,A11,A13,A14,ALG_1:def 1;
now
A17: dom h1 = the carrier of A by FUNCT_2:def 1;
dom h2 = the carrier of A by FUNCT_2:def 1;
hence G|^n c= dom h1 & G|^n c= dom h2 by A17;
let x be set;
assume x in G|^n;
hence h1.x = h2.x by A7;
end;
hence thesis by A9,A12,A15,A16,Th1;
end;
A18: for n being Nat holds P[n] from NAT_1:sch 2(A4,A6);
now
let a be Element of A;
ex n being Nat st a in G|^n by Th30;
hence h1.a = h2.a by A18;
end;
hence thesis by FUNCT_2:63;
end;
Lm2: for A being free Universal_Algebra for o1,o2 being OperSymbol of A
for p1,p2 being FinSequence st p1 in dom Den(o1,A) & p2 in dom Den(o2,A)
holds Den(o1,A).p1 = Den(o2,A).p2 implies o1 = o2
proof
let A be free Universal_Algebra;
set G = the free GeneratorSet of A;
let o1,o2 be OperSymbol of A;
let p1,p2 be FinSequence such that
A1: p1 in dom Den(o1,A) and
A2: p2 in dom Den(o2,A) and
A3: Den(o1,A).p1 = Den(o2,A).p2;
reconsider S = signature A as non empty FinSequence of NAT by MSUALG_1:4;
consider B being Universal_Algebra such that
A4: the carrier of B = NAT and
A5: signature B = S and
A6: for i,j being Nat st i in dom S & j = S.i
holds (the charact of B).i = (j-tuples_on NAT) --> i by Th14;
reconsider f = G --> 0 as Function of G, the carrier of B by A4;
A,B are_similar by A5;
then consider h being Function of A,B such that
A7: h is_homomorphism and h|G = f by FREEALG:def 5;
A8: len S = len the charact of B by A5,UNIALG_1:def 4;
A9: len S = len the charact of A by UNIALG_1:def 4;
A10: dom S = dom the charact of B by A8,FINSEQ_3:29;
A11: dom S = dom the charact of A by A9,FINSEQ_3:29;
reconsider b1 = o1, b2 = o2 as OperSymbol of B by A8,A9,FINSEQ_3:29;
reconsider n1 = o1, n2 = o2 as Element of NAT;
reconsider j1 = S.n1, j2 = S.n2 as Element of NAT;
reconsider x1 = p1, x2 = p2 as FinSequence of A by A1,A2,FINSEQ_1:def 11;
reconsider h1 = h*x1, h2 = h*x2 as FinSequence of NAT by A4;
reconsider oo1 = Den(o1,A), oo2 = Den(o2,A) as Element of Operations A;
A12: dom oo1 = (arity oo1)-tuples_on the carrier of A by MARGREL1:22;
A13: dom oo2 = (arity oo2)-tuples_on the carrier of A by MARGREL1:22;
len x1 = arity oo1 by A1,A12,CARD_1:def 7
.= j1 by A11,UNIALG_1:def 4;
then len h1 = j1 by FINSEQ_2:33;
then
A14: h1 is Element of j1-tuples_on NAT by FINSEQ_2:92;
len x2 = arity oo2 by A2,A13,CARD_1:def 7
.= j2 by A11,UNIALG_1:def 4;
then len h2 = j2 by FINSEQ_2:33;
then
A15: h2 is Element of j2-tuples_on NAT by FINSEQ_2:92;
A16: Den(o1,A) is Element of Operations A;
A17: Den(b1,B) is Element of Operations B;
then
A18: h.(Den(o1,A).x1) = Den(b1,B).h1 by A1,A7,A16,ALG_1:def 1;
A19: h.(Den(o2,A).x2) = Den(b2,B).h2 by A2,A7,A16,A17,ALG_1:def 1;
A20: Den(b1,B) = (j1-tuples_on NAT)-->n1 by A6,A10;
A21: Den(b2,B) = (j2-tuples_on NAT)-->n2 by A6,A10;
Den(b1,B).h1 = n1 by A14,A20,FUNCOP_1:7;
hence thesis by A3,A15,A18,A19,A21,FUNCOP_1:7;
end;
theorem Th36:
for A being free Universal_Algebra for o1,o2 being OperSymbol of A
for p1,p2 being FinSequence st p1 in dom Den(o1,A) & p2 in dom Den(o2,A)
holds Den(o1,A).p1 = Den(o2,A).p2 implies o1 = o2 & p1 = p2
proof
let A be free Universal_Algebra;
set G = the free GeneratorSet of A;
let o1,o2 be OperSymbol of A;
let p1,p2 be FinSequence such that
A1: p1 in dom Den(o1,A) and
A2: p2 in dom Den(o2,A) and
A3: Den(o1,A).p1 = Den(o2,A).p2;
thus
A4: o1 = o2 by A1,A2,A3,Lm2;
reconsider S = signature A as non empty FinSequence of NAT by MSUALG_1:4;
set G9 = G \/ {the carrier of A};
reconsider G9 as non empty set;
deffunc F(object) = root-tree [0,$1];
consider g being Function such that
A5: dom
g = G & for x being object st x in G holds g.x = F(x) from FUNCT_1:sch 3;
set X = [:{0},G9:];
set B = FreeUnivAlgNSG(S,X);
A6: signature B = S by FREEALG:4;
A7: Terminals DTConUA(S,[:{0},G9:]) = [:{0},G9:] by FREEALG:3;
rng g c= FreeGenSetNSG(S,[:{0},G9:])
proof
let b be object;
assume b in rng g;
then consider a being object such that
A8: a in dom g and
A9: b = g.a by FUNCT_1:def 3;
reconsider a as Element of A by A5,A8;
A10: a in G9 by A5,A8,XBOOLE_0:def 3;
0 in {0} by TARSKI:def 1;
then
A11: [0,a] in [:{0},G9:] by A10,ZFMISC_1:87;
then reconsider s = [0,a] as Symbol of DTConUA(S,[:{0},G9:]) by A7;
root-tree s in FreeGenSetNSG(S,[:{0},G9:]) by A7,A11;
hence thesis by A5,A8,A9;
end;
then reconsider g as Function of G, the carrier of B
by A5,FUNCT_2:2,XBOOLE_1:1;
signature B = S by FREEALG:4;
then A,B are_similar;
then consider h being Function of A,B such that
A12: h is_homomorphism and
A13: h|G = g by FREEALG:def 5;
defpred G[Nat] means
for a1,a2 being set st a1 in G|^$1 & a2 in G|^$1 & h.a1 = h.a2
holds a1 = a2;
A14: G|^0 = G by Th18;
A15: len S = len the charact of B by A6,UNIALG_1:def 4;
A16: len S = len the charact of A by UNIALG_1:def 4;
A17: dom S = dom the charact of B by A15,FINSEQ_3:29;
A18: now
let o be Element of dom the charact of A;
let p be FinSequence of A such that
A19: p in dom Den(o,A);
reconsider q = p as FinSequence of A;
reconsider hq = h*q as FinSequence of B;
reconsider op = Den(o,A) as Element of Operations A;
reconsider on = o as Element of NAT;
reconsider o9 = on as OperSymbol of B by A15,A16,FINSEQ_3:29;
reconsider op9 = Den(o9,B) as Element of Operations B;
reconsider j = S.o9 as Element of NAT;
dom op = (arity op)-tuples_on the carrier of A by MARGREL1:22;
then
A20: len p = arity op by A19,CARD_1:def 7
.= j by A17,UNIALG_1:def 4;
hence len p = S.o & len (h*p) = S.o by FINSEQ_2:33;
A21: h.(op.q) = op9.hq by A12,A19,ALG_1:def 1;
A22: In(o9, dom the charact of B) = o9 by SUBSET_1:def 8;
len hq = S.o9 by A20,FINSEQ_2:33;
hence h.(Den(o,A).p) = o-tree (h*p) by A17,A21,A22,Th17;
end;
A23: G[0]
proof
let a1,a2 be set;
assume that
A24: a1 in G|^0 and
A25: a2 in G|^0 and
A26: h.a1 = h.a2;
A27: h.a1 = g.a1 by A13,A14,A24,FUNCT_1:49;
A28: h.a2 = g.a2 by A13,A14,A25,FUNCT_1:49;
A29: h.a1 = F(a1) by A5,A14,A24,A27;
h.a2 = F(a2) by A5,A14,A25,A28;
then [0,a1] = [0,a2] by A26,A29,TREES_4:4;
hence thesis by XTUPLE_0:1;
end;
A30: now
let o be Element of dom the charact of A;
let p be Element of (the carrier of A)*;
assume p in dom Den(o,A);
then
A31: h.(Den(o,A).p) = o-tree(h*p) by A18;
let x be set;
assume
A32: x in G;
then
A33: h.x = g.x by A13,FUNCT_1:49
.= F(x) by A5,A32;
assume h.(Den(o,A).p) = h.x;
hence contradiction by A31,A33,TREES_4:17;
end;
A34: for k being Nat st G[k] holds G[k+1]
proof
let k be Nat such that
A35: G[k];
defpred Gk[set] means ex o being Element of dom the charact of A st
ex p being Element of (the carrier of A)*
st $1 = Den(o,A).p & p in dom Den(o,A) & rng p c= G|^k;
let a1,a2 be set;
assume that
A36: a1 in G|^(k+1) and
A37: a2 in G|^(k+1) and
A38: h.a1 = h.a2;
per cases by A36,A37,Th23;
suppose
A39: a1 in G & a2 in G;
then
A40: h.a1 = g.a1 by A13,FUNCT_1:49;
A41: h.a2 = g.a2 by A13,A39,FUNCT_1:49;
A42: h.a1 = F(a1) by A5,A39,A40;
h.a2 = F(a2) by A5,A39,A41;
then [0,a1] = [0,a2] by A38,A42,TREES_4:4;
hence thesis by XTUPLE_0:1;
end;
suppose
A43: Gk[a1] & Gk[a2];
then consider b1 being (Element of dom the charact of A),
q1 being Element of (the carrier of A)* such that
A44: a1 = Den(b1,A).q1 and
A45: q1 in dom Den(b1,A) and
A46: rng q1 c= G|^k;
consider b2 being (Element of dom the charact of A),
q2 being Element of (the carrier of A)* such that
A47: a2 = Den(b2,A).q2 and
A48: q2 in dom Den(b2,A) and
A49: rng q2 c= G|^k by A43;
A50: b1-tree(h*q1) = h.a1 by A18,A44,A45
.= b2-tree(h*q2) by A18,A38,A47,A48;
then
A51: b1 = b2 by TREES_4:15;
A52: h*q1 = h*q2 by A50,TREES_4:15;
A53: len q1 = S.b1 by A18,A45;
A54: len q2 = S.b2 by A18,A48;
A55: dom q1 = Seg len q1 by FINSEQ_1:def 3;
A56: dom q2 = Seg len q1 by A51,A53,A54,FINSEQ_1:def 3;
now
let j be Nat;
assume
A57: j in dom q1;
then
A58: q1.j in rng q1 by FUNCT_1:3;
A59: q2.j in rng q2 by A55,A56,A57,FUNCT_1:3;
A60: h.(q1.j) = (h*q1).j by A57,FUNCT_1:13;
h.(q2.j) = (h*q2).j by A55,A56,A57,FUNCT_1:13;
hence q1.j = q2.j by A35,A46,A49,A52,A58,A59,A60;
end;
hence thesis by A44,A47,A51,A55,A56,FINSEQ_1:13;
end;
suppose a1 in G & Gk[a2] or Gk[a1] & a2 in G;
hence thesis by A30,A38;
end;
end;
A61: for k being Nat holds G[k] from NAT_1:sch 2(A23,A34);
reconsider q1 = p1, q2 = p2 as FinSequence of A by A1,A2,FINSEQ_1:def 11;
o1-tree(h*q1) = h.(Den(o1,A).p1) by A1,A18
.= o2-tree(h*q2) by A2,A3,A18;
then
A62: h*p1 = h*p2 by TREES_4:15;
A63: len q1 = S.o1 by A1,A18;
A64: len q2 = S.o2 by A2,A18;
A65: dom q1 = Seg len q1 by FINSEQ_1:def 3;
A66: dom q2 = Seg len q1 by A4,A63,A64,FINSEQ_1:def 3;
now
let j be Nat;
assume
A67: j in dom q1;
then
A68: q1.j in rng q1 by FUNCT_1:3;
A69: q2.j in rng q2 by A65,A66,A67,FUNCT_1:3;
consider n1 being Nat such that
A70: q1.j in G|^n1 by A68,Th30;
consider n2 being Nat such that
A71: q2.j in G|^n2 by A69,Th30;
reconsider k = max(n1,n2) as Nat by TARSKI:1;
A72: G|^n1 c= G|^k by Th21,XXREAL_0:25;
A73: G|^n2 c= G|^k by Th21,XXREAL_0:25;
A74: h.(q1.j) = (h*q1).j by A67,FUNCT_1:13;
h.(q2.j) = (h*q2).j by A65,A66,A67,FUNCT_1:13;
hence q1.j = q2.j by A61,A62,A70,A71,A72,A73,A74;
end;
hence thesis by A65,A66;
end;
theorem
for A being free Universal_Algebra for o1,o2 being Element of Operations A
for p1,p2 being FinSequence st p1 in dom o1 & p2 in dom o2
holds o1.p1 = o2.p2 implies o1 = o2 & p1 = p2
proof
let A be free Universal_Algebra;
let o1,o2 be Element of Operations A;
consider a1 being object such that
A1: a1 in dom the charact of A and
A2: o1 = (the charact of A).a1 by FUNCT_1:def 3;
consider a2 being object such that
A3: a2 in dom the charact of A and
A4: o2 = (the charact of A).a2 by FUNCT_1:def 3;
reconsider a1,a2 as OperSymbol of A by A1,A3;
A5: o1 = Den(a1,A) by A2;
A6: o2 = Den(a2,A) by A4;
let p1,p2 be FinSequence;
assume that
A7: p1 in dom o1 and
A8: p2 in dom o2 and
A9: o1.p1 = o2.p2;
thus thesis by A5,A6,A7,A8,A9,Th36;
end;
theorem Th38:
for A being free Universal_Algebra for o being OperSymbol of A
for p being FinSequence st p in dom Den(o,A) for a being set st a in rng p
holds a <> Den(o,A).p
proof
let A be free Universal_Algebra;
let o be OperSymbol of A;
let p be FinSequence such that
A1: p in dom Den(o,A);
let a be set such that
A2: a in rng p and
A3: a = Den(o,A).p;
reconsider p as FinSequence of A by A1,FINSEQ_1:def 11;
a in rng p by A2;
then reconsider a as Element of A;
set G = Generators A;
consider n being Nat such that
A4: a in G|^n by Th30;
defpred P[Nat] means ex a being (Element of A), o being OperSymbol of A st
ex p being FinSequence of A st
p in dom Den(o,A) & a in rng p & a = Den(o,A).p & a in G|^$1;
a in rng p by A2;
then
A5: ex n being Nat st P[n] by A1,A3,A4;
consider n being Nat such that
A6: P[n] & for m being Nat st P[m] holds n <= m from NAT_1:sch 5(A5);
consider a being (Element of A), o being OperSymbol of A,
p being FinSequence of A such that
A7: p in dom Den(o,A) and
A8: a in rng p and
A9: a = Den(o,A).p and
A10: a in G|^n by A6;
reconsider op = Den(o,A) as Element of Operations A;
a in rng op by A7,A9,FUNCT_1:3;
then a nin G by Th26;
then n <> 0 by A10,Th18;
then consider k being Nat such that
A11: n = k+1 by NAT_1:6;
reconsider k as Element of NAT by ORDINAL1:def 12;
A12: k < n by A11,NAT_1:13;
then a nin G|^k by A6,A7,A8,A9;
then consider o9 being (Element of dom the charact of A),
p9 being Element of (the carrier of A)* such that
A13: a = Den(o9,A).p9 and
A14: p9 in dom Den(o9,A) and
A15: rng p9 c= G|^k by A10,A11,Th20;
p9 = p by A7,A9,A13,A14,Th36;
hence contradiction by A6,A7,A8,A9,A12,A15;
end;
theorem Th39:
for A being free Universal_Algebra for G being GeneratorSet of A
for o being OperSymbol of A
st for o9 being OperSymbol of A, p being FinSequence
st p in dom Den(o9,A) & Den(o9,A).p in G holds o9 <> o
for p being FinSequence st p in dom Den(o,A)
for n being Nat st Den(o,A).p in G|^(n+1) holds rng p c= G|^n
proof
let A be free Universal_Algebra;
let G be GeneratorSet of A;
let o be OperSymbol of A such that
A1: for o9 being OperSymbol of A, p being FinSequence
st p in dom Den(o9,A) & Den(o9,A).p in G holds o9 <> o;
let p be FinSequence such that
A2: p in dom Den(o,A);
let n be Nat such that
A3: Den(o,A).p in G|^(n+1) and
A4: not rng p c= G|^n;
reconsider p as FinSequence of A by A2,FINSEQ_1:def 11;
defpred P[Nat] means ex p being FinSequence of A st
p in dom Den(o,A) & Den(o,A).p in G|^($1+1) & not rng p c= G|^$1;
p is FinSequence of A;
then
A5: ex n being Nat st P[n] by A2,A3,A4;
consider n being Nat such that
A6: P[n] & for m being Nat st P[m] holds n <= m from NAT_1:sch 5(A5);
consider p being FinSequence of A such that
A7: p in dom Den(o,A) and
A8: Den(o,A).p in G|^(n+1) and
A9: not rng p c= G|^n by A6;
set a = Den(o,A).p;
now
assume
A10: a in G|^n;
a nin G by A1,A7;
then n <> 0 by A10,Th18;
then consider k being Nat such that
A11: n = k+1 by NAT_1:6;
reconsider k as Element of NAT by ORDINAL1:def 12;
A12: k < n by A11,NAT_1:13;
then G|^k c= G|^n by Th21;
then not rng p c= G|^k by A9;
hence contradiction by A6,A7,A10,A11,A12;
end;
then ex o9 being (Element of dom the charact of A),
p9 being Element of (the carrier of A)* st
a = Den(o9,A).p9 & p9 in dom Den(o9,A) & rng p9 c= G|^n by A8,Th20;
hence contradiction by A7,A9,Th36;
end;
theorem
for A being free Universal_Algebra for o being OperSymbol of A
for p being FinSequence st p in dom Den(o,A)
for n being Nat st Den(o,A).p in (Generators A)|^(n+1)
holds rng p c= (Generators A)|^n
proof
let A be free Universal_Algebra;
set G = Generators A;
let o be OperSymbol of A;
now
let o9 be OperSymbol of A, p be FinSequence;
reconsider op = Den(o9,A) as Element of Operations A;
assume p in dom Den(o9,A);
then op.p in rng op by FUNCT_1:3;
hence Den(o9,A).p in G implies o9 <> o by Th26;
end;
hence thesis by Th39;
end;
begin :: If-while Algebra
definition
let S be non empty UAStr;
attr S is with_empty-instruction means
: Def10:
1 in dom the charact of S &
(the charact of S).1 is 0-ary non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S;
attr S is with_catenation means
: Def11:
2 in dom the charact of S &
(the charact of S).2 is 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S;
attr S is with_if-instruction means
: Def12:
3 in dom the charact of S &
(the charact of S).3 is 3-ary non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S;
attr S is with_while-instruction means
: Def13:
4 in dom the charact of S &
(the charact of S).4 is 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S;
attr S is associative means
:
Def14: (the charact of S).2 is 2-ary associative non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S;
end;
definition
let S be non-empty UAStr;
attr S is unital means
: Def15:
ex f being 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S
st f = (the charact of S).2 &
Den(In(1, dom the charact of S), S).({}) is_a_unity_wrt f;
end;
theorem Th41:
for X being non empty set, x being Element of X
for c being 2-ary associative unital
non empty quasi_total homogeneous PartFunc of X*, X st x is_a_unity_wrt c
for i being 3-ary non empty quasi_total homogeneous PartFunc of X*, X
for w being 2-ary non empty quasi_total homogeneous PartFunc of X*, X
ex S being non-empty strict UAStr st the carrier of S = X &
the charact of S = <*(0-tuples_on X)-->x,c*>^<*i,w*> &
S is with_empty-instruction with_catenation unital associative
with_if-instruction with_while-instruction quasi_total partial
proof
let X be non empty set;
let x be Element of X;
let c be 2-ary associative unital non empty quasi_total homogeneous
PartFunc of X*, X;
assume
A1: x is_a_unity_wrt c;
let i be 3-ary non empty quasi_total homogeneous PartFunc of X*, X;
let w be 2-ary non empty quasi_total homogeneous PartFunc of X*, X;
set Y = 0-tuples_on X;
set e = Y --> x;
reconsider e as 0-ary
non empty quasi_total homogeneous PartFunc of X*, X;
set char = <*e,c*>^<*i,w*>;
char is PFuncFinSequence of X
proof
let a be object;
assume a in rng char;
then a in rng <*e,c*> \/ rng <*i,w*> by FINSEQ_1:31;
then a in rng <*e,c*> or a in rng <*i,w*> by XBOOLE_0:def 3;
then a in {e,c} or a in {i,w} by FINSEQ_2:127;
then a = e or a = c or a = i or a = w by TARSKI:def 2;
hence thesis by PARTFUN1:45;
end;
then reconsider char as non empty non-empty PFuncFinSequence of X;
reconsider S = UAStr(#X, char#) as non-empty strict UAStr by UNIALG_1:def 3;
take S;
thus the carrier of S = X;
thus the charact of S = <*(0-tuples_on X)-->x,c*>^<*i,w*>;
A2: len <*e,c*> = 2 by FINSEQ_1:44;
len <*i,w*> = 2 by FINSEQ_1:44;
then len char = 2+2 by A2,FINSEQ_1:22;
then
A3: dom char = Seg 4 by FINSEQ_1:def 3;
reconsider e as 0-ary non empty homogeneous
PartFunc of (the carrier of S)*, the carrier of S;
reconsider c as 2-ary associative non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S;
A4: <*e,c*>.1 = e by FINSEQ_1:44;
A5: <*e,c*>.2 = c by FINSEQ_1:44;
A6: <*i,w*>.1 = i by FINSEQ_1:44;
A7: <*i,w*>.2 = w by FINSEQ_1:44;
thus 1 in dom the charact of S by A3;
A8: dom <*e,c*> = Seg 2 by FINSEQ_1:89;
then
A9: 1 in dom <*e,c*>;
A10: 2 in dom <*e,c*> by A8;
A11: e = (the charact of S).1 by A4,A9,FINSEQ_1:def 7;
A12: c = (the charact of S).2 by A5,A10,FINSEQ_1:def 7;
thus (the charact of S).1 is 0-ary non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S
by A4,A9,FINSEQ_1:def 7;
thus 2 in dom the charact of S by A3;
thus (the charact of S).2 is 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S
by A5,A10,FINSEQ_1:def 7;
thus S is unital
proof
take c;
thus c = (the charact of S).2 by A5,A10,FINSEQ_1:def 7;
A13: 1 in dom the charact of S by A3;
A14: Y = {{}} by COMPUT_1:5;
A15: In(1, dom the charact of S) = 1 by A13,SUBSET_1:def 8;
A16: {} in Y by A14,TARSKI:def 1;
e = Den(In(1, dom the charact of S),S) by A4,A9,A15,FINSEQ_1:def 7;
hence thesis by A1,A16,FUNCOP_1:7;
end;
thus (the charact of S).2 is 2-ary associative non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S
by A5,A10,FINSEQ_1:def 7;
thus 3 in dom the charact of S by A3;
A17: dom <*i,w*> = Seg 2 by FINSEQ_1:89;
then
A18: 1 in dom <*i,w*>;
A19: 2 in dom <*i,w*> by A17;
A20: char.(2+1) = i by A2,A6,A18,FINSEQ_1:def 7;
A21: char.(2+2) = w by A2,A7,A19,FINSEQ_1:def 7;
thus (the charact of S).3 is 3-ary non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S by A20;
thus 4 in dom the charact of S by A3;
thus (the charact of S).4 is 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S by A2,A7,A19,
FINSEQ_1:def 7;
thus S is quasi_total
proof
let i be Nat, h be PartFunc of (the carrier of S)*, the carrier of S;
assume i in dom the charact of S;
hence thesis by A3,A11,A12,A20,A21,ENUMSET1:def 2,FINSEQ_3:2;
end;
let i be Nat, h be PartFunc of (the carrier of S)*, the carrier of S;
assume that
A22: i in dom the charact of S and
A23: h = (the charact of S).i;
let p1,p2 be FinSequence;
i = 1 or i = 2 or i = 3 or i = 4 by A3,A22,ENUMSET1:def 2,FINSEQ_3:2;
hence thesis by A11,A12,A20,A21,A23,MARGREL1:def 1;
end;
registration
cluster with_empty-instruction with_catenation with_if-instruction
with_while-instruction unital associative
for quasi_total partial non-empty strict UAStr;
existence
proof
set c = the 2-ary associative unital non empty quasi_total homogeneous
PartFunc of {{}}*, {{}};
set a = the Element of {{}};
consider x being set such that
A1: x is_a_unity_wrt c by Def3;
arity c = 2 by COMPUT_1:def 21;
then
A2: dom c = 2-tuples_on {{}} by COMPUT_1:22;
then <*a,a*> in dom c by FINSEQ_2:137;
then <*a,x*> in dom c by A1;
then reconsider x as Element of {{}} by A2,FINSEQ_2:138;
set i = the 3-ary non empty quasi_total homogeneous PartFunc of {{}}*, {{}};
set w = the 2-ary non empty quasi_total homogeneous PartFunc of {{}}*, {{}};
ex S being non-empty strict UAStr st the carrier of S = {{}} &
the charact of S = <*(0-tuples_on {{}})-->x,c*>^<*i,w*> &
S is with_empty-instruction with_catenation unital associative
with_if-instruction with_while-instruction quasi_total partial by A1,Th41;
hence thesis;
end;
end;
definition
mode preIfWhileAlgebra is with_empty-instruction
with_catenation with_if-instruction with_while-instruction
Universal_Algebra;
end;
reserve A for preIfWhileAlgebra,
C,I,J for Element of A;
reserve S for non empty set,
T for Subset of S,
s for Element of S;
definition
let A be non empty UAStr;
mode Algorithm of A is Element of A;
end;
theorem Th42:
for A being with_empty-instruction non-empty UAStr
holds dom Den(In(1, dom the charact of A), A) = {{}}
proof
let A be with_empty-instruction non-empty UAStr;
reconsider e = (the charact of A).1 as 0-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def10;
1 in dom the charact of A by Def10;
then
A1: Den(In(1, dom the charact of A), A) = e by SUBSET_1:def 8;
arity e = 0 by COMPUT_1:def 21;
then dom e = 0-tuples_on the carrier of A by COMPUT_1:22;
hence thesis by A1,COMPUT_1:5;
end;
definition
let A be with_empty-instruction non-empty UAStr;
func EmptyIns A -> Algorithm of A equals
Den(In(1, dom the charact of A), A).{};
coherence
proof
reconsider e = (the charact of A).1 as 0-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def10;
1 in dom the charact of A by Def10;
then
A1: Den(In(1, dom the charact of A), A) = e by SUBSET_1:def 8;
then dom e = {{}} by Th42;
then {} in dom e by TARSKI:def 1;
hence thesis by A1,PARTFUN1:4;
end;
end;
theorem
for A being with_empty-instruction Universal_Algebra
for o being Element of Operations A
st o = Den(In(1, dom the charact of A), A)
holds arity o = 0 & EmptyIns A in rng o
proof
let A be with_empty-instruction Universal_Algebra;
let o be Element of Operations A such that
A1: o = Den(In(1, dom the charact of A), A);
A2: dom Den(In(1, dom the charact of A), A) = {{}} by Th42;
A3: <*>the carrier of A in {{}} by TARSKI:def 1;
hence arity o = len (<*>the carrier of A) by A1,A2,MARGREL1:def 25
.= 0;
thus thesis by A1,A2,A3,FUNCT_1:def 3;
end;
theorem Th44:
for A being with_catenation non-empty UAStr
holds dom Den(In(2, dom the charact of A), A) = 2-tuples_on the carrier of A
proof
let A be with_catenation non-empty UAStr;
reconsider f = (the charact of A).2 as 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def11;
2 in dom the charact of A by Def11;
then
A1: Den(In(2, dom the charact of A), A) = f by SUBSET_1:def 8;
arity f = 2 by COMPUT_1:def 21;
hence thesis by A1,COMPUT_1:22;
end;
definition
let A be with_catenation non-empty UAStr;
let I1,I2 be Algorithm of A;
func I1 \; I2 -> Algorithm of A equals
Den(In(2, dom the charact of A), A).<*I1,I2*>;
coherence
proof
reconsider f = (the charact of A).2 as 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def11;
2 in dom the charact of A by Def11;
then
A1: Den(In(2, dom the charact of A), A) = f by SUBSET_1:def 8;
then dom f = 2-tuples_on the carrier of A by Th44;
then <*I1,I2*> in dom f by FINSEQ_2:137;
hence thesis by A1,PARTFUN1:4;
end;
end;
theorem
for A being with_empty-instruction with_catenation unital non-empty UAStr
for I being Element of A holds EmptyIns A\;I = I & I\;EmptyIns A = I
proof
let A be with_empty-instruction with_catenation unital non-empty UAStr;
let I be Element of A;
consider f being 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A such that
A1: f = (the charact of A).2 and
A2: Den(In(1, dom the charact of A), A).({}) is_a_unity_wrt f by Def15;
A3: 2 in dom the charact of A by Def11;
arity f = 2 by COMPUT_1:def 21;
then
A4: dom f = 2-tuples_on the carrier of A by COMPUT_1:22;
A5: In(2, dom the charact of A) = 2 by A3,SUBSET_1:def 8;
<*I,I*> in dom f by A4,FINSEQ_2:137;
hence thesis by A1,A2,A5;
end;
theorem
for A being associative with_catenation non-empty UAStr
for I1,I2,I3 being Element of A holds (I1\;I2)\;I3 = I1\;(I2\;I3)
proof
let A be associative with_catenation non-empty UAStr;
let I1,I2,I3 be Element of A;
reconsider f = (the charact of A).2 as
2-ary associative non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def14;
A1: 2 in dom the charact of A by Def11;
arity f = 2 by COMPUT_1:def 21;
then
A2: dom f = 2-tuples_on the carrier of A by COMPUT_1:22;
A3: In(2, dom the charact of A) = 2 by A1,SUBSET_1:def 8;
A4: <*I1,I2*> in dom f by A2,FINSEQ_2:137;
A5: <*I2,I3*> in dom f by A2,FINSEQ_2:137;
A6: <*I1,I2\;I3*> in dom f by A2,FINSEQ_2:137;
<*I1\;I2,I3*> in dom f by A2,FINSEQ_2:137;
hence thesis by A3,A4,A5,A6,Def2;
end;
theorem Th47:
for A being with_if-instruction non-empty UAStr
holds dom Den(In(3, dom the charact of A), A) = 3-tuples_on the carrier of A
proof
let A be with_if-instruction non-empty UAStr;
reconsider f = (the charact of A).3 as 3-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def12;
3 in dom the charact of A by Def12;
then
A1: Den(In(3, dom the charact of A), A) = f by SUBSET_1:def 8;
arity f = 3 by COMPUT_1:def 21;
hence thesis by A1,COMPUT_1:22;
end;
definition
let A be with_if-instruction non-empty UAStr;
let C,I1,I2 be Algorithm of A;
func if-then-else(C,I1,I2) -> Algorithm of A equals
Den(In(3, dom the charact of A), A).<*C,I1,I2*>;
coherence
proof
reconsider f = (the charact of A).3 as 3-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def12;
3 in dom the charact of A by Def12;
then
A1: Den(In(3, dom the charact of A), A) = f by SUBSET_1:def 8;
arity f = 3 by COMPUT_1:def 21;
then dom f = 3-tuples_on the carrier of A by COMPUT_1:22;
then <*C,I1,I2*> in dom f by FINSEQ_2:139;
hence thesis by A1,PARTFUN1:4;
end;
end;
definition
let A be with_empty-instruction with_if-instruction non-empty UAStr;
let C,I be Algorithm of A;
func if-then(C,I) -> Algorithm of A equals
if-then-else(C,I,EmptyIns A);
coherence;
end;
theorem Th48:
for A being with_while-instruction non-empty UAStr
holds dom Den(In(4, dom the charact of A), A) = 2-tuples_on the carrier of A
proof
let A be with_while-instruction non-empty UAStr;
reconsider f = (the charact of A).4 as 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def13;
4 in dom the charact of A by Def13;
then
A1: Den(In(4, dom the charact of A), A) = f by SUBSET_1:def 8;
arity f = 2 by COMPUT_1:def 21;
hence thesis by A1,COMPUT_1:22;
end;
definition
let A be with_while-instruction non-empty UAStr;
let C,I be Algorithm of A;
func while(C,I) -> Algorithm of A equals
Den(In(4, dom the charact of A), A).<*C,I*>;
coherence
proof
reconsider f = (the charact of A).4 as 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def13;
4 in dom the charact of A by Def13;
then
A1: Den(In(4, dom the charact of A), A) = f by SUBSET_1:def 8;
arity f = 2 by COMPUT_1:def 21;
then dom f = 2-tuples_on the carrier of A by COMPUT_1:22;
then <*C,I*> in dom f by FINSEQ_2:137;
hence thesis by A1,PARTFUN1:4;
end;
end;
definition
let A be preIfWhileAlgebra;
let I0,C,I,J be Element of A;
func for-do(I0,C,J,I) -> Element of A equals
I0\;while(C,I\;J);
coherence;
end;
definition
let A be preIfWhileAlgebra;
func ElementaryInstructions A -> Subset of A equals
(the carrier of A)
\ {EmptyIns A} \ rng Den(In(3, dom the charact of A), A)
\ rng Den(In(4, dom the charact of A), A)
\ {I1 \; I2 where I1,I2 is Algorithm of A: I1 <> I1\;I2 & I2 <> I1\;I2};
coherence;
end;
theorem Th49:
for A being preIfWhileAlgebra holds EmptyIns A nin ElementaryInstructions A
proof
let A be preIfWhileAlgebra;
set I = EmptyIns A;
I in {I} by TARSKI:def 1;
then I nin (the carrier of A)\{I} by XBOOLE_0:def 5;
then I nin (the carrier of A) \ {EmptyIns A}
\ rng Den(In(3, dom the charact of A), A) by XBOOLE_0:def 5;
then I nin (the carrier of A) \ {EmptyIns A}
\ rng Den(In(3, dom the charact of A), A)
\ rng Den(In(4, dom the charact of A), A) by XBOOLE_0:def 5;
hence thesis by XBOOLE_0:def 5;
end;
theorem Th50:
for A being preIfWhileAlgebra
for I1,I2 being Element of A st I1 <> I1\;I2 & I2 <> I1\;I2
holds I1\;I2 nin ElementaryInstructions A
proof
let A be preIfWhileAlgebra;
let I1,I2 be Element of A;
assume that
A1: I1 <> I1\;I2 and
A2: I2 <> I1\;I2;
I1\;I2 in {J1 \; J2 where J1,J2 is Algorithm of A:
J1 <> J1\;J2 & J2 <> J1\;J2} by A1,A2;
hence thesis by XBOOLE_0:def 5;
end;
theorem Th51:
for A being preIfWhileAlgebra for C,I1,I2 being Element of A
holds if-then-else(C,I1,I2) nin ElementaryInstructions A
proof
let A be preIfWhileAlgebra;
let C,I1,I2 be Element of A;
set I = if-then-else(C,I1,I2);
reconsider f = (the charact of A).3 as 3-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def12;
3 in dom the charact of A by Def12;
then In(3, dom the charact of A) = 3 by SUBSET_1:def 8;
then dom Den(In(3, dom the charact of A), A)
= (arity f)-tuples_on the carrier of A by COMPUT_1:22
.= 3-tuples_on the carrier of A by COMPUT_1:def 21;
then <*C,I1,I2*> in dom Den(In(3, dom the charact of A), A) by FINSEQ_2:139;
then I in rng Den(In(3, dom the charact of A), A) by FUNCT_1:def 3;
then I nin (the carrier of A) \ {EmptyIns A}
\ rng Den(In(3, dom the charact of A), A) by XBOOLE_0:def 5;
then I nin (the carrier of A) \ {EmptyIns A}
\ rng Den(In(3, dom the charact of A), A)
\ rng Den(In(4, dom the charact of A), A) by XBOOLE_0:def 5;
hence thesis by XBOOLE_0:def 5;
end;
theorem Th52:
for A being preIfWhileAlgebra for C,I being Element of A
holds while(C,I) nin ElementaryInstructions A
proof
let A be preIfWhileAlgebra;
let C,I1 be Element of A;
set I = while(C,I1);
reconsider f = (the charact of A).4 as 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def13;
4 in dom the charact of A by Def13;
then In(4, dom the charact of A) = 4 by SUBSET_1:def 8;
then dom Den(In(4, dom the charact of A), A)
= (arity f)-tuples_on the carrier of A by COMPUT_1:22
.= 2-tuples_on the carrier of A by COMPUT_1:def 21;
then <*C,I1*> in dom Den(In(4, dom the charact of A), A) by FINSEQ_2:137;
then I in rng Den(In(4, dom the charact of A), A) by FUNCT_1:def 3;
then I nin (the carrier of A) \ {EmptyIns A}
\ rng Den(In(3, dom the charact of A), A)
\ rng Den(In(4, dom the charact of A), A) by XBOOLE_0:def 5;
hence thesis by XBOOLE_0:def 5;
end;
theorem Th53:
for A being preIfWhileAlgebra for I being Element of A
st I nin ElementaryInstructions A holds I = EmptyIns A or
(ex I1,I2 being Element of A st I = I1\;I2 & I1 <> I1\;I2 & I2 <> I1\;I2) or
(ex C,I1,I2 being Element of A st I = if-then-else(C,I1,I2)) or
ex C,J being Element of A st I = while(C,J)
proof
let A be preIfWhileAlgebra;
let I be Element of A such that
A1: I nin ElementaryInstructions A and
A2: I <> EmptyIns A and
A3: for I1,I2 being Element of A st I = I1\;I2 & I1 <> I1\;I2 holds
I2 = I1\;I2 and
A4: for C,I1,I2 being Element of A holds I <> if-then-else(C,I1,I2) and
A5: for C,J being Element of A holds I <> while(C,J);
A6: now
assume I in rng Den(In(3, dom the charact of A), A);
then consider x being object such that
A7: x in dom Den(In(3, dom the charact of A), A) and
A8: I = Den(In(3, dom the charact of A), A).x by FUNCT_1:def 3;
reconsider f = (the charact of A).3 as 3-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def12;
3 in dom the charact of A by Def12;
then In(3, dom the charact of A) = 3 by SUBSET_1:def 8;
then dom Den(In(3, dom the charact of A), A)
= (arity f)-tuples_on the carrier of A by COMPUT_1:22
.= 3-tuples_on the carrier of A by COMPUT_1:def 21;
then consider C,I1,I2 be object such that
A9: C in the carrier of A and
A10: I1 in the carrier of A and
A11: I2 in the carrier of A and
A12: x = <*C,I1,I2*> by A7,FINSEQ_2:139;
reconsider C,I1,I2 as Element of A by A9,A10,A11;
I = if-then-else(C,I1,I2) by A8,A12;
hence contradiction by A4;
end;
A13: now
assume I in rng Den(In(4, dom the charact of A), A);
then consider x being object such that
A14: x in dom Den(In(4, dom the charact of A), A) and
A15: I = Den(In(4, dom the charact of A), A).x by FUNCT_1:def 3;
reconsider f = (the charact of A).4 as 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def13;
4 in dom the charact of A by Def13;
then In(4, dom the charact of A) = 4 by SUBSET_1:def 8;
then dom Den(In(4, dom the charact of A), A)
= (arity f)-tuples_on the carrier of A by COMPUT_1:22
.= 2-tuples_on the carrier of A by COMPUT_1:def 21;
then consider C,J be object such that
A16: C in the carrier of A and
A17: J in the carrier of A and
A18: x = <*C,J*> by A14,FINSEQ_2:137;
reconsider C,J as Element of A by A16,A17;
I = while(C,J) by A15,A18;
hence contradiction by A5;
end;
A19: I
nin {I1\;I2 where I1,I2 is Algorithm of A: I1 <> I1\;I2 & I2 <> I1\;I2}
by A3;
I in (the carrier of A) \ {EmptyIns A} by A2,ZFMISC_1:56;
then I in (the carrier of A) \ {EmptyIns A}
\ rng Den(In(3, dom the charact of A), A) by A6,XBOOLE_0:def 5;
then I in (the carrier of A) \ {EmptyIns A}
\ rng Den(In(3, dom the charact of A), A)
\ rng Den(In(4, dom the charact of A), A) by A13,XBOOLE_0:def 5;
hence contradiction by A1,A19,XBOOLE_0:def 5;
end;
definition
let A be preIfWhileAlgebra;
attr A is infinite means
: Def23:
ElementaryInstructions A is infinite;
attr A is degenerated means
: Def24:
(ex I1,I2 being Element of A st
I1 <> EmptyIns A & I1\;I2 = I2 or I2 <> EmptyIns A & I1\;I2 = I1 or
(I1 <> EmptyIns A or I2 <> EmptyIns A) & I1\;I2 = EmptyIns A) or
(ex C,I1,I2 being Element of A st if-then-else(C,I1,I2) = EmptyIns A) or
(ex C,I being Element of A st while(C,I) = EmptyIns A) or
(ex I1,I2,C,J1,J2 being Element of A st I1 <> EmptyIns A & I2 <> EmptyIns A &
I1\;I2 = if-then-else(C,J1,J2)) or
(ex I1,I2,C,J being Element of A st I1 <> EmptyIns A & I2 <> EmptyIns A &
I1\;I2 = while(C,J)) or ex C1,I1,I2,C2,J being Element of A st
if-then-else(C1,I1,I2) = while(C2,J);
attr A is well_founded means
:
Def25: ElementaryInstructions A is GeneratorSet of A;
end;
definition
func ECIW-signature -> non empty FinSequence of NAT equals
<*0, 2*>^<*3, 2*>;
coherence;
end;
theorem Th54:
len ECIW-signature = 4 & dom ECIW-signature = Seg 4 &
ECIW-signature.1 = 0 & ECIW-signature.2 = 2 &
ECIW-signature.3 = 3 & ECIW-signature.4 = 2
proof
A1: len <*0,2*> = 2 by FINSEQ_1:44;
A2: len <*3,2*> = 2 by FINSEQ_1:44;
A3: dom <*0,2*> = Seg 2 by A1,FINSEQ_1:def 3;
A4: dom <*3,2*> = Seg 2 by A2,FINSEQ_1:def 3;
then
A5: 1 in dom <*3,2*>;
A6: <*3,2*>.1 = 3 by FINSEQ_1:44;
A7: 2 in dom <*3,2*> by A4;
A8: <*3,2*>.2 = 2 by FINSEQ_1:44;
A9: 2+1 = 3;
A10: 1 in dom <*0,2*> by A3;
A11: <*0,2*>.1 = 0 by FINSEQ_1:44;
A12: 2 in dom <*0,2*> by A3;
<*0,2*>.2 = 2 by FINSEQ_1:44;
hence thesis by A1,A2,A5,A6,A7,A8,A9,A10,A11,A12,FINSEQ_1:22,def 7;
end;
definition
let A be partial non-empty non empty UAStr;
attr A is ECIW-strict means
: Def27:
signature A = ECIW-signature;
end;
theorem Th55:
for A being partial non-empty non empty UAStr st A is ECIW-strict
for o being OperSymbol of A holds o = 1 or o = 2 or o = 3 or o = 4
proof
let A be partial non-empty non empty UAStr;
assume signature A = ECIW-signature;
then 4 = len the charact of A by Th54,UNIALG_1:def 4;
then dom the charact of A = Seg 4 by FINSEQ_1:def 3;
hence thesis by ENUMSET1:def 2,FINSEQ_3:2;
end;
registration
let X be disjoint_with_NAT non empty set;
cluster FreeUnivAlgNSG(ECIW-signature,X) -> with_empty-instruction
with_catenation with_if-instruction with_while-instruction;
coherence
proof
set S = FreeUnivAlgNSG(ECIW-signature,X);
set char = ECIW-signature;
A1: len <*0,2*> = 2 by FINSEQ_1:44;
A2: len <*3,2*> = 2 by FINSEQ_1:44;
then
A3: len char = 2+2 by A1,FINSEQ_1:22;
A4: len the charact of S = len char by FREEALG:def 11;
A5: dom <*0,2*> = Seg 2 by A1,FINSEQ_1:def 3;
A6: dom <*3,2*> = Seg 2 by A2,FINSEQ_1:def 3;
A7: dom the charact of S = Seg 4 by A3,A4,FINSEQ_1:def 3;
A8: dom char = Seg 4 by A3,FINSEQ_1:def 3;
thus 1 in dom the charact of S by A7;
then
A9: (the charact of S).1 = FreeOpNSG(1,char,X) by FREEALG:def 11;
A10: 1 in dom char by A8;
A11: 2 in dom char by A8;
A12: 3 in dom char by A8;
A13: 4 in dom char by A8;
reconsider D = TS(DTConUA(char,X)) as non empty set;
reconsider char as non empty FinSequence of omega;
set o = FreeOpNSG(1,char,X);
A14: 1 in dom <*0,2*> by A5;
A15: <*0,2*>.1 = 0 by FINSEQ_1:44;
A16: 2 in dom <*0,2*> by A5;
A17: <*0,2*>.2 = 2 by FINSEQ_1:44;
char.1 = 0 by A14,A15,FINSEQ_1:def 7;
then char/.1 = 0 by A10,PARTFUN1:def 6;
then
A18: dom o = 0-tuples_on the carrier of S by A10,FREEALG:def 10;
reconsider o as homogeneous non empty quasi_total PartFunc of D*, D;
arity o = 0 by A18,COMPUT_1:25;
hence (the charact of S).1 is 0-ary non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S
by A9,COMPUT_1:def 21;
thus 2 in dom the charact of S by A7;
then
A19: (the charact of S).2 = FreeOpNSG(2,char,X) by FREEALG:def 11;
set o = FreeOpNSG(2,char,X);
char.2 = 2 by A16,A17,FINSEQ_1:def 7;
then (char qua FinSequence of omega)/.2 = 2 by A11,PARTFUN1:def 6;
then
A20: dom o = 2-tuples_on the carrier of S by A11,FREEALG:def 10;
reconsider o as homogeneous non empty quasi_total PartFunc of D*, D;
arity o = 2 by A20,COMPUT_1:25;
hence (the charact of S).2 is 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S
by A19,COMPUT_1:def 21;
thus 3 in dom the charact of S by A7;
then
A21: (the charact of S).3 = FreeOpNSG(3,char,X) by FREEALG:def 11;
set o = FreeOpNSG(3,char,X);
A22: 1 in dom <*3,2*> by A6;
A23: <*3,2*>.1 = 3 by FINSEQ_1:44;
A24: 2 in dom <*3,2*> by A6;
A25: <*3,2*>.2 = 2 by FINSEQ_1:44;
char.(2+1) = 3 by A1,A22,A23,FINSEQ_1:def 7;
then (char qua FinSequence of omega)/.3 = 3 by A12,PARTFUN1:def 6;
then
A26: dom o = 3-tuples_on the carrier of S by A12,FREEALG:def 10;
reconsider o as homogeneous non empty quasi_total PartFunc of D*, D;
arity o = 3 by A26,COMPUT_1:25;
hence (the charact of S).3 is 3-ary non empty homogeneous
quasi_total PartFunc of (the carrier of S)*, the carrier of S
by A21,COMPUT_1:def 21;
thus 4 in dom the charact of S by A7;
then
A27: (the charact of S).4 = FreeOpNSG(4,char,X) by FREEALG:def 11;
set o = FreeOpNSG(4,char,X);
char.(2+2) = 2 by A1,A24,A25,FINSEQ_1:def 7;
then (char qua FinSequence of omega)/.4 = 2 by A13,PARTFUN1:def 6;
then
A28: dom o = 2-tuples_on the carrier of S by A13,FREEALG:def 10;
reconsider o as homogeneous non empty quasi_total PartFunc of D*, D;
arity o = 2 by A28,COMPUT_1:25;
hence thesis by A27,COMPUT_1:def 21;
end;
end;
theorem Th56:
for X being disjoint_with_NAT non empty set
for I being Element of FreeUnivAlgNSG(ECIW-signature,X) holds
(ex x being Element of X st I = root-tree x) or
ex n being Nat, p being FinSequence of FreeUnivAlgNSG(ECIW-signature,X)
st n in Seg 4 & I = n-tree p & len p = ECIW-signature.n
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
set G = DTConUA(S,X);
let I be Element of FreeUnivAlgNSG(S,X) such that
A1: not ex x being Element of X st I = root-tree x;
Terminals DTConUA(S,X) = X by FREEALG:3;
then not ex d being Symbol of G st d in Terminals G & I = root-tree d by A1;
then consider o being Symbol of G, p being FinSequence of TS G such that
A2: o ==> roots p and
A3: I = o-tree p by Th16;
A4: NonTerminals G = {s where s is Symbol of G:
ex n being FinSequence st s ==> n} by LANG1:def 3;
then
A5: o in NonTerminals G by A2;
A6: NonTerminals G = Seg 4 by Th54,FREEALG:2;
then reconsider n = o as Element of NAT by A5;
reconsider p as FinSequence of FreeUnivAlgNSG(ECIW-signature,X);
take n, p;
thus n in Seg 4 by A2,A4,A6;
thus I = n-tree p by A3;
A7: [n, roots p] in the Rules of G by A2,LANG1:def 1;
then
A8: roots p in (the carrier of G)* by ZFMISC_1:87;
dom p = dom roots p by TREES_3:def 18;
hence len p = card dom roots p by CARD_1:62
.= len roots p by CARD_1:62
.= S.n by A7,A8,FREEALG:def 7;
end;
theorem Th57:
for X being disjoint_with_NAT non empty set
holds EmptyIns FreeUnivAlgNSG(ECIW-signature,X) = 1-tree {}
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
reconsider s = S as non empty FinSequence of omega;
set A = FreeUnivAlgNSG(S,X);
A1: 1 in dom the charact of A by Def10;
reconsider f = (the charact of A).1 as 0-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def10;
A2: f = FreeOpNSG(1,S,X) by A1,FREEALG:def 11;
A3: 1 in dom S by Th54;
then
A4: s/.1 = S.1 by PARTFUN1:def 6;
A5: dom FreeOpNSG(1,S,X) = (s/.1)-tuples_on TS(DTConUA(S,X))
by A3,FREEALG:def 10
.= {{}} by A4,Th54,COMPUT_1:5;
A6: {} in {{}} by TARSKI:def 1;
A7: {} = <*> TS(DTConUA(S,X));
thus EmptyIns A = f.{} by A1,SUBSET_1:def 8
.= Sym(1,S,X)-tree({}) by A2,A3,A5,A6,A7,FREEALG:def 10
.= 1-tree {} by A3,FREEALG:def 9;
end;
theorem Th58:
for X being disjoint_with_NAT non empty set
for p being FinSequence of FreeUnivAlgNSG(ECIW-signature,X)
st 1-tree p is Element of FreeUnivAlgNSG(ECIW-signature,X) holds p = {}
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
set G = DTConUA(S,X);
set A = FreeUnivAlgNSG(S,X);
let p be FinSequence of A;
assume 1-tree p is Element of A;
then reconsider I = 1-tree p as Element of A;
per cases by Th56;
suppose ex x being Element of X st I = root-tree x;
then consider x being Element of X such that
A1: 1-tree p = root-tree x;
1-tree p = x-tree(<*>TS G) by A1,TREES_4:20;
hence thesis by TREES_4:15;
end;
suppose ex n being Nat, p being FinSequence of A
st n in Seg 4 & I = n-tree p & len p = S.n;
then consider n being Nat, q being FinSequence of A such that
n in Seg 4 and
A2: I = n-tree q and
A3: len q = S.n;
q = p by A2,TREES_4:15;
hence thesis by A2,A3,Th54,TREES_4:15;
end;
end;
theorem Th59:
for X being disjoint_with_NAT non empty set
for I1,I2 being Element of FreeUnivAlgNSG(ECIW-signature,X)
holds I1\;I2 = 2-tree(I1,I2)
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
reconsider s = S as non empty FinSequence of omega;
set A = FreeUnivAlgNSG(S,X);
let I1,I2 be Element of A;
A1: 2 in dom the charact of A by Def11;
reconsider f = (the charact of A).2 as 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def11;
A2: f = FreeOpNSG(2,S,X) by A1,FREEALG:def 11;
A3: 2 in dom S by Th54;
then s/.2 = S.2 by PARTFUN1:def 6;
then
A4: dom FreeOpNSG(2,S,X) = 2-tuples_on TS(DTConUA(S,X))
by A3,Th54,FREEALG:def 10;
A5: <*I1,I2*> in 2-tuples_on TS(DTConUA(S,X)) by FINSEQ_2:137;
thus I1\;I2 = f.<*I1,I2*> by A1,SUBSET_1:def 8
.= Sym(2,S,X)-tree(<*I1,I2*>) by A2,A3,A4,A5,FREEALG:def 10
.= 2-tree (I1,I2) by A3,FREEALG:def 9;
end;
theorem Th60:
for X being disjoint_with_NAT non empty set
for p being FinSequence of FreeUnivAlgNSG(ECIW-signature,X)
st 2-tree p is Element of FreeUnivAlgNSG(ECIW-signature,X)
ex I1,I2 being Element of FreeUnivAlgNSG(ECIW-signature,X) st p = <*I1,I2*>
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
set G = DTConUA(S,X);
set A = FreeUnivAlgNSG(S,X);
let p be FinSequence of A;
assume 2-tree p is Element of A;
then reconsider I = 2-tree p as Element of A;
per cases by Th56;
suppose ex x being Element of X st I = root-tree x;
then consider x being Element of X such that
A1: 2-tree p = root-tree x;
2-tree p = x-tree(<*>TS G) by A1,TREES_4:20;
then 2 = x by TREES_4:15;
then X meets NAT by XBOOLE_0:3;
hence thesis by FREEALG:def 1;
end;
suppose ex n being Nat, p being FinSequence of A
st n in Seg 4 & I = n-tree p & len p = S.n;
then consider n being Nat, q being FinSequence of A such that
n in Seg 4 and
A2: I = n-tree q and
A3: len q = S.n;
A4: n = 2 by A2,TREES_4:15;
A5: q = p by A2,TREES_4:15;
then p = <*p.1,p.2*> by A3,A4,Th54,FINSEQ_1:44;
then rng p = {p.1,p.2} by FINSEQ_2:127;
then reconsider I1 = p.1, I2 = p.2 as Element of A by ZFMISC_1:32;
take I1,I2;
thus thesis by A3,A4,A5,Th54,FINSEQ_1:44;
end;
end;
theorem Th61:
for X being disjoint_with_NAT non empty set
for I1,I2 being Element of FreeUnivAlgNSG(ECIW-signature,X)
holds I1\;I2 <> I1 & I1\;I2 <> I2
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
set G = DTConUA(S,X);
set A = FreeUnivAlgNSG(S,X);
let I1,I2 be Element of A;
set p = <*I1,I2*>;
rng p c= FinTrees the carrier of G by XBOOLE_1:1;
then
A1: p is FinSequence of FinTrees the carrier of G by FINSEQ_1:def 4;
A2: rng p = {I1,I2} by FINSEQ_2:127;
then
A3: I1 in rng p by TARSKI:def 2;
A4: I2 in rng p by A2,TARSKI:def 2;
I1\;I2 = 2-tree(I1,I2) by Th59
.= 2-tree<*I1,I2*>;
hence thesis by A1,A3,A4,Th3;
end;
theorem
for X being disjoint_with_NAT non empty set
for I1,I2,J1,J2 being Element of FreeUnivAlgNSG(ECIW-signature,X)
holds I1\;I2 = J1\;J2 implies I1 = J1 & I2 = J2
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
set A = FreeUnivAlgNSG(S,X);
let I1,I2,J1,J2 be Element of A;
A1: I1\;I2 = 2-tree(I1,I2) by Th59;
J1\;J2 = 2-tree(J1,J2) by Th59;
then I1\;I2 = J1\;J2 implies <*I1,I2*> = <*J1,J2*> by A1,TREES_4:15;
hence thesis by FINSEQ_1:77;
end;
theorem Th63:
for X being disjoint_with_NAT non empty set
for C,I1,I2 being Element of FreeUnivAlgNSG(ECIW-signature,X)
holds if-then-else(C,I1,I2) = 3-tree<*C,I1,I2*>
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
reconsider s = S as non empty FinSequence of omega;
set A = FreeUnivAlgNSG(S,X);
let C,I1,I2 be Element of A;
A1: 3 in dom the charact of A by Def12;
reconsider f = (the charact of A).3 as 3-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def12;
A2: f = FreeOpNSG(3,S,X) by A1,FREEALG:def 11;
A3: 3 in dom S by Th54;
then s/.3 = S.3 by PARTFUN1:def 6;
then
A4: dom FreeOpNSG(3,S,X) = 3-tuples_on TS(DTConUA(S,X))
by A3,Th54,FREEALG:def 10;
A5: <*C,I1,I2*> in 3-tuples_on TS(DTConUA(S,X)) by FINSEQ_2:139;
thus if-then-else(C,I1,I2) = f.<*C,I1,I2*> by A1,SUBSET_1:def 8
.= Sym(3,S,X)-tree(<*C,I1,I2*>) by A2,A3,A4,A5,FREEALG:def 10
.= 3-tree <*C,I1,I2*> by A3,FREEALG:def 9;
end;
theorem Th64:
for X being disjoint_with_NAT non empty set
for p being FinSequence of FreeUnivAlgNSG(ECIW-signature,X)
st 3-tree p is Element of FreeUnivAlgNSG(ECIW-signature,X)
ex C,I1,I2 being Element of FreeUnivAlgNSG(ECIW-signature,X)
st p = <*C,I1,I2*>
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
set G = DTConUA(S,X);
set A = FreeUnivAlgNSG(S,X);
let p be FinSequence of A;
assume 3-tree p is Element of A;
then reconsider I = 3-tree p as Element of A;
per cases by Th56;
suppose ex x being Element of X st I = root-tree x;
then consider x being Element of X such that
A1: 3-tree p = root-tree x;
3-tree p = x-tree(<*>TS G) by A1,TREES_4:20;
then 3 = x by TREES_4:15;
then X meets NAT by XBOOLE_0:3;
hence thesis by FREEALG:def 1;
end;
suppose ex n being Nat, p being FinSequence of A
st n in Seg 4 & I = n-tree p & len p = S.n;
then consider n being Nat, q being FinSequence of A such that
n in Seg 4 and
A2: I = n-tree q and
A3: len q = S.n;
A4: n = 3 by A2,TREES_4:15;
A5: q = p by A2,TREES_4:15;
then p =<*p.1,p.2,p.3*> by A3,A4,Th54,FINSEQ_1:45;
then
A6: rng p = {p.1,p.2,p.3} by FINSEQ_2:128;
A7: p.1 in {p.1,p.2,p.3} by ENUMSET1:def 1;
A8: p.2 in {p.1,p.2,p.3} by ENUMSET1:def 1;
p.3 in {p.1,p.2,p.3} by ENUMSET1:def 1;
then reconsider C = p.1, I1 = p.2, I2 = p.3 as Element of A by A6,A7,A8;
take C,I1,I2;
thus thesis by A3,A4,A5,Th54,FINSEQ_1:45;
end;
end;
theorem
for X being disjoint_with_NAT non empty set
for C1,C2,I1,I2,J1,J2 being Element of FreeUnivAlgNSG(ECIW-signature,X)
st if-then-else(C1,I1,I2) = if-then-else(C2,J1,J2)
holds C1 = C2 & I1 = J1 & I2 = J2
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
set A = FreeUnivAlgNSG(S,X);
let C1,C2,I1,I2,J1,J2 be Element of A;
A1: if-then-else(C1,I1,I2) = 3-tree<*C1,I1,I2*> by Th63;
if-then-else(C2,J1,J2) = 3-tree<*C2,J1,J2*> by Th63;
then if-then-else(C1,I1,I2) = if-then-else(C2,J1,J2)
implies <*C1,I1,I2*> = <*C2,J1,J2*> by A1,TREES_4:15;
hence thesis by FINSEQ_1:78;
end;
theorem Th66:
for X being disjoint_with_NAT non empty set
for C,I being Element of FreeUnivAlgNSG(ECIW-signature,X)
holds while(C,I) = 4-tree(C,I)
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
reconsider s = S as non empty FinSequence of omega;
set A = FreeUnivAlgNSG(S,X);
let C,I be Element of A;
A1: 4 in dom the charact of A by Def13;
reconsider f = (the charact of A).4 as 2-ary non empty homogeneous
quasi_total PartFunc of (the carrier of A)*, the carrier of A by Def13;
A2: f = FreeOpNSG(4,S,X) by A1,FREEALG:def 11;
A3: 4 in dom S by Th54;
then s/.4 = S.4 by PARTFUN1:def 6;
then
A4: dom FreeOpNSG(4,S,X) = 2-tuples_on TS(DTConUA(S,X))
by A3,Th54,FREEALG:def 10;
A5: <*C,I*> in 2-tuples_on TS(DTConUA(S,X)) by FINSEQ_2:137;
thus while(C,I) = f.<*C,I*> by A1,SUBSET_1:def 8
.= Sym(4,S,X)-tree(<*C,I*>) by A2,A3,A4,A5,FREEALG:def 10
.= 4-tree(C,I) by A3,FREEALG:def 9;
end;
theorem Th67:
for X being disjoint_with_NAT non empty set
for p being FinSequence of FreeUnivAlgNSG(ECIW-signature,X)
st 4-tree p is Element of FreeUnivAlgNSG(ECIW-signature,X)
ex C,I being Element of FreeUnivAlgNSG(ECIW-signature,X) st p = <*C,I*>
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
set G = DTConUA(S,X);
set A = FreeUnivAlgNSG(S,X);
let p be FinSequence of A;
assume 4-tree p is Element of A;
then reconsider I = 4-tree p as Element of A;
per cases by Th56;
suppose ex x being Element of X st I = root-tree x;
then consider x being Element of X such that
A1: 4-tree p = root-tree x;
4-tree p = x-tree(<*>TS G) by A1,TREES_4:20;
then 4 = x by TREES_4:15;
then X meets NAT by XBOOLE_0:3;
hence thesis by FREEALG:def 1;
end;
suppose ex n being Nat, p being FinSequence of A
st n in Seg 4 & I = n-tree p & len p = S.n;
then consider n being Nat, q being FinSequence of A such that
n in Seg 4 and
A2: I = n-tree q and
A3: len q = S.n;
A4: n = 4 by A2,TREES_4:15;
A5: q = p by A2,TREES_4:15;
then p = <*p.1,p.2*> by A3,A4,Th54,FINSEQ_1:44;
then rng p = {p.1,p.2} by FINSEQ_2:127;
then reconsider I1 = p.1, I2 = p.2 as Element of A by ZFMISC_1:32;
take I1,I2;
thus thesis by A3,A4,A5,Th54,FINSEQ_1:44;
end;
end;
theorem Th68:
for X being disjoint_with_NAT non empty set
for I being Element of FreeUnivAlgNSG(ECIW-signature,X)
st I in ElementaryInstructions FreeUnivAlgNSG(ECIW-signature,X)
ex x being Element of X st I = x-tree {}
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
set A = FreeUnivAlgNSG(S, X);
let I be Element of FreeUnivAlgNSG(ECIW-signature,X) such that
A1: I in ElementaryInstructions FreeUnivAlgNSG(ECIW-signature,X);
per cases by Th56;
suppose ex x being Element of X st I = root-tree x;
then consider x being Element of X such that
A2: I = root-tree x;
root-tree x = x-tree {} by TREES_4:20;
hence thesis by A2;
end;
suppose
ex n being Nat, p being FinSequence of FreeUnivAlgNSG(ECIW-signature,X)
st n in Seg 4 & I = n-tree p & len p = S.n;
then consider n being Nat,
p being FinSequence of FreeUnivAlgNSG(ECIW-signature,X) such that
A3: n in Seg 4 and
A4: I = n-tree p and len p = S.n;
per cases by A3,ENUMSET1:def 2,FINSEQ_3:2;
suppose
A5: n = 1;
then p = {} by A4,Th58;
then I = EmptyIns A by A4,A5,Th57;
hence thesis by A1,Th49;
end;
suppose
A6: n = 2;
then consider I1,I2 being Element of A such that
A7: p = <*I1,I2*> by A4,Th60;
A8: I = n-tree(I1,I2) by A4,A7
.= I1\;I2 by A6,Th59;
then
A9: I <> I1 by Th61;
I <> I2 by A8,Th61;
hence thesis by A1,A8,A9,Th50;
end;
suppose
A10: n = 3;
then consider C,I1,I2 being Element of A such that
A11: p = <*C,I1,I2*> by A4,Th64;
I = if-then-else(C,I1,I2) by A4,A10,A11,Th63;
hence thesis by A1,Th51;
end;
suppose
A12: n = 4;
then consider C,I9 being Element of A such that
A13: p = <*C,I9*> by A4,Th67;
I = n-tree(C,I9) by A4,A13
.= while(C,I9) by A12,Th66;
hence thesis by A1,Th52;
end;
end;
end;
theorem
for X being disjoint_with_NAT non empty set
for p being FinSequence of FreeUnivAlgNSG(ECIW-signature,X)
for x being Element of X
st x-tree p is Element of FreeUnivAlgNSG(ECIW-signature,X) holds p = {}
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
set A = FreeUnivAlgNSG(S, X);
let p be FinSequence of FreeUnivAlgNSG(ECIW-signature,X);
let x be Element of X;
assume x-tree p is Element of FreeUnivAlgNSG(ECIW-signature,X);
then reconsider I = x-tree p as Element of A;
now
given n being Nat, p being FinSequence of A such that
A1: n in Seg 4 and
A2: I = n-tree p and len p = ECIW-signature.n;
A3: x = n by A2,TREES_4:15;
X misses NAT by FREEALG:def 1;
hence contradiction by A1,A3,XBOOLE_0:3;
end;
then consider y being Element of X such that
A4: I = root-tree y by Th56;
x-tree p = y-tree {} by A4,TREES_4:20;
hence thesis by TREES_4:15;
end;
theorem Th70:
for X being disjoint_with_NAT non empty set
holds ElementaryInstructions FreeUnivAlgNSG(ECIW-signature,X) =
FreeGenSetNSG(ECIW-signature,X) &
card X = card FreeGenSetNSG(ECIW-signature,X)
proof
let X be disjoint_with_NAT non empty set;
set S = ECIW-signature;
set G = DTConUA(S,X);
A1: X = Terminals G by FREEALG:3;
set A = FreeUnivAlgNSG(S, X);
thus ElementaryInstructions A = FreeGenSetNSG(S, X)
proof
thus ElementaryInstructions A c= FreeGenSetNSG(S, X)
proof
let x be object;
assume x in ElementaryInstructions A;
then consider y being Element of X such that
A2: x = y-tree {} by Th68;
reconsider y as Symbol of G by XBOOLE_0:def 3;
x = root-tree y by A2,TREES_4:20;
hence thesis by A1;
end;
let x be object;
assume
A3: x in FreeGenSetNSG(S,X);
then reconsider I = x as Element of A;
consider y being Symbol of G such that
A4: x = root-tree y and
A5: y in Terminals G by A3;
A6: x = y-tree {} by A4,TREES_4:20;
assume
A7: x nin ElementaryInstructions A;
per cases by A7,Th53;
suppose I = EmptyIns A;
then x = 1-tree {} by Th57;
then
A8: y = 1 by A6,TREES_4:15;
X misses NAT by FREEALG:def 1;
hence thesis by A1,A5,A8,XBOOLE_0:3;
end;
suppose ex I1,I2 being Element of A st
I = I1\;I2 & I1 <> I1\;I2 & I2 <> I1\;I2;
then consider I1,I2 be Element of A such that
A9: I = I1\;I2;
x = 2-tree(I1,I2) by A9,Th59
.= 2-tree<*I1,I2*>;
hence thesis by A6,TREES_4:15;
end;
suppose ex C,I1,I2 being Element of A st I = if-then-else(C,I1,I2);
then consider C,I1,I2 be Element of A such that
A10: I = if-then-else(C,I1,I2);
x = 3-tree<*C,I1,I2*> by A10,Th63;
hence thesis by A6,TREES_4:15;
end;
suppose ex C,J being Element of A st I = while(C,J);
then consider C,J be Element of A such that
A11: I = while(C,J);
x = 4-tree(C,J) by A11,Th66
.= 4-tree<*C,J*>;
hence thesis by A6,TREES_4:15;
end;
end;
deffunc F(object) = root-tree $1;
consider f being Function such that
A12: dom
f = X & for x being Element of X holds f.x = F(x) from FUNCT_1:sch 4;
A13: rng f = FreeGenSetNSG(S,X)
proof
thus rng f c= FreeGenSetNSG(S,X)
proof
let a be object;
assume a in rng f;
then consider x being object such that
A14: x in X and
A15: a = f.x by A12,FUNCT_1:def 3;
a = F(x) by A12,A14,A15;
hence thesis by A1,A14;
end;
let a be object;
assume a in FreeGenSetNSG(S,X);
then consider s being Symbol of G such that
A16: a = root-tree s and
A17: s in X by A1;
reconsider s as Element of X by A17;
f.s = a by A12,A16;
hence thesis by A12,FUNCT_1:def 3;
end;
f is one-to-one
proof
let a,b be object;
assume that
A18: a in dom f and
A19: b in dom f;
reconsider x = a, y = b as Element of X by A12,A18,A19;
assume f.a = f.b;
then F(x) = f.b by A12
.= F(y) by A12;
hence thesis by TREES_4:4;
end;
then X, FreeGenSetNSG(S,X) are_equipotent by A12,A13,WELLORD2:def 4;
hence thesis by CARD_1:5;
end;
registration
cluster infinite disjoint_with_NAT for set;
existence
proof
take X = [:NAT,{0}:];
thus X is infinite;
now
let x be object;
assume x in X;
then
A1: ex a,b being object st ( a in NAT)&( b in {0})&( x = [a,b])
by ZFMISC_1:def 2;
assume x in NAT;
hence contradiction by A1;
end;
hence X misses NAT by XBOOLE_0:3;
end;
end;
registration
let X be infinite disjoint_with_NAT set;
cluster FreeUnivAlgNSG(ECIW-signature,X) -> infinite;
coherence
proof
card X = card FreeGenSetNSG(ECIW-signature,X) by Th70;
then card ElementaryInstructions FreeUnivAlgNSG(ECIW-signature,X) is
infinite by Th70;
hence
ElementaryInstructions FreeUnivAlgNSG(ECIW-signature,X) is infinite;
end;
end;
registration
let X be disjoint_with_NAT non empty set;
cluster FreeUnivAlgNSG(ECIW-signature,X) -> ECIW-strict;
coherence
by FREEALG:4;
end;
theorem Th71:
for A being preIfWhileAlgebra holds Generators A c= ElementaryInstructions A
proof
let A be preIfWhileAlgebra;
let x be object;
assume that
A1: x in Generators A and
A2: x nin ElementaryInstructions A;
reconsider x as Element of A by A1;
dom Den(In(1, dom the charact of A), A) = {{}} by Th42;
then
A3: {} in dom Den(In(1, dom the charact of A),A) by TARSKI:def 1;
per cases by A2,Th53;
suppose x = EmptyIns A;
then x in rng Den(In(1, dom the charact of A), A) by A3,FUNCT_1:3;
hence contradiction by A1,Th26;
end;
suppose
ex I1,I2 being Element of A st x = I1\;I2 & I1 <> I1\;I2 & I2 <> I1\;I2;
then consider I1,I2 being Element of A such that
A4: x = I1\;I2 and I1 <> I1\;I2
and I2 <> I1\;I2;
dom Den(In(2, dom the charact of A), A) = 2-tuples_on the carrier of A
by Th44;
then <*I1,I2*> in dom Den(In(2, dom the charact of A),A) by FINSEQ_2:137;
then x in rng Den(In(2, dom the charact of A),A) by A4,FUNCT_1:3;
hence contradiction by A1,Th26;
end;
suppose ex C,I1,I2 being Element of A st x = if-then-else(C,I1,I2);
then consider C,I1,I2 being Element of A such that
A5: x = if-then-else(C,I1,I2);
dom Den(In(3, dom the charact of A), A) = 3-tuples_on the carrier of A
by Th47;
then <*C,I1,I2*> in dom Den(In(3, dom the charact of A),A) by FINSEQ_2:139;
then x in rng Den(In(3, dom the charact of A),A) by A5,FUNCT_1:3;
hence contradiction by A1,Th26;
end;
suppose ex C,J being Element of A st x = while(C,J);
then consider C,J being Element of A such that
A6: x = while(C,J);
dom Den(In(4, dom the charact of A), A) = 2-tuples_on the carrier of A
by Th48;
then <*C,J*> in dom Den(In(4, dom the charact of A),A) by FINSEQ_2:137;
then x in rng Den(In(4, dom the charact of A),A) by A6,FUNCT_1:3;
hence contradiction by A1,Th26;
end;
end;
theorem Th72:
for A being preIfWhileAlgebra st A is free for C,I1,I2 being Element of A
holds EmptyIns A <> I1\;I2 & EmptyIns A <> if-then-else(C,I1,I2) &
EmptyIns A <> while(C,I1)
proof
let A be preIfWhileAlgebra such that
A1: A is free;
let C,I1,I2 be Element of A;
A2: dom Den(In(1, dom the charact of A), A) = {{}} by Th42;
A3: dom Den(In(2, dom the charact of A), A) = 2-tuples_on the carrier of A
by Th44;
A4: dom Den(In(3, dom the charact of A), A) = 3-tuples_on the carrier of A
by Th47;
A5: dom Den(In(4, dom the charact of A), A) = 2-tuples_on the carrier of A
by Th48;
A6: {} in {{}} by TARSKI:def 1;
<*I1,I2*> in 2-tuples_on the carrier of A by FINSEQ_2:137;
hence EmptyIns A <> I1\;I2 by A1,A2,A3,A6,Th36;
<*C,I1,I2*> in 3-tuples_on the carrier of A by FINSEQ_2:139;
hence EmptyIns A <> if-then-else(C,I1,I2) by A1,A2,A4,A6,Th36;
<*C,I1*> in 2-tuples_on the carrier of A by FINSEQ_2:137;
hence thesis by A1,A2,A5,A6,Th36;
end;
theorem Th73:
for A being preIfWhileAlgebra st A is free
for I1,I2,C,J1,J2 being Element of A holds I1\;I2 <> I1 & I1\;I2 <> I2 &
(I1\;I2 = J1\;J2 implies I1 = J1 & I2 = J2) &
I1\;I2 <> if-then-else(C,J1,J2) & I1\;I2 <> while(C,J1)
proof
let A be preIfWhileAlgebra such that
A1: A is free;
let I1,I2,C,J1,J2 be Element of A;
A2: 2 in dom the charact of A by Def11;
A3: dom Den(In(2, dom the charact of A), A) = 2-tuples_on the carrier of A
by Th44;
A4: In(2, dom the charact of A) = 2 by A2,SUBSET_1:def 8;
A5: 3 in dom the charact of A by Def12;
A6: dom Den(In(3, dom the charact of A), A) = 3-tuples_on the carrier of A
by Th47;
A7: In(3, dom the charact of A) = 3 by A5,SUBSET_1:def 8;
A8: 4 in dom the charact of A by Def13;
A9: dom Den(In(4, dom the charact of A), A) = 2-tuples_on the carrier of A
by Th48;
A10: In(4, dom the charact of A) = 4 by A8,SUBSET_1:def 8;
A11: <*I1,I2*> in 2-tuples_on the carrier of A by FINSEQ_2:137;
A12: <*J1,J2*> in 2-tuples_on the carrier of A by FINSEQ_2:137;
A13: rng <*I1,I2*> = {I1,I2} by FINSEQ_2:127;
then
A14: I1 in rng <*I1,I2*> by TARSKI:def 2;
I2 in rng <*I1,I2*> by A13,TARSKI:def 2;
hence I1\;I2 <> I1 & I1\;I2 <> I2 by A1,A3,A11,A14,Th38;
hereby
assume I1\;I2 = J1\;J2;
then <*I1,I2*> = <*J1,J2*> by A1,A3,A11,A12,Th36;
hence I1 = J1 & I2 = J2 by FINSEQ_1:77;
end;
<*C,J1,J2*> in 3-tuples_on the carrier of A by FINSEQ_2:139;
hence I1\;I2 <> if-then-else(C,J1,J2) by A1,A3,A4,A6,A7,A11,Th36;
<*C,J1*> in 2-tuples_on the carrier of A by FINSEQ_2:137;
hence thesis by A1,A3,A4,A9,A10,A11,Th36;
end;
theorem Th74:
for A being preIfWhileAlgebra st A is free
for C,I1,I2,D,J1,J2 being Element of A
holds if-then-else(C,I1,I2) <> C & if-then-else(C,I1,I2) <> I1 &
if-then-else(C,I1,I2) <> I2 & if-then-else(C,I1,I2) <> while(D,J1) &
(if-then-else(C,I1,I2) = if-then-else(D,J1,J2) implies C=D & I1=J1 & I2=J2)
proof
let A be preIfWhileAlgebra such that
A1: A is free;
let C,I1,I2,D,J1,J2 be Element of A;
A2: 3 in dom the charact of A by Def12;
A3: dom Den(In(3, dom the charact of A), A) = 3-tuples_on the carrier of A
by Th47;
A4: In(3, dom the charact of A) = 3 by A2,SUBSET_1:def 8;
A5: 4 in dom the charact of A by Def13;
A6: dom Den(In(4, dom the charact of A), A) = 2-tuples_on the carrier of A
by Th48;
A7: In(4, dom the charact of A) = 4 by A5,SUBSET_1:def 8;
A8: <*C,I1,I2*> in 3-tuples_on the carrier of A by FINSEQ_2:139;
A9: <*D,J1,J2*> in 3-tuples_on the carrier of A by FINSEQ_2:139;
A10: rng <*C,I1,I2*> = {C,I1,I2} by FINSEQ_2:128;
then
A11: C in rng <*C,I1,I2*> by ENUMSET1:def 1;
A12: I1 in rng <*C,I1,I2*> by A10,ENUMSET1:def 1;
I2 in rng <*C,I1,I2*> by A10,ENUMSET1:def 1;
hence if-then-else(C,I1,I2) <> C & if-then-else(C,I1,I2) <> I1 &
if-then-else(C,I1,I2) <> I2 by A1,A3,A8,A11,A12,Th38;
<*D,J1*> in 2-tuples_on the carrier of A by FINSEQ_2:137;
hence if-then-else(C,I1,I2) <> while(D,J1) by A1,A3,A4,A6,A7,A8,Th36;
assume if-then-else(C,I1,I2) = if-then-else(D,J1,J2);
then <*C,I1,I2*> = <*D,J1,J2*> by A1,A3,A8,A9,Th36;
hence thesis by FINSEQ_1:78;
end;
theorem Th75:
for A being preIfWhileAlgebra st A is free for C,I,D,J being Element of A
holds while(C,I) <> C & while(C,I) <> I &
(while(C,I) = while(D,J) implies C = D & I = J)
proof
let A be preIfWhileAlgebra such that
A1: A is free;
let C,I,D,J be Element of A;
A2: dom Den(In(4, dom the charact of A), A) = 2-tuples_on the carrier of A
by Th48;
A3: <*C,I*> in 2-tuples_on the carrier of A by FINSEQ_2:137;
A4: <*D,J*> in 2-tuples_on the carrier of A by FINSEQ_2:137;
A5: rng <*C,I*> = {C,I} by FINSEQ_2:127;
then
A6: C in rng <*C,I*> by TARSKI:def 2;
I in rng <*C,I*> by A5,TARSKI:def 2;
hence while(C,I) <> C & while(C,I) <> I by A1,A2,A3,A6,Th38;
assume while(C,I) = while(D,J);
then <*C,I*> = <*D,J*> by A1,A2,A3,A4,Th36;
hence thesis by FINSEQ_1:77;
end;
registration
cluster free -> well_founded non degenerated for preIfWhileAlgebra;
coherence
proof
let A be preIfWhileAlgebra;
assume
A1: A is free;
then reconsider A9 = A as free Universal_Algebra;
set G = the free GeneratorSet of A9;
Generators A = G by Th34;
hence ElementaryInstructions A is GeneratorSet of A by Th31,Th71;
thus
not ex I1,I2 be Element of A st I1 <> EmptyIns A & I1\;I2 = I2 or
I2 <> EmptyIns A & I1\;I2 = I1 or
(I1 <> EmptyIns A or I2 <> EmptyIns A) & I1\;I2 = EmptyIns A
by A1,Th72,Th73;
thus thesis by A1,Th72,Th73,Th74;
end;
end;
registration
cluster infinite non degenerated well_founded ECIW-strict free
strict for preIfWhileAlgebra;
existence
proof
set X = the infinite disjoint_with_NAT set;
take FreeUnivAlgNSG(ECIW-signature,X);
thus thesis;
end;
end;
definition
mode IfWhileAlgebra is
non degenerated well_founded ECIW-strict preIfWhileAlgebra;
end;
registration
let A be infinite preIfWhileAlgebra;
cluster ElementaryInstructions A -> infinite;
coherence by Def23;
end;
theorem Th76:
for A being preIfWhileAlgebra for B being Subset of A for n being Nat holds
EmptyIns A in B|^(n+1) & for C,I1,I2 being Element of A
st C in B|^n & I1 in B|^n & I2 in B|^n
holds I1\;I2 in B|^(n+1) & if-then-else(C,I1,I2) in B|^(n+1) &
while(C,I1) in B|^(n+1)
proof
let A be preIfWhileAlgebra;
let B be Subset of A;
let n be Nat;
set X = {Den(o,A).p where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= B|^n};
A1: B|^(n+1) = B|^n \/ X by Th19;
reconsider pe = <*>the carrier of A as Element of (the carrier of A)*
by FINSEQ_1:def 11;
A2: pe in {{}} by TARSKI:def 1;
A3: rng pe = {};
A4: dom Den(In(1, dom the charact of A), A) = {{}} by Th42;
{} c= B|^n;
then EmptyIns A in X by A2,A3,A4;
hence EmptyIns A in B|^(n+1) by A1,XBOOLE_0:def 3;
let C,I1,I2 be Element of A;
assume
A5: C in B|^n;
assume
A6: I1 in B|^n;
assume
A7: I2 in B|^n;
A8: <*I1,I2*> in 2-tuples_on the carrier of A by FINSEQ_2:137;
A9: rng <*I1,I2*> = {I1,I2} by FINSEQ_2:127;
A10: dom Den(In(2, dom the charact of A), A) = 2-tuples_on the carrier of A
by Th44;
{I1,I2} c= B|^n by A6,A7,ZFMISC_1:32;
then I1\;I2 in X by A8,A9,A10;
hence I1\;I2 in B|^(n+1) by A1,XBOOLE_0:def 3;
A11: <*C,I1,I2*> in 3-tuples_on the carrier of A by FINSEQ_2:139;
A12: rng <*C,I1,I2*> = {C,I1,I2} by FINSEQ_2:128;
A13: dom Den(In(3, dom the charact of A), A) = 3-tuples_on the carrier of A
by Th47;
{C,I1,I2} c= B|^n by A5,A6,A7,ZFMISC_1:133;
then if-then-else(C,I1,I2) in X by A11,A12,A13;
hence if-then-else(C,I1,I2) in B|^(n+1) by A1,XBOOLE_0:def 3;
A14: <*C,I1*> in 2-tuples_on the carrier of A by FINSEQ_2:137;
A15: rng <*C,I1*> = {C,I1} by FINSEQ_2:127;
A16: dom Den(In(4, dom the charact of A), A) = 2-tuples_on the carrier of A
by Th48;
{C,I1} c= B|^n by A5,A6,ZFMISC_1:32;
then while(C,I1) in X by A14,A15,A16;
hence thesis by A1,XBOOLE_0:def 3;
end;
theorem Th77:
for A being ECIW-strict preIfWhileAlgebra
for x being set, n being Nat st x in (ElementaryInstructions A)|^(n+1)
holds x in (ElementaryInstructions A)|^n or x = EmptyIns A or
(ex I1,I2 being Element of A st x = I1\;I2 &
I1 in (ElementaryInstructions A)|^n & I2 in (ElementaryInstructions A)|^n) or
(ex C,I1,I2 being Element of A st x = if-then-else(C,I1,I2) &
C in (ElementaryInstructions A)|^n &
I1 in (ElementaryInstructions A)|^n & I2 in (ElementaryInstructions A)|^n) or
ex C,I being Element of A st x = while(C,I) &
C in (ElementaryInstructions A)|^n & I in (ElementaryInstructions A)|^n
proof
let A be ECIW-strict preIfWhileAlgebra;
set B = ElementaryInstructions A;
let x be set;
let n be Nat;
assume
A1: x in B|^(n+1);
then reconsider I = x as Element of A;
assume
A2: x nin B|^n;
assume
A3: x <> EmptyIns A;
assume
A4: not ex I1,I2 being Element of A st x = I1\;I2 & I1 in B|^n & I2 in B|^n;
assume
A5: not ex C,I1,I2 being Element of A st x = if-then-else(C,I1,I2) &
C in B|^n & I1 in B|^n & I2 in B|^n;
B|^(n+1) = B|^n\/{Den(o,A).p where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= B|^n}
by Th19;
then x in {Den(o,A).p where o is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= B|^n}
by A1,A2,XBOOLE_0:def 3;
then consider o being (Element of dom the charact of A),
p being Element of (the carrier of A)* such that
A6: I = Den(o,A).p and
A7: p in dom Den(o,A) and
A8: rng p c= B|^n;
reconsider no = o as Element of NAT;
reconsider oo = Den(o,A) as Element of Operations A;
len signature A = len the charact of A by UNIALG_1:def 4;
then
A9: dom signature A = dom the charact of A by FINSEQ_3:29;
A10: len p = arity oo by A7,MARGREL1:def 25
.= (signature A).no by A9,UNIALG_1:def 4
.= ECIW-signature.o by Def27;
A11: 1 in Seg 2;
A12: 2 in Seg 2;
A13: 1 in Seg 3;
A14: 2 in Seg 3;
A15: 3 in Seg 3;
per cases by Th55;
suppose
A16: o = 1;
then p = {} by A10,Th54;
hence thesis by A3,A6,A16,SUBSET_1:def 8;
end;
suppose
A17: o = 2;
then
A18: p = <*p.1,p.2*> by A10,Th54,FINSEQ_1:44;
A19: dom p = Seg 2 by A10,A17,Th54,FINSEQ_1:def 3;
then
A20: p.1 in rng p by A11,FUNCT_1:def 3;
A21: p.2 in rng p by A12,A19,FUNCT_1:def 3;
then reconsider I1 = p.1, I2 = p.2 as Element of A by A20;
I = I1\;I2 by A6,A17,A18,SUBSET_1:def 8;
hence thesis by A4,A8,A20,A21;
end;
suppose
A22: o = 3;
then
A23: p = <*p.1,p.2,p.3*> by A10,Th54,FINSEQ_1:45;
A24: dom p = Seg 3 by A10,A22,Th54,FINSEQ_1:def 3;
then
A25: p.1 in rng p by A13,FUNCT_1:def 3;
A26: p.2 in rng p by A14,A24,FUNCT_1:def 3;
A27: p.3 in rng p by A15,A24,FUNCT_1:def 3;
then reconsider C = p.1, I1 = p.2, I2 = p.3 as Element of A by A25,A26;
I = if-then-else(C,I1,I2) by A6,A22,A23,SUBSET_1:def 8;
hence thesis by A5,A8,A25,A26,A27;
end;
suppose
A28: o = 4;
then
A29: p = <*p.1,p.2*> by A10,Th54,FINSEQ_1:44;
A30: dom p = Seg 2 by A10,A28,Th54,FINSEQ_1:def 3;
then
A31: p.1 in rng p by A11,FUNCT_1:def 3;
A32: p.2 in rng p by A12,A30,FUNCT_1:def 3;
then reconsider I1 = p.1, I2 = p.2 as Element of A by A31;
I = while(I1,I2) by A6,A28,A29,SUBSET_1:def 8;
hence thesis by A8,A31,A32;
end;
end;
theorem
for A being Universal_Algebra for B being Subset of A
holds Constants A c= B|^1
proof
let A be Universal_Algebra;
let B be Subset of A;
let x be object;
assume x in Constants A;
then consider a being Element of A such that
A1: x = a and
A2: ex o being Element of Operations A st arity o = 0 & a in rng o;
consider o being Element of Operations A such that
A3: arity o = 0 and
A4: a in rng o by A2;
consider s being object such that
A5: s in dom o and
A6: a = o.s by A4,FUNCT_1:def 3;
consider z being object such that
A7: z in dom the charact of A and
A8: o = (the charact of A).z by FUNCT_1:def 3;
reconsider z as Element of dom the charact of A by A7;
A9: Den(z,A) = o by A8;
A10: s is Element of 0-tuples_on the carrier of A by A3,A5,MARGREL1:22;
reconsider s as Element of (the carrier of A)* by A5;
rng s c= B by A10;
then
A11: x in {Den(r,A).p where r is (Element of dom the charact of A),
p is Element of (the carrier of A)*: p in dom Den(r,A) & rng p c= B}
by A1,A5,A6,A9;
B|^0 = B by Th18;
then B|^(0+1) = B \/ {Den(r,A).p where r is (Element of dom the charact of
A), p is Element of (the carrier of A)*: p in dom Den(r,A) & rng p c= B}
by Th19;
hence thesis by A11,XBOOLE_0:def 3;
end;
theorem Th79:
for A being preIfWhileAlgebra holds A is well_founded iff
for I being Element of A ex n being Nat st I in (ElementaryInstructions A)|^n
by Th30;
scheme StructInd{ A() -> well_founded ECIW-strict preIfWhileAlgebra,
I() -> (Element of A()), P[set] }: P[I()]
provided
A1: for I being Element of A() st I in ElementaryInstructions A() holds P[I]
and
A2: P[EmptyIns A()] and
A3: for I1,I2 being Element of A() st P[I1] & P[I2] holds P[I1\;I2] and
A4: for C,I1,I2 being Element of A() st P[C] & P[I1] & P[I2]
holds P[if-then-else(C,I1,I2)] and
A5: for C,I being Element of A() st P[C] & P[I] holds P[while(C,I)]
proof
set A = A();
A6: ex n being Nat st ( I() in (ElementaryInstructions A())|^n) by Th79;
defpred Q[Nat] means for I being Element of A()
st I in (ElementaryInstructions A())|^$1 holds P[I];
(ElementaryInstructions A())|^0 = ElementaryInstructions A() by Th18;
then
A7: Q[0] by A1;
A8: now
let n be Nat;
assume
A9: Q[n];
thus Q[n+1]
proof
let I be Element of A();
assume
A10: I in (ElementaryInstructions A())|^(n+1);
per cases by A10,Th77;
suppose I in (ElementaryInstructions A)|^n;
hence thesis by A9;
end;
suppose I = EmptyIns A;
hence thesis by A2;
end;
suppose ex I1,I2 being Element of A st I = I1\;I2 &
I1 in (ElementaryInstructions A)|^n &
I2 in (ElementaryInstructions A)|^n;
then consider I1,I2 being Element of A such that
A11: I = I1\;I2 and
A12: I1 in (ElementaryInstructions A)|^n and
A13: I2 in (ElementaryInstructions A)|^n;
A14: P[I1] by A9,A12;
P[I2] by A9,A13;
hence thesis by A3,A11,A14;
end;
suppose
ex C,I1,I2 being Element of A st I = if-then-else(C,I1,I2) &
C in (ElementaryInstructions A)|^n &
I1 in (ElementaryInstructions A)|^n &
I2 in (ElementaryInstructions A)|^n;
then consider C,I1,I2 being Element of A such that
A15: I = if-then-else(C,I1,I2) and
A16: C in (ElementaryInstructions A)|^n and
A17: I1 in (ElementaryInstructions A)|^n and
A18: I2 in (ElementaryInstructions A)|^n;
A19: P[C] by A9,A16;
A20: P[I1] by A9,A17;
P[I2] by A9,A18;
hence thesis by A4,A15,A19,A20;
end;
suppose ex C,J being Element of A st I = while(C,J) &
C in (ElementaryInstructions A)|^n &
J in (ElementaryInstructions A)|^n;
then consider C,J being Element of A such that
A21: I = while(C,J) and
A22: C in (ElementaryInstructions A)|^n and
A23: J in (ElementaryInstructions A)|^n;
A24: P[C] by A9,A22;
P[J] by A9,A23;
hence thesis by A5,A21,A24;
end;
end;
end;
for n being Nat holds Q[n] from NAT_1:sch 2(A7,A8);
hence thesis by A6;
end;
begin :: Execution function
definition
let A be preIfWhileAlgebra;
let S be non empty set; :: states
let f be Function of [:S, the carrier of A:], S;
attr f is complying_with_empty-instruction means
:
Def28: for s being Element of S holds f.(s, EmptyIns A) = s;
attr f is complying_with_catenation means
: Def29:
for s being Element of S
for I1,I2 being Element of A holds f.(s,I1 \; I2) = f.(f.(s,I1),I2);
end;
definition
let A be preIfWhileAlgebra;
let S be non empty set; :: states
let T be Subset of S; :: true states
let f be Function of [:S, the carrier of A:], S;
pred f complies_with_if_wrt T means
for s being Element of S for C, I1,I2 being Element of A holds
(f.(s,C) in T implies f.(s,if-then-else(C,I1,I2)) = f.(f.(s,C),I1)) &
(f.(s,C) nin T implies f.(s,if-then-else(C,I1,I2)) = f.(f.(s,C),I2));
pred f complies_with_while_wrt T means
for s being Element of S for C, I being Element of A holds
(f.(s,C) in T implies f.(s,while(C,I)) = f.(f.(f.(s,C),I),while(C,I))) &
(f.(s,C) nin T implies f.(s,while(C,I)) = f.(s,C));
end;
theorem
for f being Function of [:S, the carrier of A:], S
st f is complying_with_empty-instruction & f complies_with_if_wrt T
for s being Element of S holds
f.(s,C) nin T implies f.(s,if-then(C,I)) = f.(s,C)
proof
let f be Function of [:S, the carrier of A:], S such that
A1: f is complying_with_empty-instruction and
A2: f complies_with_if_wrt T;
let s be Element of S;
assume f.(s,C) nin T;
hence f.(s,if-then(C,I)) = f.(f.(s,C),EmptyIns A) by A2
.= f.(s,C) by A1;
end;
theorem Th81:
pr1(S, the carrier of A) is complying_with_empty-instruction &
pr1(S, the carrier of A) is complying_with_catenation &
pr1(S, the carrier of A) complies_with_if_wrt T &
pr1(S, the carrier of A) complies_with_while_wrt T
proof
set f = pr1(S, the carrier of A);
thus
for s being Element of S holds f.(s, EmptyIns A) = s by FUNCT_3:def 4;
hereby
let s be Element of S;
let I1,I2 be Element of A;
thus f.(s,I1 \; I2) = s by FUNCT_3:def 4
.= f.(s,I1) by FUNCT_3:def 4
.= f.(f.(s,I1),I2) by FUNCT_3:def 4;
end;
hereby
let s be Element of S;
let C, I1,I2 be Element of A;
f.(s,if-then-else(C,I1,I2)) = s by FUNCT_3:def 4
.= f.(s,C) by FUNCT_3:def 4;
hence
(f.(s,C) in T implies f.(s,if-then-else(C,I1,I2)) = f.(f.(s,C),I1))
& (f.(s,C) nin T implies f.(s,if-then-else(C,I1,I2)) = f.(f.(s,C),I2))
by FUNCT_3:def 4;
end;
let s be Element of S;
let C, I be Element of A;
f.(s,C) = s by FUNCT_3:def 4;
hence thesis by FUNCT_3:def 4;
end;
definition
let A be preIfWhileAlgebra;
let S be non empty set; :: states
let T be Subset of S; :: true states
mode ExecutionFunction of A,S,T -> Function of [:S, the carrier of A:], S
means
: Def32:
it is complying_with_empty-instruction &
it is complying_with_catenation & it complies_with_if_wrt T &
it complies_with_while_wrt T;
existence
proof
take pr1(S, the carrier of A);
thus thesis by Th81;
end;
end;
registration
let A be preIfWhileAlgebra;
let S be non empty set; :: states
let T be Subset of S; :: true states
cluster -> complying_with_empty-instruction complying_with_catenation
for ExecutionFunction of A,S,T;
coherence by Def32;
end;
definition
let A be preIfWhileAlgebra;
let I be Element of A;
let S be non empty set; :: states
let s be Element of S;
let T be Subset of S; :: true states
let f be ExecutionFunction of A, S, T;
:: iteration of I started in s terminates wrt f
pred f iteration_terminates_for I,s means
ex r being non empty FinSequence of S st r.1 = s & r.len r nin T &
for i being Nat st 1 <= i & i < len r holds r.i in T & r.(i+1) = f.(r.i, I);
end;
definition
let A be preIfWhileAlgebra;
let I be Element of A;
let S be non empty set; :: states
let s be Element of S;
let T be Subset of S; :: true states
let f be ExecutionFunction of A, S, T;
func iteration-degree(I,s,f) -> R_eal means
:
Def34: ex r being non empty FinSequence of S st
it = (len r)-1 & r.1 = s & r.len r nin T &
for i being Nat st 1 <= i & i < len r holds r.i in T & r.(i+1) = f.(r.i, I)
if f iteration_terminates_for I,s otherwise it = +infty;
correctness
proof
A1: now
assume f iteration_terminates_for I,s;
then consider r being non empty FinSequence of S such that
A2: r.1 = s and
A3: r.len r nin T and
A4: for i being Nat st 1 <= i & i < len r holds r.i in T & r.(i+1) = f.(
r.i, I);
reconsider x = (len r)-1 as R_eal by XXREAL_0:def 1;
take x, r;
thus x = (len r)-1 & r.1 = s & r.len r nin T &
for i being Nat st 1 <= i & i < len r
holds r.i in T & r.(i+1) = f.(r.i, I) by A2,A3,A4;
end;
now
let d1, d2 be R_eal;
given r1 being non empty FinSequence of S such that
A5: d1 = (len r1)-1 and
A6: r1.1 = s and
A7: r1.len r1 nin T and
A8: for i being Nat st 1 <= i & i < len r1 holds r1.i in T & r1.(i+1) =
f.(r1.i, I);
given r2 being non empty FinSequence of S such that
A9: d2 = (len r2)-1 and
A10: r2.1 = s and
A11: r2.len r2 nin T and
A12: for i being Nat st 1 <= i & i < len r2 holds r2.i in T & r2.(i+1) =
f.(r2.i, I);
defpred P[Nat] means
$1 < len r1 implies $1 < len r2 & r1.($1+1) = r2.($1+1);
A13: P[0] by A6,A10;
A14: now
let i be Nat;
assume
A15: P[i];
thus P[i+1]
proof
assume
A16: i+1 < len r1;
A17: 1 <= i+1 by NAT_1:11;
then
A18: r1.(i+1+1) = f.(r1.(i+1), I) by A8,A16;
A19: r1.(i+1) in T by A8,A16,A17;
i+1 <= len r2 by A15,A16,NAT_1:13;
hence i+1 < len r2 by A11,A15,A16,A19,NAT_1:13,XXREAL_0:1;
hence r1.(i+1+1) = r2.(i+1+1) by A12,A15,A16,A17,A18,NAT_1:13;
end;
end;
A20: for i being Nat holds P[i] from NAT_1:sch 2(A13,A14);
consider i being Nat such that
A21: len r1 = i+1 by NAT_1:6;
reconsider i as Element of NAT by ORDINAL1:def 12;
i < len r1 by A21,NAT_1:13;
then
A22: r1.len r1 = r2.len r1 by A20,A21;
A23: 1 <= len r1 by A21,NAT_1:11;
A24: len r1 <= len r2 by A20;
len r2 <= len r1 by A7,A12,A22,A23;
hence d1 = d2 by A5,A9,A24,XXREAL_0:1;
end;
hence thesis by A1;
end;
end;
reserve f for ExecutionFunction of A,S,T;
theorem
f iteration_terminates_for I,s iff iteration-degree(I,s,f) < +infty
proof
hereby
assume f iteration_terminates_for I,s;
then consider r being non empty FinSequence of S such that
A1: iteration-degree(I,s,f) = (len r)-1 and r.1 = s
and r.len r nin T
and for i being Nat st 1 <= i & i < len r holds r.i in T & r.(i+1) = f.(
r.i, I)
by Def34;
(len r)-1 in REAL by XREAL_0:def 1;
hence iteration-degree(I,s,f) < +infty by A1,XXREAL_0:9;
end;
thus thesis by Def34;
end;
theorem Th83:
s nin T implies f iteration_terminates_for I,s & iteration-degree(I,s,f) = 0
proof
assume
A1: s nin T;
set r = <*s*>;
A2: r.1 = s by FINSEQ_1:40;
A3: len r = 1 by FINSEQ_1:40;
A4: for i being Nat st 1 <= i & i < len r
holds r.i in T & r.(i+1) = f.(r.i, I) by FINSEQ_1:40;
A5: 1-1 = 0.;
thus f iteration_terminates_for I,s
proof
take <*s*>;
thus thesis by A1,A2,FINSEQ_1:40;
end;
hence thesis by A1,A2,A3,A4,A5,Def34;
end;
theorem
s in T implies
(f iteration_terminates_for I,s iff f iteration_terminates_for I, f.(s,I)) &
iteration-degree(I,s,f) = 1.+iteration-degree(I,f.(s,I),f)
proof
assume
A1: s in T;
thus
A2: f iteration_terminates_for I,s iff f iteration_terminates_for I, f.(s,I)
proof
thus f iteration_terminates_for I,s implies
f iteration_terminates_for I, f.(s,I)
proof
given r being non empty FinSequence of S such that
A3: r.1 = s and
A4: r.len r nin T and
A5: for i being Nat st 1 <= i & i < len r
holds r.i in T & r.(i+1) = f.(r.i, I);
consider r1 being (Element of S), q being FinSequence of S such that
r1 = r.1 and
A6: r = <*r1*>^q by FINSEQ_3:102;
A7: len r = 1+len q by A6,FINSEQ_5:8;
then reconsider q as non empty FinSequence of S by A1,A3,A4;
len r >= 1 by A7,NAT_1:11;
then
A8: 1 < len r by A1,A3,A4,XXREAL_0:1;
A9: len q >= 0+1 by NAT_1:13;
take q;
A10: len <*r1*> = 1 by FINSEQ_1:40;
1 in dom q by A9,FINSEQ_3:25;
hence q.1 = r.(1+1) by A6,A10,FINSEQ_1:def 7
.= f.(s,I) by A3,A5,A8;
len q in dom q by A9,FINSEQ_3:25;
hence q.len q nin T by A4,A6,A7,A10,FINSEQ_1:def 7;
let i be Nat;
assume that
A11: 1 <= i and
A12: i < len q;
A13: i in dom q by A11,A12,MSUALG_8:1;
A14: 1 <= i+1 by NAT_1:11;
A15: i+1 < len r by A7,A12,XREAL_1:6;
A16: i+1 in dom q by A11,A12,MSUALG_8:1;
A17: r.(i+1) = q.i by A6,A10,A13,FINSEQ_1:def 7;
r.(i+1+1) = q.(i+1) by A6,A10,A16,FINSEQ_1:def 7;
hence thesis by A5,A14,A15,A17;
end;
given q being non empty FinSequence of S such that
A18: q.1 = f.(s,I) and
A19: q.len q nin T and
A20: for i being Nat st 1 <= i & i < len q
holds q.i in T & q.(i+1) = f.(q.i, I);
take r = <*s*>^q;
A21: len <*s*> = 1 by FINSEQ_1:40;
thus
A22: r.1 = s by FINSEQ_1:41;
A23: len r = 1+len q by FINSEQ_5:8;
A24: 0+1 <= len q by NAT_1:13;
then len q in dom q by FINSEQ_3:25;
hence r.len r nin T by A19,A21,A23,FINSEQ_1:def 7;
let i be Nat;
assume that
A25: 1 <= i and
A26: i < len r;
consider j being Nat such that
A27: i = 1+j by A25,NAT_1:10;
per cases;
suppose
A28: j = 0;
1 in dom q by A24,FINSEQ_3:25;
hence thesis by A1,A18,A21,A22,A27,A28,FINSEQ_1:def 7;
end;
suppose j > 0;
then
A29: j >= 0+1 by NAT_1:13;
A30: j < len q by A23,A26,A27,XREAL_1:6;
A31: j in dom q by A29,A30,MSUALG_8:1;
A32: j+1 in dom q by A29,A30,MSUALG_8:1;
A33: r.(j+1) = q.j by A21,A31,FINSEQ_1:def 7;
r.(j+1+1) = q.(j+1) by A21,A32,FINSEQ_1:def 7;
hence thesis by A20,A27,A29,A30,A33;
end;
end;
per cases by A2;
suppose
A34: not f iteration_terminates_for I,s;
then
A35: iteration-degree(I,s,f) = +infty by Def34;
iteration-degree(I,f.(s,I),f) = +infty by A2,A34,Def34;
hence thesis by A35,XXREAL_3:def 2;
end;
suppose
f iteration_terminates_for I,f.(s,I);
then consider q being non empty FinSequence of S such that
A36: iteration-degree(I,f.(s,I),f) = (len q)-1 and
A37: q.1 = f.(s,I) and
A38: q.len q nin T and
A39: for i being Nat st 1 <= i & i < len q
holds q.i in T & q.(i+1) = f.(q.i, I) by Def34;
set r = <*s*>^q;
A40: len <*s*> = 1 by FINSEQ_1:40;
A41: r.1 = s by FINSEQ_1:41;
A42: len r = 1+len q by FINSEQ_5:8;
1+((len q)-1) = len q;
then
A43: (len r)-1 = 1.+iteration-degree(I,f.(s,I),f) by A36,A42,XXREAL_3:def 2;
A44: 0+1 <= len q by NAT_1:13;
then len q in dom q by FINSEQ_3:25;
then
A45: r.len r nin T by A38,A40,A42,FINSEQ_1:def 7;
now
let i be Nat;
assume that
A46: 1 <= i and
A47: i < len r;
consider j being Nat such that
A48: i = 1+j by A46,NAT_1:10;
per cases;
suppose
A49: j = 0;
1 in dom q by A44,FINSEQ_3:25;
hence r.i in T & r.(i+1) = f.(r.i,I)
by A1,A37,A40,A41,A48,A49,FINSEQ_1:def 7;
end;
suppose j > 0;
then
A50: j >= 0+1 by NAT_1:13;
A51: j < len q by A42,A47,A48,XREAL_1:6;
A52: j in dom q by A50,A51,MSUALG_8:1;
A53: j+1 in dom q by A50,A51,MSUALG_8:1;
A54: r.(j+1) = q.j by A40,A52,FINSEQ_1:def 7;
r.(j+1+1) = q.(j+1) by A40,A53,FINSEQ_1:def 7;
hence r.i in T & r.(i+1) = f.(r.i,I) by A39,A48,A50,A51,A54;
end;
end;
hence thesis by A2,A41,A43,A45,Def34;
end;
end;
theorem
iteration-degree(I,s,f) >= 0 proof per cases;
suppose not f iteration_terminates_for I,s;
hence thesis by Def34;
end;
suppose f iteration_terminates_for I,s;
then consider r being non empty FinSequence of S such that
A1: iteration-degree(I,s,f) = (len r)-1 and r.1 = s
and r.len r nin T
and for i being Nat st 1 <= i & i < len r holds r.i in T & r.(i+1) = f.(
r.i, I)
by Def34;
ex i being Nat st len r = i+1 by NAT_1:6;
hence thesis by A1;
end;
end;
scheme Termination {A() -> preIfWhileAlgebra, I() -> (Element of A()),
S() -> non empty set, s() -> (Element of S()), T() -> Subset of S(),
f() -> ExecutionFunction of A(),S(),T(), F(set) -> Nat, P[set] }:
f() iteration_terminates_for I(),s()
provided
A1: s() in T() iff P[s()] and
A2: for s being Element of S() st P[s]
holds (P[f().(s,I())] iff f().(s,I()) in T()) & F(f().(s,I())) < F(s)
proof
per cases;
suppose s() nin T();
hence thesis by Th83;
end;
suppose
A3: s() in T();
deffunc F(set,set) = f().(In($2,S()),I());
consider f being sequence of S() such that
A4: f.0 = s() and
A5: for i being Nat holds f.(i+1) = F(i,f.i) from NAT_1:sch 12;
defpred Q[Nat] means ex i being Element of NAT st F(f.i) = $1;
F(f.0) in NAT by ORDINAL1:def 12;
then
A6: ex j being Nat st Q[j];
consider j being Nat such that
A7: Q[j] & for i being Nat st Q[i] holds j <= i from NAT_1:sch 5(A6);
consider i0 being Element of NAT such that
A8: F(f.i0) = j by A7;
defpred R[Nat] means not P[f.$1];
In(f.i0,S()) = f.i0 by SUBSET_1:def 8;
then f.(i0+1) = f().(f.i0,I()) by A5;
then P[f.i0] implies F(f.(i0+1)) < j by A2,A8;
then
A9: ex i being Nat st R[i] by A7;
consider j being Nat such that
A10: R[j] & for i being Nat st R[i] holds j <= i from NAT_1:sch 5(A9);
deffunc G(Nat) = f.($1-'1);
consider p being FinSequence of S() such that
A11: len p = j+1 & for i being Nat st i in dom p holds p.i = G(i)
from FINSEQ_2:sch 1;
A12: dom p = Seg(j+1) by A11,FINSEQ_1:def 3;
reconsider p as non empty FinSequence of S() by A11;
take p;
A13: 1 <= j+1 by NAT_1:11;
then 1 in Seg(j+1);
hence p.1 = G(1) by A11,A12
.= s() by A4,XREAL_1:232;
len p in Seg(j+1) by A11,A13;
then
A14: p.len p = G(j+1) by A11,A12
.= f.j by NAT_D:34;
j > 0 by A1,A3,A4,A10;
then j >= 0+1 by NAT_1:13;
then consider j9 being Nat such that
A15: j = 1+j9 by NAT_1:10;
reconsider j9 as Element of NAT by ORDINAL1:def 12;
A16: f.j = f().(In(f.j9,S()),I()) by A5,A15;
j9 < j by A15,NAT_1:13;
then
A17: P[f.j9] by A10;
In(f.j9,S()) = f.j9 by SUBSET_1:def 8;
hence p.len p nin T() by A2,A10,A14,A16,A17;
let i be Nat;
assume that
A18: 1 <= i and
A19: i < len p;
A20: i+1 >= 1 by A18,NAT_1:13;
A21: i+1 <= len p by A19,NAT_1:13;
A22: i in Seg(j+1) by A11,A18,A19;
A23: i+1 in Seg(j+1) by A11,A20,A21;
A24: p.i = G(i) by A11,A12,A22;
A25: p.(i+1) = G(i+1) by A11,A12,A23;
consider i9 being Nat such that
A26: i = 1+i9 by A18,NAT_1:10;
reconsider i9 as Element of NAT by ORDINAL1:def 12;
i <= j by A11,A19,NAT_1:13;
then
A27: i9 < j by A26,NAT_1:13;
then
A28: P[f.i9] by A10;
A29: i-'1 = i9 by A26,NAT_D:34;
A30: i+1-'1 = i by NAT_D:34;
A31: In(f.i9,S()) = f.i9 by SUBSET_1:def 8;
now
assume i9 <> 0;
then i9 >= 0+1 by NAT_1:13;
then consider i99 being Nat such that
A32: i9 = 1+i99 by NAT_1:10;
reconsider i99 as Element of NAT by ORDINAL1:def 12;
i99 <= i9 by A32,NAT_1:11;
then i99 < j by A27,XXREAL_0:2;
then
A33: P[f.i99] by A10;
A34: In(f.i99,S()) = f.i99 by SUBSET_1:def 8;
f.i9 = F(i99,f.i99) by A5,A32;
hence p.i in T() by A2,A24,A28,A29,A33,A34;
end;
hence thesis by A3,A4,A5,A24,A25,A26,A29,A30,A31;
end;
end;
scheme Termination2 {A() -> preIfWhileAlgebra, I() -> (Element of A()),
S() -> non empty set, s() -> (Element of S()), T() -> Subset of S(),
f() -> ExecutionFunction of A(),S(),T(), F(set) -> Nat, P,R[set] }:
f() iteration_terminates_for I(),s()
provided
A1: P[s()] and
A2: s() in T() iff R[s()] and
A3: for s being Element of S() st P[s] & s in T() & R[s]
holds P[f().(s, I())] & (R[f().(s,I())] iff f().(s,I()) in T()) &
F(f().(s,I())) < F(s)
proof
per cases;
suppose s() nin T();
hence thesis by Th83;
end;
suppose
A4: s() in T();
deffunc F(set,set) = f().(In($2,S()),I());
consider f being sequence of S() such that
A5: f.0 = s() and
A6: for i being Nat holds f.(i+1) = F(i,f.i) from NAT_1:sch 12;
defpred Q[Nat] means ex i being Element of NAT st F(f.i) = $1;
F(f.0) in NAT by ORDINAL1:def 12;
then
A7: ex j being Nat st Q[j];
consider j being Nat such that
A8: Q[j] & for i being Nat st Q[i] holds j <= i from NAT_1:sch 5(A7);
consider i0 being Element of NAT such that
A9: F(f.i0) = j by A8;
defpred notR[Nat] means not (P[f.$1] & f.$1 in T() & R[f.$1]);
In(f.i0,S()) = f.i0 by SUBSET_1:def 8;
then f.(i0+1) = f().(f.i0,I()) by A6;
then not notR[i0] implies F(f.(i0+1)) < j by A3,A9;
then
A10: ex i being Nat st notR[i] by A8;
consider j being Nat such that
A11: notR[j] & for i being Nat st notR[i] holds j <= i from NAT_1:sch 5(A10
);
deffunc G(Nat) = f.($1-'1);
consider p being FinSequence of S() such that
A12: len p = j+1 & for i being Nat st i in dom p holds p.i = G(i)
from FINSEQ_2:sch 1;
A13: dom p = Seg(j+1) by A12,FINSEQ_1:def 3;
reconsider p as non empty FinSequence of S() by A12;
take p;
A14: 1 <= j+1 by NAT_1:11;
then 1 in Seg(j+1);
hence p.1 = G(1) by A12,A13
.= s() by A5,XREAL_1:232;
len p in Seg(j+1) by A12,A14;
then
A15: p.len p = G(j+1) by A12,A13
.= f.j by NAT_D:34;
j > 0 by A1,A2,A4,A5,A11;
then j >= 0+1 by NAT_1:13;
then consider j9 being Nat such that
A16: j = 1+j9 by NAT_1:10;
reconsider j9 as Element of NAT by ORDINAL1:def 12;
A17: f.j = f().(In(f.j9,S()),I()) by A6,A16;
A18: j9 < j by A16,NAT_1:13;
then
A19: R[f.j9] by A11;
A20: f.j9 in T() by A11,A18;
A21: P[f.j9] by A11,A18;
In(f.j9,S()) = f.j9 by SUBSET_1:def 8;
hence p.len p nin T() by A3,A11,A15,A17,A19,A20,A21;
let i be Nat;
assume that
A22: 1 <= i and
A23: i < len p;
A24: i+1 >= 1 by A22,NAT_1:13;
A25: i+1 <= len p by A23,NAT_1:13;
A26: i in Seg(j+1) by A12,A22,A23;
A27: i+1 in Seg(j+1) by A12,A24,A25;
A28: p.i = G(i) by A12,A13,A26;
A29: p.(i+1) = G(i+1) by A12,A13,A27;
consider i9 being Nat such that
A30: i = 1+i9 by A22,NAT_1:10;
reconsider i9 as Element of NAT by ORDINAL1:def 12;
i <= j by A12,A23,NAT_1:13;
then
A31: i9 < j by A30,NAT_1:13;
A32: i-'1 = i9 by A30,NAT_D:34;
A33: i+1-'1 = i by NAT_D:34;
In(f.i9,S()) = f.i9 by SUBSET_1:def 8;
hence thesis by A6,A11,A28,A29,A30,A31,A32,A33;
end;
end;
theorem Th86:
for r being non empty FinSequence of S st r.1 = f.(s,C) & r.len r nin T &
for i being Nat st 1 <= i & i < len r
holds r.i in T & r.(i+1) = f.(r.i, I \; C) holds f.(s, while(C,I)) = r.len r
proof
A1: f complies_with_while_wrt T by Def32;
let r be non empty FinSequence of S;
assume
A2: r.1 = f.(s,C);
assume
A3: r.len r nin T;
assume
A4: for i being Nat st 1 <= i & i < len r
holds r.i in T & r.(i+1) = f.(r.i, I \; C);
defpred P[Nat] means (len r)-$1 in dom r implies
for q being Element of S st f.(q,C) = r.((len r)-$1)
holds f.(q, while(C,I)) = r.len r;
A5: P[0] by A1,A3;
A6: for i being Nat st P[i] holds P[i+1]
proof
let i be Nat such that
A7: P[i] and
A8: (len r)-(i+1) in dom r;
reconsider j = (len r)-(i+1) as Element of NAT by A8;
A9: j+1+i = len r;
A10: 1 <= j+1 by NAT_1:11;
A11: j+1 <= len r by A9,NAT_1:11;
A12: 1 <= j by A8,FINSEQ_3:25;
A13: j < len r by A11,NAT_1:13;
then
A14: r.(j+1) = f.(r.j, I\;C) by A4,A12;
let q be Element of S;
assume
A15: f.(q,C) = r.((len r)-(i+1));
then
A16: f.(q,C) in T by A4,A12,A13;
r.(j+1) = f.(f.(f.(q,C), I), C) by A14,A15,Def29;
then f.(f.(f.(q,C), I), while(C,I)) = r.len r by A7,A10,A11,FINSEQ_3:25;
hence thesis by A1,A16;
end;
A17: for i being Nat holds P[i] from NAT_1:sch 2(A5,A6);
A18: len r >= 0+1 by NAT_1:13;
then consider i being Nat such that
A19: len r = 1+i by NAT_1:10;
P[i] by A17;
hence thesis by A2,A18,A19,FINSEQ_3:25;
end;
theorem Th87:
for I being Element of A for s being Element of S holds
not f iteration_terminates_for I,s iff (curry' f).I orbit s c= T
proof
let I be Element of A;
let s be Element of S;
set g = (curry' f).I;
hereby
assume
A1: not f iteration_terminates_for I,s;
thus g orbit s c= T
proof
let x be object;
assume x in g orbit s;
then
A2: ex n being Element of NAT st ( x = iter(g, n).s)&( s in dom iter(g, n));
defpred P[Nat] means iter(g,$1).s nin T;
assume x nin T;
then
A3: ex n being Nat st P[n] by A2;
consider n being Nat such that
A4: P[n] & for m being Nat st P[m] holds n <= m from NAT_1:sch 5(A3);
deffunc F(Nat) = iter(g,$1-'1).s;
consider r being FinSequence such that
A5: len r = n+1 & for k being Nat st k in dom r holds r.k = F(k)
from FINSEQ_1:sch 2;
rng r c= S
proof
let a be object;
assume a in rng r;
then consider b being object such that
A6: b in dom r and
A7: a = r.b by FUNCT_1:def 3;
reconsider b as Element of NAT by A6;
r.b = iter(g,b-'1).s by A5,A6;
hence thesis by A7;
end;
then reconsider r as non empty FinSequence of S
by A5,FINSEQ_1:def 4;
A8: 1 <= n+1 by NAT_1:11;
then
A9: 1 in dom r by A5,FINSEQ_3:25;
A10: n+1 in dom r by A5,A8,FINSEQ_3:25;
A11: 1-'1 = 0 by XREAL_1:232;
A12: n+1-'1 = n by NAT_D:34;
A13: iter(g,0) = id S by FUNCT_7:84;
r.1 = F(1) by A5,A9;
then
A14: r.1 = s by A11,A13;
A15: r.len r nin T by A4,A5,A10,A12;
now
let i be Nat such that
A16: 1 <= i and
A17: i < len r;
consider j being Nat such that
A18: i = 1+j by A16,NAT_1:10;
reconsider j as Element of NAT by ORDINAL1:def 12;
A19: i-'1 = j by A18,NAT_D:34;
A20: (i+1)-'1 = i by NAT_D:34;
A21: dom curry' f = the carrier of A by FUNCT_2:def 1;
dom g = S by FUNCT_2:def 1;
then
A22: g.(iter(g,j).s) = f.(iter(g,j).s, I) by A21,FUNCT_5:34;
A23: iter(g,i) = g*iter( g,j) by A18,FUNCT_7:71;
A24: 1 <= i+1 by A16,NAT_1:13;
A25: i+1 <= n+1 by A5,A17,NAT_1:13;
A26: i-'1 < n by A5,A17,A18,A19,XREAL_1:6;
A27: i in dom r by A16,A17,FINSEQ_3:25;
A28: i+1 in dom r by A5,A24,A25,FINSEQ_3:25;
A29: r.i = iter(g,i-'1).s by A5,A27;
r.(i+1) = iter(g,i).s by A5,A20,A28;
hence r.i in T & r.(i+1) = f.(r.i, I) by A4,A19,A22,A23,A26,A29,
FUNCT_2:15;
end;
hence contradiction by A1,A14,A15;
end;
end;
assume
A30: (curry' f).I orbit s c= T;
given r being non empty FinSequence of S such that
A31: r.1 = s and
A32: r.len r nin T and
A33: for i being Nat st 1 <= i & i < len r
holds r.i in T & r.(i+1) = f.(r.i, I);
defpred P[Nat] means $1+1 <= len r implies r.($1+1) in (curry' f).I orbit s;
dom g = S by FUNCT_2:def 1;
then
A34: P[0] by A31,Th6;
A35: for i being Nat st P[i] holds P[i+1]
proof
let i be Nat such that
A36: P[i] and
A37: i+1+1 <= len r;
A38: 1 <= i+1 by NAT_1:11;
A39: i+1 < len r by A37,NAT_1:13;
then i+1 in dom r by A38,FINSEQ_3:25;
then
A40: r.(i+1) in rng r by FUNCT_1:3;
dom f = [:S, the carrier of A:] by FUNCT_2:def 1;
then
A41: [r.(i+1), I] in dom f by A40,ZFMISC_1:87;
consider n being Element of NAT such that
A42: r.(i+1) = iter((curry' f).I,n).s and s in dom iter((curry' f).I,n)
by A36,A37,NAT_1:13;
A43: r.(i+1+1) = f.(r.(i+1), I) by A33,A38,A39
.= (curry' f).I.(r.(i+1)) by A41,FUNCT_5:22
.= (g*iter(g,n)).s by A42,FUNCT_2:15
.= iter((curry' f).I,n+1).s by FUNCT_7:71;
dom iter(g,n+1) = S by FUNCT_2:def 1;
hence r.(i+1+1) in g orbit s by A43;
end;
consider i being Nat such that
A44: len r = i+1 by NAT_1:6;
for n being Nat holds P[n] from NAT_1:sch 2(A34,A35);
then r.(i+1) in g orbit s by A44;
hence contradiction by A30,A32,A44;
end;
scheme InvariantSch {A() -> preIfWhileAlgebra, C,I() -> (Element of A()),
S() -> non empty set, s() -> (Element of S()), T() -> Subset of S(),
f() -> ExecutionFunction of A(),S(),T(), P,R[set] }:
P[f().(s(),while(C(),I()))] & not R[f().(s(),while(C(),I()))]
provided
A1: P[s()] and
A2: f() iteration_terminates_for I()\;C(), f().(s(),C()) and
A3: for s being Element of S() st P[s] & s in T() & R[s] holds P[f().(s,I())]
and
A4: for s being Element of S() st P[s] holds
P[f().(s,C())] & (f().(s,C()) in T() iff R[f().(s,C())])
proof
consider r being non empty FinSequence of S() such that
A5: r.1 = f().(s(),C()) and
A6: r.len r nin T() and
A7: for i being Nat st 1 <= i & i < len r holds r.i in T() & r.(i+1) = f
().(r.i, I()\;C())
by A2;
A8: f().(s(), while(C(),I())) = r.len r by A5,A6,A7,Th86;
defpred Q[Nat] means $1+1 in dom r implies P[r.($1+1)] &
($1+1 < len r implies R[r.($1+1)]) &
ex q being Element of S() st P[q] & r.($1+1) = f().(q,C());
0+1 < len r implies r.(0+1) in T() by A7;
then
A9: Q[0] by A1,A4,A5;
A10: for n being Nat st Q[n] holds Q[n+1]
proof
let n be Nat;
assume
A11: Q[n];
assume
A12: n+1+1 in dom r;
then
A13: n+1+1 <= len r by FINSEQ_3:25;
A14: n+1+1 >= 1 by NAT_1:11;
A15: n+1 >= 1 by NAT_1:11;
A16: n+1 < len r by A13,NAT_1:13;
then
A17: n+1 in dom r by A15,FINSEQ_3:25;
A18: r.(n+1) in T() by A7,A15,A16;
A19: r.(n+1+1) = f().(r.(n+1), I()\;C( )) by A7,A15,A16;
reconsider q1 = r.(n+1), q2 = r.(n+1+1) as Element of S()
by A12,A17,DTCONSTR:2;
reconsider q3 = f().(q1,I()) as Element of S();
A20: q2 = f().(q3, C()) by A19,Def29;
A21: P[q3] by A3,A11,A15,A16,A18,FINSEQ_3:25;
hence P[r.(n+1+1)] by A4,A20;
hereby
assume n+1+1 < len r;
then r.(n+1+1) in T() by A7,A14;
hence R[r.(n+1+1)] by A4,A20,A21;
end;
take q3;
thus thesis by A3,A11,A15,A16,A18,A19,Def29,FINSEQ_3:25;
end;
A22: for n being Nat holds Q[n] from NAT_1:sch 2(A9,A10);
A23: len r >= 0+1 by NAT_1:13;
then consider j being Nat such that
A24: len r = 1+j by NAT_1:10;
A25: j+1 in dom r by A23,A24,FINSEQ_3:25;
hence P[f().(s(),while(C(),I()))] by A8,A22,A24;
ex q being Element of S() st P[q] & r.(j+1) = f().(q, C()) by A22,A25;
hence thesis by A4,A6,A8,A24;
end;
scheme coInvariantSch {A() -> preIfWhileAlgebra, C,I() -> (Element of A()),
S() -> non empty set, s() -> (Element of S()), T() -> Subset of S(),
f() -> ExecutionFunction of A(),S(),T(), P[set] }: P[s()]
provided
A1: P[f().(s(),while(C(),I()))] and
A2: f() iteration_terminates_for I()\;C(), f().(s(),C()) and
A3: for s being Element of S() st P[f().(f().(s,C()),I())] & f().(s,C()) in T()
holds P[f().(s,C())] and
A4: for s being Element of S() st P[f().(s,C())] holds P[s]
proof
consider r being non empty FinSequence of S() such that
A5: r.1 = f().(s(),C()) and
A6: r.len r nin T() and
A7: for i being Nat st 1 <= i & i < len r holds r.i in T() & r.(i+1) = f
().(r.i, I()\;C())
by A2;
defpred Q[Nat] means (len r)-$1 in dom r implies P[r.((len r)-$1)];
defpred R[Nat] means $1+1 in dom r implies
ex q being Element of S() st r.($1+1) = f().(q,C());
A8: R[0] by A5;
A9: for n being Nat st R[n] holds R[n+1]
proof
let n be Nat;
assume R[n];
assume n+1+1 in dom r;
then
A10: n+1+1 <= len r by FINSEQ_3:25;
A11: n+1 >= 1 by NAT_1:11;
A12: n+1 < len r by A10,NAT_1:13;
then
A13: r.(n+1) in T() by A7,A11;
A14: r.(n+1+1) = f().(r.(n+1), I()\;C() ) by A7,A11,A12;
reconsider q1 = r.(n+1) as Element of S() by A13;
reconsider q3 = f().(q1,I()) as Element of S();
take q3;
thus thesis by A14,Def29;
end;
A15: Q[0] by A1,A5,A6,A7,Th86;
A16: for n being Nat st Q[n] holds Q[n+1]
proof
let n be Nat;
assume
A17: Q[n];
assume
A18: (len r)-(n+1) in dom r;
then reconsider j = (len r)-(n+1) as Element of NAT;
A19: j >= 1 by A18,FINSEQ_3:25;
n+1 >= 0+1 by NAT_1:13;
then j <= (len r)-1 by XREAL_1:10;
then
A20: j+1 <= (len r)-1+1 by XREAL_1:6;
A21: 1 <= 1+j by NAT_1:11;
A22: j < len r by A20,NAT_1:13;
A23: j+1 in dom r by A20,A21,FINSEQ_3:25;
A24: r.j in T() by A7,A19,A22;
A25: r.(j+1) = f().(r.j, I()\;C()) by A7,A19,A22;
reconsider q1 = r.j, q2 = r.(j+1) as Element of S() by A23,A24,DTCONSTR:2;
reconsider q9 = f().(q1, I()) as Element of S();
consider j9 being Nat such that
A26: j = 1+j9 by A19,NAT_1:10;
for n being Nat holds R[n] from NAT_1:sch 2(A8,A9);
then consider qq being Element of S() such that
A27: r.(j9+1) = f().(qq,C()) by A18,A26;
q2 = f().(q9, C()) by A25,Def29;
then P[f().(f().(qq,C()),I())] by A4,A17,A20,A21,A26,A27,FINSEQ_3:25;
hence thesis by A3,A7,A19,A22,A26,A27;
end;
A28: for n being Nat holds Q[n] from NAT_1:sch 2(A15,A16);
A29: len r >= 0+1 by NAT_1:13;
then consider j being Nat such that
A30: len r = 1+j by NAT_1:10;
(len r)-j in dom r by A29,A30,FINSEQ_3:25;
hence thesis by A4,A5,A28,A30;
end;
theorem Th88:
for A being free preIfWhileAlgebra for I1,I2 being Element of A
for n being Nat st I1\;I2 in (ElementaryInstructions A)|^n
ex i being Nat st n = i+1 &
I1 in (ElementaryInstructions A)|^i & I2 in (ElementaryInstructions A)|^i
proof
let A be free preIfWhileAlgebra;
set B = ElementaryInstructions A;
A1: B is GeneratorSet of A by Def25;
let I1,I2 be Element of A;
A2: I1\;I2 <> I1 by Th73;
I1\;I2 <> I2 by Th73;
then I1\;I2 nin B by A2,Th50;
then
A3: I1\;I2 nin B|^0 by Th18;
let n be Nat;
assume
A4: I1\;I2 in B|^n;
then n > 0 by A3;
then n >= 0+1 by NAT_1:13;
then consider i being Nat such that
A5: n = 1+i by NAT_1:10;
take i;
thus n = i+1 by A5;
A6: dom Den(In(2, dom the charact of A), A) = 2-tuples_on the carrier of A
by Th44;
A7: for o being OperSymbol of A, p being FinSequence st p in dom Den(o,A)
holds Den(o,A).p in B implies o <> In(2, dom the charact of A)
proof
let o be OperSymbol of A;
let p be FinSequence;
assume that
A8: p in dom Den(o,A) and
A9: Den(o,A).p in B and
A10: o = In(2, dom the charact of A);
consider a,b being object such that
A11: a in the carrier of A and
A12: b in the carrier of A and
A13: p = <*a,b*> by A6,A8,A10,FINSEQ_2:137;
reconsider a,b as Element of A by A11,A12;
A14: a\;b <> a by Th73;
a\;b <> b by Th73;
hence contradiction by A9,A10,A13,A14,Th50;
end;
<*I1,I2*> in dom Den(In(2, dom the charact of A),A) by A6,FINSEQ_2:137;
then rng <*I1,I2*> c= B|^i by A1,A4,A5,A7,Th39;
then {I1,I2} c= B|^i by FINSEQ_2:127;
hence thesis by ZFMISC_1:32;
end;
theorem Th89:
for A being free preIfWhileAlgebra for C,I1,I2 being Element of A
for n being Nat st if-then-else(C,I1,I2) in (ElementaryInstructions A)|^n
ex i being Nat st n = i+1 & C in (ElementaryInstructions A)|^i &
I1 in (ElementaryInstructions A)|^i & I2 in (ElementaryInstructions A)|^i
proof
let A be free preIfWhileAlgebra;
set B = ElementaryInstructions A;
A1: B is GeneratorSet of A by Def25;
let C,I1,I2 be Element of A;
if-then-else(C,I1,I2) nin B by Th51;
then
A2: if-then-else(C,I1,I2) nin B|^0 by Th18;
let n be Nat;
assume
A3: if-then-else(C,I1,I2) in B|^n;
then consider i being Nat such that
A4: n = i+1 by A2,NAT_1:6;
take i;
thus n = i+1 by A4;
A5: dom Den(In(3, dom the charact of A), A) = 3-tuples_on the carrier of A
by Th47;
A6: for o being OperSymbol of A, p being FinSequence st p in dom Den(o,A)
holds Den(o,A).p in B implies o <> In(3, dom the charact of A)
proof
let o be OperSymbol of A;
let p be FinSequence;
assume that
A7: p in dom Den(o,A) and
A8: Den(o,A).p in B and
A9: o = In(3, dom the charact of A);
consider a,b,c being object such that
A10: a in the carrier of A and
A11: b in the carrier of A and
A12: c in the carrier of A and
A13: p = <*a,b,c*> by A5,A7,A9,FINSEQ_2:139;
reconsider a,b,c as Element of A by A10,A11,A12;
Den(o,A).p = if-then-else(a,b,c) by A9,A13;
hence contradiction by A8,Th51;
end;
<*C,I1,I2*> in dom Den(In(3, dom the charact of A),A) by A5,FINSEQ_2:139;
then rng <*C,I1,I2*> c= B|^i by A1,A3,A4,A6,Th39;
then
A14: {C,I1,I2} c= B|^i by FINSEQ_2:128;
A15: C in {C,I1,I2} by ENUMSET1:def 1;
A16: I1 in {C,I1,I2} by ENUMSET1:def 1;
I2 in {C,I1,I2 } by ENUMSET1:def 1;
hence thesis by A14,A15,A16;
end;
theorem Th90:
for A being free preIfWhileAlgebra for C,I being Element of A
for n being Nat st while(C,I) in (ElementaryInstructions A)|^n
ex i being Nat st n = i+1 &
C in (ElementaryInstructions A)|^i & I in (ElementaryInstructions A)|^i
proof
let A be free preIfWhileAlgebra;
set B = ElementaryInstructions A;
A1: B is GeneratorSet of A by Def25;
let C,I be Element of A;
while(C,I) nin B by Th52;
then
A2: while(C,I) nin B|^0 by Th18;
let n be Nat;
assume
A3: while(C,I) in B|^n;
then consider i being Nat such that
A4: n = i+1 by A2,NAT_1:6;
take i;
thus n = i+1 by A4;
A5: dom Den(In(4, dom the charact of A), A) = 2-tuples_on the carrier of A
by Th48;
A6: for o being OperSymbol of A, p being FinSequence st p in dom Den(o,A)
holds Den(o,A).p in B implies o <> In(4, dom the charact of A)
proof
let o be OperSymbol of A;
let p be FinSequence;
assume that
A7: p in dom Den(o,A) and
A8: Den(o,A).p in B and
A9: o = In(4, dom the charact of A);
consider a,b being object such that
A10: a in the carrier of A and
A11: b in the carrier of A and
A12: p = <*a,b*> by A5,A7,A9,FINSEQ_2:137;
reconsider a,b as Element of A by A10,A11;
Den(o,A).p = while(a,b) by A9,A12;
hence contradiction by A8,Th52;
end;
<*C,I*> in dom Den(In(4, dom the charact of A),A) by A5,FINSEQ_2:137;
then rng <*C,I*> c= B|^i by A1,A3,A4,A6,Th39;
then {C,I} c= B|^i by FINSEQ_2:127;
hence thesis by ZFMISC_1:32;
end;
begin :: Existence and uniqueness of execution function and termination
scheme IndDef {A() -> free ECIW-strict preIfWhileAlgebra,
S() -> non empty set, Emp() -> (Element of S()), ElemF(set) -> set,
ConF, WhiF(set,set) -> (Element of S()),
IfF(set,set,set) -> Element of S()}:
ex f being Function of the carrier of A(), S() st
(for I being Element of A() st I in ElementaryInstructions A()
holds f.I = ElemF(I)) & f.EmptyIns A() = Emp() &
(for I1,I2 being Element of A() holds f.(I1\;I2) = ConF(f.I1,f.I2)) &
(for C,I1,I2 being Element of A()
holds f.if-then-else(C,I1,I2) = IfF(f.C,f.I1,f.I2)) &
for C,I being Element of A() holds f.while(C,I) = WhiF(f.C,f.I)
provided
A1: for I being Element of A() st I in ElementaryInstructions A()
holds ElemF(I) in S()
proof
set B = ElementaryInstructions A();
A2: B|^0 = B by Th18;
set FB = {[I,ElemF(I)] where I is Element of A(): I in B};
deffunc CF(Nat,set) = {[I1\;I2, ConF(fI1,fI2)]
where I1,I2 is (Element of A()),fI1,fI2 is Element of S():
I1 in B|^$1 & I2 in B|^$1 & [I1,fI1] in $2 & [I2,fI2] in $2};
deffunc IF(Nat,set) = {[if-then-else(C,I1,I2), IfF(fC,fI1,fI2)]
where C,I1,I2 is (Element of A()),fC,fI1,fI2 is (Element of S()):
C in B|^$1 & I1 in B|^$1 & I2 in B|^$1 &
[C,fC] in $2 & [I1,fI1] in $2 & [I2,fI2] in $2};
deffunc WF(Nat,set) = {[while(C,I), WhiF(gC,gI)]
where C,I is (Element of A()),gC,gI is Element of S():
C in B|^$1 & I in B|^$1 & [C,gC] in $2 & [I,gI] in $2};
deffunc F(Nat,set) = $2 \/ {[EmptyIns A(), Emp()]} \/
CF($1,$2) \/ IF($1,$2) \/ WF($1,$2);
consider FF being Function such that
A3: dom FF = NAT & FF.0 = FB and
A4: for n being Nat holds FF.(n+1) = F(n,FF.n) from NAT_1:sch 11;
set f = Union FF;
A5: for n,m being Nat st n <= m holds FF.n c= FF.m
proof
let n,m be Nat;
assume n <= m;
then consider i being Nat such that
A6: m = n+i by NAT_1:10;
reconsider i as Element of NAT by ORDINAL1:def 12;
A7: m = n+i by A6;
defpred I[Nat] means FF.n c= FF.(n+$1);
A8: I[0];
A9: now
let i be Nat;
reconsider n9 =n as Element of NAT by ORDINAL1:def 12;
FF.(n9+i+1) = F(n9+i, FF.(n9+i)) by A4
.= FF.(n+i) \/ {[EmptyIns A(), Emp()]} \/ CF(n+i, FF.(n+i)) \/
(IF(n+i, FF.(n+i)) \/ WF(n+i, FF.(n+i))) by XBOOLE_1:4
.= FF.(n+i) \/ {[EmptyIns A(), Emp()]} \/ (CF(n+i, FF.(n+i)) \/
(IF(n+i, FF.(n+i)) \/ WF(n+i, FF.(n+i)))) by XBOOLE_1:4
.= FF.(n+i) \/ ({[EmptyIns A(), Emp()]} \/ (CF(n+i, FF.(n+i)) \/
(IF(n+i, FF.(n+i)) \/ WF(n+i, FF.(n+i))))) by XBOOLE_1:4;
then FF.(n+i) c= FF.(n+i+1) by XBOOLE_1:7;
hence I[i] implies I[i+1] by XBOOLE_1:1;
end;
for i being Nat holds I[i] from NAT_1:sch 2(A8,A9);
hence thesis by A7;
end;
defpred P[Nat] means ex g being Function of B|^$1, S() st g = FF.$1 &
(EmptyIns A() in B|^$1 implies g.EmptyIns A() = Emp()) &
(for I1,I2 being Element of A() st I1\;I2 in B|^$1
holds g.(I1\;I2) = ConF(g.I1,g.I2)) &
(for C,I1,I2 being Element of A() st if-then-else(C,I1,I2) in B|^$1
holds g.if-then-else(C,I1,I2) = IfF(g.C,g.I1,g.I2)) &
(for C,I being Element of A() st while(C,I) in B|^$1
holds g.while(C,I) = WhiF(g.C,g.I));
defpred p[set] means $1 in B;
reconsider f0 = {[I,ElemF(I)] where I is Element of A(): p[I]} as Function
from ALTCAT_2:sch 1;
A10: dom f0 = B
proof
thus dom f0 c= B
proof
let x be object;
assume x in dom f0;
then [x,f0.x] in f0 by FUNCT_1:def 2;
then ex I being Element of A() st [x,f0.x] = [I,ElemF(I)] & p[I];
hence thesis by XTUPLE_0:1;
end;
let x be object;
assume
A11: x in B;
then reconsider I = x as Element of A();
[I,ElemF(I)] in f0 by A11;
hence thesis by XTUPLE_0:def 12;
end;
rng f0 c= S()
proof
let y be object;
assume y in rng f0;
then consider x being object such that
A12: [x,y] in f0 by XTUPLE_0:def 13;
consider I being Element of A() such that
A13: [x,y] = [I,ElemF(I)] and
A14: p[I] by A12;
y = ElemF(I) by A13,XTUPLE_0:1;
hence thesis by A1,A14;
end;
then reconsider f0 as Function of B|^0, S() by A2,A10,FUNCT_2:2;
A15: P[0]
proof
take f0;
thus f0 = FF.0 by A3;
now
let I1,I2 be Element of A();
A16: I1\;I2 <> I1 by Th73;
I1\;I2 <> I2 by Th73;
hence I1\;I2 nin B by A16,Th50;
end;
hence thesis by A2,Th49,Th51,Th52;
end;
A17: for i being Nat st P[i] holds P[i+1]
proof
let i be Nat;
given g being Function of B|^i, S() such that
A18: g = FF.i and
A19: EmptyIns A() in B|^i implies g.EmptyIns A() = Emp() and
A20: for I1,I2 being Element of A() st I1\;I2 in B|^i holds g.(I1\;I2)
= ConF(g.I1,g.I2) and
A21: for C,I1,I2 being Element of A() st if-then-else(C,I1,I2) in B|^i
holds g.if-then-else(C,I1,I2) = IfF(g.C,g.I1,g.I2) and
A22: for C,I being Element of A() st while(C,I) in B|^i holds g.while(C,
I) = WhiF(g.C,g.I);
set h = FF.(i+1);
A23: i < i+1 by NAT_1:13;
A24: h = F(i, g) by A4,A18;
A25: dom g = B|^i by FUNCT_2:def 1;
A26: B|^i c= B|^(i+1) by A23,Th21;
A27: now
let x be set;
assume x in h;
then x in g \/ {[EmptyIns A(), Emp()]} \/ CF(i, g) \/ IF(i, g) or
x in WF(i, g) by A24,XBOOLE_0:def 3;
then x in g \/ {[EmptyIns A(), Emp()]} \/ CF(i, g) or x in IF(i, g) or
x in WF(i, g) by XBOOLE_0:def 3;
then x in g \/ {[EmptyIns A(), Emp()]} or x in CF(i,g) or x in IF(i, g
) or x in WF(i, g) by XBOOLE_0:def 3;
hence x in g or x in {[EmptyIns A(), Emp()]} or x in CF(i,g) or
x in IF(i, g) or x in WF(i, g) by XBOOLE_0:def 3;
end;
h is Relation-like
proof
let x be object;
assume x in h;
then x in g or x in {[EmptyIns A(), Emp()]} or
x in CF(i,g) or x in IF(i,g) or x in WF(i,g) by A27;
then (ex a,b being object st x = [a,b]) or x = [EmptyIns A(), Emp()] or
(ex I1,I2 being (Element of A()), fI1,fI2 being Element of S() st
x = [I1\;I2, ConF(fI1,fI2)] & I1 in B|^i & I2 in B|^i &
[I1,fI1] in g & [I2,fI2] in g) or
(ex C,I1,I2 being (Element of A()),a,b,c being Element of S() st
x = [if-then-else(C,I1,I2), IfF(a,b,c)] & C in B|^i & I1 in B|^i &
I2 in B|^i & [C,a] in g & [I1,b] in g & [I2,c] in g) or
(ex C,I being (Element of A()), a,b being Element of S() st
x = [while(C,I), WhiF(a,b)] & C in B|^i & I in B|^i & [C,a] in g &
[I,b] in g) by RELAT_1:def 1;
hence thesis;
end;
then reconsider h as Relation;
h is Function-like
proof
let x,y1,y2 be object;
set x1 = [x,y1], x2 = [x,y2];
assume
A28: [x,y1] in h;
assume
A29: [x,y2] in h;
per cases by A27,A28;
suppose
A30: x1 in g;
then
A31: x in dom g by FUNCT_1:1;
A32: y1 = g.x by A30,FUNCT_1:1;
per cases by A27,A29;
suppose x2 in g;
hence thesis by A30,FUNCT_1:def 1;
end;
suppose x2 in {[EmptyIns A(), Emp()]};
then
A33: x2 = [EmptyIns A(), Emp()] by TARSKI:def 1;
then x = EmptyIns A() by XTUPLE_0:1;
hence thesis by A19,A31,A32,A33,XTUPLE_0:1;
end;
suppose x2 in CF(i,g);
then consider J1,J2 being (Element of A()), gJ1,gJ2 being Element
of S() such that
A34: x2 = [J1\;J2, ConF(gJ1,gJ2)] and J1 in B|^i
and J2 in B|^i and
A35: [J1,gJ1] in g and
A36: [J2,gJ2] in g;
A37: x = J1\;J2 by A34,XTUPLE_0:1;
A38: y2 = ConF(gJ1,gJ2) by A34,XTUPLE_0:1;
A39: g.J1 = gJ1 by A35,FUNCT_1:1;
g.J2 = gJ2 by A36,FUNCT_1:1;
hence thesis by A20,A31,A32,A37,A38,A39;
end;
suppose x2 in IF(i,g);
then consider D,J1,J2 being (Element of A()), a,b,c being Element
of S() such that
A40: x2 = [if-then-else(D,J1,J2), IfF(a,b,c)] and D in B|^i
and J1 in B|^i
and J2 in B|^i and
A41: [D,a] in g and
A42: [J1,b] in g and
A43: [J2,c] in g;
A44: x = if-then-else(D,J1,J2) by A40,XTUPLE_0:1;
A45: y2 = IfF(a,b,c) by A40,XTUPLE_0:1;
A46: g.D = a by A41,FUNCT_1:1;
A47: g.J1 = b by A42,FUNCT_1:1;
g.J2 = c by A43,FUNCT_1:1;
hence thesis by A21,A31,A32,A44,A45,A46,A47;
end;
suppose x2 in WF(i,g);
then consider D,J being (Element of A()), a,b being Element of S()
such that
A48: x2 = [while(D,J), WhiF(a,b)] and D in B|^i
and J in B|^i and
A49: [D,a] in g and
A50: [J,b] in g;
A51: x = while(D,J) by A48,XTUPLE_0:1;
A52: y2 = WhiF(a,b) by A48,XTUPLE_0:1;
A53: g.D = a by A49,FUNCT_1:1;
g.J = b by A50,FUNCT_1:1;
hence thesis by A22,A31,A32,A51,A52,A53;
end;
end;
suppose x1 in {[EmptyIns A(), Emp()]};
then
A54: x1 = [EmptyIns A(), Emp()] by TARSKI:def 1;
then
A55: x = EmptyIns A() by XTUPLE_0:1;
A56: y1 = Emp() by A54,XTUPLE_0:1;
per cases by A27,A29;
suppose
A57: x2 in g;
then x in dom g by FUNCT_1:1;
hence thesis by A19,A55,A56,A57,FUNCT_1:1;
end;
suppose x2 in {[EmptyIns A(), Emp()]};
then x2 = [EmptyIns A(), Emp()] by TARSKI:def 1;
hence thesis by A54,XTUPLE_0:1;
end;
suppose x2 in CF(i,g);
then consider J1,J2 being (Element of A()), a,b being Element of S(
) such that
A58: x2 = [J1\;J2, ConF(a,b)] and J1 in B|^i
and J2 in B|^i
and [J1,a] in g
and [J2,b] in g;
x = J1\;J2 by A58,XTUPLE_0:1;
hence thesis by A55,Th72;
end;
suppose x2 in IF(i,g);
then consider D,J1,J2 being (Element of A()),a,b,c being Element of
S() such that
A59: x2 = [if-then-else(D,J1,J2), IfF(a,b,c)] and D in B|^i
and J1 in B|^i
and J2 in B|^i
and [D,a] in g
and [J1,b] in g
and [J2,c] in g;
x = if-then-else(D,J1,J2) by A59,XTUPLE_0:1;
hence thesis by A55,Def24;
end;
suppose x2 in WF(i,g);
then consider D,J being (Element of A()),a,b being Element of S()
such that
A60: x2 = [while(D,J), WhiF(a,b)] and D in B|^i
and J in B|^i
and [D,a] in g
and [J,b] in g;
x = while(D,J) by A60,XTUPLE_0:1;
hence thesis by A55,Def24;
end;
end;
suppose x1 in CF(i,g);
then consider I1,I2 being (Element of A()), gI1,gI2 being Element of
S() such that
A61: x1 = [I1\;I2, ConF(gI1,gI2)] and I1 in B|^i
and I2 in B|^i and
A62: [I1,gI1] in g and
A63: [I2,gI2] in g;
A64: x = I1\;I2 by A61,XTUPLE_0:1;
A65: y1 = ConF(gI1,gI2) by A61,XTUPLE_0:1;
A66: g.I1 = gI1 by A62,FUNCT_1:1;
A67: g.I2 = gI2 by A63,FUNCT_1:1;
per cases by A27,A29;
suppose
A68: x2 in g;
then
A69: x in dom g by FUNCT_1:1;
y2 = g.x by A68,FUNCT_1:1;
hence thesis by A20,A64,A65,A66,A67,A69;
end;
suppose x2 in {[EmptyIns A(), Emp()]};
then x2 = [EmptyIns A(), Emp()] by TARSKI:def 1;
then x = EmptyIns A() by XTUPLE_0:1;
hence thesis by A64,Th72;
end;
suppose x2 in CF(i,g);
then consider J1,J2 being (Element of A()), a,b being Element of S(
) such that
A70: x2 = [J1\;J2, ConF(a,b)] and J1 in B|^i
and J2 in B|^i and
A71: [J1,a] in g and
A72: [J2,b] in g;
A73: x = J1\;J2 by A70,XTUPLE_0:1;
A74: y2 = ConF(a,b) by A70,XTUPLE_0:1;
A75: g.J1 = a by A71,FUNCT_1:1;
A76: g.J2 = b by A72,FUNCT_1:1;
I1 = J1 by A64,A73,Th73;
hence thesis by A64,A65,A66,A67,A73,A74,A75,A76,Th73;
end;
suppose x2 in IF(i,g);
then consider D,J1,J2 being (Element of A()),a,b,c being Element of
S() such that
A77: x2 = [if-then-else(D,J1,J2), IfF(a,b,c)] and D in B|^i
and J1 in B|^i
and J2 in B|^i
and [D,a] in g
and [J1,b] in g
and [J2,c] in g;
x = if-then-else(D,J1,J2) by A77,XTUPLE_0:1;
hence thesis by A64,Th73;
end;
suppose x2 in WF(i,g);
then consider D,J being (Element of A()),a,b being Element of S()
such that
A78: x2 = [while(D,J), WhiF(a,b)] and D in B|^i
and J in B|^i
and [D,a] in g
and [J,b] in g;
x = while(D,J) by A78,XTUPLE_0:1;
hence thesis by A64,Th73;
end;
end;
suppose x1 in IF(i,g);
then consider C,I1,I2 being (Element of A()), gC,gI1,gI2 being
Element of S() such that
A79: x1 = [if-then-else(C,I1,I2), IfF(gC,gI1,gI2)] and C in B|^i
and I1 in B|^i
and I2 in B|^i and
A80: [C,gC] in g and
A81: [I1,gI1] in g and
A82: [I2,gI2] in g;
A83: x = if-then-else(C,I1,I2) by A79,XTUPLE_0:1;
A84: y1 = IfF(gC,gI1,gI2) by A79,XTUPLE_0:1;
A85: g.I1 = gI1 by A81,FUNCT_1:1;
A86: g.I2 = gI2 by A82,FUNCT_1:1;
A87: g.C = gC by A80,FUNCT_1:1;
per cases by A27,A29;
suppose
A88: x2 in g;
then
A89: x in dom g by FUNCT_1:1;
y2 = g.x by A88,FUNCT_1:1;
hence thesis by A21,A83,A84,A85,A86,A87,A89;
end;
suppose x2 in {[EmptyIns A(), Emp()]};
then x2 = [EmptyIns A(), Emp()] by TARSKI:def 1;
then x = EmptyIns A() by XTUPLE_0:1;
hence thesis by A83,Th72;
end;
suppose x2 in CF(i,g);
then consider J1,J2 being (Element of A()),a,b being Element of S()
such that
A90: x2 = [J1\;J2, ConF(a,b)] and J1 in B|^i
and J2 in B|^i
and [J1,a] in g
and [J2,b] in g;
x = J1\;J2 by A90,XTUPLE_0:1;
hence thesis by A83,Th73;
end;
suppose x2 in IF(i,g);
then consider D,J1,J2 being (Element of A()),a,b,c being Element of
S() such that
A91: x2 = [if-then-else(D,J1,J2), IfF(a,b,c)] and D in B|^i
and J1 in B|^i
and J2 in B|^i and
A92: [D,a] in g and
A93: [J1,b] in g and
A94: [J2,c] in g;
A95: x = if-then-else(D,J1,J2) by A91,XTUPLE_0:1;
A96: y2 = IfF(a,b,c) by A91,XTUPLE_0:1;
A97: g.D = a by A92,FUNCT_1:1;
A98: g.J1 = b by A93,FUNCT_1:1;
A99: g.J2 = c by A94,FUNCT_1:1;
A100: C = D by A83,A95,Th74;
I1 = J1 by A83,A95,Th74;
hence thesis by A83,A84,A85,A86,A87,A95,A96,A97,A98,A99,A100,Th74;
end;
suppose x2 in WF(i,g);
then consider D,J being (Element of A()),a,b being Element of S()
such that
A101: x2 = [while(D,J), WhiF(a,b)] and D in B|^i
and J in B|^i
and [D,a] in g
and [J,b] in g;
x = while(D,J) by A101,XTUPLE_0:1;
hence thesis by A83,Th74;
end;
end;
suppose x1 in WF(i,g);
then consider C,I being (Element of A()), gC,gI being Element of S()
such that
A102: x1 = [while(C,I), WhiF(gC,gI)] and C in B|^i
and I in B|^i and
A103: [C,gC] in g and
A104: [I,gI] in g;
A105: x = while(C,I) by A102,XTUPLE_0:1;
A106: y1 = WhiF(gC,gI) by A102,XTUPLE_0:1;
A107: g.C = gC by A103,FUNCT_1:1;
A108: g.I = gI by A104,FUNCT_1:1;
per cases by A27,A29;
suppose
A109: x2 in g;
then
A110: x in dom g by FUNCT_1:1;
y2 = g.x by A109,FUNCT_1:1;
hence thesis by A22,A105,A106,A107,A108,A110;
end;
suppose x2 in {[EmptyIns A(), Emp()]};
then x2 = [EmptyIns A(), Emp()] by TARSKI:def 1;
then x = EmptyIns A() by XTUPLE_0:1;
hence thesis by A105,Th72;
end;
suppose x2 in CF(i,g);
then consider J1,J2 being (Element of A()),a,b being Element of S()
such that
A111: x2 = [J1\;J2, ConF(a,b)] and J1 in B|^i
and J2 in B|^i
and [J1,a] in g
and [J2,b] in g;
x = J1\;J2 by A111,XTUPLE_0:1;
hence thesis by A105,Th73;
end;
suppose x2 in IF(i,g);
then consider D,J1,J2 being (Element of A()), a,b,c being Element
of S() such that
A112: x2 = [if-then-else(D,J1,J2), IfF(a,b,c)] and D in B|^i
and J1 in B|^i
and J2 in B|^i
and [D,a] in g
and [J1,b] in g
and [J2,c] in g;
x = if-then-else(D,J1,J2) by A112,XTUPLE_0:1;
hence thesis by A105,Th74;
end;
suppose x2 in WF(i,g);
then consider D,J being (Element of A()),a,b being Element of S()
such that
A113: x2 = [while(D,J), WhiF(a,b)] and D in B|^i
and J in B|^i and
A114: [D,a] in g and
A115: [J,b] in g;
A116: x = while(D,J) by A113,XTUPLE_0:1;
A117: y2 = WhiF(a,b) by A113,XTUPLE_0:1;
A118: g.D = a by A114,FUNCT_1:1;
A119: g.J = b by A115,FUNCT_1:1;
D = C by A105,A116,Th75;
hence thesis by A105,A106,A107,A108,A116,A117,A118,A119,Th75;
end;
end;
end;
then reconsider h as Function;
A120: dom h = B|^(i+1)
proof
thus dom h c= B|^(i+1)
proof
let a be object;
set ah = [a,h.a];
assume a in dom h;
then
A121: [a,h.a] in h by FUNCT_1:def 2;
per cases by A27,A121;
suppose ah in g;
then a in dom g by FUNCT_1:1;
hence thesis by A26;
end;
suppose ah in {[EmptyIns A(), Emp()]};
then ah = [EmptyIns A(), Emp()] by TARSKI:def 1;
then a = EmptyIns A() by XTUPLE_0:1;
hence thesis by Th76;
end;
suppose ah in CF(i,g);
then consider I,J being (Element of A()),e,b being Element of S()
such that
A122: ah = [I\;J, ConF(e,b)] and
A123: I in B|^i and
A124: J in B|^i and [I,e] in g
and [J,b] in g;
a = I\;J by A122,XTUPLE_0:1;
hence thesis by A123,A124,Th76;
end;
suppose ah in IF(i,g);
then consider C,I,J being (Element of A()),e,b,c being Element of S
() such that
A125: ah = [if-then-else(C,I,J), IfF(e,b,c)] and
A126: C in B|^i and
A127: I in B|^i and
A128: J in B|^i and [C,e] in g
and [I,b] in g
and [J,c] in g;
a = if-then-else(C,I,J) by A125,XTUPLE_0:1;
hence thesis by A126,A127,A128,Th76;
end;
suppose ah in WF(i,g);
then consider I,J being (Element of A()),e,b being Element of S()
such that
A129: ah = [while(I,J), WhiF(e,b)] and
A130: I in B|^i and
A131: J in B|^i and [I,e] in g
and [J,b] in g;
a = while(I,J) by A129,XTUPLE_0:1;
hence thesis by A130,A131,Th76;
end;
end;
let x be object;
assume
A132: x in B|^(i+1);
per cases by A132,Th77;
suppose x in B|^i;
then [x,g.x] in g by A25,FUNCT_1:def 2;
then [x,g.x] in g \/ {[EmptyIns A(), Emp()]} by XBOOLE_0:def 3;
then [x,g.x] in g \/ {[EmptyIns A(), Emp()]} \/ CF(i,g)
by XBOOLE_0:def 3;
then [x,g.x] in g \/ {[EmptyIns A(), Emp()]} \/ CF(i,g) \/ IF(i,g)
by XBOOLE_0:def 3;
then [x,g.x] in h by A24,XBOOLE_0:def 3;
hence thesis by XTUPLE_0:def 12;
end;
suppose x = EmptyIns A();
then [x,Emp()] in {[EmptyIns A(), Emp()]} by TARSKI:def 1;
then [x,Emp()] in g \/ {[EmptyIns A(), Emp()]} by XBOOLE_0:def 3;
then [x,Emp()] in g \/ {[EmptyIns A(), Emp()]} \/ CF(i,g)
by XBOOLE_0:def 3;
then [x,Emp()] in g \/ {[EmptyIns A(), Emp()]} \/ CF(i,g) \/ IF(i,g)
by XBOOLE_0:def 3;
then [x,Emp()] in h by A24,XBOOLE_0:def 3;
hence thesis by XTUPLE_0:def 12;
end;
suppose ex I1,I2 being Element of A() st x = I1\;I2 &
I1 in B|^i & I2 in B|^i;
then consider I1,I2 being Element of A() such that
A133: x = I1\;I2 and
A134: I1 in B|^i and
A135: I2 in B|^i;
reconsider a = g.I1, b = g.I2 as Element of S() by A134,A135,FUNCT_2:5;
A136: [I1,a] in g by A25,A134,FUNCT_1:def 2;
[I2,b] in g by A25,A135,FUNCT_1:def 2;
then [x,ConF(a,b)] in CF(i,g) by A133,A134,A135,A136;
then [x,ConF(a,b)] in g \/ {[EmptyIns A(), Emp()]} \/ CF(i,g)
by XBOOLE_0:def 3;
then [x,ConF(a,b)] in g \/ {[EmptyIns A(), Emp()]} \/ CF(i,g) \/ IF(
i,g) by XBOOLE_0:def 3;
then [x,ConF(a,b)] in h by A24,XBOOLE_0:def 3;
hence thesis by XTUPLE_0:def 12;
end;
suppose
ex C,I1,I2 being Element of A() st x = if-then-else(C,I1,I2) &
C in B|^i & I1 in B|^i & I2 in B|^i;
then consider C,I1,I2 being Element of A() such that
A137: x = if-then-else(C,I1,I2) and
A138: C in B|^i and
A139: I1 in B|^i and
A140: I2 in B|^i;
reconsider a = g.I1, b = g.I2, c = g.C as Element of S()
by A138,A139,A140,FUNCT_2:5;
A141: [I1,a] in g by A25,A139,FUNCT_1:def 2;
A142: [I2,b] in g by A25,A140,FUNCT_1:def 2;
[C,c] in g by A25,A138,FUNCT_1:def 2;
then [x,IfF(c,a,b)] in IF(i,g) by A137,A138,A139,A140,A141,A142;
then [x,IfF(c,a,b)] in g \/ {[EmptyIns A(), Emp()]} \/ CF(i,g) \/ IF
(i,g) by XBOOLE_0:def 3;
then [x,IfF(c,a,b)] in h by A24,XBOOLE_0:def 3;
hence thesis by XTUPLE_0:def 12;
end;
suppose ex C,I being Element of A() st
x = while(C,I) & C in B|^i & I in B|^i;
then consider C,I being Element of A() such that
A143: x = while(C,I) and
A144: C in B|^i and
A145: I in B|^i;
reconsider a = g.C, b = g.I as Element of S() by A144,A145,FUNCT_2:5;
A146: [C,a] in g by A25,A144,FUNCT_1:def 2;
[I,b] in g by A25,A145,FUNCT_1:def 2;
then [x,WhiF(a,b)] in WF(i,g) by A143,A144,A145,A146;
then [x,WhiF(a,b)] in h by A24,XBOOLE_0:def 3;
hence thesis by XTUPLE_0:def 12;
end;
end;
rng h c= S()
proof
let a be object;
assume a in rng h;
then consider x being object such that
A147: [x,a] in h by XTUPLE_0:def 13;
set ah = [x,a];
per cases by A27,A147;
suppose ah in g;
hence thesis by ZFMISC_1:87;
end;
suppose ah in {[EmptyIns A(), Emp()]};
then ah = [EmptyIns A(), Emp()] by TARSKI:def 1;
then a = Emp() by XTUPLE_0:1;
hence thesis;
end;
suppose ah in CF(i,g);
then consider I,J being (Element of A()),e,b being Element of S() such
that
A148: ah = [I\;J, ConF(e,b)] and I in B|^i
and J in B|^i
and [I,e] in g
and [J,b] in g;
a = ConF(e,b) by A148,XTUPLE_0:1;
hence thesis;
end;
suppose ah in IF(i,g);
then consider C,I,J being (Element of A()),e,b,c being Element of S()
such that
A149: ah = [if-then-else(C,I,J), IfF(e,b,c)] and C in B|^i
and I in B|^i
and J in B|^i
and [C,e] in g
and [I,b] in g
and [J,c] in g;
a = IfF(e,b,c) by A149,XTUPLE_0:1;
hence thesis;
end;
suppose ah in WF(i,g);
then consider I,J being (Element of A()),e,b being Element of S() such
that
A150: ah = [while(I,J), WhiF(e,b)] and I in B|^i
and J in B|^i
and [I,e] in g
and [J,b] in g;
a = WhiF(e,b) by A150,XTUPLE_0:1;
hence thesis;
end;
end;
then reconsider h as Function of B|^(i+1), S() by A120,FUNCT_2:2;
h = g\/{[EmptyIns A(), Emp()]}\/CF(i,g)\/(IF(i,g)\/WF(i,g))
by A24,XBOOLE_1:4
.= g\/{[EmptyIns A(), Emp()]}\/(CF(i,g)\/(IF(i,g)\/WF(i,g)))
by XBOOLE_1:4
.= g\/({[EmptyIns A(), Emp()]}\/(CF(i,g)\/(IF(i,g)\/WF(i,g))))
by XBOOLE_1:4;
then
A151: g c= h by XBOOLE_1:7;
take h;
thus h = FF.(i+1);
hereby
set x = EmptyIns A();
assume x in B|^(i+1);
[x,Emp()] in {[EmptyIns A(), Emp()]} by TARSKI:def 1;
then [x,Emp()] in g \/ {[EmptyIns A(), Emp()]} by XBOOLE_0:def 3;
then [x,Emp()] in g \/ {[EmptyIns A(), Emp()]} \/ CF(i,g)
by XBOOLE_0:def 3;
then [x,Emp()] in g \/ {[EmptyIns A(), Emp()]} \/ CF(i,g) \/ IF(i,g)
by XBOOLE_0:def 3;
then [x,Emp()] in h by A24,XBOOLE_0:def 3;
hence h.EmptyIns A() = Emp() by FUNCT_1:1;
end;
hereby
let I1,I2 be Element of A();
set x = I1\;I2;
set y = ConF(h.I1,h.I2);
assume I1\;I2 in B|^(i+1);
then
A152: ex i0 being Nat st ( i+1 = i0+1)&( I1 in B|^i0)&( I2 in B|^ i0) by Th88;
then reconsider gI1 = g.I1, gI2 = g.I2 as Element of S() by FUNCT_2:5;
A153: [I1,gI1] in g by A25,A152,FUNCT_1:def 2;
A154: [I2,gI2] in g by A25,A152,FUNCT_1:def 2;
A155: g.I1 = h.I1 by A151,A153,FUNCT_1:1;
g.I2 = h.I2 by A151,A154,FUNCT_1:1;
then [x,y] in CF(i,g) by A152,A153,A154,A155;
then [x,y] in g \/ {[EmptyIns A(), Emp()]} \/ CF(i,g) by XBOOLE_0:def 3;
then [x,y] in g \/ {[EmptyIns A(), Emp()]} \/ CF(i,g) \/ IF(i,g)
by XBOOLE_0:def 3;
then [x,y] in h by A24,XBOOLE_0:def 3;
hence h.(I1\;I2) = ConF(h.I1,h.I2) by FUNCT_1:1;
end;
hereby
let C,I1,I2 be Element of A();
set x = if-then-else(C,I1,I2);
set y = IfF(h.C,h.I1,h.I2);
assume if-then-else(C,I1,I2) in B|^(i+1);
then
A156: ex i0 being Nat st ( i+1 = i0+1)&( C in B|^i0)&( I1 in B|^
i0)&( I2 in B|^i0) by Th89;
then reconsider gC = g.C, gI1 = g.I1, gI2 = g.I2 as Element of S()
by FUNCT_2:5;
A157: [C,gC] in g by A25,A156,FUNCT_1:def 2;
A158: [I1,gI1] in g by A25,A156,FUNCT_1:def 2;
A159: [I2,gI2] in g by A25,A156,FUNCT_1:def 2;
A160: g.C = h.C by A151,A157,FUNCT_1:1;
A161: g.I1 = h.I1 by A151,A158,FUNCT_1:1;
g.I2 = h.I2 by A151,A159,FUNCT_1:1;
then [x,y] in IF(i,g) by A156,A157,A158,A159,A160,A161;
then [x,y] in g \/ {[EmptyIns A(), Emp()]} \/ CF(i,g) \/ IF(i,g)
by XBOOLE_0:def 3;
then [x,y] in h by A24,XBOOLE_0:def 3;
hence h.if-then-else(C,I1,I2) = IfF(h.C,h.I1,h.I2) by FUNCT_1:1;
end;
let C,I be Element of A();
set x = while(C,I);
set y = WhiF(h.C,h.I);
assume while(C,I) in B|^(i+1);
then
A162: ex i0 being Nat st ( i+1 = i0+1)&( C in B|^i0)&( I in B|^i0 ) by Th90;
then reconsider gC = g.C, gI = g.I as Element of S() by FUNCT_2:5;
A163: [C,gC] in g by A25,A162,FUNCT_1:def 2;
A164: [I,gI] in g by A25,A162,FUNCT_1:def 2;
A165: g.C = h.C by A151,A163,FUNCT_1:1;
g.I = h.I by A151,A164,FUNCT_1:1;
then [x,y] in WF(i,g) by A162,A163,A164,A165;
then [x,y] in h by A24,XBOOLE_0:def 3;
hence thesis by FUNCT_1:1;
end;
A166: for i being Nat holds P[i] from NAT_1:sch 2(A15,A17);
f is Relation-like Function-like
proof
hereby
let x be object;
assume x in f;
then consider n being object such that
A167: n in dom FF and
A168: x in FF.n by CARD_5:2;
reconsider n as Element of NAT by A3,A167;
P[n] by A166;
hence ex a,b being object st x = [a,b] by A168,RELAT_1:def 1;
end;
let x,y1,y2 be object;
assume [x,y1] in f;
then consider n1 being object such that
A169: n1 in dom FF and
A170: [x,y1] in FF.n1 by CARD_5:2;
assume [x,y2] in f;
then consider n2 being object such that
A171: n2 in dom FF and
A172: [x,y2] in FF.n2 by CARD_5:2;
reconsider n1,n2 as Element of NAT by A3,A169,A171;
n1 <= n2 or n2 <= n1;
then FF.n1 c= FF.n2 or FF.n2 c= FF.n1 by A5;
then [x,y1] in FF.n2 & P[n2] or [x,y2] in FF.n1 & P[n1] by A166,A170,A172;
hence thesis by A170,A172,FUNCT_1:def 1;
end;
then reconsider f as Function;
A173: dom f = the carrier of A()
proof
thus dom f c= the carrier of A()
proof
let x be object;
assume x in dom f;
then [x,f.x] in f by FUNCT_1:def 2;
then consider n being object such that
A174: n in dom FF and
A175: [x,f.x] in FF.n by CARD_5:2;
reconsider n as Element of NAT by A3,A174;
P[n] by A166;
then x in B|^n by A175,ZFMISC_1:87;
hence thesis;
end;
let x be object;
assume x in the carrier of A();
then reconsider I = x as Element of A();
consider n being Nat such that
A176: I in B|^n by Th79;
reconsider n as Element of NAT by ORDINAL1:def 12;
P[n] by A166;
then reconsider g = FF.n as Function of B|^n, S();
dom g = B|^n by FUNCT_2:def 1;
then [I,g.I] in g by A176,FUNCT_1:def 2;
then [I,g.I] in f by A3,CARD_5:2;
hence thesis by XTUPLE_0:def 12;
end;
rng f c= S()
proof
let b be object;
assume b in rng f;
then consider a being object such that
A177: a in dom f and
A178: b = f.a by FUNCT_1:def 3;
reconsider a as Element of A() by A173,A177;
consider n being Nat such that
A179: a in B|^n by Th79;
reconsider n as Element of NAT by ORDINAL1:def 12;
P[n] by A166;
then reconsider g = FF.n as Function of B|^n, S();
A180: dom g = B|^n by FUNCT_2:def 1;
then [a,g.a] in g by A179,FUNCT_1:def 2;
then [a,g.a] in f by A3,CARD_5:2;
then
A181: b = g.a by A178,FUNCT_1:1;
g.a in rng g by A179,A180,FUNCT_1:3;
hence thesis by A181;
end;
then reconsider f as Function of the carrier of A(), S() by A173,FUNCT_2:2;
take f;
hereby
let I be Element of A();
assume I in ElementaryInstructions A();
then [I,ElemF(I)] in FF.0 by A3;
then [I,ElemF(I)] in f by A3,CARD_5:2;
hence f.I = ElemF(I) by FUNCT_1:1;
end;
A182: now
let n be Nat;
let I be Element of A();
let g be Function of B|^n, S();
assume that
A183: I in B|^n and
A184: g = FF.n;
dom g = B|^n by FUNCT_2:def 1;
then
A185: [I,g.I] in g by A183,FUNCT_1:def 2;
n in NAT by ORDINAL1:def 12;
then [I,g.I] in f by A3,A184,A185,CARD_5:2;
hence g.I = f.I by FUNCT_1:1;
end;
consider n0 being Nat such that
A186: EmptyIns A() in B|^n0 by Th79;
reconsider n0 as Element of NAT by ORDINAL1:def 12;
consider g0 being Function of B|^n0, S() such that
A187: g0 = FF.n0 and
A188: EmptyIns A() in B|^n0 implies g0.EmptyIns A() = Emp() and
for I1,I2 being Element of A() st I1\;I2 in B|^n0 holds g0.(I1\;I2) =
ConF(g0.I1,g0.I2)
and for C,I1,I2 being Element of A() st if-then-else(C,I1,I2) in B|^
n0 holds g0.if-then-else(C,I1,I2) = IfF(g0.C,g0.I1,g0.I2)
and for C,I being Element of A() st while(C,I) in B|^n0 holds g0.while
(C,I) = WhiF(g0.C,g0.I)
by A166;
dom g0 = B|^n0 by FUNCT_2:def 1;
then [EmptyIns A(), Emp()] in g0 by A186,A188,FUNCT_1:def 2;
then [EmptyIns A(), Emp()] in f by A3,A187,CARD_5:2;
hence f.EmptyIns A() = Emp() by FUNCT_1:1;
hereby
let I1,I2 be Element of A();
consider n0 being Nat such that
A189: I1\;I2 in B|^n0 by Th79;
reconsider n0 as Element of NAT by ORDINAL1:def 12;
consider g0 being Function of B|^n0, S() such that
A190: g0 = FF.n0 and
EmptyIns A() in B|^n0 implies g0.EmptyIns A() = Emp() and
A191: for I1,I2 being Element of A() st I1\;I2 in B|^n0
holds g0.(I1\;I2) = ConF(g0.I1,g0.I2) and
for C,I1,I2 being Element of A() st if-then-else(C,I1,I2) in B|^n0
holds g0.if-then-else(C,I1,I2) = IfF(g0.C,g0.I1,g0.I2)
and for C,I being Element of A() st while(C,I) in B|^n0 holds g0.while
(C,I) = WhiF(g0.C,g0.I)
by A166;
consider i0 being Nat such that
A192: n0 = i0+1 and
A193: I1 in B|^i0 and
A194: I2 in B|^i0 by A189,Th88;
n0 > i0 by A192,NAT_1:13;
then
A195: B|^i0 c= B|^n0 by Th21;
A196: dom g0 = B|^n0 by FUNCT_2:def 1;
A197: g0.I1 = f.I1 by A182,A190,A193,A195;
A198: g0.I2 = f.I2 by A182,A190,A194,A195;
A199: [I1\;I2, g0.(I1\;I2)] in g0 by A189,A196,FUNCT_1:1;
g0.(I1\;I2) = ConF(f.I1,f.I2) by A189,A191,A197,A198;
then [I1\;I2, ConF(f.I1,f.I2)] in f by A3,A190,A199,CARD_5:2;
hence f.(I1\;I2) = ConF(f.I1,f.I2) by FUNCT_1:1;
end;
hereby
let C,I1,I2 be Element of A();
set IF = if-then-else(C,I1,I2);
consider n0 being Nat such that
A200: IF in B|^n0 by Th79;
reconsider n0 as Element of NAT by ORDINAL1:def 12;
consider g0 being Function of B|^n0, S() such that
A201: g0 = FF.n0 and
EmptyIns A() in B|^n0 implies g0.EmptyIns A() = Emp() and
for I1,I2 being Element of A() st I1\;I2 in B|^n0
holds g0.(I1\;I2) = ConF(g0.I1,g0.I2) and
A202: for C,I1,I2 being Element of A() st if-then-else(C,I1,I2) in B|^n0
holds g0.if-then-else(C,I1,I2) = IfF(g0.C,g0.I1,g0.I2) and
for C,I being Element of A() st while(C,I) in B|^n0
holds g0.while(C,I) = WhiF(g0.C,g0.I) by A166;
consider i0 being Nat such that
A203: n0 = i0+1 and
A204: C in B|^i0 and
A205: I1 in B|^i0 and
A206: I2 in B|^i0 by A200,Th89;
n0 > i0 by A203,NAT_1:13;
then
A207: B|^i0 c= B|^n0 by Th21;
A208: dom g0 = B|^n0 by FUNCT_2:def 1;
A209: g0.C = f.C by A182,A201,A204,A207;
A210: g0.I1 = f.I1 by A182,A201,A205,A207;
A211: g0.I2 = f.I2 by A182,A201,A206,A207;
A212: [IF, g0.IF] in g0 by A200,A208,FUNCT_1:1;
g0.IF = IfF(f.C,f.I1,f.I2) by A200,A202,A209,A210,A211;
then [IF, IfF(f.C,f.I1,f.I2)] in f by A3,A201,A212,CARD_5:2;
hence f.if-then-else(C,I1,I2) = IfF(f.C,f.I1,f.I2) by FUNCT_1:1;
end;
let C,I be Element of A();
set WH = while(C,I);
consider n0 being Nat such that
A213: WH in B|^n0 by Th79;
reconsider n0 as Element of NAT by ORDINAL1:def 12;
consider g0 being Function of B|^n0, S() such that
A214: g0 = FF.n0 and
EmptyIns A() in B|^n0 implies g0.EmptyIns A() = Emp() and
for I1,I2 being Element of A() st I1\;I2 in B|^n0
holds g0.(I1\;I2) = ConF(g0.I1,g0.I2) and
for C,I1,I2 being Element of A() st if-then-else(C,I1,I2) in B|^n0
holds g0.if-then-else(C,I1,I2) = IfF(g0.C,g0.I1,g0.I2) and
A215: for C,I being Element of A() st while(C,I) in B|^n0
holds g0.while(C,I) = WhiF(g0.C,g0.I) by A166;
consider i0 being Nat such that
A216: n0 = i0+1 and
A217: C in B|^i0 and
A218: I in B|^i0 by A213,Th90;
n0 > i0 by A216,NAT_1:13;
then
A219: B|^i0 c= B|^n0 by Th21;
A220: dom g0 = B|^n0 by FUNCT_2:def 1;
A221: g0.C = f.C by A182,A214,A217,A219;
A222: g0.I = f.I by A182,A214,A218,A219;
A223: [WH, g0.WH] in g0 by A213,A220,FUNCT_1:1;
g0.WH = WhiF(f.C,f.I) by A213,A215,A221,A222;
then [WH, WhiF(f.C,f.I)] in f by A3,A214,A223,CARD_5:2;
hence thesis by FUNCT_1:1;
end;
theorem
for A being free ECIW-strict preIfWhileAlgebra
for g being Function of [:S, ElementaryInstructions A:], S
for s0 being Element of S ex f being ExecutionFunction of A, S, T
st f|[:S, ElementaryInstructions A:] = g & for s being Element of S
for C,I being Element of A st not f iteration_terminates_for I\;C, f.(s,C)
holds f.(s, while(C,I)) = s0
proof
let A be free ECIW-strict preIfWhileAlgebra;
let g be Function of [:S, ElementaryInstructions A:], S;
let s0 be Element of S;
reconsider Ss0 = S-->s0 as Element of Funcs(S,S) by FUNCT_2:9;
set Z = Funcs(S,S);
deffunc ElemF(Element of A) = (curry' g).$1;
A1: for I being Element of A st I in ElementaryInstructions A
holds ElemF(I) in Z
proof
let I be Element of A;
assume
A2: I in ElementaryInstructions A;
then reconsider B = ElementaryInstructions A as non empty set;
reconsider I as Element of B by A2;
reconsider g as Function of [:S,B:],S;
(curry' g).I is Element of Z;
hence thesis;
end;
reconsider idS = id S as Element of Z by FUNCT_2:126;
deffunc ConF((Element of Z), Element of Z) = $2*$1 qua Element of Z;
deffunc IfF((Element of Z), (Element of Z), Element of Z)
= (($2,T)+*$3)*$1 qua Element of Z;
deffunc WhiF((Element of Z), Element of Z)
= ((T,Ss0) iter ($1*$2))*$1 qua Element of Z;
consider h being Function of the carrier of A, Z such that
A3: for I being Element of A st I in ElementaryInstructions A
holds h.I = ElemF(I) and
A4: h.EmptyIns A = idS and
A5: for I1,I2 being Element of A holds h.(I1\;I2) = ConF(h.I1,h.I2) and
A6: for C,I1,I2 being Element of A
holds h.if-then-else(C,I1,I2) = IfF(h.C,h.I1,h.I2) and
A7: for C,I being Element of A holds h.while(C,I) = WhiF(h.C,h.I)
from IndDef(A1);
h in Funcs(the carrier of A, Z) by FUNCT_2:8;
then uncurry' h in Funcs([:S, the carrier of A:], S) by FUNCT_6:11;
then reconsider f = uncurry' h as Function of [:S, the carrier of A:], S
by FUNCT_2:66;
A8: dom h = the carrier of A by FUNCT_2:def 1;
A9: f is complying_with_empty-instruction
proof
let s be Element of S;
idS.s = s;
hence thesis by A4,A8,FUNCT_5:39;
end;
A10: f is complying_with_catenation
proof
let s be Element of S;
let I1,I2 be Element of A;
A11: dom (h.(I1\;I2)) = S by FUNCT_2:def 1;
A12: dom (h.I1) = S by FUNCT_2:def 1;
A13: dom (h.I2) = S by FUNCT_2:def 1;
thus f.(s,I1 \; I2) = (h.(I1\;I2)).s by A8,A11,FUNCT_5:39
.= ((h.I2)*(h.I1)).s by A5
.= (h.I2).((h.I1).s) by FUNCT_2:15
.= (h.I2).(f.(s,I1)) by A8,A12,FUNCT_5:39
.= f.(f.(s,I1),I2) by A8,A13,FUNCT_5:39;
end;
A14: f complies_with_if_wrt T
proof
let s be Element of S;
let C, I1,I2 be Element of A;
A15: dom (h.if-then-else(C,I1,I2)) = S by FUNCT_2:def 1;
A16: dom (h.C) = S by FUNCT_2:def 1;
A17: dom (h.I1) = S by FUNCT_2:def 1;
A18: dom (h.I2) = S by FUNCT_2:def 1;
A19: f.(s,if-then-else(C,I1,I2))
= (h.if-then-else(C,I1,I2)).s by A8,A15,FUNCT_5:39
.= IfF(h.C,h.I1,h.I2).s by A6
.= ((h.I1,T)+*(h.I2)).((h.C).s) by FUNCT_2:15;
A20: f.(s,C) = (h.C).s by A8,A16,FUNCT_5:39;
hereby
assume f.(s,C) in T;
hence f.(s,if-then-else(C,I1,I2)) = (h.I1).(f.(s,C)) by A17,A19,A20,Th4
.= f.(f.(s,C),I1) by A8,A17,FUNCT_5:39;
end;
assume f.(s,C) nin T;
hence f.(s,if-then-else(C,I1,I2)) = (h.I2).(f.(s,C)) by A18,A19,A20,Th5
.= f.(f.(s,C),I2) by A8,A18,FUNCT_5:39;
end;
f complies_with_while_wrt T
proof
let s be Element of S;
let C, I be Element of A;
A21: dom (h.while(C,I)) = S by FUNCT_2:def 1;
A22: dom (h.C) = S by FUNCT_2:def 1;
A23: dom (h.I) = S by FUNCT_2:def 1;
A24: dom ((h.C)*(h.I)) = S by FUNCT_2:def 1;
A25: f.(s,while(C,I)) = (h.while(C,I)).s by A8,A21,FUNCT_5:39
.= WhiF(h.C,h.I).s by A7
.= ((T,Ss0) iter ((h.C)*(h.I))).((h.C).s) by FUNCT_2:15;
A26: f.(s,C) = (h.C).s by A8,A22,FUNCT_5:39;
A27: rng ((h.C)*(h.I)) c= S;
A28: now
let z be Element of S;
thus (Ss0*((h.C)*(h.I))).z = Ss0.(((h.C)*(h.I)).z) by FUNCT_2:15
.= s0 by FUNCOP_1:7
.= Ss0.z by FUNCOP_1:7;
end;
hereby
assume f.(s,C) in T;
hence f.(s,while(C,I))
= ((T,Ss0) iter ((h.C)*(h.I))).(((h.C)*(h.I)).(f.(s,C)))
by A24,A25,A26,A27,A28,Th11,FUNCT_2:63
.= ((T,Ss0) iter ((h.C)*(h.I))).((h.C).((h.I).(f.(s,C))))
by FUNCT_2:15
.= (((T,Ss0) iter ((h.C)*(h.I)))*(h.C)).((h.I).(f.(s,C)))
by FUNCT_2:15
.= (((T,Ss0) iter ((h.C)*(h.I)))*(h.C)).(f.(f.(s,C),I))
by A8,A23,FUNCT_5:39
.= (h.while(C,I)).(f.(f.(s,C),I)) by A7
.= f.(f.(f.(s,C),I),while(C,I)) by A8,A21,FUNCT_5:39;
end;
thus thesis by A24,A25,A26,A27,Th12;
end;
then reconsider f as ExecutionFunction of A, S, T by A9,A10,A14,Def32;
take f;
dom f = [:S, the carrier of A:] by FUNCT_2:def 1;
then
A29: [:S, ElementaryInstructions A:] c= dom f by ZFMISC_1:95;
A30: dom g = [:S, ElementaryInstructions A:] by FUNCT_2:def 1;
A31: dom f /\ [:S, ElementaryInstructions A:] = [:S, ElementaryInstructions
A:] by A29,XBOOLE_1:28;
now
let a be object;
assume
A32: a in dom g;
then consider s,I being object such that
A33: s in S and
A34: I in ElementaryInstructions A and
A35: a = [s,I] by ZFMISC_1:def 2;
reconsider s as Element of S by A33;
reconsider I as Element of A by A34;
reconsider EI = (curry' g).I as Element of Z by A1,A34;
g in Funcs([:S, ElementaryInstructions A:], S) by FUNCT_2:8;
then curry' g in Funcs(ElementaryInstructions A, Z) by A32,FUNCT_6:10;
then
A36: dom curry' g = ElementaryInstructions A by FUNCT_2:92;
A37: dom EI = S by FUNCT_2:92;
A38: dom (h.I) = S by FUNCT_2:92;
thus g.a = g.(s,I) by A35
.= EI.s by A34,A36,A37,FUNCT_5:34
.= (h.I).s by A3,A34
.= f.(s,I) by A8,A38,FUNCT_5:39
.= f.a by A35;
end;
hence f|[:S, ElementaryInstructions A:] = g by A30,A31,FUNCT_1:46;
let s be Element of S;
let C,I be Element of A;
assume
A39: not f iteration_terminates_for I\;C, f.(s,C);
A40: dom (h.while(C,I)) = S by FUNCT_2:def 1;
A41: dom (h.C) = S by FUNCT_2:def 1;
A42: dom ((h.C)*(h.I)) = S by FUNCT_2:def 1;
A43: f.(s,while(C,I)) = (h.while(C,I)).s by A8,A40,FUNCT_5:39
.= WhiF(h.C,h.I).s by A7
.= ((T,Ss0) iter ((h.C)*(h.I))).((h.C).s) by FUNCT_2:15;
A44: f.(s,C) = (h.C).s by A8,A41,FUNCT_5:39;
A45: rng ((h.C)*(h.I)) c= S;
rng h c= Z;
then h = curry' f by FUNCT_5:48;
then (curry' f).(I\;C) = (h.C)*(h.I) by A5;
then (h.C)*(h.I) orbit f.(s,C) c= T by A39,Th87;
hence f.(s, while(C,I)) = Ss0.(f.(s,C)) by A42,A43,A44,A45,Def7
.= s0 by FUNCOP_1:7;
end;
theorem
for A being free ECIW-strict preIfWhileAlgebra
for g being Function of [:S, ElementaryInstructions A:], S
for F being Function of Funcs(S,S), Funcs(S,S)
st for h being Element of Funcs(S,S) holds (F.h)*h = F.h
ex f being ExecutionFunction of A, S, T
st f|[:S, ElementaryInstructions A:] = g & for C,I being Element of A
for s being Element of S st not f iteration_terminates_for I\;C, f.(s, C)
holds f.(s, while(C, I)) = F.((curry' f).(I\;C)).(f.(s,C))
proof
let A be free ECIW-strict preIfWhileAlgebra;
let g be Function of [:S, ElementaryInstructions A:], S;
let F being Function of Funcs(S,S), Funcs(S,S) such that
A1: for h being Element of Funcs(S,S) holds (F.h)*h = F.h;
set Z = Funcs(S,S);
deffunc ElemF(Element of A) = (curry' g).$1;
A2: for I being Element of A st I in ElementaryInstructions A
holds ElemF(I) in Z
proof
let I be Element of A;
assume
A3: I in ElementaryInstructions A;
then reconsider B = ElementaryInstructions A as non empty set;
reconsider I as Element of B by A3;
reconsider g as Function of [:S,B:],S;
(curry' g).I is Element of Z;
hence thesis;
end;
reconsider idS = id S as Element of Z by FUNCT_2:126;
deffunc ConF((Element of Z), Element of Z) = $2*$1 qua Element of Z;
deffunc IfF((Element of Z), (Element of Z), Element of Z)
= (($2,T)+*$3)*$1 qua Element of Z;
deffunc WhiF((Element of Z), Element of Z)
= ((T, F.($1*$2)) iter ($1*$2))*$1 qua Element of Z;
consider h being Function of the carrier of A, Z such that
A4: for I being Element of A st I in ElementaryInstructions A
holds h.I = ElemF(I) and
A5: h.EmptyIns A = idS and
A6: for I1,I2 being Element of A holds h.(I1\;I2) = ConF(h.I1,h.I2) and
A7: for C,I1,I2 being Element of A
holds h.if-then-else(C,I1,I2) = IfF(h.C,h.I1,h.I2) and
A8: for C,I being Element of A holds h.while(C,I) = WhiF(h.C,h.I)
from IndDef(A2);
h in Funcs(the carrier of A, Z) by FUNCT_2:8;
then uncurry' h in Funcs([:S, the carrier of A:], S) by FUNCT_6:11;
then reconsider f = uncurry' h as Function of [:S, the carrier of A:], S
by FUNCT_2:66;
A9: dom h = the carrier of A by FUNCT_2:def 1;
A10: f is complying_with_empty-instruction
proof
let s be Element of S;
idS.s = s;
hence thesis by A5,A9,FUNCT_5:39;
end;
A11: f is complying_with_catenation
proof
let s be Element of S;
let I1,I2 be Element of A;
A12: dom (h.(I1\;I2)) = S by FUNCT_2:def 1;
A13: dom (h.I1) = S by FUNCT_2:def 1;
A14: dom (h.I2) = S by FUNCT_2:def 1;
thus f.(s,I1 \; I2) = (h.(I1\;I2)).s by A9,A12,FUNCT_5:39
.= ((h.I2)*(h.I1)).s by A6
.= (h.I2).((h.I1).s) by FUNCT_2:15
.= (h.I2).(f.(s,I1)) by A9,A13,FUNCT_5:39
.= f.(f.(s,I1),I2) by A9,A14,FUNCT_5:39;
end;
A15: f complies_with_if_wrt T
proof
let s be Element of S;
let C, I1,I2 be Element of A;
A16: dom (h.if-then-else(C,I1,I2)) = S by FUNCT_2:def 1;
A17: dom (h.C) = S by FUNCT_2:def 1;
A18: dom (h.I1) = S by FUNCT_2:def 1;
A19: dom (h.I2) = S by FUNCT_2:def 1;
A20: f.(s,if-then-else(C,I1,I2))
= (h.if-then-else(C,I1,I2)).s by A9,A16,FUNCT_5:39
.= IfF(h.C,h.I1,h.I2).s by A7
.= ((h.I1,T)+*(h.I2)).((h.C).s) by FUNCT_2:15;
A21: f.(s,C) = (h.C).s by A9,A17,FUNCT_5:39;
hereby
assume f.(s,C) in T;
hence f.(s,if-then-else(C,I1,I2)) = (h.I1).(f.(s,C)) by A18,A20,A21,Th4
.= f.(f.(s,C),I1) by A9,A18,FUNCT_5:39;
end;
assume f.(s,C) nin T;
hence f.(s,if-then-else(C,I1,I2)) = (h.I2).(f.(s,C)) by A19,A20,A21,Th5
.= f.(f.(s,C),I2) by A9,A19,FUNCT_5:39;
end;
f complies_with_while_wrt T
proof
let s be Element of S;
let C, I be Element of A;
A22: dom (h.while(C,I)) = S by FUNCT_2:def 1;
A23: dom (h.C) = S by FUNCT_2:def 1;
A24: dom (h.I) = S by FUNCT_2:def 1;
A25: dom ((h.C)*(h.I)) = S by FUNCT_2:def 1;
A26: f.(s,while(C,I)) = (h.while(C,I)).s by A9,A22,FUNCT_5:39
.= WhiF(h.C,h.I).s by A8
.= ((T,F.((h.C)*(h.I))) iter ((h.C)*(h.I))).((h.C).s) by FUNCT_2:15;
A27: f.(s,C) = (h.C).s by A9,A23,FUNCT_5:39;
A28: rng ((h.C)*(h.I)) c= S;
A29: (F.((h.C)*(h.I)))*((h.C)*(h.I)) = F.((h.C)*(h.I)) by A1;
hereby
assume f.(s,C) in T;
hence f.(s,while(C,I))
= ((T,F.((h.C)*(h.I))) iter ((h.C)*(h.I))).(((h.C)*(h.I)).(f.(s,C)))
by A25,A26,A27,A28,A29,Th11
.= ((T,F.((h.C)*(h.I))) iter ((h.C)*(h.I))).((h.C).((h.I).(f.(s,C))))
by FUNCT_2:15
.= (((T,F.((h.C)*(h.I))) iter ((h.C)*(h.I)))*(h.C)).((h.I).(f.(s,C)))
by FUNCT_2:15
.= (((T,F.((h.C)*(h.I))) iter ((h.C)*(h.I)))*(h.C)).(f.(f.(s,C),I))
by A9,A24,FUNCT_5:39
.= (h.while(C,I)).(f.(f.(s,C),I)) by A8
.= f.(f.(f.(s,C),I),while(C,I)) by A9,A22,FUNCT_5:39;
end;
thus thesis by A25,A26,A27,A28,Th12;
end;
then reconsider f as ExecutionFunction of A, S, T by A10,A11,A15,Def32;
take f;
dom f = [:S, the carrier of A:] by FUNCT_2:def 1;
then
A30: [:S, ElementaryInstructions A:] c= dom f by ZFMISC_1:95;
A31: dom g = [:S, ElementaryInstructions A:] by FUNCT_2:def 1;
A32: dom f /\ [:S, ElementaryInstructions A:] = [:S, ElementaryInstructions
A:] by A30,XBOOLE_1:28;
now
let a be object;
assume
A33: a in dom g;
then consider s,I being object such that
A34: s in S and
A35: I in ElementaryInstructions A and
A36: a = [s,I] by ZFMISC_1:def 2;
reconsider s as Element of S by A34;
reconsider I as Element of A by A35;
reconsider EI = (curry' g).I as Element of Z by A2,A35;
g in Funcs([:S, ElementaryInstructions A:], S) by FUNCT_2:8;
then curry' g in Funcs(ElementaryInstructions A, Z) by A33,FUNCT_6:10;
then
A37: dom curry' g = ElementaryInstructions A by FUNCT_2:92;
A38: dom EI = S by FUNCT_2:92;
A39: dom (h.I) = S by FUNCT_2:92;
thus g.a = g.(s,I) by A36
.= EI.s by A35,A37,A38,FUNCT_5:34
.= (h.I).s by A4,A35
.= f.(s,I) by A9,A39,FUNCT_5:39
.= f.a by A36;
end;
hence f|[:S, ElementaryInstructions A:] = g by A31,A32,FUNCT_1:46;
let C,I be Element of A;
let s be Element of S;
assume
A40: not f iteration_terminates_for I\;C, f.(s,C);
A41: dom (h.while(C,I)) = S by FUNCT_2:def 1;
A42: dom (h.C) = S by FUNCT_2:def 1;
A43: dom ((h.C)*(h.I)) = S by FUNCT_2:def 1;
A44: f.(s,while(C,I)) = (h.while(C,I)).s by A9,A41,FUNCT_5:39
.= WhiF(h.C,h.I).s by A8
.= ((T,F.((h.C)*(h.I))) iter ((h.C)*(h.I))).((h.C).s) by FUNCT_2:15;
A45: f.(s,C) = (h.C).s by A9,A42,FUNCT_5:39;
A46: rng ((h.C)*(h.I)) c= S;
rng h c= Z;
then h = curry' f by FUNCT_5:48;
then
A47: (curry' f).(I\;C) = (h.C)*(h.I) by A6;
then (h.C)*(h.I) orbit f.(s,C) c= T by A40,Th87;
hence thesis by A43,A44,A45,A46,A47,Def7;
end;
theorem
for A being free ECIW-strict preIfWhileAlgebra
for f1,f2 being ExecutionFunction of A, S, T
st f1|[:S, ElementaryInstructions A:] = f2|[:S, ElementaryInstructions A:] &
for s being Element of S for C,I being Element of A
st not f1 iteration_terminates_for I\;C, f1.(s,C)
holds f1.(s, while(C,I)) = f2.(s, while(C,I)) holds f1 = f2
proof
let A be free ECIW-strict preIfWhileAlgebra;
let f1,f2 be ExecutionFunction of A, S, T;
assume
A1: f1|[:S, ElementaryInstructions A:] = f2|[:S, ElementaryInstructions A:];
set g = f1|[:S, ElementaryInstructions A:];
assume
A2: for s being Element of S for C,I being Element of A
st not f1 iteration_terminates_for I\;C, f1.(s,C)
holds f1.(s, while(C,I)) = f2.(s, while(C,I));
defpred P[set] means for s being Element of S holds f1.(s, $1) = f2.(s, $1);
A3: for I being Element of A st I in ElementaryInstructions A holds P[I]
proof
let I be Element of A such that
A4: I in ElementaryInstructions A;
let s be Element of S;
A5: [s,I] in [:S, ElementaryInstructions A:] by A4,ZFMISC_1:87;
hence f1.(s,I) = g.[s,I] by FUNCT_1:49
.= f2.(s,I) by A1,A5,FUNCT_1:49;
end;
A6: P[EmptyIns A]
proof
let s be Element of S;
thus f1.(s, EmptyIns A) = s by Def28
.= f2.(s, EmptyIns A) by Def28;
end;
A7: for I1,I2 being Element of A st P[I1] & P[I2] holds P[I1\;I2]
proof
let I1,I2 be Element of A such that
A8: P[I1] and
A9: P[I2];
let s be Element of S;
thus f1.(s, I1\;I2) = f1.(f1.(s, I1), I2) by Def29
.= f1.(f2.(s, I1), I2) by A8
.= f2.(f2.(s, I1), I2) by A9
.= f2.(s, I1\;I2) by Def29;
end;
A10: for C,I1,I2 being Element of A st P[C] & P[I1] & P[I2]
holds P[if-then-else(C,I1,I2)]
proof
let C,I1,I2 be Element of A such that
A11: P[C] and
A12: P[I1] and
A13: P[I2];
let s be Element of S;
A14: f1 complies_with_if_wrt T by Def32;
A15: f2 complies_with_if_wrt T by Def32;
A16: f1.(s, C) = f2.(s, C) by A11;
per cases;
suppose
A17: f1.(s,C) in T;
hence f1.(s, if-then-else(C,I1,I2)) = f1.(f1.(s, C), I1) by A14
.= f2.(f1.(s, C), I1) by A12
.= f2.(s, if-then-else(C,I1,I2)) by A15,A16,A17;
end;
suppose
A18: f1.(s,C) nin T;
hence f1.(s, if-then-else(C,I1,I2)) = f1.(f1.(s, C), I2) by A14
.= f2.(f1.(s, C), I2) by A13
.= f2.(s, if-then-else(C,I1,I2)) by A15,A16,A18;
end;
end;
A19: for C,I being Element of A st P[C] & P[I] holds P[while(C,I)]
proof
let C,I be Element of A such that
A20: P[C] and
A21: P[I];
let s be Element of S;
now
assume f1 iteration_terminates_for I\;C, f1.(s,C);
then consider r being non empty FinSequence of S such that
A22: r.1 = f1.(s, C) and
A23: r.len r nin T and
A24: for i being Nat st 1 <= i & i < len r
holds r.i in T & r.(i+1) = f1.(r.i, I\;C);
A25: f1.(s, C) = f2.(s, C) by A20;
A26: now
let i be Nat;
assume that
A27: 1 <= i and
A28: i < len r;
thus r.i in T by A24,A27,A28;
then reconsider si = r.i as Element of S;
thus r.(i+1) = f1.(si, I\;C) by A24,A27,A28
.= f1.(f1.(si,I),C) by Def29
.= f1.(f2.(si,I),C) by A21
.= f2.(f2.(si,I),C) by A20
.= f2.(r.i, I\;C) by Def29;
end;
thus f1.(s, while(C,I)) = r.len r by A22,A23,A24,Th86
.= f2.(s, while(C,I)) by A22,A23,A25,A26,Th86;
end;
hence thesis by A2;
end;
now
let sI be Element of [:S, the carrier of A:];
consider s,I being object such that
A29: s in S and
A30: I in the carrier of A and
A31: sI = [s,I] by ZFMISC_1:def 2;
reconsider I as Element of A by A30;
reconsider s as Element of S by A29;
P[I] from StructInd(A3,A6,A7,A10,A19);
then f1.(s,I) = f2.(s,I);
hence f1.sI = f2.sI by A31;
end;
hence thesis by FUNCT_2:63;
end;
definition
let A be preIfWhileAlgebra;
let S be non empty set;
let T be Subset of S;
let f be ExecutionFunction of A, S, T;
defpred Q[set] means
[:S, ElementaryInstructions A:] c= $1 & [:S, {EmptyIns A}:] c= $1 &
for s being Element of S for C,I,J being Element of A holds
([s,I] in $1 & [f.(s,I), J] in $1 implies [s, I\;J] in $1) &
([s,C] in $1 & [f.(s,C), I] in $1 & f.(s, C) in T
implies [s, if-then-else(C,I,J)] in $1) &
([s,C] in $1 & [f.(s,C), J] in $1 & f.(s, C) nin T
implies [s, if-then-else(C,I,J)] in $1) & ([s,C] in $1 &
(ex r being non empty FinSequence of S st r.1 = f.(s,C) & r.len r nin T &
for i being Nat st 1 <= i & i < len r
holds r.i in T & [r.i, I\;C] in $1 & r.(i+1) = f.(r.i, I\;C))
implies [s, while(C,I)] in $1);
func TerminatingPrograms(A,S,T,f) -> Subset of [:S, the carrier of A:] means
:
Def35: ([:S, ElementaryInstructions A:] c= it & [:S, {EmptyIns A}:] c= it &
for s being Element of S for C,I,J being Element of A holds
([s,I] in it & [f.(s,I), J] in it implies [s, I\;J] in it) &
([s,C] in it & [f.(s,C), I] in it & f.(s, C) in T
implies [s, if-then-else(C,I,J)] in it) &
([s,C] in it & [f.(s,C), J] in it & f.(s, C) nin T
implies [s, if-then-else(C,I,J)] in it) & ([s,C] in it &
(ex r being non empty FinSequence of S st r.1 = f.(s,C) & r.len r nin T &
for i being Nat st 1 <= i & i < len r
holds r.i in T & [r.i, I\;C] in it & r.(i+1) = f.(r.i, I\;C))
implies [s, while(C,I)] in it) ) &
for P being Subset of [:S, the carrier of A:] st
[:S, ElementaryInstructions A:] c= P & [:S, {EmptyIns A}:] c= P &
for s being Element of S for C,I,J being Element of A holds
([s,I] in P & [f.(s,I), J] in P implies [s, I\;J] in P) &
([s,C] in P & [f.(s,C), I] in P & f.(s, C) in T
implies [s, if-then-else(C,I,J)] in P) &
([s,C] in P & [f.(s,C), J] in P & f.(s, C) nin T
implies [s, if-then-else(C,I,J)] in P) & ([s,C] in P &
(ex r being non empty FinSequence of S st r.1 = f.(s,C) & r.len r nin T &
for i being Nat st 1 <= i & i < len r
holds r.i in T & [r.i, I\;C] in P & r.(i+1) = f.(r.i, I\;C))
implies [s, while(C,I)] in P) holds it c= P;
existence
proof
set QQ = {Z where Z is Subset of [:S, the carrier of A:]: Q[Z]};
set IT = meet QQ;
Q[ [#] [:S, the carrier of A:] ]
proof
set Y = [#] [:S, the carrier of A:];
{EmptyIns A} c= the carrier of A by ZFMISC_1:31;
hence
[:S, ElementaryInstructions A:] c= Y & [:S, {EmptyIns A}:] c= Y
by ZFMISC_1:95;
thus thesis by ZFMISC_1:87;
end;
then
A1: [:S, the carrier of A:] in QQ;
then reconsider IT as Subset of [:S, the carrier of A:] by SETFAM_1:3;
take IT;
now
let a be set;
assume a in QQ;
then ex Z being Subset of [:S, the carrier of A:] st a = Z & Q[Z];
hence [:S, ElementaryInstructions A:] c= a;
end;
hence [:S, ElementaryInstructions A:] c= IT by A1,SETFAM_1:5;
now
let a be set;
assume a in QQ;
then ex Z being Subset of [:S, the carrier of A:] st a = Z & Q[Z];
hence [:S, {EmptyIns A}:] c= a;
end;
hence [:S, {EmptyIns A}:] c= IT by A1,SETFAM_1:5;
hereby
let s be Element of S;
let C,I,J be Element of A;
hereby
assume that
A2: [s,I] in IT and
A3: [f.(s,I), J] in IT;
now
let a be set;
assume
A4: a in QQ;
then
A5: [s,I] in a by A2,SETFAM_1:def 1;
A6: [f.(s,I), J] in a by A3,A4,SETFAM_1:def 1;
ex Z being Subset of [:S, the carrier of A:] st a = Z & Q[Z] by A4;
hence [s, I\;J] in a by A5,A6;
end;
hence [s, I\;J] in IT by A1,SETFAM_1:def 1;
end;
hereby
assume that
A7: [s,C] in IT and
A8: [f.(s,C), I] in IT and
A9: f.(s, C) in T;
now
let a be set;
assume
A10: a in QQ;
then
A11: [s,C] in a by A7,SETFAM_1:def 1;
A12: [f.(s,C), I] in a by A8,A10,SETFAM_1:def 1;
ex Z being Subset of [:S, the carrier of A:] st a = Z & Q[Z] by A10;
hence [s, if-then-else(C,I,J)] in a by A9,A11,A12;
end;
hence [s, if-then-else(C,I,J)] in IT by A1,SETFAM_1:def 1;
end;
hereby
assume that
A13: [s,C] in IT and
A14: [f.(s,C), J] in IT and
A15: f.(s, C) nin T;
now
let a be set;
assume
A16: a in QQ;
then
A17: [s,C] in a by A13,SETFAM_1:def 1;
A18: [f.(s,C), J] in a by A14,A16,SETFAM_1:def 1;
ex Z being Subset of [:S, the carrier of A:] st a = Z & Q[Z] by A16;
hence [s, if-then-else(C,I,J)] in a by A15,A17,A18;
end;
hence [s, if-then-else(C,I,J)] in IT by A1,SETFAM_1:def 1;
end;
assume
A19: [s,C] in IT;
given r being non empty FinSequence of S such that
A20: r.1 = f.(s,C) and
A21: r.len r nin T and
A22: for i being Nat st 1 <= i & i < len r holds r.i in T & [r.i, I\;C]
in IT & r.(i+1) = f.(r.i, I\;C);
now
let a be set;
assume
A23: a in QQ;
A24: now
let i be Nat;
assume that
A25: 1 <= i and
A26: i < len r;
[r.i, I\;C] in IT by A22,A25,A26;
hence r.i in T & [r.i, I\;C] in a & r.(i+1) = f.(r.i, I\;C)
by A22,A23,A25,A26,SETFAM_1:def 1;
end;
A27: [s,C] in a by A19,A23,SETFAM_1:def 1;
ex Z being Subset of [:S, the carrier of A:] st a = Z & Q[Z] by A23;
hence [s, while(C,I)] in a by A20,A21,A24,A27;
end;
hence [s, while(C,I)] in IT by A1,SETFAM_1:def 1;
end;
let Y be Subset of [:S, the carrier of A:];
assume Q[Y];
then Y in QQ;
hence thesis by SETFAM_1:3;
end;
uniqueness
proof
let Y1,Y2 being Subset of [:S, the carrier of A:] such that
A28: Q[Y1] and
A29: for Y being Subset of [:S, the carrier of A:] st Q[Y] holds Y1 c= Y and
A30: Q[Y2] and
A31: for Y being Subset of [:S, the carrier of A:] st Q[Y] holds Y2 c= Y;
thus Y1 c= Y2 by A29,A30;
thus thesis by A28,A31;
end;
end;
definition
let A be preIfWhileAlgebra;
let I be Element of A;
attr I is absolutely-terminating means
:
Def36: for S being non empty set, s being Element of S
for T being Subset of S for f being ExecutionFunction of A, S, T
holds [s,I] in TerminatingPrograms(A,S,T,f);
end;
definition
let A be preIfWhileAlgebra;
let S be non empty set;
let T be Subset of S;
let I be Element of A;
let f be ExecutionFunction of A, S, T;
pred I is_terminating_wrt f means
for s being Element of S holds [s,I] in TerminatingPrograms(A, S, T, f);
end;
definition
let A be preIfWhileAlgebra;
let S be non empty set;
let T be Subset of S;
let I be Element of A;
let f be ExecutionFunction of A, S, T;
let Z be set;
pred I is_terminating_wrt f, Z means
for s being Element of S st s in Z
holds [s,I] in TerminatingPrograms(A, S, T, f);
pred Z is_invariant_wrt I, f means
for s being Element of S st s in Z holds f.(s, I) in Z;
end;
theorem Th94:
I in ElementaryInstructions A implies [s, I] in TerminatingPrograms(A,S,T,f)
proof
assume I in ElementaryInstructions A;
then
A1: [s, I] in [:S, ElementaryInstructions A:] by ZFMISC_1:87;
[:S, ElementaryInstructions A:] c= TerminatingPrograms(A,S,T,f) by Def35;
hence thesis by A1;
end;
theorem
I in ElementaryInstructions A implies I is absolutely-terminating
by Th94;
theorem Th96:
[s, EmptyIns A] in TerminatingPrograms(A,S,T,f)
proof
set I = EmptyIns A;
I in {I} by TARSKI:def 1;
then
A1: [s, I] in [:S, {I}:] by ZFMISC_1:87;
[:S, {I}:] c= TerminatingPrograms(A,S,T,f) by Def35;
hence thesis by A1;
end;
registration
let A;
cluster EmptyIns A -> absolutely-terminating;
coherence
by Th96;
end;
registration
let A;
cluster absolutely-terminating for Element of A;
existence
proof
take EmptyIns A;
thus thesis;
end;
end;
theorem Th97:
A is free & [s, I\;J] in TerminatingPrograms(A,S,T,f) implies
[s,I] in TerminatingPrograms(A,S,T,f) &
[f.(s,I), J] in TerminatingPrograms(A,S,T,f)
proof
set TP = TerminatingPrograms(A,S,T,f);
assume that
A1: A is free and
A2: [s, I\;J] in TP;
reconsider P = TP \ {[s, I\;J]} as Subset of [:S, the carrier of A:];
A3: [:S, ElementaryInstructions A:] c= P
proof
let x,y be object;
assume
A4: [x,y] in [:S, ElementaryInstructions A:];
A5: I <> I\;J by A1,Th73;
A6: J <> I\;J by A1,Th73;
y in ElementaryInstructions A by A4,ZFMISC_1:87;
then
A7: y <> I\;J by A5,A6,Th50;
A8: [:S, ElementaryInstructions A:] c= TP by Def35;
[x,y] <> [s, I\;J] by A7,XTUPLE_0:1;
then [x,y] nin {[s, I\;J]} by TARSKI:def 1;
hence thesis by A4,A8,XBOOLE_0:def 5;
end;
A9: [:S, {EmptyIns A}:] c= P
proof
let x,y be object;
assume
A10: [x,y] in [:S, {EmptyIns A}:];
then y in {EmptyIns A} by ZFMISC_1:87;
then y = EmptyIns A by TARSKI:def 1;
then
A11: y <> I\;J by A1,Th72;
A12: [:S, {EmptyIns A}:] c= TP by Def35;
[x,y] <> [s, I\;J] by A11,XTUPLE_0:1;
then [x,y] nin {[s, I\;J]} by TARSKI:def 1;
hence thesis by A10,A12,XBOOLE_0:def 5;
end;
set rr = s, IJ = I\;J;
A13: now
let s be Element of S;
let C,I,J be Element of A;
hereby
assume that
A14: [s,C] in P and
A15: [f.(s,C), I] in P and
A16: f.(s, C) in T;
A17: [s,C] in TP by A14,ZFMISC_1:56;
A18: [f.(s,C), I] in TP by A15,ZFMISC_1:56;
A19: IJ <> if-then-else(C,I,J) by A1,Th73;
A20: [s, if-then-else(C,I,J)] in TP by A16,A17,A18,Def35;
[rr,IJ] <> [s, if-then-else(C,I, J)] by A19,XTUPLE_0:1;
hence [s, if-then-else(C,I,J)] in P by A20,ZFMISC_1:56;
end;
hereby
assume that
A21: [s,C] in P and
A22: [f.(s,C), J] in P and
A23: f.(s, C) nin T;
A24: [s,C] in TP by A21,ZFMISC_1:56;
A25: [f.(s,C), J] in TP by A22,ZFMISC_1:56;
A26: IJ <> if-then-else(C,I,J) by A1,Th73;
A27: [s, if-then-else(C,I,J)] in TP by A23,A24,A25,Def35;
[rr,IJ] <> [s, if-then-else(C,I, J)] by A26,XTUPLE_0:1;
hence [s, if-then-else(C,I,J)] in P by A27,ZFMISC_1:56;
end;
assume
A28: [s,C] in P;
given r being non empty FinSequence of S such that
A29: r.1 = f.(s,C) and
A30: r.len r nin T and
A31: for i being Nat st 1 <= i & i < len r
holds r.i in T & [r.i, I\;C] in P & r.(i+1) = f.(r.i, I\;C);
A32: now
let i be Nat;
assume that
A33: 1 <= i and
A34: i < len r;
[r.i, I\;C] in P by A31,A33,A34;
hence r.i in T & [r.i, I\;C] in TP & r.(i+1) = f.(r.i, I\;C)
by A31,A33,A34,ZFMISC_1:56;
end;
A35: [s,C] in TP by A28,ZFMISC_1:56;
A36: while(C,I) <> IJ by A1,Th73;
A37: [s, while(C,I)] in TP by A29,A30,A32,A35,Def35;
[s, while(C,I)] <> [rr,IJ] by A36,XTUPLE_0:1;
hence [s, while(C,I)] in P by A37,ZFMISC_1:56;
end;
hereby
assume
A38: [rr,I] nin TP;
now
let q be Element of S;
let C,I9,J9 be Element of A;
assume that
A39: [q,I9] in P and
A40: [f.(q,I9), J9] in P;
A41: [q,I9] in TP by A39,ZFMISC_1:56;
A42: [f.(q,I9), J9] in TP by A40,ZFMISC_1:56;
A43: q <> rr or I9\;J9 <> I\;J by A1,A38,A41,Th73;
A44: [q, I9\;J9] in TP by A41,A42,Def35;
[q,I9\;J9] <> [rr,I\;J] by A43,XTUPLE_0:1;
hence [q, I9\;J9] in P by A44,ZFMISC_1:56;
end;
then for s being Element of S for C,I,J being Element of A holds
([s,I] in P & [f.(s,I), J] in P implies [s, I\;J] in P) &
([s,C] in P & [f.(s,C), I] in P & f.(s, C) in T
implies [s, if-then-else(C,I,J)] in P) &
([s,C] in P & [f.(s,C), J] in P & f.(s, C) nin T
implies [s, if-then-else(C,I,J)] in P) & ([s,C] in P &
(ex r being non empty FinSequence of S st r.1 = f.(s,C) & r.len r nin T &
for i being Nat st 1 <= i & i < len r
holds r.i in T & [r.i, I\;C] in P & r.(i+1) = f.(r.i, I\;C))
implies [s, while(C,I)] in P) by A13;
then TP c= P by A3,A9,Def35;
hence contradiction by A2,ZFMISC_1:56;
end;
assume
A45: [f.(s,I), J] nin TP;
now
let q be Element of S;
let C,I9,J9 be Element of A;
assume that
A46: [q,I9] in P and
A47: [f.(q,I9), J9] in P;
A48: [q,I9] in TP by A46,ZFMISC_1:56;
A49: [f.(q,I9), J9] in TP by A47,ZFMISC_1:56;
f.(q,I9) <> f.(s,I) or J9 <> J by A45,A47,ZFMISC_1:56;
then
A50: q <> s or I9\;J9 <> I\;J by A1,Th73;
A51: [q, I9\;J9] in TP by A48,A49,Def35;
[q,I9\;J9] <> [rr,I\;J] by A50,XTUPLE_0:1;
hence [q, I9\;J9] in P by A51,ZFMISC_1:56;
end;
then for s being Element of S for C,I,J being Element of A holds
([s,I] in P & [f.(s,I), J] in P implies [s, I\;J] in P) &
([s,C] in P & [f.(s,C), I] in P & f.(s, C) in T
implies [s, if-then-else(C,I,J)] in P) &
([s,C] in P & [f.(s,C), J] in P & f.(s, C) nin T
implies [s, if-then-else(C,I,J)] in P) & ([s,C] in P &
(ex r being non empty FinSequence of S st r.1 = f.(s,C) & r.len r nin T &
for i being Nat st 1 <= i & i < len r
holds r.i in T & [r.i, I\;C] in P & r.(i+1) = f.(r.i, I\;C))
implies [s, while(C,I)] in P) by A13;
then TP c= P by A3,A9,Def35;
hence contradiction by A2,ZFMISC_1:56;
end;
registration
let A;
let I,J be absolutely-terminating Element of A;
cluster I\;J -> absolutely-terminating;
coherence
proof
let S,s,T,f;
A1: [s,I] in TerminatingPrograms(A,S,T,f) by Def36;
[f.(s,I),J] in TerminatingPrograms(A,S,T,f) by Def36;
hence thesis by A1,Def35;
end;
end;
theorem Th98:
A is free & [s, if-then-else(C,I,J)] in TerminatingPrograms(A,S,T,f)
implies [s,C] in TerminatingPrograms(A,S,T,f) &
(f.(s,C) in T implies [f.(s,C), I] in TerminatingPrograms(A,S,T,f)) &
(f.(s,C) nin T implies [f.(s,C), J] in TerminatingPrograms(A,S,T,f))
proof
set TP = TerminatingPrograms(A,S,T,f);
set rr = s, IJ = if-then-else(C,I,J);
assume that
A1: A is free and
A2: [s, IJ] in TP;
reconsider P = TP \ {[s, IJ]} as Subset of [:S, the carrier of A:];
A3: [:S, ElementaryInstructions A:] c= P
proof
let x,y be object;
assume
A4: [x,y] in [:S, ElementaryInstructions A:];
then y in ElementaryInstructions A by ZFMISC_1:87;
then
A5: y <> IJ by Th51;
A6: [:S, ElementaryInstructions A:] c= TP by Def35;
[x,y] <> [s, IJ] by A5,XTUPLE_0:1;
then [x,y] nin {[s, IJ]} by TARSKI:def 1;
hence thesis by A4,A6,XBOOLE_0:def 5;
end;
A7: [:S, {EmptyIns A}:] c= P
proof
let x,y be object;
assume
A8: [x,y] in [:S, {EmptyIns A}:];
then y in {EmptyIns A} by ZFMISC_1:87;
then y = EmptyIns A by TARSKI:def 1;
then
A9: y <> IJ by A1,Th72;
A10: [:S, {EmptyIns A}:] c= TP by Def35;
[x,y] <> [s, IJ] by A9,XTUPLE_0:1;
then [x,y] nin {[s, IJ]} by TARSKI:def 1;
hence thesis by A8,A10,XBOOLE_0:def 5;
end;
A11: now
let s be Element of S;
let C,I,J be Element of A;
hereby
assume that
A12: [s,I] in P and
A13: [f.(s,I), J] in P;
A14: [s,I] in TP by A12,ZFMISC_1:56;
A15: [f.(s,I), J] in TP by A13,ZFMISC_1:56;
A16: IJ <> I\;J by A1,Th73;
A17: [s, I\;J] in TP by A14,A15,Def35;
[rr,IJ] <> [s, I\;J] by A16,XTUPLE_0:1;
hence [s, I\;J] in P by A17,ZFMISC_1:56;
end;
assume
A18: [s,C] in P;
given r being non empty FinSequence of S such that
A19: r.1 = f.(s,C) and
A20: r.len r nin T and
A21: for i being Nat st 1 <= i & i < len r
holds r.i in T & [r.i, I\;C] in P & r.(i+1) = f.(r.i, I\;C);
A22: now
let i be Nat;
assume that
A23: 1 <= i and
A24: i < len r;
[r.i, I\;C] in P by A21,A23,A24;
hence r.i in T & [r.i, I\;C] in TP & r.(i+1) = f.(r.i, I\;C)
by A21,A23,A24,ZFMISC_1:56;
end;
A25: [s,C] in TP by A18,ZFMISC_1:56;
A26: while(C,I) <> IJ by A1,Th74;
A27: [s, while(C,I)] in TP by A19,A20,A22,A25,Def35;
[s, while(C,I)] <> [rr,IJ] by A26,XTUPLE_0:1;
hence [s, while(C,I)] in P by A27,ZFMISC_1:56;
end;
hereby
assume
A28: [s,C] nin TerminatingPrograms(A,S,T,f);
A29: now
let s be Element of S;
let C9,I,J be Element of A;
assume that
A30: [s,C9] in P and
A31: [f.(s,C9), I] in P and
A32: f.(s, C9) in T;
A33: [s,C9] in TP by A30,ZFMISC_1:56;
A34: [f.(s,C9), I] in TP by A31,ZFMISC_1:56;
A35: IJ <> if-then-else(C9,I,J) or rr <> s by A1,A28,A33,Th74;
A36: [s, if-then-else(C9,I,J)] in TP by A32,A33,A34,Def35;
[rr,IJ] <> [s, if-then-else(C9, I,J)] by A35,XTUPLE_0:1;
hence [s, if-then-else(C9,I,J)] in P by A36,ZFMISC_1:56;
end;
now
let s be Element of S;
let C9,I,J be Element of A;
assume that
A37: [s,C9] in P and
A38: [f.(s,C9), J] in P and
A39: f.(s, C9) nin T;
A40: [s,C9] in TP by A37,ZFMISC_1:56;
A41: [f.(s,C9), J] in TP by A38,ZFMISC_1:56;
A42: IJ <> if-then-else(C9,I,J) or rr <> s by A1,A28,A40,Th74;
A43: [s, if-then-else(C9,I,J)] in TP by A39,A40,A41,Def35;
[rr,IJ] <> [s, if-then-else(C9, I,J)] by A42,XTUPLE_0:1;
hence [s, if-then-else(C9,I,J)] in P by A43,ZFMISC_1:56;
end;
then TP c= P by A3,A7,A11,A29,Def35;
hence contradiction by A2,ZFMISC_1:56;
end;
thus
f.(s,C) in T implies [f.(s,C), I] in TerminatingPrograms(A,S,T,f)
proof
assume that
A44: f.(s,C) in T and
A45: [f.(s,C), I] nin TP;
A46: now
let s be Element of S;
let C9,I9,J be Element of A;
assume that
A47: [s,C9] in P and
A48: [f.(s,C9), I9] in P and
A49: f.(s, C9) in T;
A50: [s,C9] in TP by A47,ZFMISC_1:56;
A51: [f.(s,C9), I9] in TP by A48,ZFMISC_1:56;
f.(s,C9) <> f.(rr,C) or I <> I9 by A45,A48,ZFMISC_1:56;
then
A52: IJ <> if-then-else(C9,I9,J) or rr <> s by A1,Th74;
A53: [s,if-then-else(C9,I9,J)] in TP by A49,A50,A51,Def35;
[rr,IJ] <> [s,if-then-else(C9, I9,J)] by A52,XTUPLE_0:1;
hence [s, if-then-else(C9,I9,J)] in P by A53,ZFMISC_1:56;
end;
now
let s be Element of S;
let C9,I,J9 be Element of A;
assume that
A54: [s,C9] in P and
A55: [f.(s,C9), J9] in P and
A56: f.(s, C9) nin T;
A57: [s,C9] in TP by A54,ZFMISC_1:56;
A58: [f.(s,C9), J9] in TP by A55,ZFMISC_1:56;
A59: IJ <> if-then-else(C9,I,J9) or rr <> s by A1,A44,A56,Th74;
A60: [s,if-then-else(C9,I,J9)] in TP by A56,A57,A58,Def35;
[rr,IJ] <> [s,if-then-else(C9,I,J9)] by A59,XTUPLE_0:1;
hence [s, if-then-else(C9,I,J9)] in P by A60,ZFMISC_1:56;
end;
then TP c= P by A3,A7,A11,A46,Def35;
hence contradiction by A2,ZFMISC_1:56;
end;
assume that
A61: f.(s,C) nin T and
A62: [f.(s,C), J] nin TP;
A63: now
let s be Element of S;
let C9,I9,J be Element of A;
assume that
A64: [s,C9] in P and
A65: [f.(s,C9), I9] in P and
A66: f.(s, C9) in T;
A67: [s,C9] in TP by A64,ZFMISC_1:56;
A68: [f.(s,C9), I9] in TP by A65,ZFMISC_1:56;
A69: IJ <> if-then-else(C9,I9,J) or rr <> s by A1,A61,A66,Th74;
A70: [s,if-then-else(C9,I9,J)] in TP by A66,A67,A68,Def35;
[rr,IJ] <> [s,if-then-else(C9,I9, J)] by A69,XTUPLE_0:1;
hence [s, if-then-else(C9,I9,J)] in P by A70,ZFMISC_1:56;
end;
now
let s be Element of S;
let C9,I,J9 be Element of A;
assume that
A71: [s,C9] in P and
A72: [f.(s,C9), J9] in P and
A73: f.(s, C9) nin T;
A74: [s,C9] in TP by A71,ZFMISC_1:56;
A75: [f.(s,C9), J9] in TP by A72,ZFMISC_1:56;
f.(s,C9) <> f.(rr,C) or J <> J9 by A62,A72,ZFMISC_1:56;
then
A76: IJ <> if-then-else(C9,I,J9) or rr <> s by A1,Th74;
A77: [s,if-then-else(C9,I,J9)] in TP by A73,A74,A75,Def35;
[rr,IJ] <> [s,if-then-else(C9,I, J9)] by A76,XTUPLE_0:1;
hence [s, if-then-else(C9,I,J9)] in P by A77,ZFMISC_1:56;
end;
then TP c= P by A3,A7,A11,A63,Def35;
hence contradiction by A2,ZFMISC_1:56;
end;
registration
let A;
let C,I,J be absolutely-terminating Element of A;
cluster if-then-else(C,I,J) -> absolutely-terminating;
coherence
proof
let S,s,T,f;
A1: [s,C] in TerminatingPrograms(A,S,T,f) by Def36;
A2: f.(s,C) in T or f.(s,C) nin T;
A3: [f.(s,C),I] in TerminatingPrograms(A,S,T,f) by Def36;
[f.(s,C),J] in TerminatingPrograms(A,S,T,f) by Def36;
hence thesis by A1,A2,A3,Def35;
end;
end;
registration
let A;
let C,I be absolutely-terminating Element of A;
cluster if-then(C,I) -> absolutely-terminating;
coherence;
end;
theorem Th99:
A is free & [s, while(C,I)] in TerminatingPrograms(A,S,T,f)
implies [s,C] in TerminatingPrograms(A,S,T,f) &
ex r being non empty FinSequence of S st r.1 = f.(s,C) & r.len r nin T &
for i being Nat st 1 <= i & i < len r
holds r.i in T & [r.i, I\;C] in TerminatingPrograms(A,S,T,f) &
r.(i+1) = f.(r.i, I\;C)
proof
set TP = TerminatingPrograms(A,S,T,f);
set rr = s, IJ = while(C,I);
assume that
A1: A is free and
A2: [s, IJ] in TP;
reconsider P = TP \ {[s, IJ]} as Subset of [:S, the carrier of A:];
A3: [:S, ElementaryInstructions A:] c= P
proof
let x,y be object;
assume
A4: [x,y] in [:S, ElementaryInstructions A:];
then y in ElementaryInstructions A by ZFMISC_1:87;
then
A5: y <> IJ by Th52;
A6: [:S, ElementaryInstructions A:] c= TP by Def35;
[x,y] <> [s, IJ] by A5,XTUPLE_0:1;
then [x,y] nin {[s, IJ]} by TARSKI:def 1;
hence thesis by A4,A6,XBOOLE_0:def 5;
end;
A7: [:S, {EmptyIns A}:] c= P
proof
let x,y be object;
assume
A8: [x,y] in [:S, {EmptyIns A}:];
then y in {EmptyIns A} by ZFMISC_1:87;
then y = EmptyIns A by TARSKI:def 1;
then
A9: y <> IJ by A1,Th72;
A10: [:S, {EmptyIns A}:] c= TP by Def35;
[x,y] <> [s, IJ] by A9,XTUPLE_0:1;
then [x,y] nin {[s, IJ]} by TARSKI:def 1;
hence thesis by A8,A10,XBOOLE_0:def 5;
end;
A11: now
let s be Element of S;
let C,I,J be Element of A;
hereby
assume that
A12: [s,I] in P and
A13: [f.(s,I), J] in P;
A14: [s,I] in TP by A12,ZFMISC_1:56;
A15: [f.(s,I), J] in TP by A13,ZFMISC_1:56;
A16: IJ <> I\;J by A1,Th73;
A17: [s, I\;J] in TP by A14,A15,Def35;
[rr,IJ] <> [s, I\;J] by A16,XTUPLE_0:1;
hence [s, I\;J] in P by A17,ZFMISC_1:56;
end;
hereby
assume that
A18: [s,C] in P and
A19: [f.(s,C), I] in P and
A20: f.(s, C) in T;
A21: [s,C] in TP by A18,ZFMISC_1:56;
A22: [f.(s,C), I] in TP by A19,ZFMISC_1:56;
A23: IJ <> if-then-else(C,I,J) by A1,Th74;
A24: [s, if-then-else(C,I,J)] in TP by A20,A21,A22,Def35;
[rr,IJ] <> [s, if-then-else(C,I, J)] by A23,XTUPLE_0:1;
hence [s, if-then-else(C,I,J)] in P by A24,ZFMISC_1:56;
end;
hereby
assume that
A25: [s,C] in P and
A26: [f.(s,C), J] in P and
A27: f.(s, C) nin T;
A28: [s,C] in TP by A25,ZFMISC_1:56;
A29: [f.(s,C), J] in TP by A26,ZFMISC_1:56;
A30: IJ <> if-then-else(C,I,J) by A1,Th74;
A31: [s, if-then-else(C,I,J)] in TP by A27,A28,A29,Def35;
[rr,IJ] <> [s, if-then-else(C,I, J)] by A30,XTUPLE_0:1;
hence [s, if-then-else(C,I,J)] in P by A31,ZFMISC_1:56;
end;
end;
hereby
assume
A32: [s,C] nin TerminatingPrograms(A,S,T,f);
now
let s be Element of S;
let C9,I9,J be Element of A;
assume
A33: [s,C9] in P;
given r being non empty FinSequence of S such that
A34: r.1 = f.(s,C9) and
A35: r.len r nin T and
A36: for i being Nat st 1 <= i & i < len r
holds r.i in T & [r.i, I9\;C9] in P & r.(i+1) = f.(r.i, I9\;C9);
A37: now
let i be Nat;
assume that
A38: 1 <= i and
A39: i < len r;
[r.i, I9\;C9] in P by A36,A38,A39;
hence r.i in T & [r.i, I9\;C9] in TP & r.(i+1) = f.(r.i, I9\;C9)
by A36,A38,A39,ZFMISC_1:56;
end;
A40: [s,C9] in TP by A33,ZFMISC_1:56;
then
A41: while(C9,I9) <> IJ or s <> rr by A1,A32,Th75;
A42: [s, while(C9,I9)] in TP by A34,A35,A37,A40,Def35;
[s, while(C9,I9)] <> [rr,IJ] by A41,XTUPLE_0:1;
hence [s, while(C9,I9)] in P by A42,ZFMISC_1:56;
end;
then for s being Element of S for C,I,J being Element of A holds
([s,I] in P & [f.(s,I), J] in P implies [s, I\;J] in P) &
([s,C] in P & [f.(s,C), I] in P & f.(s, C) in T
implies [s, if-then-else(C,I,J)] in P) &
([s,C] in P & [f.(s,C), J] in P & f.(s, C) nin T
implies [s, if-then-else(C,I,J)] in P) & ([s,C] in P &
(ex r being non empty FinSequence of S st r.1 = f.(s,C) & r.len r nin T &
for i being Nat st 1 <= i & i < len r
holds r.i in T & [r.i, I\;C] in P & r.(i+1) = f.(r.i, I\;C))
implies [s, while(C,I)] in P) by A11;
then TP c= P by A3,A7,Def35;
hence contradiction by A2,ZFMISC_1:56;
end;
assume
A43: not ex r being non empty FinSequence of S st
r.1 = f.(rr,C) & r.len r nin T & for i being Nat st 1 <= i & i < len r
holds r.i in T & [r.i, I\;C] in TP & r.(i+1) = f.(r.i, I\;C);
now
let s be Element of S;
let C9,I9,J be Element of A;
assume
A44: [s,C9] in P;
given r being non empty FinSequence of S such that
A45: r.1 = f.(s,C9) and
A46: r.len r nin T and
A47: for i being Nat st 1 <= i & i < len r
holds r.i in T & [r.i, I9\;C9] in P & r.(i+1) = f.(r.i, I9\;C9);
A48: now
let i be Nat;
assume that
A49: 1 <= i and
A50: i < len r;
[r.i, I9\;C9] in P by A47,A49,A50;
hence r.i in T & [r.i, I9\;C9] in TP & r.(i+1) = f.(r.i, I9\;C9)
by A47,A49,A50,ZFMISC_1:56;
end;
A51: [s,C9] in TP by A44,ZFMISC_1:56;
I <> I9 or C <> C9 or s <> rr by A43,A45,A46,A48;
then
A52: while(C9,I9) <> IJ or s <> rr by A1,Th75;
A53: [s, while(C9,I9)] in TP by A45,A46,A48,A51,Def35;
[s, while(C9,I9)] <> [rr,IJ] by A52,XTUPLE_0:1;
hence [s, while(C9,I9)] in P by A53,ZFMISC_1:56;
end;
then for s being Element of S for C,I,J being Element of A holds
([s,I] in P & [f.(s,I), J] in P implies [s, I\;J] in P) &
([s,C] in P & [f.(s,C), I] in P & f.(s, C) in T
implies [s, if-then-else(C,I,J)] in P) &
([s,C] in P & [f.(s,C), J] in P & f.(s, C) nin T
implies [s, if-then-else(C,I,J)] in P) & ([s,C] in P &
(ex r being non empty FinSequence of S st r.1 = f.(s,C) & r.len r nin T &
for i being Nat st 1 <= i & i < len r
holds r.i in T & [r.i, I\;C] in P & r.(i+1) = f.(r.i, I\;C))
implies [s, while(C,I)] in P) by A11;
then TP c= P by A3,A7,Def35;
hence contradiction by A2,ZFMISC_1:56;
end;
theorem
A is free & [s, while(C,I)] in TerminatingPrograms(A,S,T,f) & f.(s,C) in T
implies [f.(s,C), I] in TerminatingPrograms(A,S,T,f)
proof
set TP = TerminatingPrograms(A,S,T,f);
set IJ = while(C,I);
assume that
A1: A is free and
A2: [s, IJ] in TP and
A3: f.(s,C) in T;
consider r being non empty FinSequence of S such that
A4: r.1 = f.(s,C) and
A5: r.len r nin T and
A6: for i being Nat st 1 <= i & i < len r
holds r.i in T & [r.i, I\;C] in TP & r.(i+1) = f.(r.i, I\;C) by A1,A2,Th99;
len r >= 1 by NAT_1:14;
then 1 < len r by A3,A4,A5,XXREAL_0:1;
then [r.1, I\;C] in TP by A6;
hence thesis by A1,A4,Th97;
end;
theorem
for C,I being absolutely-terminating Element of A
st f iteration_terminates_for I\;C, f.(s,C)
holds [s, while(C,I)] in TerminatingPrograms(A,S,T,f)
proof
let C,I be absolutely-terminating Element of A;
given r being non empty FinSequence of S such that
A1: r.1 = f.(s,C) and
A2: r.len r nin T and
A3: for i being Nat st 1 <= i & i < len r
holds r.i in T & r.(i+1) = f.(r.i, I\;C);
A4: now
let i be Nat;
assume that
A5: 1 <= i and
A6: i < len r;
thus r.i in T by A3,A5,A6;
hence [r.i, I\;C] in TerminatingPrograms(A,S,T,f) &
r.(i+1) = f.(r.i, I\;C) by A3,A5,A6,Def36;
end;
[s,C] in TerminatingPrograms(A,S,T,f) by Def36;
hence thesis by A1,A2,A4,Def35;
end;
Lm3: for A being free ECIW-strict preIfWhileAlgebra
for f1,f2 being ExecutionFunction of A, S, T
st f1|[:S, ElementaryInstructions A:] = f2|[:S, ElementaryInstructions A:]
for I being Element of A
for s being Element of S st [s,I] in TerminatingPrograms(A,S,T,f1)
holds [s,I] in TerminatingPrograms(A,S,T,f2) & f1.(s,I) = f2.(s,I)
proof
let A be free ECIW-strict preIfWhileAlgebra;
let f1,f2 be ExecutionFunction of A, S, T such that
A1: f1|[:S, ElementaryInstructions A:] = f2|[:S, ElementaryInstructions A:];
set g = f1|[:S, ElementaryInstructions A:];
set TP1 = TerminatingPrograms(A,S,T,f1);
set TP2 = TerminatingPrograms(A,S,T,f2);
defpred P[Element of A] means
for s st [s,$1] in TP1 holds [s,$1] in TP2 & f1.(s,$1) = f2.(s,$1);
A2: for I being Element of A st I in ElementaryInstructions A holds P[I]
proof
let I be Element of A;
assume
A3: I in ElementaryInstructions A;
let s be Element of S;
assume [s,I] in TP1;
thus [s,I] in TP2 by A3,Th94;
A4: [s,I] in [:S, ElementaryInstructions A:] by A3,ZFMISC_1:87;
hence f1.(s,I) = g.[s,I] by FUNCT_1:49
.= f2.(s,I) by A1,A4,FUNCT_1:49;
end;
A5: P[EmptyIns A]
proof
let s be Element of S;
f1.(s,EmptyIns A) = s by Def28;
hence thesis by Def28,Th96;
end;
A6: for I1,I2 being Element of A st P[I1] & P[I2] holds P[I1\;I2]
proof
let I1,I2 be Element of A such that
A7: P[I1] and
A8: P[I2];
let s be Element of S;
assume
A9: [s, I1\;I2] in TP1;
then
A10: [s, I1] in TP1 by Th97;
A11: [f1.(s,I1),I2] in TP1 by A9,Th97;
A12: [s, I1] in TP2 by A7,A10;
A13: [f1.(s,I1),I2] in TP2 by A8,A11;
A14: f1.(s,I1) = f2.(s,I1) by A7,A10;
A15: f1.(f1.(s,I1),I2) = f2.(f1.(s,I1),I2) by A8,A11;
f1.(f1.(s,I1),I2) = f1.(s,I1\;I2) by Def29;
hence thesis by A12,A13,A14,A15,Def29,Def35;
end;
A16: for C,I1,I2 being Element of A st P[C] & P[I1] & P[I2]
holds P[if-then-else(C,I1,I2)]
proof
let C,I1,I2 be Element of A such that
A17: P[C] and
A18: P[I1] and
A19: P[I2];
A20: f1 complies_with_if_wrt T by Def32;
A21: f2 complies_with_if_wrt T by Def32;
set J = if-then-else(C,I1,I2);
let s be Element of S;
assume
A22: [s, J] in TP1;
then
A23: [s, C] in TP1 by Th98;
A24: f1.(s,C) in T implies [f1.(s,C),I1] in TP1 by A22,Th98;
A25: f1.(s,C) nin T implies [f1.(s,C),I2] in TP1 by A22,Th98;
A26: [s, C] in TP2 by A17,A23;
A27: f1.(s,C) = f2.(s,C) by A17,A23;
A28: f1.(s,C) in T implies [f1.(s,C),I1] in TP2 & f1.(f1.(s,C),I1) = f2.(f1
.(s,C),I1) & f1.(s,J) = f1.(f1.(s,C),I1) by A18,A20,A24;
A29: f1.(s,C) nin T implies [f1.(s,C),I2] in TP2 & f1.(f1.(s,C),I2) = f2.(
f1.(s,C),I2) & f1.(s,J) = f1.(f1.(s,C),I2) by A19,A20,A25;
f1.(s,C) in T or f1.(s,C) nin T;
hence thesis by A21,A26,A27,A28,A29,Def35;
end;
A30: for C,I being Element of A st P[C] & P[I] holds P[while(C,I)]
proof
let C,I be Element of A such that
A31: P[C] and
A32: P[I];
set J = while(C,I);
let s be Element of S;
assume
A33: [s, J] in TP1;
then
A34: [s, C] in TP1 by Th99;
then
A35: [s, C] in TP2 by A31;
A36: f1.(s,C) = f2.(s,C) by A31,A34;
consider r being non empty FinSequence of S such that
A37: r.1 = f1.(s,C) and
A38: r.len r nin T and
A39: for i being Nat st 1 <= i & i < len r holds
r.i in T & [r.i, I\;C] in TP1 & r.(i+1) = f1.(r.i, I\;C) by A33,Th99;
for i being Nat st 1 <= i & i < len r holds
r.i in T & r.(i+1) = f1.(r.i, I\;C) by A39;
then
A40: f1.(s,J) = r.len r by A37,A38,Th86;
defpred Q[Nat] means 1 <= $1 & $1 < len r implies
r.$1 in T & [r.$1, I\;C] in TP2 & r.($1+1) = f2.(r.$1, I\;C);
A41: for i being Nat holds Q[i]
proof
let i be Nat;
assume that
A42: 1 <= i and
A43: i < len r;
thus
A44: r.i in T by A39,A42,A43;
then reconsider ri = r.i as Element of S;
A45: [r.i, I\;C] in TP1 by A39,A42,A43;
hence [r.i, I\;C] in TP2 by A6,A31,A32,A44;
A46: [ri, I] in TP1 by A45,Th97;
A47: [f1.(ri,I),C] in TP1 by A45,Th97;
thus r.(i+1) = f1.(r.i, I\;C) by A39,A42,A43
.= f1.(f1.(ri,I),C) by Def29
.= f2.(f1.(ri,I),C) by A31,A47
.= f2.(f2.(ri,I),C) by A32,A46
.= f2.(r.i, I\;C) by Def29;
end;
then for i being Nat st 1 <= i & i < len r holds
r.i in T & r.(i+1) = f2.(r.i, I\;C);
hence thesis by A35,A36,A37,A38,A40,A41,Def35,Th86;
end;
let I be Element of A;
thus P[I] from StructInd(A2,A5,A6,A16,A30);
end;
theorem
for A being free ECIW-strict preIfWhileAlgebra
for f1,f2 being ExecutionFunction of A, S, T
st f1|[:S, ElementaryInstructions A:] = f2|[:S, ElementaryInstructions A:]
holds TerminatingPrograms(A,S,T,f1) = TerminatingPrograms(A,S,T,f2)
proof
let A be free ECIW-strict preIfWhileAlgebra;
let f1,f2 be ExecutionFunction of A, S, T;
assume
A1: f1|[:S, ElementaryInstructions A:] = f2|[:S, ElementaryInstructions A:];
set TP1 = TerminatingPrograms(A,S,T,f1);
set TP2 = TerminatingPrograms(A,S,T,f2);
thus TP1 c= TP2
proof
let q,I be object;
assume
A2: [q,I] in TP1;
then
A3: q is Element of S by ZFMISC_1:87;
I is Element of A by A2,ZFMISC_1:87;
hence thesis by A1,A2,A3,Lm3;
end;
let q,I be object;
assume
A4: [q,I] in TP2;
then
A5: q is Element of S by ZFMISC_1:87;
I is Element of A by A4,ZFMISC_1:87;
hence thesis by A1,A4,A5,Lm3;
end;
theorem
for A being free ECIW-strict preIfWhileAlgebra
for f1,f2 being ExecutionFunction of A, S, T
st f1|[:S, ElementaryInstructions A:] = f2|[:S, ElementaryInstructions A:]
for s being Element of S
for I being Element of A st [s,I] in TerminatingPrograms(A,S,T,f1)
holds f1.(s, I) = f2.(s, I) by Lm3;
theorem Th104:
for I being absolutely-terminating Element of A holds I is_terminating_wrt f
by Def36;
theorem
for I being Element of A holds
I is_terminating_wrt f iff I is_terminating_wrt f, S;
theorem Th106:
for I being Element of A st I is_terminating_wrt f
for P being set holds I is_terminating_wrt f, P;
theorem
for I being absolutely-terminating Element of A
for P being set holds I is_terminating_wrt f, P by Th104,Th106;
theorem
for I being Element of A holds S is_invariant_wrt I, f;
theorem
for P being set for I,J being Element of A
st P is_invariant_wrt I, f & P is_invariant_wrt J, f
holds P is_invariant_wrt I\;J, f
proof
let P be set;
let I,J be Element of A;
assume that
A1: for s being Element of S st s in P holds f.(s, I) in P and
A2: for s being Element of S st s in P holds f.(s, J) in P;
let s be Element of S;
assume s in P;
then
A3: f.(s, I) in P by A1;
f.(s, I\;J) = f.(f.(s, I), J) by Def29;
hence thesis by A2,A3;
end;
theorem
for I,J being Element of A st I is_terminating_wrt f & J is_terminating_wrt f
holds I\;J is_terminating_wrt f
proof
let I,J be Element of A such that
A1: for s being Element of S holds [s,I] in TerminatingPrograms(A, S, T, f) and
A2: for s being Element of S holds [s,J] in TerminatingPrograms(A, S, T, f);
let s be Element of S;
A3: [s,I] in TerminatingPrograms(A,S,T,f) by A1;
[f.(s,I),J] in TerminatingPrograms(A,S,T,f) by A2;
hence thesis by A3,Def35;
end;
theorem
for P being set for I,J being Element of A
st I is_terminating_wrt f,P & J is_terminating_wrt f,P &
P is_invariant_wrt I,f holds I\;J is_terminating_wrt f,P
proof
let P be set;
let I,J be Element of A such that
A1: for s being Element of S st s in P
holds [s,I] in TerminatingPrograms(A, S, T, f) and
A2: for s being Element of S st s in P
holds [s,J] in TerminatingPrograms(A, S, T, f) and
A3: for s being Element of S st s in P holds f.(s, I) in P;
let s be Element of S;
assume
A4: s in P;
then
A5: [s,I] in TerminatingPrograms(A,S,T,f) by A1;
[f.(s,I),J] in TerminatingPrograms(A,S,T,f) by A2,A3,A4;
hence thesis by A5,Def35;
end;
theorem
for C,I,J being Element of A
st C is_terminating_wrt f & I is_terminating_wrt f & J is_terminating_wrt f
holds if-then-else(C,I,J) is_terminating_wrt f
proof
let C,I,J be Element of A such that
A1: for s being Element of S holds [s,C] in TerminatingPrograms(A, S, T, f) and
A2: for s being Element of S holds [s,I] in TerminatingPrograms(A, S, T, f) and
A3: for s being Element of S holds [s,J] in TerminatingPrograms(A, S, T, f);
let s be Element of S;
A4: f.(s,C) in T or f.(s,C) nin T;
A5: [s,C] in TerminatingPrograms(A,S,T,f) by A1;
A6: [f.(s,C),I] in TerminatingPrograms(A,S,T,f) by A2;
[f.(s,C),J] in TerminatingPrograms(A,S,T,f) by A3;
hence thesis by A4,A5,A6,Def35;
end;
theorem
for P being set for C,I,J being Element of A
st C is_terminating_wrt f,P & I is_terminating_wrt f,P &
J is_terminating_wrt f,P & P is_invariant_wrt C,f
holds if-then-else(C,I,J) is_terminating_wrt f,P
proof
let P be set;
let C,I,J be Element of A such that
A1: for s being Element of S st s in P
holds [s,C] in TerminatingPrograms(A, S, T, f) and
A2: for s being Element of S st s in P
holds [s,I] in TerminatingPrograms(A, S, T, f) and
A3: for s being Element of S st s in P
holds [s,J] in TerminatingPrograms(A, S, T, f) and
A4: for s being Element of S st s in P holds f.(s, C) in P;
let s be Element of S;
assume
A5: s in P;
A6: f.(s,C) in T or f.(s,C) nin T;
A7: [s,C] in TerminatingPrograms(A,S,T,f ) by A1,A5;
A8: [f.(s,C),I] in TerminatingPrograms(A,S,T,f) by A2,A4,A5;
[f.(s,C),J] in TerminatingPrograms(A,S,T,f) by A3,A4,A5;
hence thesis by A6,A7,A8,Def35;
end;
theorem Th114:
for C,I being Element of A
st C is_terminating_wrt f & I is_terminating_wrt f &
f iteration_terminates_for I\;C, f.(s,C) holds [s, while(C,I)] in
TerminatingPrograms(A, S, T, f)
proof
let C,I be Element of A such that
A1: C is_terminating_wrt f and
A2: I is_terminating_wrt f;
given r being non empty FinSequence of S such that
A3: r.1 = f.(s,C) and
A4: r.len r nin T and
A5: for i being Nat st 1 <= i & i < len r
holds r.i in T & r.(i+1) = f.(r.i, I\;C);
A6: now
let i be Nat;
assume that
A7: 1 <= i and
A8: i < len r;
thus r.i in T by A5,A7,A8;
then reconsider s = r.i as Element of S;
A9: [s, I] in TerminatingPrograms(A,S,T,f) by A2;
[f.(s, I), C] in TerminatingPrograms(A,S,T,f) by A1;
hence [r.i, I\;C] in TerminatingPrograms(A,S,T,f) &
r.(i+1) = f.(r.i, I\;C) by A5,A7,A8,A9,Def35;
end;
[s,C] in TerminatingPrograms(A,S,T,f) by A1;
hence thesis by A3,A4,A6,Def35;
end;
theorem
for P being set for C,I being Element of A
st C is_terminating_wrt f,P & I is_terminating_wrt f,P &
P is_invariant_wrt C,f & P is_invariant_wrt I,f &
f iteration_terminates_for I\;C, f.(s,C) & s in P holds [s, while(C,I)] in
TerminatingPrograms(A, S, T, f)
proof
let P be set;
let C,I be Element of A such that
A1: C is_terminating_wrt f,P and
A2: I is_terminating_wrt f,P and
A3: P is_invariant_wrt C,f and
A4: P is_invariant_wrt I,f;
given r being non empty FinSequence of S such that
A5: r.1 = f.(s,C) and
A6: r.len r nin T and
A7: for i being Nat st 1 <= i & i < len r
holds r.i in T & r.(i+1) = f.(r.i, I\;C);
assume
A8: s in P;
defpred P[Nat] means $1 < len r implies r.($1+1) in P;
A9: P[0] by A3,A5,A8;
A10: for i being Nat st P[i] holds P[i+1]
proof
let i be Nat such that
A11: P[i] and
A12: i+1 < len r;
A13: i+1 >= 1 by NAT_1:11;
then
A14: r.(i+1) in T by A7,A12;
A15: r.(i+1+1) = f.(r.(i+1), I\;C) by A7,A12,A13;
reconsider s = r.(i+1) as Element of S by A14;
f.(s,I) in P by A4,A11,A12,NAT_1:13;
then f.(f.(s,I),C) in P by A3;
hence r.(i+1+1) in P by A15,Def29;
end;
A16: for i being Nat holds P[i] from NAT_1:sch 2(A9,A10);
A17: now
let i be Nat;
assume that
A18: 1 <= i and
A19: i < len r;
thus r.i in T by A7,A18,A19;
then reconsider s = r.i as Element of S;
A20: i-'1 <= i by NAT_D:35;
A21: i = (i-'1)+1 by A18,XREAL_1:235;
i-'1 < len r by A19,A20,XXREAL_0:2;
then
A22: s in P by A16,A21;
then
A23: [s, I] in TerminatingPrograms(A,S,T,f) by A2;
f.(s, I) in P by A4,A22;
then [f.(s, I), C] in TerminatingPrograms(A,S,T,f) by A1;
hence [r.i, I\;C] in TerminatingPrograms(A,S,T,f) &
r.(i+1) = f.(r.i, I\;C) by A7,A18,A19,A23,Def35;
end;
[s,C] in TerminatingPrograms(A,S,T,f) by A1,A8;
hence thesis by A5,A6,A17,Def35;
end;
theorem Th116:
for P being set for C,I being Element of A
st C is_terminating_wrt f & I is_terminating_wrt f,P &
P is_invariant_wrt C,f & (for s st s in P & f.(f.(s,I),C) in T
holds f.(s,I) in P) & f iteration_terminates_for I\;C, f.(s,C) & s in P
holds [s, while(C,I)] in TerminatingPrograms(A, S, T, f)
proof
let P be set;
let C,I be Element of A such that
A1: C is_terminating_wrt f and
A2: I is_terminating_wrt f,P and
A3: P is_invariant_wrt C,f and
A4: for s st s in P & f.(f.(s,I),C) in T holds f.(s,I) in P;
given r being non empty FinSequence of S such that
A5: r.1 = f.(s,C) and
A6: r.len r nin T and
A7: for i being Nat st 1 <= i & i < len r
holds r.i in T & r.(i+1) = f.(r.i, I\;C);
assume
A8: s in P;
defpred P[Nat] means $1+1 < len r implies r.($1+1) in P;
A9: P[0] by A3,A5,A8;
A10: for i being Nat st P[i] holds P[i+1]
proof
let i be Nat such that
A11: P[i] and
A12: i+1+1 < len r;
A13: i+1 >= 1 by NAT_1:11;
A14: i+1+1 >= 1 by NAT_1:11;
A15: i+1 < len r by A12,NAT_1:13;
then
A16: r.(i+1) in T by A7,A13;
A17: r.(i+1+1) in T by A7,A12,A14;
A18: r.(i+1+1) = f.(r.(i+1), I\;C) by A7,A13,A15;
reconsider s = r.(i+1) as Element of S by A16;
f.(f.(s, I), C) in T by A17,A18,Def29;
then f.(s,I) in P by A4,A11,A12,NAT_1:13;
then f.(f.(s,I),C) in P by A3;
hence r.(i+1+1) in P by A18,Def29;
end;
A19: for i being Nat holds P[i] from NAT_1:sch 2(A9,A10);
A20: now
let i be Nat;
assume that
A21: 1 <= i and
A22: i < len r;
thus r.i in T by A7,A21,A22;
then reconsider s = r.i as Element of S;
i = (i-'1)+1 by A21,XREAL_1:235;
then s in P by A19,A22;
then
A23: [s, I] in TerminatingPrograms(A,S,T,f) by A2;
[f.(s, I), C] in TerminatingPrograms(A,S,T,f) by A1;
hence [r.i, I\;C] in TerminatingPrograms(A,S,T,f) &
r.(i+1) = f.(r.i, I\;C) by A7,A21,A22,A23,Def35;
end;
[s,C] in TerminatingPrograms(A,S,T,f) by A1;
hence thesis by A5,A6,A20,Def35;
end;
theorem
for C,I being Element of A
st C is_terminating_wrt f & I is_terminating_wrt f &
for s holds f iteration_terminates_for I\;C, s
holds while(C,I) is_terminating_wrt f
proof
let C,I be Element of A such that
A1: C is_terminating_wrt f and
A2: I is_terminating_wrt f and
A3: for s holds f iteration_terminates_for I\;C, s;
let s;
f iteration_terminates_for I\;C, f.(s,C) by A3;
hence thesis by A1,A2,Th114;
end;
theorem
for P being set for C,I being Element of A
st C is_terminating_wrt f & I is_terminating_wrt f,P &
P is_invariant_wrt C,f & (for s st s in P & f.(f.(s,I),C) in T
holds f.(s,I) in P) &
for s st f.(s,C) in P holds f iteration_terminates_for I\;C, f.(s,C)
holds while(C,I) is_terminating_wrt f,P
proof
let P be set;
let C,I be Element of A such that
A1: C is_terminating_wrt f and
A2: I is_terminating_wrt f,P and
A3: P is_invariant_wrt C,f and
A4: for s st s in P & f.(f.(s,I),C) in T holds f.(s,I) in P and
A5: for s st f.(s,C) in P holds f iteration_terminates_for I\;C, f.(s,C);
let s;
assume
A6: s in P;
then f.(s,C) in P by A3;
hence thesis by A1,A2,A3,A4,A5,A6,Th116;
end;