%----------------------------------------------------------------------------- % Flatten, an operator that takes a sequence of sequences, and concatenates % the elements to form a single sequence of countable length. % % 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_flatten[T: TYPE]: THEORY BEGIN
% I would really like to define flatten like this: % flatten(cseq) = reduce(o)(cseq) % but this theorem is as close as I can come
flatten_concatenate: THEOREM FORALL cseq: nonempty?(cseq) IMPLIES
flatten(cseq) = first(cseq) o flatten(rest(cseq))
flatten_rest_suffix: THEOREM FORALL cseq: nonempty?(flatten(cseq)) IMPLIES LET first = first_p(nonempty?, cseq) IN
rest(flatten(cseq)) =
flatten(add(rest(nth(cseq, first)), suffix(cseq, first + 1)))
flatten_finite: THEOREM FORALL cseq:
is_finite(flatten(cseq)) IFF
is_finite(filter(cseq, nonempty?)) AND every(is_finite)(cseq)
flatten_infinite: THEOREM FORALL cseq:
is_infinite(flatten(cseq)) IFF
is_infinite(filter(cseq, nonempty?)) OR some(is_infinite)(cseq)
finite_flatten_csequence: TYPE = {cseq | is_finite(flatten(cseq))}
fseq: VAR finite_flatten_csequence
% I believe the following two theorems are true. Proving them, however, % is a different matter. If you have a proof strategy to suggest, or a % nicer way of stating these theorems, please contact me. % % flatten_some_converse: THEOREM % FORALL cseq, p: % (EXISTS (i: indexes(cseq)): % some(p)(nth(cseq, i)) AND % (FORALL (j: indexes(cseq)): % j < i IMPLIES is_finite(nth(cseq, j)))) % IMPLIES some(p)(flatten(cseq)) % % flatten_every_converse: THEOREM % FORALL cseq, p: % every(p)(flatten(cseq)) IMPLIES % (FORALL (i: indexes(cseq)): % (FORALL (j: indexes(cseq)): % j < i IMPLIES is_finite(nth(cseq, j))) % IMPLIES every(p)(nth(cseq, i)))
END csequence_flatten
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.