let S be non empty set ; for T being Subset of S
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 ) )
let T be Subset of S; 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 ) )
let A be 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 ) )
let g be 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 ) )
let s0 be 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 ) )
reconsider Ss0 = S --> s0 as Element of Funcs S,S ;
set Z = Funcs S,S;
deffunc H1( Element of A) -> set = (curry' g) . $1;
A1:
for I being Element of A st I in ElementaryInstructions A holds
H1(I) in Funcs S,S
reconsider idS = id S as Element of Funcs S,S by ALTCAT_1:2;
deffunc H2( Element of Funcs S,S, Element of Funcs S,S) -> Element of Funcs S,S = $2 * $1;
deffunc H3( Element of Funcs S,S, Element of Funcs S,S, Element of Funcs S,S) -> Element of Funcs S,S = ($2,T +* $3) * $1;
deffunc H4( Element of Funcs S,S, Element of Funcs S,S) -> Element of Funcs S,S = (T,Ss0 iter ($1 * $2)) * $1;
consider h being Function of the carrier of A,(Funcs S,S) such that
A3:
for I being Element of A st I in ElementaryInstructions A holds
h . I = H1(I)
and
A4:
h . (EmptyIns A) = idS
and
A5:
for I1, I2 being Element of A holds h . (I1 \; I2) = H2(h . I1,h . I2)
and
A6:
for C, I1, I2 being Element of A holds h . (if-then-else C,I1,I2) = H3(h . C,h . I1,h . I2)
and
A7:
for C, I being Element of A holds h . (while C,I) = H4(h . C,h . I)
from AOFA_000:sch 7(A1);
h in Funcs the carrier of A,(Funcs S,S)
by FUNCT_2:11;
then
uncurry' h in Funcs [:S,the carrier of A:],S
by FUNCT_6:20;
then reconsider f = uncurry' h as Function of [:S,the carrier of A:],S by FUNCT_2:121;
A8:
dom h = the carrier of A
by FUNCT_2:def 1;
A9:
dom idS = S
by FUNCT_2:def 1;
A10:
f is complying_with_empty-instruction
A11:
f is complying_with_catenation
proof
let s be
Element of
S;
AOFA_000:def 29 for I1, I2 being Element of A holds f . s,(I1 \; I2) = f . (f . s,I1),I2let I1,
I2 be
Element of
A;
f . s,(I1 \; I2) = f . (f . s,I1),I2
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 A8, A12, FUNCT_5:46
.=
((h . I2) * (h . I1)) . s
by A5
.=
(h . I2) . ((h . I1) . s)
by FUNCT_2:21
.=
(h . I2) . (f . s,I1)
by A8, A13, FUNCT_5:46
.=
f . (f . s,I1),
I2
by A8, A14, FUNCT_5:46
;
verum
end;
A15:
f complies_with_if_wrt T
proof
let s be
Element of
S;
AOFA_000:def 30 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 ) )let C,
I1,
I2 be
Element of
A;
( ( 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 ) )
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 A8, A16, FUNCT_5:46
.=
H3(
h . C,
h . I1,
h . I2)
. s
by A6
.=
((h . I1),T +* (h . I2)) . ((h . C) . s)
by FUNCT_2:21
;
A21:
f . s,
C = (h . C) . s
by A8, A17, FUNCT_5:46;
hereby ( f . s,C nin T implies f . s,(if-then-else C,I1,I2) = f . (f . s,C),I2 )
assume
f . s,
C in T
;
f . s,(if-then-else C,I1,I2) = f . (f . s,C),I1hence f . s,
(if-then-else C,I1,I2) =
(h . I1) . (f . s,C)
by A18, A20, A21, Th4
.=
f . (f . s,C),
I1
by A8, A18, FUNCT_5:46
;
verum
end;
assume
f . s,
C nin T
;
f . s,(if-then-else C,I1,I2) = f . (f . s,C),I2
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 A8, A19, FUNCT_5:46
;
verum
end;
f complies_with_while_wrt T
proof
let s be
Element of
S;
AOFA_000:def 31 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 ) )let C,
I be
Element of
A;
( ( 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 ) )
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 A8, A22, FUNCT_5:46
.=
H4(
h . C,
h . I)
. s
by A7
.=
(T,Ss0 iter ((h . C) * (h . I))) . ((h . C) . s)
by FUNCT_2:21
;
A27:
f . s,
C = (h . C) . s
by A8, A23, FUNCT_5:46;
A28:
rng ((h . C) * (h . I)) c= S
;
hereby ( f . s,C nin T implies f . s,(while C,I) = f . s,C )
assume
f . s,
C in T
;
f . s,(while C,I) = f . (f . (f . s,C),I),(while C,I)hence f . s,
(while C,I) =
(T,Ss0 iter ((h . C) * (h . I))) . (((h . C) * (h . I)) . (f . s,C))
by A25, A26, A27, A28, A29, Th11, FUNCT_2:113
.=
(T,Ss0 iter ((h . C) * (h . I))) . ((h . C) . ((h . I) . (f . s,C)))
by FUNCT_2:21
.=
((T,Ss0 iter ((h . C) * (h . I))) * (h . C)) . ((h . I) . (f . s,C))
by FUNCT_2:21
.=
((T,Ss0 iter ((h . C) * (h . I))) * (h . C)) . (f . (f . s,C),I)
by A8, A24, FUNCT_5:46
.=
(h . (while C,I)) . (f . (f . s,C),I)
by A7
.=
f . (f . (f . s,C),I),
(while C,I)
by A8, A22, FUNCT_5:46
;
verum
end;
thus
(
f . s,
C nin T implies
f . s,
(while C,I) = f . s,
C )
by A25, A26, A27, A28, Th12;
verum
end;
then reconsider f = f as ExecutionFunction of A,S,T by A10, A11, A15, Def32;
take
f
; ( 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 ) )
dom f = [:S,the carrier of A:]
by FUNCT_2:def 1;
then A30:
[:S,(ElementaryInstructions A):] c= dom f
by ZFMISC_1:118;
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
set ;
( a in dom g implies g . a = f . a )assume A33:
a in dom g
;
g . a = f . athen consider s,
I being
set such that A34:
s in S
and A35:
I in ElementaryInstructions A
and A36:
a = [s,I]
by ZFMISC_1:def 2;
reconsider s =
s as
Element of
S by A34;
reconsider I =
I as
Element of
A by A35;
reconsider EI =
(curry' g) . I as
Element of
Funcs S,
S by A1, A35;
g in Funcs [:S,(ElementaryInstructions A):],
S
by FUNCT_2:11;
then
curry' g in Funcs (ElementaryInstructions A),
(Funcs S,S)
by A33, FUNCT_6:19;
then A37:
dom (curry' g) = ElementaryInstructions A
by FUNCT_2:169;
A38:
dom EI = S
by FUNCT_2:169;
A39:
dom (h . I) = S
by FUNCT_2:169;
thus g . a =
g . s,
I
by A36
.=
EI . s
by A35, A37, A38, FUNCT_5:41
.=
(h . I) . s
by A3, A35
.=
f . s,
I
by A8, A39, FUNCT_5:46
.=
f . a
by A36
;
verum end;
hence
f | [:S,(ElementaryInstructions A):] = g
by A31, A32, FUNCT_1:68; 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
let s be 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
let C, I be Element of A; ( not f iteration_terminates_for I \; C,f . s,C implies f . s,(while C,I) = s0 )
assume A40:
not f iteration_terminates_for I \; C,f . s,C
; f . s,(while C,I) = s0
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 A8, A41, FUNCT_5:46
.=
H4(h . C,h . I) . s
by A7
.=
(T,Ss0 iter ((h . C) * (h . I))) . ((h . C) . s)
by FUNCT_2:21
;
A45:
f . s,C = (h . C) . s
by A8, A42, FUNCT_5:46;
A46:
rng ((h . C) * (h . I)) c= S
;
rng h c= Funcs S,S
;
then
h = curry' f
by FUNCT_5:55;
then
(curry' f) . (I \; C) = (h . C) * (h . I)
by A5;
then
((h . C) * (h . I)) orbit (f . s,C) c= T
by A40, Th87;
hence f . s,(while C,I) =
Ss0 . (f . s,C)
by A43, A44, A45, A46, Def7
.=
s0
by FUNCOP_1:13
;
verum