let s be State of SCM+FSA ; :: thesis: ( s . (intloc 0 ) = 1 implies for c0 being Element of NAT st IC s = c0 holds
for a being Int-Location
for k being Integer st a <> intloc 0 & ( for c being Element of NAT st c in dom (aSeq a,k) holds
(aSeq a,k) . c = s . ((c0 + c) -' 1) ) holds
( ( for i being Element of NAT st i <= len (aSeq a,k) holds
( IC (Comput (ProgramPart s),s,i) = c0 + i & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) ) & (Comput (ProgramPart s),s,(len (aSeq a,k))) . a = k ) )

assume A1: s . (intloc 0 ) = 1 ; :: thesis: for c0 being Element of NAT st IC s = c0 holds
for a being Int-Location
for k being Integer st a <> intloc 0 & ( for c being Element of NAT st c in dom (aSeq a,k) holds
(aSeq a,k) . c = s . ((c0 + c) -' 1) ) holds
( ( for i being Element of NAT st i <= len (aSeq a,k) holds
( IC (Comput (ProgramPart s),s,i) = c0 + i & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) ) & (Comput (ProgramPart s),s,(len (aSeq a,k))) . a = k )

let c0 be Element of NAT ; :: thesis: ( IC s = c0 implies for a being Int-Location
for k being Integer st a <> intloc 0 & ( for c being Element of NAT st c in dom (aSeq a,k) holds
(aSeq a,k) . c = s . ((c0 + c) -' 1) ) holds
( ( for i being Element of NAT st i <= len (aSeq a,k) holds
( IC (Comput (ProgramPart s),s,i) = c0 + i & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) ) & (Comput (ProgramPart s),s,(len (aSeq a,k))) . a = k ) )

assume A2: IC s = c0 ; :: thesis: for a being Int-Location
for k being Integer st a <> intloc 0 & ( for c being Element of NAT st c in dom (aSeq a,k) holds
(aSeq a,k) . c = s . ((c0 + c) -' 1) ) holds
( ( for i being Element of NAT st i <= len (aSeq a,k) holds
( IC (Comput (ProgramPart s),s,i) = c0 + i & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) ) & (Comput (ProgramPart s),s,(len (aSeq a,k))) . a = k )

let a be Int-Location ; :: thesis: for k being Integer st a <> intloc 0 & ( for c being Element of NAT st c in dom (aSeq a,k) holds
(aSeq a,k) . c = s . ((c0 + c) -' 1) ) holds
( ( for i being Element of NAT st i <= len (aSeq a,k) holds
( IC (Comput (ProgramPart s),s,i) = c0 + i & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) ) & (Comput (ProgramPart s),s,(len (aSeq a,k))) . a = k )

let k be Integer; :: thesis: ( a <> intloc 0 & ( for c being Element of NAT st c in dom (aSeq a,k) holds
(aSeq a,k) . c = s . ((c0 + c) -' 1) ) implies ( ( for i being Element of NAT st i <= len (aSeq a,k) holds
( IC (Comput (ProgramPart s),s,i) = c0 + i & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) ) & (Comput (ProgramPart s),s,(len (aSeq a,k))) . a = k ) )

assume that
A3: a <> intloc 0 and
A4: for c being Element of NAT st c in dom (aSeq a,k) holds
(aSeq a,k) . c = s . ((c0 + c) -' 1) ; :: thesis: ( ( for i being Element of NAT st i <= len (aSeq a,k) holds
( IC (Comput (ProgramPart s),s,i) = c0 + i & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) ) & (Comput (ProgramPart s),s,(len (aSeq a,k))) . a = k )

per cases ( k > 0 or k <= 0 ) ;
suppose A5: k > 0 ; :: thesis: ( ( for i being Element of NAT st i <= len (aSeq a,k) holds
( IC (Comput (ProgramPart s),s,i) = c0 + i & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) ) & (Comput (ProgramPart s),s,(len (aSeq a,k))) . a = k )

then reconsider k9 = k as Element of NAT by INT_1:16;
consider k1 being Element of NAT such that
A6: k1 + 1 = k9 and
A7: aSeq a,k9 = <*(a := (intloc 0 ))*> ^ (k1 |-> (AddTo a,(intloc 0 ))) by A5, Def3;
defpred S1[ Nat] means ( $1 <= k9 implies ( IC (Comput (ProgramPart s),s,$1) = c0 + $1 & ( 1 <= $1 implies (Comput (ProgramPart s),s,$1) . a = $1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,$1) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,$1) . f = s . f ) ) );
A8: len (aSeq a,k9) = (len <*(a := (intloc 0 ))*>) + (len (k1 |-> (AddTo a,(intloc 0 )))) by A7, FINSEQ_1:35
.= 1 + (len (k1 |-> (AddTo a,(intloc 0 )))) by FINSEQ_1:56
.= k9 by A6, FINSEQ_1:def 18 ;
A9: for i being Element of NAT st i <= len (aSeq a,k9) holds
( IC (Comput (ProgramPart s),s,i) = c0 + i & ( 1 <= i implies (Comput (ProgramPart s),s,i) . a = i ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) )
proof
A10: now
let i be Element of NAT ; :: thesis: ( i < k9 implies i + 1 in dom (aSeq a,k9) )
assume i < k9 ; :: thesis: i + 1 in dom (aSeq a,k9)
then i in dom (Load (aSeq a,k9)) by A8, Th29;
hence i + 1 in dom (aSeq a,k9) by Th26; :: thesis: verum
end;
A11: now
let i be Element of NAT ; :: thesis: ( i < k9 implies s . (c0 + i) = (aSeq a,k9) . (i + 1) )
assume A12: i < k9 ; :: thesis: s . (c0 + i) = (aSeq a,k9) . (i + 1)
thus s . (c0 + i) = s . (((c0 + i) + 1) -' 1) by NAT_D:34
.= s . ((c0 + (i + 1)) -' 1)
.= (aSeq a,k9) . (i + 1) by A4, A10, A12 ; :: thesis: verum
end;
then A13: s . (c0 + 0 ) = (aSeq a,k9) . (0 + 1) by A5
.= a := (intloc 0 ) by A7, FINSEQ_1:58 ;
A14: now
let n be Element of NAT ; :: thesis: ( n = 0 implies ( Comput (ProgramPart s),s,n = s & CurInstr (ProgramPart (Comput (ProgramPart s),s,n)),(Comput (ProgramPart s),s,n) = a := (intloc 0 ) & Comput (ProgramPart s),s,(n + 1) = Exec (a := (intloc 0 )),s ) )
Y: (ProgramPart (Comput (ProgramPart s),s,n)) /. (IC (Comput (ProgramPart s),s,n)) = (Comput (ProgramPart s),s,n) . (IC (Comput (ProgramPart s),s,n)) by COMPOS_1:38;
assume n = 0 ; :: thesis: ( Comput (ProgramPart s),s,n = s & CurInstr (ProgramPart (Comput (ProgramPart s),s,n)),(Comput (ProgramPart s),s,n) = a := (intloc 0 ) & Comput (ProgramPart s),s,(n + 1) = Exec (a := (intloc 0 )),s )
hence A15: Comput (ProgramPart s),s,n = s by AMI_1:13; :: thesis: ( CurInstr (ProgramPart (Comput (ProgramPart s),s,n)),(Comput (ProgramPart s),s,n) = a := (intloc 0 ) & Comput (ProgramPart s),s,(n + 1) = Exec (a := (intloc 0 )),s )
hence CurInstr (ProgramPart (Comput (ProgramPart s),s,n)),(Comput (ProgramPart s),s,n) = a := (intloc 0 ) by A2, A13, Y; :: thesis: Comput (ProgramPart s),s,(n + 1) = Exec (a := (intloc 0 )),s
thus Comput (ProgramPart s),s,(n + 1) = Following (ProgramPart s),(Comput (ProgramPart s),s,n) by AMI_1:14
.= Exec (a := (intloc 0 )),s by A2, A13, A15, Y ; :: thesis: verum
end;
A16: now
let i be Element of NAT ; :: thesis: ( 1 < i & i <= k9 implies (aSeq a,k9) . i = AddTo a,(intloc 0 ) )
assume that
A17: 1 < i and
A18: i <= k9 ; :: thesis: (aSeq a,k9) . i = AddTo a,(intloc 0 )
A19: 1 <= i - 1 by A17, INT_1:79;
then reconsider i1 = i - 1 as Element of NAT by INT_1:16;
i - 1 <= k9 - 1 by A18, XREAL_1:11;
then A20: i1 in Seg k1 by A6, A19;
len <*(a := (intloc 0 ))*> = 1 by FINSEQ_1:56;
hence (aSeq a,k9) . i = (k1 |-> (AddTo a,(intloc 0 ))) . (i - 1) by A7, A8, A17, A18, FINSEQ_1:37
.= AddTo a,(intloc 0 ) by A20, FUNCOP_1:13 ;
:: thesis: verum
end;
A21: now
let i be Element of NAT ; :: thesis: ( 0 < i & i < k9 implies s . (c0 + i) = AddTo a,(intloc 0 ) )
assume that
A22: 0 < i and
A23: i < k9 ; :: thesis: s . (c0 + i) = AddTo a,(intloc 0 )
A24: ( 0 + 1 < i + 1 & i + 1 <= k9 ) by A22, A23, NAT_1:13, XREAL_1:8;
thus s . (c0 + i) = (aSeq a,k9) . (i + 1) by A11, A23
.= AddTo a,(intloc 0 ) by A16, A24 ; :: thesis: verum
end;
A25: for n being Element of NAT st S1[n] holds
S1[n + 1]
proof
let n be Element of NAT ; :: thesis: ( S1[n] implies S1[n + 1] )
assume A26: S1[n] ; :: thesis: S1[n + 1]
assume A27: n + 1 <= k9 ; :: thesis: ( IC (Comput (ProgramPart s),s,(n + 1)) = c0 + (n + 1) & ( 1 <= n + 1 implies (Comput (ProgramPart s),s,(n + 1)) . a = n + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,(n + 1)) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f ) )

per cases ( n = 0 or n > 0 ) ;
suppose A28: n = 0 ; :: thesis: ( IC (Comput (ProgramPart s),s,(n + 1)) = c0 + (n + 1) & ( 1 <= n + 1 implies (Comput (ProgramPart s),s,(n + 1)) . a = n + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,(n + 1)) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f ) )

hence IC (Comput (ProgramPart s),s,(n + 1)) = (Exec (a := (intloc 0 )),s) . (IC SCM+FSA ) by A14
.= succ (c0 + n) by A2, A28, SCMFSA_2:89
.= (c0 + n) + 1 by NAT_1:39
.= c0 + (n + 1) ;
:: thesis: ( ( 1 <= n + 1 implies (Comput (ProgramPart s),s,(n + 1)) . a = n + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,(n + 1)) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f ) )

hereby :: thesis: ( ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,(n + 1)) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f ) )
assume 1 <= n + 1 ; :: thesis: (Comput (ProgramPart s),s,(n + 1)) . a = n + 1
thus (Comput (ProgramPart s),s,(n + 1)) . a = (Exec (a := (intloc 0 )),s) . a by A14, A28
.= n + 1 by A1, A28, SCMFSA_2:89 ; :: thesis: verum
end;
hereby :: thesis: for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f
let b be Int-Location ; :: thesis: ( b <> a implies (Comput (ProgramPart s),s,(n + 1)) . b = s . b )
assume A29: b <> a ; :: thesis: (Comput (ProgramPart s),s,(n + 1)) . b = s . b
thus (Comput (ProgramPart s),s,(n + 1)) . b = (Exec (a := (intloc 0 )),s) . b by A14, A28
.= s . b by A29, SCMFSA_2:89 ; :: thesis: verum
end;
let f be FinSeq-Location ; :: thesis: (Comput (ProgramPart s),s,(n + 1)) . f = s . f
thus (Comput (ProgramPart s),s,(n + 1)) . f = (Exec (a := (intloc 0 )),s) . f by A14, A28
.= s . f by SCMFSA_2:89 ; :: thesis: verum
end;
suppose A30: n > 0 ; :: thesis: ( IC (Comput (ProgramPart s),s,(n + 1)) = c0 + (n + 1) & ( 1 <= n + 1 implies (Comput (ProgramPart s),s,(n + 1)) . a = n + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,(n + 1)) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f ) )

A31: n < k9 by A27, NAT_1:13;
Y: (ProgramPart (Comput (ProgramPart s),s,n)) /. (IC (Comput (ProgramPart s),s,n)) = (Comput (ProgramPart s),s,n) . (IC (Comput (ProgramPart s),s,n)) by COMPOS_1:38;
A32: n + 0 <= n + 1 by XREAL_1:9;
then A33: CurInstr (ProgramPart (Comput (ProgramPart s),s,n)),(Comput (ProgramPart s),s,n) = s . (c0 + n) by A26, A27, Y, AMI_1:54, XXREAL_0:2
.= AddTo a,(intloc 0 ) by A21, A30, A31 ;
T: ProgramPart s = ProgramPart (Comput (ProgramPart s),s,n) by AMI_1:123;
A34: Comput (ProgramPart s),s,(n + 1) = Following (ProgramPart s),(Comput (ProgramPart s),s,n) by AMI_1:14
.= Exec (AddTo a,(intloc 0 )),(Comput (ProgramPart s),s,n) by A33, T ;
hence IC (Comput (ProgramPart s),s,(n + 1)) = succ (IC (Comput (ProgramPart s),s,n)) by SCMFSA_2:90
.= (c0 + n) + 1 by A26, A27, A32, NAT_1:39, XXREAL_0:2
.= c0 + (n + 1) ;
:: thesis: ( ( 1 <= n + 1 implies (Comput (ProgramPart s),s,(n + 1)) . a = n + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,(n + 1)) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f ) )

A35: 0 + 1 <= n by A30, INT_1:20;
hereby :: thesis: ( ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,(n + 1)) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f ) )
assume 1 <= n + 1 ; :: thesis: (Comput (ProgramPart s),s,(n + 1)) . a = n + 1
thus (Comput (ProgramPart s),s,(n + 1)) . a = n + ((Comput (ProgramPart s),s,n) . (intloc 0 )) by A26, A27, A35, A32, A34, SCMFSA_2:90, XXREAL_0:2
.= n + 1 by A1, A3, A26, A27, A32, XXREAL_0:2 ; :: thesis: verum
end;
hereby :: thesis: for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f
let b be Int-Location ; :: thesis: ( b <> a implies (Comput (ProgramPart s),s,(n + 1)) . b = s . b )
assume A36: b <> a ; :: thesis: (Comput (ProgramPart s),s,(n + 1)) . b = s . b
hence (Comput (ProgramPart s),s,(n + 1)) . b = (Comput (ProgramPart s),s,n) . b by A34, SCMFSA_2:90
.= s . b by A26, A27, A32, A36, XXREAL_0:2 ;
:: thesis: verum
end;
let f be FinSeq-Location ; :: thesis: (Comput (ProgramPart s),s,(n + 1)) . f = s . f
thus (Comput (ProgramPart s),s,(n + 1)) . f = (Comput (ProgramPart s),s,n) . f by A34, SCMFSA_2:90
.= s . f by A26, A27, A32, XXREAL_0:2 ; :: thesis: verum
end;
end;
end;
A37: S1[ 0 ] by A2, AMI_1:13;
A38: for i being Element of NAT holds S1[i] from NAT_1:sch 1(A37, A25);
let i be Element of NAT ; :: thesis: ( i <= len (aSeq a,k9) implies ( IC (Comput (ProgramPart s),s,i) = c0 + i & ( 1 <= i implies (Comput (ProgramPart s),s,i) . a = i ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) )

assume i <= len (aSeq a,k9) ; :: thesis: ( IC (Comput (ProgramPart s),s,i) = c0 + i & ( 1 <= i implies (Comput (ProgramPart s),s,i) . a = i ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) )

hence ( IC (Comput (ProgramPart s),s,i) = c0 + i & ( 1 <= i implies (Comput (ProgramPart s),s,i) . a = i ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) by A8, A38; :: thesis: verum
end;
hence for i being Element of NAT st i <= len (aSeq a,k) holds
( IC (Comput (ProgramPart s),s,i) = c0 + i & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) ; :: thesis: (Comput (ProgramPart s),s,(len (aSeq a,k))) . a = k
1 <= len (aSeq a,k) by A6, A8, NAT_1:11;
hence (Comput (ProgramPart s),s,(len (aSeq a,k))) . a = k by A8, A9; :: thesis: verum
end;
suppose A39: k <= 0 ; :: thesis: ( ( for i being Element of NAT st i <= len (aSeq a,k) holds
( IC (Comput (ProgramPart s),s,i) = c0 + i & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) ) & (Comput (ProgramPart s),s,(len (aSeq a,k))) . a = k )

then reconsider mk = - k as Element of NAT by INT_1:16;
defpred S1[ Nat] means ( $1 <= (mk + 1) + 1 implies ( IC (Comput (ProgramPart s),s,$1) = c0 + $1 & ( 1 <= $1 implies (Comput (ProgramPart s),s,$1) . a = ((- $1) + 1) + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,$1) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,$1) . f = s . f ) ) );
consider k1 being Element of NAT such that
A40: k1 + k = 1 and
A41: aSeq a,k = <*(a := (intloc 0 ))*> ^ (k1 |-> (SubFrom a,(intloc 0 ))) by A39, Def3;
A42: len (aSeq a,k) = (len <*(a := (intloc 0 ))*>) + (len (k1 |-> (SubFrom a,(intloc 0 )))) by A41, FINSEQ_1:35
.= 1 + (len (k1 |-> (SubFrom a,(intloc 0 )))) by FINSEQ_1:56
.= (mk + 1) + 1 by A40, FINSEQ_1:def 18 ;
A43: for i being Element of NAT st i <= len (aSeq a,k) holds
( IC (Comput (ProgramPart s),s,i) = c0 + i & ( 1 <= i implies (Comput (ProgramPart s),s,i) . a = ((- i) + 1) + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) )
proof
A44: now
let i be Element of NAT ; :: thesis: ( i < (mk + 1) + 1 implies i + 1 in dom (aSeq a,k) )
assume i < (mk + 1) + 1 ; :: thesis: i + 1 in dom (aSeq a,k)
then i in dom (Load (aSeq a,k)) by A42, Th29;
hence i + 1 in dom (aSeq a,k) by Th26; :: thesis: verum
end;
A45: now
let i be Element of NAT ; :: thesis: ( i < (mk + 1) + 1 implies s . (c0 + i) = (aSeq a,k) . (i + 1) )
assume A46: i < (mk + 1) + 1 ; :: thesis: s . (c0 + i) = (aSeq a,k) . (i + 1)
thus s . (c0 + i) = s . (((c0 + i) + 1) -' 1) by NAT_D:34
.= s . ((c0 + (i + 1)) -' 1)
.= (aSeq a,k) . (i + 1) by A4, A44, A46 ; :: thesis: verum
end;
then A47: s . (c0 + 0 ) = (aSeq a,k) . (0 + 1)
.= a := (intloc 0 ) by A41, FINSEQ_1:58 ;
A48: for n being Element of NAT st n = 0 holds
( Comput (ProgramPart s),s,n = s & CurInstr (ProgramPart (Comput (ProgramPart s),s,n)),(Comput (ProgramPart s),s,n) = a := (intloc 0 ) & Comput (ProgramPart s),s,(n + 1) = Exec (a := (intloc 0 )),s )
proof
let n be Element of NAT ; :: thesis: ( n = 0 implies ( Comput (ProgramPart s),s,n = s & CurInstr (ProgramPart (Comput (ProgramPart s),s,n)),(Comput (ProgramPart s),s,n) = a := (intloc 0 ) & Comput (ProgramPart s),s,(n + 1) = Exec (a := (intloc 0 )),s ) )
Y: (ProgramPart (Comput (ProgramPart s),s,n)) /. (IC (Comput (ProgramPart s),s,n)) = (Comput (ProgramPart s),s,n) . (IC (Comput (ProgramPart s),s,n)) by COMPOS_1:38;
assume n = 0 ; :: thesis: ( Comput (ProgramPart s),s,n = s & CurInstr (ProgramPart (Comput (ProgramPart s),s,n)),(Comput (ProgramPart s),s,n) = a := (intloc 0 ) & Comput (ProgramPart s),s,(n + 1) = Exec (a := (intloc 0 )),s )
hence A49: Comput (ProgramPart s),s,n = s by AMI_1:13; :: thesis: ( CurInstr (ProgramPart (Comput (ProgramPart s),s,n)),(Comput (ProgramPart s),s,n) = a := (intloc 0 ) & Comput (ProgramPart s),s,(n + 1) = Exec (a := (intloc 0 )),s )
hence CurInstr (ProgramPart (Comput (ProgramPart s),s,n)),(Comput (ProgramPart s),s,n) = a := (intloc 0 ) by A2, A47, Y; :: thesis: Comput (ProgramPart s),s,(n + 1) = Exec (a := (intloc 0 )),s
thus Comput (ProgramPart s),s,(n + 1) = Following (ProgramPart s),(Comput (ProgramPart s),s,n) by AMI_1:14
.= Exec (a := (intloc 0 )),s by A2, A47, A49, Y ; :: thesis: verum
end;
A50: now
let i be Element of NAT ; :: thesis: ( 1 < i & i <= (mk + 1) + 1 implies (aSeq a,k) . i = SubFrom a,(intloc 0 ) )
assume that
A51: 1 < i and
A52: i <= (mk + 1) + 1 ; :: thesis: (aSeq a,k) . i = SubFrom a,(intloc 0 )
A53: i - 1 <= ((mk + 1) + 1) - 1 by A52, XREAL_1:11;
A54: 1 - 1 < i - 1 by A51, XREAL_1:11;
then reconsider i1 = i - 1 as Element of NAT by INT_1:16;
(1 - 1) + 1 <= i - 1 by A54, INT_1:20;
then A55: i1 in Seg k1 by A40, A53;
len <*(a := (intloc 0 ))*> = 1 by FINSEQ_1:56;
hence (aSeq a,k) . i = (k1 |-> (SubFrom a,(intloc 0 ))) . (i - 1) by A41, A42, A51, A52, FINSEQ_1:37
.= SubFrom a,(intloc 0 ) by A55, FUNCOP_1:13 ;
:: thesis: verum
end;
A56: now
let i be Element of NAT ; :: thesis: ( 0 < i & i < (mk + 1) + 1 implies s . (c0 + i) = SubFrom a,(intloc 0 ) )
assume that
A57: 0 < i and
A58: i < (mk + 1) + 1 ; :: thesis: s . (c0 + i) = SubFrom a,(intloc 0 )
A59: ( 0 + 1 < i + 1 & i + 1 <= (mk + 1) + 1 ) by A57, A58, NAT_1:13, XREAL_1:8;
thus s . (c0 + i) = (aSeq a,k) . (i + 1) by A45, A58
.= SubFrom a,(intloc 0 ) by A50, A59 ; :: thesis: verum
end;
A60: for n being Element of NAT st S1[n] holds
S1[n + 1]
proof
let n be Element of NAT ; :: thesis: ( S1[n] implies S1[n + 1] )
assume A61: S1[n] ; :: thesis: S1[n + 1]
assume A62: n + 1 <= (mk + 1) + 1 ; :: thesis: ( IC (Comput (ProgramPart s),s,(n + 1)) = c0 + (n + 1) & ( 1 <= n + 1 implies (Comput (ProgramPart s),s,(n + 1)) . a = ((- (n + 1)) + 1) + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,(n + 1)) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f ) )

per cases ( n = 0 or n > 0 ) ;
suppose A63: n = 0 ; :: thesis: ( IC (Comput (ProgramPart s),s,(n + 1)) = c0 + (n + 1) & ( 1 <= n + 1 implies (Comput (ProgramPart s),s,(n + 1)) . a = ((- (n + 1)) + 1) + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,(n + 1)) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f ) )

hence IC (Comput (ProgramPart s),s,(n + 1)) = (Exec (a := (intloc 0 )),s) . (IC SCM+FSA ) by A48
.= succ (c0 + n) by A2, A63, SCMFSA_2:89
.= (c0 + n) + 1 by NAT_1:39
.= c0 + (n + 1) ;
:: thesis: ( ( 1 <= n + 1 implies (Comput (ProgramPart s),s,(n + 1)) . a = ((- (n + 1)) + 1) + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,(n + 1)) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f ) )

hereby :: thesis: ( ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,(n + 1)) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f ) )
assume 1 <= n + 1 ; :: thesis: (Comput (ProgramPart s),s,(n + 1)) . a = ((- (n + 1)) + 1) + 1
thus (Comput (ProgramPart s),s,(n + 1)) . a = (Exec (a := (intloc 0 )),s) . a by A48, A63
.= ((- (n + 1)) + 1) + 1 by A1, A63, SCMFSA_2:89 ; :: thesis: verum
end;
hereby :: thesis: for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f
let b be Int-Location ; :: thesis: ( b <> a implies (Comput (ProgramPart s),s,(n + 1)) . b = s . b )
assume A64: b <> a ; :: thesis: (Comput (ProgramPart s),s,(n + 1)) . b = s . b
thus (Comput (ProgramPart s),s,(n + 1)) . b = (Exec (a := (intloc 0 )),s) . b by A48, A63
.= s . b by A64, SCMFSA_2:89 ; :: thesis: verum
end;
let f be FinSeq-Location ; :: thesis: (Comput (ProgramPart s),s,(n + 1)) . f = s . f
thus (Comput (ProgramPart s),s,(n + 1)) . f = (Exec (a := (intloc 0 )),s) . f by A48, A63
.= s . f by SCMFSA_2:89 ; :: thesis: verum
end;
suppose A65: n > 0 ; :: thesis: ( IC (Comput (ProgramPart s),s,(n + 1)) = c0 + (n + 1) & ( 1 <= n + 1 implies (Comput (ProgramPart s),s,(n + 1)) . a = ((- (n + 1)) + 1) + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,(n + 1)) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f ) )

A66: n < (mk + 1) + 1 by A62, NAT_1:13;
Y: (ProgramPart (Comput (ProgramPart s),s,n)) /. (IC (Comput (ProgramPart s),s,n)) = (Comput (ProgramPart s),s,n) . (IC (Comput (ProgramPart s),s,n)) by COMPOS_1:38;
A67: n + 0 <= n + 1 by XREAL_1:9;
then A68: CurInstr (ProgramPart (Comput (ProgramPart s),s,n)),(Comput (ProgramPart s),s,n) = s . (c0 + n) by A61, A62, Y, AMI_1:54, XXREAL_0:2
.= SubFrom a,(intloc 0 ) by A56, A65, A66 ;
T: ProgramPart s = ProgramPart (Comput (ProgramPart s),s,n) by AMI_1:123;
A69: Comput (ProgramPart s),s,(n + 1) = Following (ProgramPart s),(Comput (ProgramPart s),s,n) by AMI_1:14
.= Exec (SubFrom a,(intloc 0 )),(Comput (ProgramPart s),s,n) by A68, T ;
hence IC (Comput (ProgramPart s),s,(n + 1)) = succ (IC (Comput (ProgramPart s),s,n)) by SCMFSA_2:91
.= (c0 + n) + 1 by A61, A62, A67, NAT_1:39, XXREAL_0:2
.= c0 + (n + 1) ;
:: thesis: ( ( 1 <= n + 1 implies (Comput (ProgramPart s),s,(n + 1)) . a = ((- (n + 1)) + 1) + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,(n + 1)) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f ) )

A70: 0 + 1 < n + 1 by A65, XREAL_1:8;
hereby :: thesis: ( ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,(n + 1)) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f ) )
assume 1 <= n + 1 ; :: thesis: (Comput (ProgramPart s),s,(n + 1)) . a = ((- (n + 1)) + 1) + 1
thus (Comput (ProgramPart s),s,(n + 1)) . a = (((- n) + 1) + 1) - ((Comput (ProgramPart s),s,n) . (intloc 0 )) by A61, A62, A70, A69, NAT_1:13, SCMFSA_2:91
.= (((- n) + 1) + 1) - (s . (intloc 0 )) by A3, A61, A62, A67, XXREAL_0:2
.= ((- (n + 1)) + 1) + 1 by A1 ; :: thesis: verum
end;
hereby :: thesis: for f being FinSeq-Location holds (Comput (ProgramPart s),s,(n + 1)) . f = s . f
let b be Int-Location ; :: thesis: ( b <> a implies (Comput (ProgramPart s),s,(n + 1)) . b = s . b )
assume A71: b <> a ; :: thesis: (Comput (ProgramPart s),s,(n + 1)) . b = s . b
hence (Comput (ProgramPart s),s,(n + 1)) . b = (Comput (ProgramPart s),s,n) . b by A69, SCMFSA_2:91
.= s . b by A61, A62, A67, A71, XXREAL_0:2 ;
:: thesis: verum
end;
let f be FinSeq-Location ; :: thesis: (Comput (ProgramPart s),s,(n + 1)) . f = s . f
thus (Comput (ProgramPart s),s,(n + 1)) . f = (Comput (ProgramPart s),s,n) . f by A69, SCMFSA_2:91
.= s . f by A61, A62, A67, XXREAL_0:2 ; :: thesis: verum
end;
end;
end;
A72: S1[ 0 ] by A2, AMI_1:13;
A73: for i being Element of NAT holds S1[i] from NAT_1:sch 1(A72, A60);
let i be Element of NAT ; :: thesis: ( i <= len (aSeq a,k) implies ( IC (Comput (ProgramPart s),s,i) = c0 + i & ( 1 <= i implies (Comput (ProgramPart s),s,i) . a = ((- i) + 1) + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) )

assume i <= len (aSeq a,k) ; :: thesis: ( IC (Comput (ProgramPart s),s,i) = c0 + i & ( 1 <= i implies (Comput (ProgramPart s),s,i) . a = ((- i) + 1) + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) )

hence ( IC (Comput (ProgramPart s),s,i) = c0 + i & ( 1 <= i implies (Comput (ProgramPart s),s,i) . a = ((- i) + 1) + 1 ) & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) by A42, A73; :: thesis: verum
end;
hence for i being Element of NAT st i <= len (aSeq a,k) holds
( IC (Comput (ProgramPart s),s,i) = c0 + i & ( for b being Int-Location st b <> a holds
(Comput (ProgramPart s),s,i) . b = s . b ) & ( for f being FinSeq-Location holds (Comput (ProgramPart s),s,i) . f = s . f ) ) ; :: thesis: (Comput (ProgramPart s),s,(len (aSeq a,k))) . a = k
1 <= len (aSeq a,k) by A42, NAT_1:11;
hence (Comput (ProgramPart s),s,(len (aSeq a,k))) . a = ((- ((- k) + (1 + 1))) + 1) + 1 by A42, A43
.= k ;
:: thesis: verum
end;
end;