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

Dummy module for module merge/split #15

Open
alxest opened this issue May 29, 2020 · 1 comment
Open

Dummy module for module merge/split #15

alxest opened this issue May 29, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@alxest
Copy link
Contributor

alxest commented May 29, 2020

Use case

In module merge, we prove sth like this:
ctx [ModTuple mdl mdr] >= ctx[mdl ++ mdr]
Here, source's Midx.ts are ctx ++ mdl while target's are ctx ++ mdl ++ mdr.
Therefore, source can have less undefined behavior in linking.
To solve this nicely, we can put dummy module that only has Midx.t but nothing else.
Then, we can prove something like this:
ctx [ModTuple mdl mdr ++ dummy mdr] >= ctx[mdl ++ mdr].

Problem

In order to define such dummy module, we should have identity element of Sk.t.
(i.e. we need sth like this: forall sk, link sk Sk.empty = Some sk)
However, CompCert's PTree does not support intentional equality, so we can't get such identity element.

Solution

  1. Extend PTree theorems.
  2. Use some equivalence class rather than leibniz equality --> it is an expensive solution...
  3. Do not link Sk.t, instead link prog_defmap Sk.t whose identity element is easily PTree.empty
  4. Put dummy_midxs: list Midx.t in Mod.t, just to evoke UB
  5. Just quantify mdr.(midx) \notin ctx
@alxest alxest added the enhancement New feature or request label May 29, 2020
@alxest
Copy link
Contributor Author

alxest commented May 29, 2020

Quick test:

  Let x :=
    let t0 := (PTree.set 1%positive 10 (PTree.set 3%positive 30 (PTree.set 2%positive 20 (@PTree.empty _)))) in
    let t1 := PTree.set 2%positive 20 (PTree.set 5%positive 50 (PTree.remove 2%positive t0)) in
    t1
  .
  Let p := Eval compute in x.
  Let q := Eval compute in (PTree_Properties.of_list (PTree.elements x)).
  Print p.
  Print q.
  Goal p = q. refl. Qed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant