Definition contained (l: list ident) (g1 g2: generator) : Prop :=
  forall id, In id l -> within id g1 g2.

Lemma contained_app: forall l1 l2 g1 g2, contained l1 g1 g2 -> contained l2 g1 g2 -> contained (l1 ++ l2) g1 g2.