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

Meta-Theory: Clarify transitive coherence #173

Merged
merged 2 commits into from
Feb 2, 2021

Conversation

nomeata
Copy link
Collaborator

@nomeata nomeata commented Jan 30, 2021

I tried to prove the “weak transitive coherence” that we claim in Coq:

Theorem transitive_coherence:
  forall ta tb tc v1,
  ta <: tb ->
  tb <: tc ->
  v1 :: ta ->
  coerce tb tc (coerce ta tb v1) [=  coerce ta tc v1.

where [= allows more null on the left than on the right. I believed this
holds, but the proof doesn't go through.

A counter example is bool <: opt bool <: opt opt bool.

Coercing true in two steps goes via opt true to opt opt true.
Coercing directly goes to null, because the “constituent-to-opt” rule
t <: opt t' requires that t' is a non-opt type.

We added that restriction in 30f719f for the reasons discussed
in #135 (comment)

This PR just updates the prose to not claim wrong things.

(This is a good humbling reminder about how easy it is to go wrong when
one does not do formal proofs.)

I tried to prove the “weak transitive coherence” that we claim in Coq:

    Theorem transitive_coherence:
      forall ta tb tc v1,
      ta <: tb ->
      tb <: tc ->
      v1 :: ta ->
      coerce tb tc (coerce ta tb v1) [=  coerce ta tc v1.

where [= allows more null on the left than on the right. I believed this
holds, but the proof doesn't go through.

A counter example is `bool <: opt bool <: opt opt bool`.

Coercing `true` in two steps goes via `opt true` to `opt opt true`.
Coercing directly goes to `null`, because the “constituent-to-opt” rule
`t <: opt t'` requires that `t'` is a non-opt type.

We added that restriction in 30f719f for the reasons discussed
in #135 (comment)

This PR just updates the prose to not claim wrong things.

(This is a good humbling reminder about how easy it is to go wrong when
one does not do formal proofs.)
@nomeata nomeata merged commit 9fbffdc into master Feb 2, 2021
@nomeata nomeata deleted the joachim/transitive-coherence branch February 2, 2021 11:00
nomeata added a commit that referenced this pull request Apr 23, 2021
…ence (#171)

A revamp of the Coq development:

 * It models the subtype-checking on decoding (#168). Looks good
 * It connects MiniCandid to the IDL-Soundness theorem. The main work here is the subtyping-compositonality lemma.
   ```
   If t1 <: t2 and s1 in t1 <: s2 in t2 then s1 <: s2.
   ```
   With this in place, instantiating the “canonical subtyping” proof there works nicely.
 * It proves transitive coherence with regard to the relaxed relation as per #173
 * Mild coqdoc’ifiacation. I’d like to eventually render these to HTML and host them somewhere.
   It’s very annoying that Github Action artifacts, even if they are HTML, are not directly accessible with the browser.
   Maybe setup Github pages?
   
It is still a Mini-Candid with a limited set of types, but I think it has all the interesting ones to cover the corner cases. Even adding vectors adds a lot of technical noise with little additional insight (see #154.)
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.

2 participants