controw flow: synthesizer write modes addition (no tests fix for always and may inersection)

This commit is contained in:
ProgramSnail 2026-03-21 12:13:49 +00:00
parent 2069b6179e
commit 93e8f23c4a
4 changed files with 54 additions and 51 deletions

View file

@ -17,7 +17,7 @@
(name tests_cf) (name tests_cf)
(modules tests) (modules tests)
(flags (-rectypes)) (flags (-rectypes))
(libraries synthesizer_mods tests_f_mods) (libraries synthesizer_cf tests_f_cf)
(inline_tests) (inline_tests)
(wrapped false) (wrapped false)
(preprocess (preprocess
@ -27,7 +27,7 @@
(name tests_f_cf) (name tests_f_cf)
(modules tests_f) (modules tests_f)
(flags (-rectypes)) (flags (-rectypes))
(libraries OCanren OCanren.tester synthesizer_mods) (libraries OCanren OCanren.tester synthesizer_cf)
(preprocessor_deps ../camlp5/pp5+gt+plugins+ocanren+dump.exe) (preprocessor_deps ../camlp5/pp5+gt+plugins+ocanren+dump.exe)
(wrapped false) (wrapped false)
(preprocess (preprocess

View file

@ -22,7 +22,7 @@ struct
module WriteCap = struct module WriteCap = struct
[@@@warning "-26-27-32-33-34-35-36-37-38-39-60-66-67"] [@@@warning "-26-27-32-33-34-35-36-37-38-39-60-66-67"]
[%%ocanren_inject [%%ocanren_inject
type nonrec t = Wr | NWr type nonrec t = AlwaysWr | MayWr | NeverWr
[@@deriving gt ~options:{ show; gmap }] [@@deriving gt ~options:{ show; gmap }]
type nonrec ground = t type nonrec ground = t
] ]
@ -72,49 +72,49 @@ struct
let open CopyCap in let open CopyCap in
let open InCap in let open InCap in
let open OutCap in let open OutCap in
ocanren { Tag (Rd, Wr, Val, In, NOut) } ocanren { Tag (Rd, AlwaysWr, Val, In, NOut) }
let ri_val = let open ReadCap in let ri_val = let open ReadCap in
let open WriteCap in let open WriteCap in
let open CopyCap in let open CopyCap in
let open InCap in let open InCap in
let open OutCap in let open OutCap in
ocanren { Tag (Rd, NWr, Val, In, NOut) } ocanren { Tag (Rd, NeverWr, Val, In, NOut) }
let wi_val = let open ReadCap in let wi_val = let open ReadCap in
let open WriteCap in let open WriteCap in
let open CopyCap in let open CopyCap in
let open InCap in let open InCap in
let open OutCap in let open OutCap in
ocanren { Tag (NRd, Wr, Val, In, NOut) } ocanren { Tag (NRd, AlwaysWr, Val, In, NOut) }
let i_val = let open ReadCap in let i_val = let open ReadCap in
let open WriteCap in let open WriteCap in
let open CopyCap in let open CopyCap in
let open InCap in let open InCap in
let open OutCap in let open OutCap in
ocanren { Tag (NRd, NWr, Val, In, NOut) } ocanren { Tag (NRd, NeverWr, Val, In, NOut) }
let rwi_ref = let open ReadCap in let rwi_ref = let open ReadCap in
let open WriteCap in let open WriteCap in
let open CopyCap in let open CopyCap in
let open InCap in let open InCap in
let open OutCap in let open OutCap in
ocanren { Tag (Rd, Wr, Ref, In, NOut) } ocanren { Tag (Rd, AlwaysWr, Ref, In, NOut) }
let ri_ref = let open ReadCap in let ri_ref = let open ReadCap in
let open WriteCap in let open WriteCap in
let open CopyCap in let open CopyCap in
let open InCap in let open InCap in
let open OutCap in let open OutCap in
ocanren { Tag (Rd, NWr, Ref, In, NOut) } ocanren { Tag (Rd, NeverWr, Ref, In, NOut) }
let wi_ref = let open ReadCap in let wi_ref = let open ReadCap in
let open WriteCap in let open WriteCap in
let open CopyCap in let open CopyCap in
let open InCap in let open InCap in
let open OutCap in let open OutCap in
ocanren { Tag (NRd, Wr, Ref, In, NOut) } ocanren { Tag (NRd, AlwaysWr, Ref, In, NOut) }
let i_ref = let open ReadCap in let i_ref = let open ReadCap in
let open WriteCap in let open WriteCap in
let open CopyCap in let open CopyCap in
let open InCap in let open InCap in
let open OutCap in let open OutCap in
ocanren { Tag (NRd, NWr, Ref, In, NOut) } ocanren { Tag (NRd, NeverWr, Ref, In, NOut) }
(* constraints *) (* constraints *)
let x_any tag = let open InCap in let x_any tag = let open InCap in
@ -141,12 +141,16 @@ struct
let is_not_reado tag = let open ReadCap in ocanren { let is_not_reado tag = let open ReadCap in ocanren {
fresh w_, c_, i_, o_ in fresh w_, c_, i_, o_ in
tag == Tag (NRd, w_, c_, i_, o_) } tag == Tag (NRd, w_, c_, i_, o_) }
let is_writeo tag = let open WriteCap in ocanren { let is_always_writeo tag = let open WriteCap in ocanren {
fresh r_, c_, i_, o_ in fresh r_, c_, i_, o_ in
tag == Tag (r_, Wr, c_, i_, o_) } tag == Tag (r_, AlwaysWr, c_, i_, o_) }
let is_not_writeo tag = let open WriteCap in ocanren { let is_may_writeo tag = let open WriteCap in ocanren {
fresh r_, c_, i_, o_ in fresh r_, c_, i_, o_ in
tag == Tag (r_, NWr, c_, i_, o_) } { tag == Tag (r_, AlwaysWr, c_, i_, o_) |
tag == Tag (r_, MayWr, c_, i_, o_) } }
let is_never_writeo tag = let open WriteCap in ocanren {
fresh r_, c_, i_, o_ in
tag == Tag (r_, NeverWr, c_, i_, o_) }
let is_refo tag = let open CopyCap in ocanren { let is_refo tag = let open CopyCap in ocanren {
fresh r_, w_, i_, o_ in fresh r_, w_, i_, o_ in
tag == Tag (r_, w_, Ref, i_, o_) } tag == Tag (r_, w_, Ref, i_, o_) }
@ -178,7 +182,7 @@ struct
let open CopyCap in let open CopyCap in
let open InCap in let open InCap in
let open OutCap in let open OutCap in
ocanren {q == Tag (Rd, NWr, Ref, In, NOut)}) ocanren {q == Tag (Rd, NeverWr, Ref, In, NOut)})
(fun q -> q#reify reify))) (fun q -> q#reify reify)))
end end
end end
@ -438,7 +442,7 @@ struct
let tag_correcto tg = let tag_correcto tg =
let open Tag in let open Tag in
ocanren { ocanren {
{is_not_outo tg | { is_outo tg & is_writeo tg } } & {is_not_outo tg | { is_outo tg & is_always_writeo tg } } &
{is_not_reado tg | { is_reado tg & is_ino tg } } {is_not_reado tg | { is_reado tg & is_ino tg } }
} }
@ -461,7 +465,7 @@ struct
arg == LValue arg' & arg == LValue arg' &
env_geto state_before id parent_tag mem_id & env_geto state_before id parent_tag mem_id &
env_addo state id arg_tag mem_id state' & env_addo state id arg_tag mem_id state' &
{ is_not_writeo arg_tag | { is_writeo arg_tag & is_writeo parent_tag } } & { is_never_writeo arg_tag | { is_may_writeo arg_tag & is_may_writeo parent_tag } } &
{ {
{ is_reado arg_tag & state' == state'' } | { is_reado arg_tag & state' == state'' } |
{ is_not_reado arg_tag & mem_seto state' id Bot state'' } { is_not_reado arg_tag & mem_seto state' id Bot state'' }
@ -478,14 +482,13 @@ struct
fresh env, mem, mem_len, _visited, parent_tg, _mem_id in fresh env, mem, mem_len, _visited, parent_tg, _mem_id in
state == St (env, mem, mem_len, _visited) & state == St (env, mem, mem_len, _visited) &
env_geto state id parent_tg _mem_id & env_geto state id parent_tg _mem_id &
(* NOTE: replaced with later condition (this one needs fix) *)
(* { is_not_writeo tg | { is_writeo tg & is_writeo parent_tg } } & *)
{ is_not_reado tg | { is_reado tg & mem_checko state_before id } } & { is_not_reado tg | { is_reado tg & mem_checko state_before id } } &
{ { is_not_writeo tg & state == state'} | { { is_never_writeo tg & state == state'} |
{ is_writeo tg & { { is_always_writeo tg &
{ is_outo tg & is_writeo parent_tg & mem_seto state id Unit state' } | is_outo tg & is_may_writeo parent_tg & mem_seto state id Unit state' } |
{ is_may_writeo tg & {
{ is_not_outo tg & is_valueo tg & state == state' } | { is_not_outo tg & is_valueo tg & state == state' } |
{ is_not_outo tg & is_refo tg & is_writeo parent_tg & mem_seto state id Bot state' } { is_not_outo tg & is_refo tg & is_may_writeo parent_tg & mem_seto state id Bot state' }
} } } }
} }
} }
@ -578,7 +581,7 @@ struct
{ fresh id, tag, _mem_id in { fresh id, tag, _mem_id in
stmt == Write id & stmt == Write id &
env_geto state id tag _mem_id & env_geto state id tag _mem_id &
is_writeo tag & is_may_writeo tag &
mem_seto state id Unit state' } mem_seto state id Unit state' }
} }

View file

@ -3,14 +3,14 @@ open Synthesizer
open Relational open Relational
(* type tests *) (* type tests *)
let%expect_test "Tag type test" = print_endline (Tag.Test.test ()); [%expect {| [Tag (Rd, NWr, Ref, In, NOut)] |}] let%expect_test "Tag type test" = print_endline (Tag.Test.test ()); [%expect {| [Tag (Rd, NeverWr, Ref, In, NOut)] |}]
let%expect_test "Stmt type test (1)" = print_endline (Stmt.Test.test1 ()); [%expect {| [[S (S (O))]] |}] let%expect_test "Stmt type test (1)" = print_endline (Stmt.Test.test1 ()); [%expect {| [[S (S (O))]] |}]
let%expect_test "Stmt type test (2)" = print_endline (Stmt.Test.test2 ()); [%expect {| [Call (S (O), [S (S (O))])] |}] let%expect_test "Stmt type test (2)" = print_endline (Stmt.Test.test2 ()); [%expect {| [Call (S (O), [S (S (O))])] |}]
let%expect_test "FunDecl type test" = print_endline (FunDecl.Test.test ()); [%expect {| [FunDecl ([Tag (Rd, Wr, Ref, In, NOut); Tag (Rd, Wr, Val, In, NOut)], [Call (S (O), [O]); Write (S (O))])] |}] let%expect_test "FunDecl type test" = print_endline (FunDecl.Test.test ()); [%expect {| [FunDecl ([Tag (Rd, AlwaysWr, Ref, In, NOut); Tag (Rd, AlwaysWr, Val, In, NOut)], [Call (S (O), [O]); Write (S (O))])] |}]
let%expect_test "Prog type test" = print_endline (Prog.Test.test ()); [%expect {| [Prog ([], FunDecl ([Tag (Rd, NWr, Val, In, NOut)], [Write (O); Read (O)]))] |}] let%expect_test "Prog type test" = print_endline (Prog.Test.test ()); [%expect {| [Prog ([], FunDecl ([Tag (Rd, NeverWr, Val, In, NOut)], [Write (O); Read (O)]))] |}]
let%expect_test "Arg type test" = print_endline (Arg.Test.test ()); [%expect {| [LValue (S (S (S (O))))] |}] let%expect_test "Arg type test" = print_endline (Arg.Test.test ()); [%expect {| [LValue (S (S (S (O))))] |}]
let%expect_test "Value type test" = print_endline (Value.Test.test ()); [%expect {| [Bot; Unit] |}] let%expect_test "Value type test" = print_endline (Value.Test.test ()); [%expect {| [Bot; Unit] |}]
let%expect_test "St type test" = print_endline (St.Test.test ()); [%expect {| [St ([(O, (Tag (Rd, Wr, Val, In, NOut), O))], [Bot], S (O), [O])] |}] let%expect_test "St type test" = print_endline (St.Test.test ()); [%expect {| [St ([(O, (Tag (Rd, AlwaysWr, Val, In, NOut), O))], [Bot], S (O), [O])] |}]
(* function tests *) (* function tests *)
let%expect_test "inv_id test 1" = print_endline (inv_id_t ()); [%expect {| [O] |}] let%expect_test "inv_id test 1" = print_endline (inv_id_t ()); [%expect {| [O] |}]
@ -19,20 +19,20 @@ let%expect_test "inv_id test 3" = print_endline (inv_id_t3 ()); [%expect {| [S (
let%expect_test "list_drop test" = print_endline (list_drop_t ()); [%expect {| [[S (S (S (O)))]] |}] let%expect_test "list_drop test" = print_endline (list_drop_t ()); [%expect {| [[S (S (S (O)))]] |}]
let%expect_test "list_replace test" = print_endline (list_replace_t ()); [%expect {| [[S (O); O; S (S (S (O))); S (S (S (S (O))))]] |}] let%expect_test "list_replace test" = print_endline (list_replace_t ()); [%expect {| [[S (O); O; S (S (S (O))); S (S (S (S (O))))]] |}]
let%expect_test "arG_to_value test 1" = print_endline (arg_to_value_t ()); [%expect {| [Unit] |}] let%expect_test "arG_to_value test 1" = print_endline (arg_to_value_t ()); [%expect {| [Unit] |}]
let%expect_test "st_add_arg test" = print_endline (st_add_arg_t ()); [%expect {| [St ([(O, (Tag (Rd, Wr, Val, In, NOut), O))], [Unit], S (O), [])] |}] let%expect_test "st_add_arg test" = print_endline (st_add_arg_t ()); [%expect {| [St ([(O, (Tag (Rd, AlwaysWr, Val, In, NOut), O))], [Unit], S (O), [])] |}]
let%expect_test "write eval test 1" = print_endline (write_eval_t1 ()); [%expect {| [St ([(S (O), (Tag (NRd, Wr, Ref, In, NOut), S (O))); (O, (Tag (NRd, Wr, Ref, In, NOut), O))], [Bot; Unit], S (S (O)), [])] |}] let%expect_test "write eval test 1" = print_endline (write_eval_t1 ()); [%expect {| [St ([(S (O), (Tag (NRd, AlwaysWr, Ref, In, NOut), S (O))); (O, (Tag (NRd, AlwaysWr, Ref, In, NOut), O))], [Bot; Unit], S (S (O)), [])] |}]
let%expect_test "write eval test 2" = print_endline (write_eval_t2 ()); [%expect {| [St ([(S (O), (Tag (NRd, Wr, Ref, In, NOut), S (O))); (O, (Tag (NRd, Wr, Ref, In, NOut), O))], [Unit; Bot], S (S (O)), [])] |}] let%expect_test "write eval test 2" = print_endline (write_eval_t2 ()); [%expect {| [St ([(S (O), (Tag (NRd, AlwaysWr, Ref, In, NOut), S (O))); (O, (Tag (NRd, AlwaysWr, Ref, In, NOut), O))], [Unit; Bot], S (S (O)), [])] |}]
let%expect_test "multiple writes eval test" = print_endline (writes_eval_t ()); [%expect {| [St ([(S (O), (Tag (NRd, Wr, Ref, In, NOut), S (O))); (O, (Tag (NRd, Wr, Ref, In, NOut), O))], [Unit; Unit], S (S (O)), [])] |}] let%expect_test "multiple writes eval test" = print_endline (writes_eval_t ()); [%expect {| [St ([(S (O), (Tag (NRd, AlwaysWr, Ref, In, NOut), S (O))); (O, (Tag (NRd, AlwaysWr, Ref, In, NOut), O))], [Unit; Unit], S (S (O)), [])] |}]
let%expect_test "call eval test 1" = print_endline (call_eval_t1 ()); [%expect {| [St ([(O, (Tag (NRd, Wr, Ref, In, NOut), O))], [Bot], S (O), [O])] |}] let%expect_test "call eval test 1" = print_endline (call_eval_t1 ()); [%expect {| [St ([(O, (Tag (NRd, AlwaysWr, Ref, In, NOut), O))], [Bot], S (O), [O])] |}]
let%expect_test "call eval test 2" = print_endline (call_eval_t2 ()); [%expect {| [St ([(S (O), (Tag (NRd, Wr, Ref, In, NOut), S (O))); (O, (Tag (NRd, Wr, Ref, In, NOut), O))], [Unit; Bot], S (S (O)), [O])] |}] let%expect_test "call eval test 2" = print_endline (call_eval_t2 ()); [%expect {| [St ([(S (O), (Tag (NRd, AlwaysWr, Ref, In, NOut), S (O))); (O, (Tag (NRd, AlwaysWr, Ref, In, NOut), O))], [Unit; Bot], S (S (O)), [O])] |}]
let%expect_test "call eval test 3" = print_endline (call_eval_t3 ()); [%expect {| [St ([(S (O), (Tag (NRd, Wr, Ref, In, NOut), S (O))); (O, (Tag (NRd, Wr, Ref, In, NOut), O))], [Bot; Unit], S (S (O)), [O])] |}] let%expect_test "call eval test 3" = print_endline (call_eval_t3 ()); [%expect {| [St ([(S (O), (Tag (NRd, AlwaysWr, Ref, In, NOut), S (O))); (O, (Tag (NRd, AlwaysWr, Ref, In, NOut), O))], [Bot; Unit], S (S (O)), [O])] |}]
let%expect_test "call eval test 4" = print_endline (call_eval_t4 ()); [%expect {| [St ([(S (O), (Tag (NRd, Wr, Ref, In, NOut), S (O))); (O, (Tag (NRd, Wr, Ref, In, NOut), O))], [Bot; Bot], S (S (O)), [O])] |}] let%expect_test "call eval test 4" = print_endline (call_eval_t4 ()); [%expect {| [St ([(S (O), (Tag (NRd, AlwaysWr, Ref, In, NOut), S (O))); (O, (Tag (NRd, AlwaysWr, Ref, In, NOut), O))], [Bot; Bot], S (S (O)), [O])] |}]
let%expect_test "call eval test 5" = print_endline (call_eval_t5 ()); [%expect {| [St ([(S (O), (Tag (NRd, Wr, Ref, In, NOut), S (O))); (O, (Tag (NRd, Wr, Ref, In, NOut), O))], [Bot; Bot], S (S (O)), [O])] |}] let%expect_test "call eval test 5" = print_endline (call_eval_t5 ()); [%expect {| [St ([(S (O), (Tag (NRd, AlwaysWr, Ref, In, NOut), S (O))); (O, (Tag (NRd, AlwaysWr, Ref, In, NOut), O))], [Bot; Bot], S (S (O)), [O])] |}]
let%expect_test "mem_set test 1" = print_endline (mem_set_t1 ()); [%expect {| [St ([(O, (Tag (NRd, Wr, Ref, In, NOut), O))], [Unit], S (O), [])] |}] let%expect_test "mem_set test 1" = print_endline (mem_set_t1 ()); [%expect {| [St ([(O, (Tag (NRd, AlwaysWr, Ref, In, NOut), O))], [Unit], S (O), [])] |}]
let%expect_test "mem_set test 2" = print_endline (mem_set_t2 ()); [%expect {| [St ([(O, (Tag (NRd, Wr, Ref, In, NOut), O))], [Bot], S (O), [])] |}] let%expect_test "mem_set test 2" = print_endline (mem_set_t2 ()); [%expect {| [St ([(O, (Tag (NRd, AlwaysWr, Ref, In, NOut), O))], [Bot], S (O), [])] |}]
let%expect_test "mem_set test 3" = print_endline (meem_set_t3 ()); [%expect {| [St ([(O, (Tag (NRd, Wr, Ref, In, NOut), S (O)))], [Bot; Unit], S (S (O)), [])] |}] let%expect_test "mem_set test 3" = print_endline (meem_set_t3 ()); [%expect {| [St ([(O, (Tag (NRd, AlwaysWr, Ref, In, NOut), S (O)))], [Bot; Unit], S (S (O)), [])] |}]
let%expect_test "add_arg_folder test" = print_endline (add_arg_folder_t ()); [%expect {| [St ([(O, (Tag (Rd, Wr, Val, In, NOut), O))], [Unit], S (O), [])] |}] let%expect_test "add_arg_folder test" = print_endline (add_arg_folder_t ()); [%expect {| [St ([(O, (Tag (Rd, AlwaysWr, Val, In, NOut), O))], [Unit], S (O), [])] |}]
let%expect_test "foldl2 test" = print_endline (foldl2_t ()); [%expect {| [St ([(O, (Tag (Rd, Wr, Val, In, NOut), O))], [Unit], S (O), [])] |}] let%expect_test "foldl2 test" = print_endline (foldl2_t ()); [%expect {| [St ([(O, (Tag (Rd, AlwaysWr, Val, In, NOut), O))], [Unit], S (O), [])] |}]
let%expect_test "rvalue test" = print_endline (rvalue_t ()); [%expect {| [[]; [RValue]; [RValue; RValue]] |}] let%expect_test "rvalue test" = print_endline (rvalue_t ()); [%expect {| [[]; [RValue]; [RValue; RValue]] |}]
let%expect_test "empty_state test" = print_endline (empty_state_t ()); [%expect {| [St ([], [], O, [])] |}] let%expect_test "empty_state test" = print_endline (empty_state_t ()); [%expect {| [St ([], [], O, [])] |}]
let%expect_test "function eval test 1" = print_endline (fun_eval_t1 ()); [%expect {| [St ([], [], O, [])] |}] let%expect_test "function eval test 1" = print_endline (fun_eval_t1 ()); [%expect {| [St ([], [], O, [])] |}]
@ -47,10 +47,10 @@ let%expect_test "prog eval test 3" = print_endline (prog_eval_t3 ()); [%expect {
let%expect_test "prog eval test 4" = print_endline (prog_eval_t4 ()); [%expect {| [] |}] let%expect_test "prog eval test 4" = print_endline (prog_eval_t4 ()); [%expect {| [] |}]
let%expect_test "prog eval test 5" = print_endline (prog_eval_t5 ()); [%expect {| [St ([], [], O, [O])] |}] let%expect_test "prog eval test 5" = print_endline (prog_eval_t5 ()); [%expect {| [St ([], [], O, [O])] |}]
let%expect_test "prog eval test 6" = print_endline (prog_eval_t6 ()); [%expect {| [] |}] let%expect_test "prog eval test 6" = print_endline (prog_eval_t6 ()); [%expect {| [] |}]
let%expect_test "synthesis test 1" = print_endline (synt_t1 ()); [%expect {| [Tag (Rd, Wr, Val, In, NOut); Tag (NRd, Wr, Val, In, NOut)] |}] let%expect_test "synthesis test 1" = print_endline (synt_t1 ()); [%expect {| [Tag (Rd, AlwaysWr, Val, In, NOut); Tag (NRd, AlwaysWr, Val, In, NOut)] |}]
let%expect_test "synthesis test 2" = print_endline (synt_t2 ()); [%expect {| [Tag (NRd, Wr, Val, In, NOut); Tag (NRd, Wr, Ref, In, NOut)] |}] let%expect_test "synthesis test 2" = print_endline (synt_t2 ()); [%expect {| [Tag (NRd, AlwaysWr, Val, In, NOut); Tag (NRd, AlwaysWr, Ref, In, NOut)] |}]
let%expect_test "synthesis test 3" = print_endline (synt_t3 ()); [%expect {| [[Tag (NRd, Wr, Val, In, NOut); Tag (NRd, Wr, Val, In, NOut)]; [Tag (NRd, Wr, Ref, In, NOut); Tag (NRd, Wr, Val, In, NOut)]] |}] let%expect_test "synthesis test 3" = print_endline (synt_t3 ()); [%expect {| [[Tag (NRd, AlwaysWr, Val, In, NOut); Tag (NRd, AlwaysWr, Val, In, NOut)]; [Tag (NRd, AlwaysWr, Ref, In, NOut); Tag (NRd, AlwaysWr, Val, In, NOut)]] |}]
let%expect_test "synthesis test 4" = print_endline (synt_t4 ()); [%expect {| [[Tag (NRd, Wr, Val, In, NOut)]] |}] let%expect_test "synthesis test 4" = print_endline (synt_t4 ()); [%expect {| [[Tag (NRd, AlwaysWr, Val, In, NOut)]] |}]
let%expect_test "synthesis test 5" = print_endline (synt_t5 ()); [%expect {| [[Val; Val]; [Val; Ref]; [Ref; Val]; [Ref; Ref]] |}] let%expect_test "synthesis test 5" = print_endline (synt_t5 ()); [%expect {| [[Val; Val]; [Val; Ref]; [Ref; Val]; [Ref; Ref]] |}]
let%expect_test "synthesis test 6" = print_endline (synt_t6 ()); [%expect {| [[Val; Val]; [Val; Ref]; [Ref; Ref]; [Ref; Val]] |}] let%expect_test "synthesis test 6" = print_endline (synt_t6 ()); [%expect {| [[Val; Val]; [Val; Ref]; [Ref; Ref]; [Ref; Val]] |}]
let%expect_test "synthesis test 7" = print_endline (synt_t7 ()); [%expect {| [[Val; Val]; [Ref; Val]] |}] let%expect_test "synthesis test 7" = print_endline (synt_t7 ()); [%expect {| [[Val; Val]; [Ref; Val]] |}]

View file

@ -432,7 +432,7 @@ let synt_t5 _ = show(answerCopyCaps) (Stream.take (run qr
let open St in let open St in
ocanren {fresh q', r' in ocanren {fresh q', r' in
i_any q' & is_not_reado q' & i_any q' & is_not_reado q' &
i_any r' & is_not_reado r' & is_not_writeo r' & i_any r' & is_not_reado r' & is_never_writeo r' &
eq_copyo q' q & eq_copyo r' r & eq_copyo q' q & eq_copyo r' r &
eval_progo (Prog ([FunDecl ([q'; r'], [Write 0])], eval_progo (Prog ([FunDecl ([q'; r'], [Write 0])],
FunDecl ([wi_val; wi_val], [Call (0, [0; 1]); Write 0; Read 0]))) (St ([], [], 0, [0]))}) FunDecl ([wi_val; wi_val], [Call (0, [0; 1]); Write 0; Read 0]))) (St ([], [], 0, [0]))})
@ -447,7 +447,7 @@ let synt_t6 _ = show(answerCopyCaps) (Stream.take (run qr
let open St in let open St in
ocanren {fresh q', r' in ocanren {fresh q', r' in
i_any q' & is_not_reado q' & i_any q' & is_not_reado q' &
i_any r' & is_not_reado r' & is_not_writeo r' & i_any r' & is_not_reado r' & is_never_writeo r' &
eq_copyo q' q & eq_copyo r' r & eq_copyo q' q & eq_copyo r' r &
eval_progo (Prog ([FunDecl ([q'; r'], [Write 0])], eval_progo (Prog ([FunDecl ([q'; r'], [Write 0])],
FunDecl ([wi_val; wi_val], [Call (0, [1; 0]); Write 0; Read 0]))) (St ([], [], 0, [0]))}) FunDecl ([wi_val; wi_val], [Call (0, [1; 0]); Write 0; Read 0]))) (St ([], [], 0, [0]))})
@ -490,7 +490,7 @@ let synt_t9 _ = show(answerCopyCaps) (Stream.take (run qr
let open St in let open St in
ocanren {fresh q', r' in ocanren {fresh q', r' in
i_any q' & is_not_reado q' & i_any q' & is_not_reado q' &
i_any r' & is_reado r' & is_not_writeo r' & i_any r' & is_reado r' & is_never_writeo r' &
eq_copyo q' q & eq_copyo r' r & eq_copyo q' q & eq_copyo r' r &
eval_progo (Prog ([FunDecl ([q'; r'], [Write 0; Read 1])], eval_progo (Prog ([FunDecl ([q'; r'], [Write 0; Read 1])],
FunDecl ([wi_val; wi_val], [Call (0, [0; 1]); Read 0; Read 1]))) (St ([], [], 0, [0]))}) FunDecl ([wi_val; wi_val], [Call (0, [0; 1]); Read 0; Read 1]))) (St ([], [], 0, [0]))})