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

Incorrect subtyping of divergent functions #3659

Open
gebner opened this issue Jan 7, 2025 · 0 comments · May be fixed by #3665
Open

Incorrect subtyping of divergent functions #3659

gebner opened this issue Jan 7, 2025 · 0 comments · May be fixed by #3665

Comments

@gebner
Copy link
Contributor

gebner commented Jan 7, 2025

F* admits a subtyping rule such that a -> b is a subtype of a -> Dv b, irrespective of the universes of a and b. This is clearly inconsistent with (a -> Dv b) <: Type0, as shown using the cardinality argument below.

Thanks to Guido for the incredible idea of generalizing #3644 to Div!

module DivSt

let point t = unit -> t
let dv_point t = unit -> Dv t

let cast (#t: Type u#a) (f: point t) : dv_point t = f
let cast_inj t : squash (Functions.is_inj (cast #t)) = ()

let to_type (#t: Type0) (x: t) : Type0 = y:t { y == x }
let to_type_inj t : squash (Functions.is_inj (to_type #t)) =
  introduce forall (x y: t). to_type x == to_type y ==> x == y with
  introduce _ ==> _ with _.
  let x: to_type x = x in
  let x: to_type y = coerce_eq () x in
  ()

let const #t (x: t) : point t = fun _ -> x
let const_inj t : squash (Functions.is_inj (const #t)) =
  introduce forall (x y: t). const x == const y ==> x == y with
  (assert const x () == x; assert const y () == y)

let f (t: Type u#a) : Type0 = to_type (cast (const t))
let f_inj : squash (Functions.is_inj (f u#a)) =
  to_type_inj (dv_point (Type u#a));
  cast_inj (point (Type u#a));
  const_inj (Type u#a)

let contradiction : squash False =
  Cardinality.Universes.no_inj_universes_suc f
@gebner gebner linked a pull request Jan 9, 2025 that will close this issue
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 a pull request may close this issue.

1 participant