Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e44f9da
fix some tests
cp526 Aug 19, 2026
93a7948
fixes for integer-mode and test updates
cp526 Aug 22, 2026
bd91104
add bw_{and/or/xor}_uf
cp526 Aug 22, 2026
613dbab
dune fmt
cp526 Aug 22, 2026
c8fe09b
typing rules for shifts in integer mode, Hiro's optimisation
cp526 Aug 23, 2026
3e0765f
more
cp526 Aug 23, 2026
045e561
test output fixes
cp526 Aug 24, 2026
2072f4d
remove in_z_range Loc logic
cp526 Aug 24, 2026
f049530
Revert "remove in_z_range Loc logic"
cp526 Aug 24, 2026
cd2b6b1
fix int/pointer cast rules for integer-mode
cp526 Aug 25, 2026
b962d59
arithmetic fixes and additions
cp526 Aug 25, 2026
10b0e4d
more
cp526 Aug 27, 2026
9930548
wib
cp526 Aug 27, 2026
d62cb15
run CI tests with `--always-interp` and adjust test outputs
cp526 Sep 1, 2026
2ca422e
CLZ, CTZ, FFS, FLS
cp526 Sep 1, 2026
981b608
update tests
cp526 Sep 1, 2026
ec58e6c
fix test outputs
cp526 Sep 1, 2026
322af44
more
cp526 Sep 2, 2026
3114f49
dune fmt
cp526 Sep 2, 2026
0906d33
test fixes
cp526 Sep 3, 2026
816d653
fix, as found by Dhruv
cp526 Sep 3, 2026
754cf3f
more, fixes
cp526 Sep 3, 2026
c0a8148
fix
cp526 Sep 3, 2026
02fc7d2
fixes
cp526 Sep 4, 2026
0ea5801
fix tests, switch VIP tests to cvc5
cp526 Sep 6, 2026
df4bab6
test fixes
cp526 Sep 6, 2026
5b5517f
dune fmt
cp526 Sep 6, 2026
a986c60
use the 'fix-integers' CN-tutorial branch while the PR is in-progress
cp526 Sep 6, 2026
6104e3d
wib
cp526 Sep 6, 2026
9824236
add missing terms as unsupported to cn-to-coq
cp526 Sep 6, 2026
40fb8a8
dune fmt
cp526 Sep 6, 2026
acf1a8b
disable Rocq workflow
cp526 Sep 6, 2026
88da706
update cn-seq-test-gen tests
cp526 Sep 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/proof.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,11 @@ jobs:
opam install --yes cn

- name: Checkout cn-tutorial
uses: actions/checkout@v6
uses: actions/checkout@v7
with:
repository: rems-project/cn-tutorial
path: cn-tutorial
ref: fix-integers # remove once the PR is ready

- name: Run CN tests
run: |
Expand Down
File renamed without changes.
12 changes: 10 additions & 2 deletions bin/verify.ml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ let verify
allow_split_magic_comments
disable_derived_lc1
try_hard
always_interp
disable_unfold_multiclause_preds
check_consistency (* integermode *)
=
Expand All @@ -67,6 +68,7 @@ let verify
Solver.solver_type := solver_type;
Solver.solver_flags := solver_flags;
Solver.try_hard := try_hard;
Solver.always_interp := always_interp;
Solver.inc_enabled := solver_inc_enabled;
Solver.inc_timeout := solver_inc_timeout;
Solver.hybrid := solver_hybrid;
Expand Down Expand Up @@ -99,13 +101,13 @@ let verify
~skip_label_inlining:false
~handle_error:(Common.handle_type_error ~json ?output_dir ~serialize_json:json_trace)
~f:(fun ~cabs_tunit:_ ~prog5:_ ~ail_prog:_ ~statement_locs:_ ~paused ->
let check (functions, global_var_constraints, lemmas) =
let check (functions, constraints_to_add, lemmas) =
let open Typing in
let@ errors =
Check.time_check_c_functions
(skip, only)
check_consistency
(global_var_constraints, functions)
(constraints_to_add, functions)
in
if not quiet then
List.iter
Expand Down Expand Up @@ -203,6 +205,11 @@ module Flags = struct
Arg.(value & flag & info ~docs:s_verification [ "try-hard" ] ~doc)


let always_interp =
let doc = "Always use interpreted functions, even for NIA." in
Arg.(value & flag & info ~docs:s_verification [ "always-interp" ] ~doc)


let only =
let doc = "Only type-check this function (or comma-separated names)" in
Arg.(value & opt (list string) [] & info ~docs:s_verification [ "only" ] ~doc)
Expand Down Expand Up @@ -350,6 +357,7 @@ let verify_t : unit Term.t =
$ Common.Flags.allow_split_magic_comments
$ Flags.disable_derived_lc1
$ Flags.try_hard
$ Flags.always_interp
$ Flags.disable_unfold_multiclause_preds
$ Flags.check_consistency

Expand Down
1 change: 1 addition & 0 deletions coq/Cn/Terms.v
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Inductive const : Type :=

(* Unary operators *)
Inductive unop : Type :=
| Abs : unop
| Not : unop
| Negate : unop
| BW_CLZ : unop
Expand Down
2 changes: 1 addition & 1 deletion lib/baseTypes.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let cnBV = ref true
let cnBV = ref false

type sign =
| Signed
Expand Down
9 changes: 7 additions & 2 deletions lib/builtins.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ let min_bits_def (sign, n) =
| Signed -> (Z.(neg @@ shift_left one (Int.sub n 1)), "i")
in
let name = "MIN" ^ letter ^ Int.to_string n in
MT.num_lit_ num (BT.Bits (sign, n)) loc |> mk_builtin_arg0 name
let bt = if !BT.cnBV then BT.Bits (sign, n) else Integer in
MT.num_lit_ num bt loc |> mk_builtin_arg0 name


let max_bits_def (sign, n) =
Expand All @@ -90,7 +91,8 @@ let max_bits_def (sign, n) =
| Signed -> (Z.(shift_left one (Int.sub n 1) - one), "i")
in
let name = "MAX" ^ letter ^ Int.to_string n in
MT.num_lit_ num (BT.Bits (sign, n)) loc |> mk_builtin_arg0 name
let bt = if !BT.cnBV then BT.Bits (sign, n) else Integer in
MT.num_lit_ num bt loc |> mk_builtin_arg0 name


let max_min_bits =
Expand Down Expand Up @@ -176,6 +178,8 @@ let power_def =
mk_arg2 (fun (it, it') loc -> MT.binop Exp (it, it') loc (Terms.get_bt it)) )


let abs_def = ("abs", Sym.fresh "abs", mk_arg1 (fun it loc -> MT.arith_unop Abs it loc))

let rem_def =
( "rem",
Sym.fresh "rem",
Expand Down Expand Up @@ -209,6 +213,7 @@ let builtin_funs
shift_left_def;
shift_right_def;
power_def;
abs_def;
rem_def;
mod_def;
has_alloc_id_def;
Expand Down
15 changes: 13 additions & 2 deletions lib/cLogicalFuns.ml
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,19 @@ let add_logical_funs_from_c call_funinfo funs_to_convert funs =
let@ conv_defs =
ListM.mapM
(fun Mu.{ c_fun_sym; loc; l_fun_sym } ->
if not !BT.cnBV then
failwith "todo: deriving CN function from C function in integer-mode";
let@ () =
if !BT.cnBV then
return ()
else
fail_n
{ loc;
msg =
Generic
!^"Deriving CN functions from C functions not yet supported in \
integer-mode."
[@alert "-deprecated"]
}
in
let@ def = Global.get_logical_function_def loc l_fun_sym in
let@ fbody =
match Pmap.lookup c_fun_sym funs with
Expand Down
Loading
Loading