fseqs_def [T: TYPE, default: T]: THEORY %------------------------------------------------------------------------ % % A new finite sequences theory % % This theory defines finite sequences as a simple record type. Unlike the prelude % version, this record is not a dependent type. The domain of all finite_sequences % are identical and therefore operators over them are greatly simplified. However, % the built-in equality is no longer valid. This theory provides a new equality % but unfortunately many PVS strategies and commands do not work with this new % equality. Therefore, this theory should be considered highly experimental. % % Two finite sequences are concatenated with the operator 'o', and a % subsequence can be extracted with the operator '^'. Note that ^ % allows any natural numbers m and n to define the range; if m > n then % the empty sequence is returned % % This theory creates two levels of finite_sequence % (1) fsq -- simple structure but equality reasoning not available (see fsq.pvs) % (2) fseq -- adds mechanisms to make equality reasoning possible % though it is expected that most users will use only (2) % % % AUTHORS: Rick Butler and Jeff Maddalon % % Difference between this theory and prelude % (1) domain fs`seq is "nat" rather than below[l(fs)] % (2) ^ operator does not have "min" in the type % (3) provides auxiliary functions such as fseq1, fseq2, const_seq, rev % (4) provides ne_fseq: TYPE = {s: fseq | length(s) > 0} % % Warning: The prelude "finseq_appl" conversion seems to take precedence over % cnvfsq it in many theories that import fseqs % Warning: sometimes seq(fs) is confused with prelude definitions. Use % seqn(fs) in that case. %------------------------------------------------------------------------ BEGIN
IMPORTING fsq[T]
barray(n: nat): TYPE = { f: [nat -> T] | FORALL (i: nat): i >= n IMPLIES f(i) = default}
x,y : VAR T
member_composition: LEMMA
member(x,fs1 o fs2) IFF member(x,fs1) OR member(x,fs2)
concat_right_emptyseq: LEMMA
fs o emptyseq = fs
concat_left_emptyseq: LEMMA
emptyseq o fs = fs
member_singleton: LEMMA
member(x,singleton(y)) IFF x = y
%% ------------ Extraction ---------
mmin(m,n:nat): MACRO nat = IF m > n THEN n ELSE m ENDIF ;
^(fs: fseq, p:[nat, nat]): fseq = LET (m, n) = p INIF m > n OR m >= fs`length THEN empty_seq ELSELET len = mmin(n - m + 1, fs`length - m) IN
(# length := len,
seq := (LAMBDA (x: nat): IF x < len THEN fs`seq(x + m) ELSE default ENDIF) #) ENDIF
%% ----- Some Special Functions that operate on fseqs ----------
fseq1(t:T): fseq = (# length := 1,
seq := (LAMBDA (n: nat): IF n < 1 THEN t ELSE default ENDIF) #)
fseq2(u,v: T): fseq = (# length := 2,
seq := (LAMBDA (i: nat): IF i = 0 THEN u ELSIF i= 1 THEN v ELSE default ENDIF) #)
fseq1_def: LEMMA fseq1(x)`seq(0) = x
const_seq(n: nat,c:T): fseq = (# length := n,
seq := (LAMBDA (i: nat): IF i < n THEN c ELSE default ENDIF)
#)
rev(fs:fseq): fseq = (# length := l(fs),
seq := (LAMBDA (i: nat): IF i < l(fs) THEN seq(fs)(l(fs)-1-i) ELSE default ENDIF)
#)
AUTO_REWRITE+ fseq1_def
END fseqs_def
¤ 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.0.13Bemerkung:
(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.