Library LangAlg.terms_w_terms
In this module we describe the reductions between terms (type
๐), primed weak terms (๐') and series-parallel terms (๐๐).
Set Implicit Arguments.
Require Export terms w_terms.
Open Scope term_scope.
Section s.
Variable X : Set.
Variable dec_X : decidable_set X.
We start by defining a conversion function from series parallel
terms over a duplicated alphabet into terms over the original
alphabet.
Fixpoint ๐๐_to_๐ (e : ๐๐ (@X' X)) : ๐ X :=
match e with
| ๐๐_var (a,true) โ ๐_var a
| ๐๐_var (a,false) โ ๐_cvar a
| e โจพ f โ ๐๐_to_๐ e โ ๐๐_to_๐ f
| e โฅ f โ ๐๐_to_๐ e โฉ ๐๐_to_๐ f
end.
match e with
| ๐๐_var (a,true) โ ๐_var a
| ๐๐_var (a,false) โ ๐_cvar a
| e โจพ f โ ๐๐_to_๐ e โ ๐๐_to_๐ f
| e โฅ f โ ๐๐_to_๐ e โฉ ๐๐_to_๐ f
end.
Using this function, we build a translation from primed weak
terms into terms.
Definition ๐'_to_๐ (e : ๐') : ๐ X:=
match e with
| (exist _ (None,A) _) โ โจmap fst Aโฉ
| (exist _ (Some u,A) _ ) โ
โจmap fst Aโฉ โ ๐๐_to_๐ u
end.
match e with
| (exist _ (None,A) _) โ โจmap fst Aโฉ
| (exist _ (Some u,A) _ ) โ
โจmap fst Aโฉ โ ๐๐_to_๐ u
end.
For the converse direction, we directly translate terms into
primed weak terms.
Fixpoint ๐_to_๐' (e : ๐ X) : ๐' :=
match e with
| 1 โ ๐ญ'
| ๐_var a โ (exist _ (Some (๐๐_var (a,true)),[]) (@balanced_nil X))
| ๐_cvar a โ
(exist _ (Some (๐๐_var (a,false)),[]) (@balanced_nil X))
| e โ f โ (๐_to_๐' e) โ' (๐_to_๐' f)
| e โฉ f โ (๐_to_๐' e) โ' (๐_to_๐' f)
end.
match e with
| 1 โ ๐ญ'
| ๐_var a โ (exist _ (Some (๐๐_var (a,true)),[]) (@balanced_nil X))
| ๐_cvar a โ
(exist _ (Some (๐๐_var (a,false)),[]) (@balanced_nil X))
| e โ f โ (๐_to_๐' e) โ' (๐_to_๐' f)
| e โฉ f โ (๐_to_๐' e) โ' (๐_to_๐' f)
end.
The translation from terms to primed weak terms is monotone with
respect to the ordering of ๐'.
The translation from series-parallel terms into terms is size
preserving.
The translation from terms to primed weak terms reduces the
size.
From weak terms to terms the size may increase, but is bounded as follows:
We may recover the variables of a term by map the first
projection to the set of variables of its translation in ๐'.
Lemma variables_๐_to_๐' (t : ๐ X) : โtโ โ map fst (๐'_variables (๐_to_๐' t)).
Going from primed weak terms to terms and back yields an
equivalent ๐'-term.
We can relate the variables of a series parallel term (over the
duplicated alphabet) with the variables of its corresponding
term.
Lemma variables_๐๐_to_๐ (u : ๐๐ (@X' X)) : โ๐๐_to_๐ uโ โ map fst โuโ.
The translation from primed weak terms to terms is monotone.
Going from terms to primed weak terms and back yields an
equivalent term.
The translation from primed weak terms into terms is a
reduction, in the sense that two ๐' terms are ordered if and only
if their images are ordered.
Similarly, the translation from terms to primed weak terms is a
reduction.
Theorem ๐_to_๐'_inf_iff e f : e โค f โ ๐_to_๐' e โค ๐_to_๐' f.
End s.
Close Scope term_scope.
End s.
Close Scope term_scope.
Languages
Lemma ๐๐_to_๐_lang X t ฮฃ (ฯ : ๐ฌ[Xโฮฃ]) : โฆtโง(ฮ ฯ) โ โฆ๐๐_to_๐ tโงฯ.
Lemma ๐'_to_๐_lang X (t : ๐') ฮฃ (ฯ : ๐ฌ[Xโฮฃ]) :
โฆฯ{t}โง(ฮ ฯ) โ โฆ๐'_to_๐ tโงฯ.
โฆฯ{t}โง(ฮ ฯ) โ โฆ๐'_to_๐ tโงฯ.
So is ๐_to_๐', under similar hypotheses.