Skip to content

Commit

Permalink
Fix issue 1099
Browse files Browse the repository at this point in the history
The `D_cnf` module didn't use the flag `toplevel` as it was done in `Cnf`.
This flag is important because the `Expr` AST doesn't store quantified
type variables with binders as it does for the term variable. Instead, we
use a `prenex polymorphism` approach, which means the quantified type
variables are at the top level only.

I believe this PR fixes the issue OCamlPro#1099.
  • Loading branch information
Halbaroth committed Apr 30, 2024
1 parent 05e98a4 commit 1be1c40
Show file tree
Hide file tree
Showing 4 changed files with 305 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib/frontend/d_cnf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ let rec mk_expr

| Binder ((Forall (tyvl, tvl) | Exists (tyvl, tvl)) as e, body) ->
if tvl == []
then (Cache.store_tyvl tyvl; aux_mk_expr ~toplevel body)
then (Cache.store_tyvl tyvl; aux_mk_expr ~toplevel:false body)
else
let name =
if !name_tag = 0 then name_base
Expand Down Expand Up @@ -1520,7 +1520,7 @@ let rec mk_expr
end
in
let in_theory = decl_kind == E.Dtheory in
let f = aux_mk_expr ~toplevel body in
let f = aux_mk_expr ~toplevel:false body in
let qbody = E.purify_form f in
(* All the triggers that are encoutered at this level are assumed
to be user-defined. *)
Expand Down
294 changes: 293 additions & 1 deletion tests/dune.inc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions tests/issues/1099.ae
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type 'a t
logic p : 'a t, unit -> prop
logic f : 'a t -> prop
logic r : unit t

axiom a : forall s:'a t. exists n:unit. p(s, n)

goal g : f(r)
2 changes: 2 additions & 0 deletions tests/issues/1099.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

unknown

0 comments on commit 1be1c40

Please sign in to comment.