Mefresa.GCM.Base
More on Idents
Definition ErrorIdent : ident := Ident "ExceptionIdent".
On Paths
Naturaly, two paths are equal if all identifiers constituting them are equal.
Function beq_path (p p':path) {struct p} : bool :=
match p, p' with
| nil, nil => true
| id :: r, id' :: r' => if (id != id') then false else beq_path r r'
| _, _ => false
end.
Bind Scope path_scope with path.
Delimit Scope path_scope with path.
Notation "p1 '==' p2" := (beq_path p1 p2) (at level 80) : path_scope.
Notation "p1 '!=' p2" := (~~ beq_path p1 p2) (at level 80) : path_scope.
Lemma path_refl:
forall p : path, (p == p)%path = true.
Proof.
induction p; simpl; auto.
destruct ident_dec with (id1:=a) (id2:=a).
assert ((a==a) = true).
auto.
unfold bneq_ident.
rewrite H. auto.
congruence.
Qed.
Hint Resolve path_refl.
Lemma path_eq_reflection:
forall p p' : path, (p==p')%path=true <-> p=p'.
Proof.
induction p; induction p'; split; intros; simpl in *; try congruence.
assert ((a==a0)=true -> a = a0).
auto.
assert ((a!=a0)=true -> a <> a0).
auto.
unfold bneq_ident in *.
destruct ((a == a0)).
assert (a = a0); auto.
subst. apply f_equal.
apply IHp; auto.
congruence.
inversion H; subst. clear H.
destruct ident_dec with (id1:=a0) (id2:=a0).
assert ((a0==a0) = true).
auto.
unfold bneq_ident.
rewrite H.
apply IHp. refl.
congruence.
Qed.