Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A 'textbook' unification algorithm #11

Merged
merged 47 commits into from
Jun 17, 2024
Merged

A 'textbook' unification algorithm #11

merged 47 commits into from
Jun 17, 2024

Conversation

h0nzZik
Copy link
Owner

@h0nzZik h0nzZik commented Jun 17, 2024

I was inspired by this code and the associated paper. But the specification of when the algorithm is supposed to fail is weird there:

Inductive UnifyFailure : list_constr -> Prop :=
  | occ_fail  : forall v t lc, occurs v t -> UnifyFailure (((var v), t) :: lc)
  | occ_fail'  : forall v t lc, occurs v t -> UnifyFailure ((t, (var v)) :: lc)
  | con_app   : forall l r lc, UnifyFailure ((con,(arr l r)) :: lc)
  | app_con   : forall l r lc, UnifyFailure (((arr l r), con) :: lc)
  | app_left  : forall l l' r r' lc, UnifyFailure ((l,l') :: lc) -> UnifyFailure (((arr l r), (arr l' r')) :: lc)
  | app_right  : forall l l' r r' lc, UnifyFailure ((l,l') :: (r, r') :: lc) -> UnifyFailure (((arr l r), (arr l' r')) :: lc)
  | constr_rec : forall t t' l, UnifyFailure l -> UnifyFailure ((t,t') :: l)
  | subs_rec : forall t t' s l, UnifyFailure (apply_subst_constraint s l) -> UnifyFailure ((t,t') :: l).

With such a definition, one is not able to prove the completeness lemma I wanted.
However, with my definition (unify_failure), it works:

Lemma unify_failure_is_severe
  {Σ : StaticModel}
  (es : list eqn)
:
  unify_failure es ->
  ~ exists s : SubT,
    is_unifier_of s es
.

I wonder why the paper didn't contain any result like that - the specification UnifyFailure is not very helpful in saying why the algorithm should fail. Why would anyone take it as a specification?
That said, it was definitely easier to take the paper and this inductive as a starting point than starting from scratch.

@h0nzZik h0nzZik merged commit 09eb56c into main Jun 17, 2024
2 checks passed
@h0nzZik h0nzZik deleted the symex branch June 17, 2024 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant