- 
                Notifications
    
You must be signed in to change notification settings  - Fork 243
 
Carrying universes through to the SMT encoding #3699
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
Conversation
…s ... 146 go through
… for nullary universe-polymorphic definitions
…alities on universe projections
…isit, see FStar.List.Tot.Properties.sorted
…n FStar.Monotonic.Pure
| 
           Something is still ignoring universes: module Raise
#set-options "--print_implicits --print_universes"
// [raisable u#a u#b] iff [u#a <= u#b]
assume val raisable : p:prop { Type u#(max a b) } // hack to specify universe parameters for raisable
// (** [raise_t a] is an isomorphic copy of [a] (living in universe a) in universe [b] **)
assume val raise_t (t : Type u#a { raisable u#a u#b }) : Type u#b
[@@expect_failure]
assume val this_does_not_work_as_expected (a: Type u#a) (h: squash (raisable u#0 u#0)) : raise_t u#a u#b a
assume val this_should_not_work (a: Type u#a { raisable u#0 u#0 }) : raise_t u#a u#b aThe last line works, but the query   | 
    
| 
           thanks for the example, will have a look  | 
    
…ific everparse branch
| 
           Just noticed some weirdness when looking at the failures in SCIO*. The last definition fails: open FStar.FunctionalExtensionality
let min2 (t : Type u#1) (x : t) : (int ^-> t) =
  on_domain _ (fun _ -> x)
let min3 (t : Type u#1) (x : int) : (t ^-> int) =
  on_domain _ (fun _ -> x)
let min4 (t : Type u#1) (x : t) : (t ^-> t) =
  on_domain _ (fun _ -> x)
let min' (b : Type0) (t : Type u#1) (x : t) : (b ^-> t) =
  on_domain b (fun _ -> x)
let min (t : Type u#1) (x : t) : ((unit -> Dv int) ^-> t) =
  // idempotence_on_domain u#0 u#1 #(unit -> Dv int) (fun _ -> x);
  on_domain (unit -> Dv int) (fun _ -> x)Uncommenting the lemma call makes it work. Looks like the pattern for this lemma isn't being triggered when the type an effectful arrow? This should be a special case of   | 
    
NB: This is a breaking change and projects that upgrade to this version of F may have to adjust their proofs
Background
In F* PR #2954, I mention work in progress to propagate universes to the SMT encoding.
In #2069, we note that WellFounded.axiom1 is incompatible with universe erasure in the SMT encoding.
In #3647, Gabriel points out that it one can directly exploit the erasure of universes in the SMT encoding to prove a contradiction.
This PR
So, in this PR, Gabriel revived an old incomplete branch where I started to add universes to the SMT encoding. I picked it up from there and propagated universes throughout the SMT encoding, getting things back to a point where the F* repo again verifies. This prevents the unsoundness in #3647.
Impact
The side-effect of this PR is that some proofs needed universe annotations, where previously they didn't. A common case is something like
Previously, one could call
some_lemma (), and F* would default the universe argument u#a to u#0, and since universes were erased anyway in the SMT encoding, this would suffice for a proof that required instantiating the quantifier for some typetsay inType u#1.Now, in such cases, you have to explicit instantiate the universe at which you are invoking the lemma, i.e.,
some_lemma u#1 ()---since there is no way for F* to infer which universe to instantiate to in the caller's context.Impact on other repos