Top.Util.Label
IMPORTANT
THIS IS A COPY OF THE ATOMS FILE, RENAMED TO LABELSDefinition
Module Type LABEL.
Parameter label : Set.
Parameter label_fresh_for_list :
∀ (xs : list label), {x : label | ¬ List.In x xs}.
Declare Module Label_as_OT : UsualOrderedType with Definition t := label.
Parameter eq_label_dec : ∀ x y : label, {x = y} + {x ≠ y}.
End LABEL.
The implementation of the above interface is hidden for documentation purposes.
Basic operations on finite sets of labels are available, in the remainder of this file, without qualification. We use Import instead of Export in order to avoid unnecessary namespace pollution.
We instantiate two modules which provide useful lemmas and tactics work working with finite sets of labels.
Module LabelSetDecide := FSetDecide.Decide LabelSet.F.
Module LabelSetNotin := FSetNotin.Notin LabelSet.F.
Module LabelSetFacts := FSetFacts.Facts LabelSet.F.
Module LabelSetProperties := FSetProperties.Properties LabelSet.F.
Tactics for working with finite sets of labels
The tactic notin_simpl simplifies all hypotheses of the form (~ In x F), where F is constructed from the empty set, singleton sets, and unions.
The tactic notin_solve, solves goals of the form (~ In x F), where F is constructed from the empty set, singleton sets, and unions. The goal must be provable from hypothesis of the form simplified by notin_simpl.
Lemmas for working with finite sets of labels
Notation leq_if_Equal := LabelSet.eq_if_Equal.
Notation lnotin_empty := LabelSetNotin.notin_empty.
Notation lnotin_singleton := LabelSetNotin.notin_singleton.
Notation lnotin_singleton_rw := LabelSetNotin.notin_singleton_rw.
Notation lnotin_union := LabelSetNotin.notin_union.
Additional tactics
Picking a fresh label
(beautify_lset V) takes a set V built as a union of finite sets and returns the same set with empty sets removed and union operations associated to the right. Duplicate sets are also removed from the union.
The tactic (pick fresh Y for L) takes a finite set of labels L and a fresh name Y, and adds to the context an label with name Y and a proof that (~ In Y L), i.e., that Y is fresh for L. The tactic will fail if Y is already declared in the context.
Tactic Notation "pick" "fresh" "label" ident(Y) "for" constr(L) :=
let Fr := fresh "Fr" in
let L := beautify_lset L in
(destruct (label_fresh_for_set L) as [Y Fr]).
Demonstration
- Repeatedly invoke gather_labels_with, using functions with different argument types each time.
- Union together the result of the calls, and invoke (pick fresh ... for ...) with that union of sets.
Lemma example_pick_fresh_use : ∀ (x y z : label) (L1 L2 L3: labels), True.
Proof.
intros x y z L1 L2 L3. example_pick_fresh k.
At this point in the proof, we have a new label k and a hypothesis Fr : ¬ In k (union L1 (union L2 (union L3 (union (singleton x) (union (singleton y) (singleton z)))))).
trivial.
Qed.
Notation "x =l= y" := (eq_label_dec x y) (at level 67) : metatheory_scope.
Definition labels_disjoint (xs : labels) (ys: labels) : Prop :=
LabelSet.F.Empty (LabelSet.F.inter xs ys).