max_fseq[T: TYPE+, <= : (total_order?[T]) ]: THEORY %------------------------------------------------------------------------ % % max_fseq (basic definitions and properties) % ------------------------------------------- % % Author: Ricky W. Butler % % This theory defines the maximum function over a sequence of values % from an ordered type. This is done in an implementation-independent % manner. % % Imax(s,ii,jj) = general definition of maximum of sequence s % over the internal from ii to jj. Returns the % index into the sequence. % % imax(s) = general definition of maximum of sequence s. % Returns the index into the sequence. % % max(s) = general definition of maximum of sequence s. % Returns the maximal element. % % Notes: % 1. The properties of imax and max are readily obtained via % TYPEPRED "max" and TYPEPRED "imax" or through use of % max_seq_lem and imax_seq_lem. % 2. Since there may be replicates in s, the return type of imax % may not be a singleton set. % %------------------------------------------------------------------------
EXPORTING ALL WITH fseqs[T],fsq[T]
BEGIN
IMPORTING fseqs[T]
% seqs: TYPE = {s: fseq[T] | length(s) > 0} % in?(x,s): bool = (EXISTS (ii: dom(s)): x = seq(s)(ii))
s: VAR ne_fseq
j,ii: VAR nat
x: VAR T
IMPORTING max_array_def
dom(s): TYPE = below(length(s))
abv(ii,s): TYPE = {i: nat | ii <= i AND i < length(s)}
Imax(s, (ii: dom(s)),(jj: abv(ii,s))):
{i: subrange(ii,jj) | (FORALL j: ii <= j AND j <= jj IMPLIES seq(s)(j) <= seq(s)(i))}
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.