%%-------------------** Term Rewriting System (TRS) **------------------------ %% %% Authors : Ana Cristina Rocha Oliveira, Andre Galdino and Mauricio Ayala Rincon %% Universidade de Brasília - Brasil %% Orthogonality theory formalizing confluence of orthogonal rewriting systems %% subtheories mem_test and mem_tes2 specify properties between finite sequences %% and associated sets that are necessary for dealing adequately with sequences %% of positions, rules and substitutions involved in parallel rewriting steps. %% The theory orthogonality is the main one. %% %% Last Modified On: June 28, 2013 %% %%--------------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% mem_test is an auxiliary theory formalising properties related with length and %% cardinality and membership of elements in finite_sequences and associated sets. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
mem_test[T: TYPE] : THEORY BEGIN IMPORTING structures@seq_extras[T],
structures@seq2set[T]
x : VAR T
seq, seq1, seq2: VAR finseq[T]
E : VAR set[T]
n : VAR nat
P : VAR [[T, T] -> bool]
P1 : VAR [[nat, T] -> bool]
member_seq(x, seq): bool = EXISTS(i:below[seq`length]): x = seq(i)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Orthogonality contains specification of notions related with orthogonal %% rewriting systems, parallel rewriting and the formalization of theorems %% of confluence of left and right linear non-ambiguous TRSs and the main %% theorem of confluence of orthogonal TRSs. %% The inductive proof of the main theorem uses the Parallel Moves Lemma. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
orthogonality[variable:TYPE+, symbol: TYPE+, arity: [symbol -> nat]]: THEORY
n: VAR nat
s, t, t1, t2: VAR term
sigma, sg1, sg2, alpha, delta, theta: VAR Sub
p,q,p1,p2,p3,q1,q2: VAR position
rho, rho1, rho2: VAR Ren
e, e1o, e2o, e1, e1p, e2, e2p: VAR rewrite_rule
E: VAR set[rewrite_rule]
R: VAR pred[[term, term]]
x, y: VAR (V)
fsq, fsp, fsp1, fsp2: VAR finseq[position]
fse, fse1, fse2: VAR finseq[rewrite_rule]
fss, fss1, fss2: VAR finseq[Sub]
fsv: VAR finseq[(V)]
fst, fst1, fst2: VAR finseq[term]
PO1, PO2, PE: VAR PP
%%%% Basic specific definitions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% ntCP? is the predicate for non trivially generated CPs %%%%%%%%%%%%%%%%%%%%%%%% %%%%% This in contrast with CP? excludes all CPs generated by sobreposition of %%%%%% %%%%% a rule with itself at root position and is used to define ambiguity. %%%%%% %%%%% The necessity of this notion was gently pointed out by Rene Thiemann. %%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ntCP?(E)(t1, t2): bool = EXISTS (sigma,rho,
(e1 | member(e1, E)),
(e2p | member(e2p, E)),
(p: positions?(lhs(e1)))): NOT (e1 = e2p AND p = empty_seq) AND LET e2 = (# lhs := ext(rho)(lhs(e2p)), rhs := ext(rho)(rhs(e2p)) #) IN
disjoint?(Vars(lhs(e1)),Vars(lhs(e2))) & NOT vars?(subtermOF(lhs(e1), p)) &
mgu(sigma)(subtermOF(lhs(e1), p), lhs(e2)) &
t1 = ext(sigma)(rhs(e1)) &
t2 = replaceTerm(ext(sigma)(lhs(e1)), ext(sigma)(rhs(e2)), p)
% Lemma of inclusions of the rewriting relation in the parallel rewriting relation % and the latter in the reflexive-transitive closure of the former relation.
parallel_reduction_inclusion: LEMMA
subset?(reduction?(E), parallel_reduction?(E))
& subset?(parallel_reduction?(E), RTC(reduction?(E)))
% The reflexive-transitive clousures of the rewriting and the parallel % rewriting relations are equivalent.
parallel_reduction_RTC: LEMMA
RTC(reduction?(E)) = RTC(parallel_reduction?(E))
% Once you rewrite in parallel at positions fsp which are % parallel to position p ("p || fsp"), a term in which position p is % preserved is obtained.
replace_par_pos_preservs_pos: LEMMA
SPP?(t)(add_first(p,fsp)) AND fst`length = fsp`length
=> positionsOF(replace_par_pos(t, fsp, fst))(p)
% When you replace the subterms at the positions in fsp, % those positions are preserved in the resulting term.
replace_par_pos_preservs_PP: LEMMA
SPP?(t)(fsp) AND fst`length = fsp`length
=> (FORALL (i : below[fsp`length]) : positionsOF(replace_par_pos(t, fsp, fst))(fsp(i)))
% Same of replace_par_pos_preserv_pos but instead for % a unique position p || fsp for a sequence of positions fsq || fsp.
replace_par_pos_preservs_PP_o_PP: LEMMA
SPP?(t)(fsp o fsq ) AND fst`length = fsp`length
=> (FORALL (i : below[fsq`length]) : positionsOF(replace_par_pos(t, fsp, fst))(fsq(i)))
% If you replace the first parallel position firstly or lastly, % that does not change the resulting term.
replace_par_pos_equivalence: LEMMA
SPP?(s)(fsp) AND fsp`length /= 0 AND fst`length = fsp`length
=> replace_par_pos(replaceTerm(s, fst(0), fsp(0)), rest(fsp), rest(fst)) =
replaceTerm(replace_par_pos(s, rest(fsp), rest(fst)), fst(0), fsp(0))
% Generalization of the previous result: you can pick up any position to start to work % with replace_par_pos and that does not change the result.
replace_par_pos_equivalence1: LEMMA
SPP?(s)(fsp) AND fsp`length /= 0 AND fst`length = fsp`length AND n < fsp`length
=> replace_par_pos(replaceTerm(s, fst(n), fsp(n)), delete(fsp,n), delete[term](fst,n)) =
replace_par_pos(s,fsp,fst)
% If you apply replace_par_pos in positions fsp, then the subterm % at any position p || fsp is preserved.
replace_par_pos_preservs_subterm: LEMMA
SPP?(t)(add_first(p,fsp)) AND fst`length = fsp`length
=> subtermOF(replace_par_pos(t, fsp, fst), p) = subtermOF(t, p)
% When one rewrites in parallel at fsp, the subterms of the resulting term % at fsp are exatly the terms in fst.
replace_par_pos_subterm: LEMMA
SPP?(t)(fsp) AND fst`length = fsp`length
=> (FORALL (i : below[fsp`length]) : subtermOF(replace_par_pos(t, fsp, fst),fsp(i))=fst(i))
% If you replace the subterms at a composition of sequences 'fsp1 o fsp2', % that are parallel, it is the same that doing it separately.
replace_par_pos_comp: LEMMA
SPP?(t)(fsp1 o fsp2) AND fst1`length = fsp1`length AND fst2`length = fsp2`length
=> replace_par_pos(t, fsp1 o fsp2, fst1 o fst2) =
replace_par_pos(replace_par_pos(t, fsp1, fst1),fsp2, fst2)
%% In general, applying replace_par_pos at a parallel composition of sequences %% fsp1 o fsp2 is commutative.
replace_par_pos_comp_commute: LEMMA
SPP?(t)(fsp1 o fsp2) AND fst1`length = fsp1`length AND fst2`length = fsp2`length IMPLIES
replace_par_pos(t, fsp1 o fsp2, fst1 o fst2) =
replace_par_pos(t, fsp2 o fsp1, fst2 o fst1)
%% Replacing at the position q of t by the result of replacing in parallel at positions fsp of s %% gives as result the same as replacing at positions q o fsp of t[q<-s].
replace_replace_par_pos: LEMMA
positionsOF(t)(q) AND SPP?(s)(fsp) AND fst`length = fsp`length IMPLIES
replaceTerm(t, replace_par_pos(s,fsp,fst), q) = replace_par_pos(replaceTerm(t,s,q), comp_pos(q,fsp), fst)
Pos_Over_and_Pos_Equal_dominance: LEMMA
SPP?(t)(fsp1) & SPP?(t)(fsp2) IMPLIES
(FORALL(i:below[fsp1`length]): EXISTS(j:below[(Pos_Over(fsp1,fsp2) o Pos_Over(fsp2,fsp1) o Pos_Equal(fsp1,fsp2))`length]):
(Pos_Over(fsp1,fsp2) o Pos_Over(fsp2,fsp1) o Pos_Equal(fsp1,fsp2))`seq(j) <= fsp1`seq(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.