%%-------------------** Term Rewriting System (TRS) **------------------------ %% %% Authors : Andre Luiz Galdino %% Universidade Federal de Goiás - Brasil %% %% and %% %% Mauricio Ayala Rincon %% Universidade de Brasília - Brasil %% %% Last Modified On: April 25, 2011 %% %%----------------------------------------------------------------------------
subterm[variable: TYPE+, symbol: TYPE+, arity: [symbol -> nat]]: THEORY BEGIN
x, y: VAR (V)
p, q: VAR position
s, t: VAR term
i,j: VAR posnat
m,n: VAR nat
%%%% Definition: subterm of t at position p %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subtermOF(t: term, (p: positions?(t))): RECURSIVE term =
(IF length(p) = 0 THEN
t ELSE LET st = args(t),
i = first(p),
q = rest(p) IN
subtermOF(st(i-1), q) ENDIF) MEASURE length(p)
%%%%%%%%%%%% Definition: variables occurring in t %%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Auxiliary lemmas about subterms - Andréia B. Avelar %%%% %%%% Note: the constructor "subterm(?,?)" can be found in the term_adt.pvs %%%%
subterm_empty_seq : LEMMA
subtermOF(s, empty_seq) = s
equal_subterms_equal_term : LEMMA IFFORALL (p : position | positionsOF(s)(p) AND
positionsOF(t)(p) ):
subtermOF(s, p) = subtermOF(t, p) THEN s = t ELSE s /= t ENDIF
subt_of_subt_is_subt_of_term : LEMMA FORALL (s : term,
(k : posnat | positionsOF(s)( #(k))),
(p : position | positionsOF(subtermOF(s, #(k)))(p)),
(x : position | positionsOF(s)(x))):
x = add_first(k, p) IMPLIES
subtermOF(s, x) = subtermOF( subtermOF(s, #(k)), p)
subterm_to_subtermOF : LEMMA FORALL (s : term, t : term):
subterm(s, t) IMPLIES
(EXISTS ( p : position | positionsOF(t)(p) ) : subtermOF(t, p) = s)
subtermOF_to_subterm : LEMMA FORALL (s : term, t: term, (p : position | positionsOF(t)(p))):
subtermOF(t, p) = s IMPLIES subterm(s, t)
subterm_to_subterm : LEMMA FORALL (s : term, t : term, r : term):
( subterm(s, r) AND subterm(r, t) ) IMPLIES subterm(s, t)
comp_of_pos(p : position, n : nat) : RECURSIVE position = IF n = 0 then empty_seq ELSE p o comp_of_pos(p, n - 1) ENDIF MEASURE n
length_comp_p : LEMMA
length(comp_of_pos(p,n)) = n * length(p)
m_neq_n : LEMMA
p /= empty_seq AND m/= n IMPLIES comp_of_pos(p,n) /= comp_of_pos(p,m)
function_inj(p)(n): position = comp_of_pos(p,n)
is_injective_function_inj: LEMMA
p /= empty_seq IMPLIES injective?[nat,(set_of_seq_pos(p))](function_inj(p))
infinite_set_of_seq_pos : LEMMA
p /= empty_seq IMPLIES is_infinite(set_of_seq_pos(p))
comp_of_pos_is_pos: LEMMA FORALL (n: nat): positionsOF(s)(p) AND subtermOF(s, p) = s IMPLIES positionsOF(s)(comp_of_pos(p,n))
subset_of_seq_pos : LEMMA
positionsOF(s)(p) AND subtermOF(s, p) = s IMPLIES
subset?(set_of_seq_pos(p),positionsOF(s))
term_eq_subterm : LEMMA
positionsOF(s)(p) AND subtermOF(s, p) = s IMPLIES p = empty_seq
app_term : LEMMA
( positionsOF(s)(p) AND positionsOF(s)(q) AND child(p, q) ) IMPLIES app?(subtermOF(s, q))
positions_of_a_term : LEMMA FORALL (p : position | positionsOF(t)(p)) :
positionsOF(t)(q) IMPLIES (left_without_children(p, q) OR
left_without_children(q, p) OR
child(p, q) OR
(EXISTS(q1 : position) :
positionsOF(subtermOF(t, p))(q1) AND q = p o q1) )
equal_app_term : LEMMA
( app?(s) AND app?(t) AND f(s) = f(t) AND args(s) = args(t) ) IMPLIES s = t
equal_term : LEMMA FORALL (s : term,
t : term,
p : position | positionsOF(s)(p) AND
positionsOF(t)(p)) :
( (FORALL (q: position | positionsOF(s)(q) AND
positionsOF(t)(q)):
left_without_children(p, q) =>
subtermOF(s, q) = subtermOF(t, q)) AND
(FORALL (q: position | positionsOF(s)(q) AND
positionsOF(t)(q)):
left_without_children(q, p) =>
subtermOF(s, q) = subtermOF(t, q)) AND
(FORALL (p1: position | positionsOF(s)(p1) AND
positionsOF(t)(p1)):
child(p, p1) => f(subtermOF(s, p1)) = f(subtermOF(t, p1))) AND
subtermOF(s, p) = subtermOF(t, p) AND NOT p = empty_seq ) IMPLIES s = t
END subterm
¤ 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.15Bemerkung:
(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.