-
Notifications
You must be signed in to change notification settings - Fork 235
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
WellFounded.axiom1
is incompatible with universe-free SMT encoding
#2069
Comments
Thanks @mtzguido! I've started work on a branch to retain universes in the SMT encoding. It requires a non-trivial structural change to the SMT translation, but it's also the right fix. Will post back here with updates. |
Let me restate that as "no total function..." val fd : unit -> Dv (x:Type u#0 & x)
let rec fd () = (| _, fd |) This works since |
Following several discussions with @aseemr about this, we have the Removing FStar.WellFounded.axiom1_dep/axiom1 and internalizing itAs Bug 2069 shows (#2069) The trouble is that the axiom allows one to write and prove In nik_smt_univs, I have been trying out a variant of the SMT So, we have been considering other ways to express the intent of What is the purpose of FStar.WellFounded.axiom1_depHere's the troublesome axiom.
The purpose of this axiom is to facilitate termination proofs of More concretely, consider:
Here, to justify the recursive call Removing FStar.WellFounded.axiom1_depThe statement of WF.axiom1_dep is problematic---it immediately leads Further, needing to expliclity invoke WF.axiom1 at each call site is We will remove FStar.WellFounded.axiom1_dep. Rather than providing a universe polymorphic WF.axiom1_dep for all Consider this example:
Currently, in the SMT encoding of
The proposal is to add a third ordering axiom to this encoding, of
There are a few points to note about this axiom: -- It states that every element of the co-domain of -- With this change, it should be possible to simply write:
since we'll get Impact on the counterexampleGuido's original counterexample stems from being able to prove that
and due to universe erasure, this leads to But, in this proposal, it is no longer possible to prove One might be concerned about an example such as this one: An inductive type
Two instances of it, with identity functions at universes 0 and 1
You can apply
But, you cannot relate General form of additional ordering axioms on inductivesGiven mutually inductive type definitions introducing types For instance, given
We will generate
Which should allow us to write the following without needing to use
|
Note, this flavor of inducing an ordering only between @misc{Barthe02type-basedtermination, http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.12.4933 For a quick read, consider
See how this plays out in Example 2.18, the additional of ordinals. Notably, in the case of the limit ordinal, analyzing Rephrasing in our setting, given
For |
Fixed in PR #2205 |
WellFounded.axiom1
allows to conclude that a value returned by a function is smaller than the function itself, i.e. thatf x << f
. This makes sense since no function can return itself due to the universe hierarchy, but some universe-polymorphic ones can return a differently instantiated version of itself, like the identity:This is only typable since the first
id
is instantiated "one level up" than its argument, e.g.:However, that is not reflected in the SMT encoding, which means we can trick it into proving
id << id
:We could then recurse on an
id
decreases clause, but that's not even needed, we can immediately prove false callinglem ()
.The annotations are also optional:
After chatting with @nikswamy and @aseemr, we see the root cause of this is the unfaithful encoding. We thought of some possible bandaids to
axiom1
and<<
, but our plan is to make the encoding faithful, which would prevent future surprises.The text was updated successfully, but these errors were encountered: