%----------------------------------------------------------------------------- % Append an element to a sequence of countable length defined as a coalgebraic % datatype. This operation has no effect if the sequence is infinite. % % Author: Jerry James <loganjerry@gmail.com> % % This file and its accompanying proof file are distributed under the CC0 1.0 % Universal license: http://creativecommons.org/publicdomain/zero/1.0/. % % Version history: % 2007 Feb 14: PVS 4.0 version % 2011 May 6: PVS 5.0 version % 2013 Jan 14: PVS 6.0 version %-----------------------------------------------------------------------------
csequence_append[T: TYPE]: THEORY BEGIN
n: VAR nat
t, u: VAR T
p: VAR pred[T]
state: VAR [csequence, T, bool]
cseq, cseq1, cseq2: VAR csequence
nseq: VAR nonempty_csequence
fseq: VAR finite_csequence
iseq: VAR infinite_csequence
% The boolean distinguishes between the two cases when the sequence part of % the state is empty?: (1) the T has been appended; and (2) the T has not % been appended.
append_struct(state): csequence_struct = IF state`3 THEN inj_empty_cseq ELSIF empty?(state`1) THEN inj_add(state`2, (state`1, state`2, TRUE)) ELSE inj_add(first(state`1), (rest(state`1), state`2, FALSE)) ENDIF