Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit fa9e239

Browse files
committed
Merge branch 'master' into substitution
2 parents fc17322 + fd345f7 commit fa9e239

File tree

11 files changed

+100
-60
lines changed

11 files changed

+100
-60
lines changed

_oasis

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ License: BSD-3-clause
77
Plugins: META (0.3)
88
AlphaFeatures: ocamlbuild_more_args
99

10-
Executable tlapm
10+
Executable tlapm2
1111
Path: src
1212
BuildTools: ocamlbuild
1313
# CompiledObject: native

_tags

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# OASIS_START
2-
# DO NOT EDIT (digest: eeea92f4095e11397222270722383a49)
2+
# DO NOT EDIT (digest: f0e44f04570ded47df44744f470a0578)
33
# Ignore VCS directories, you can use the same kind of rule outside
44
# OASIS_START/STOP if you want to exclude directories that contains
55
# useless stuff for the build process
@@ -14,7 +14,7 @@ true: annot, bin_annot
1414
".git": not_hygienic
1515
"_darcs": -traverse
1616
"_darcs": not_hygienic
17-
# Executable tlapm
17+
# Executable tlapm2
1818
"src/tlapm.byte": pkg_result
1919
"src/tlapm.byte": pkg_sexplib
2020
"src/tlapm.byte": pkg_str

nunchaku/prelude.nun

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ include "set-theory.nun".
66

77
spec dom : u -> u
88
and app : u -> u -> u :=
9-
forall f g. (dom (upcast f) = dom (upcast g)) && (forall x. mem x (dom (upcast f)) => ((app (upcast f) x)=(app (upcast g) x))) => (f=g).
9+
forall f g. (dom (upcast f) = dom (upcast g))
10+
&& (forall x. t_mem x (dom (upcast f))
11+
=> ((app (upcast f) x)=(app (upcast g) x)))
12+
=> (f=g).

nunchaku/set-theory.nun

+21-21
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,43 @@ val mem_raw : u -> u -> prop.
66
# extensionality
77
axiom forall (A : alpha_u) (B : alpha_u). upcast A = upcast B || (exists (x : alpha_u). ~ (mem_raw (upcast x) (upcast A) = mem_raw (upcast x) (upcast B))).
88

9-
rec mem : u -> u -> prop :=
10-
forall x y. mem x y = (mem_raw x y asserting ((exists a. upcast a = x) && (exists b. upcast b = y))).
11-
# forall x y. mem x y = unique_unsafe (fun P. P = mem_raw x y && (exists a. upcast a = x) && (exists b. upcast b = y)).
9+
rec t_mem : u -> u -> prop :=
10+
forall x y. t_mem x y = (mem_raw x y asserting ((exists a. upcast a = x) && (exists b. upcast b = y))).
11+
# forall x y. t_mem x y = unique_unsafe (fun P. P = mem_raw x y && (exists a. upcast a = x) && (exists b. upcast b = y)).
1212

13-
val trans_mem : alpha_u -> alpha_u -> prop.
13+
val t_trans_mem : alpha_u -> alpha_u -> prop.
1414

1515
# overapproximation of transitive closure
16-
axiom forall x (y : alpha_u). mem_raw (upcast x) (upcast y) => trans_mem x y.
17-
axiom forall x y (z : alpha_u). trans_mem x y && mem_raw (upcast y) (upcast z) => trans_mem x z.
16+
axiom forall x (y : alpha_u). mem_raw (upcast x) (upcast y) => t_trans_mem x y.
17+
axiom forall x y (z : alpha_u). t_trans_mem x y && mem_raw (upcast y) (upcast z) => t_trans_mem x z.
1818

1919
# acyclicity
20-
axiom forall x. ~ trans_mem x x.
20+
axiom forall x. ~ t_trans_mem x x.
2121

2222
# empty set
23-
rec emptyset : u :=
24-
emptyset = unique_unsafe (fun A. forall a. ~ mem_raw (upcast a) A && (exists a. upcast a = A)).
23+
rec t_emptyset : u :=
24+
t_emptyset = unique_unsafe (fun A. forall a. ~ mem_raw (upcast a) A && (exists a. upcast a = A)).
2525

2626
# subset
27-
rec subset : u -> u -> prop :=
28-
forall A B. subset A B = (forall a. mem (upcast a) A => mem (upcast a) B).
27+
rec t_subset : u -> u -> prop :=
28+
forall A B. t_subset A B = (forall a. t_mem (upcast a) A => t_mem (upcast a) B).
2929

3030
# union
31-
rec union : u -> u -> u :=
32-
forall A B. union A B = unique_unsafe (fun C. forall x. mem (upcast x) C = (mem (upcast x) A || mem (upcast x) B)).
31+
rec t_union : u -> u -> u :=
32+
forall A B. t_union A B = unique_unsafe (fun C. forall x. t_mem (upcast x) C = (t_mem (upcast x) A || t_mem (upcast x) B)).
3333

3434
# intersection
35-
rec inter : u -> u -> u :=
36-
forall A B. inter A B = unique_unsafe (fun C. forall x. mem (upcast x) C = (mem (upcast x) A && mem (upcast x) B)).
35+
rec t_inter : u -> u -> u :=
36+
forall A B. t_inter A B = unique_unsafe (fun C. forall x. t_mem (upcast x) C = (t_mem (upcast x) A && t_mem (upcast x) B)).
3737

3838
# substraction
39-
rec minus : u -> u -> u :=
40-
forall A B. minus A B = unique_unsafe (fun C. forall x. mem (upcast x) C = (mem (upcast x) A && ~(mem (upcast x) B))).
39+
rec t_minus : u -> u -> u :=
40+
forall A B. t_minus A B = unique_unsafe (fun C. forall x. t_mem (upcast x) C = (t_mem (upcast x) A && ~(t_mem (upcast x) B))).
4141

4242
# powerset
43-
rec Pow : u -> u :=
44-
forall B. Pow B = unique_unsafe (fun C. forall A. mem (upcast A) C = subset (upcast A) B).
43+
rec t_Pow : u -> u :=
44+
forall B. t_Pow B = unique_unsafe (fun C. forall A. t_mem (upcast A) C = t_subset (upcast A) B).
4545

4646
# big union
47-
rec Union : u -> u :=
48-
forall A. Union A = unique_unsafe (fun U. forall x. mem (upcast x) U = (exists X. mem (upcast x) (upcast X) && mem (upcast X) A)).
47+
rec t_Union : u -> u :=
48+
forall A. t_Union A = unique_unsafe (fun U. forall x. t_mem (upcast x) U = (exists X. t_mem (upcast x) (upcast X) && t_mem (upcast X) A)).

opam

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
opam-version: "1.2"
2+
name: "tlapm2"
3+
version: "dev"
4+
maintainer: "[email protected]"
5+
authors: ["Martin Riener" "Matthieu Lequesne"]
6+
homepage: "https://github.com/tlaplus/v2-tlapm"
7+
bug-reports: "https://github.com/tlaplus/v2-tlapm/issues"
8+
dev-repo: "https://github.com/tlaplus/v2-tlapm.git"
9+
build: [
10+
["oasis" "setup"]
11+
["./configure"
12+
"--prefix" prefix
13+
"--disable-tests"
14+
"--enable-docs"
15+
]
16+
[make "build"]
17+
]
18+
build-doc: [ make "doc" ]
19+
build-test: [ make "test" ]
20+
install: [make "install"]
21+
remove: ["ocamlfind" "remove" "tlapm2"]
22+
depends: [
23+
"ocamlfind" {build}
24+
"base-unix"
25+
"base-threads"
26+
"oasis" {build}
27+
"ocamlbuild" {build}
28+
"xmlm" {>= "1.2.0"}
29+
"sexplib"
30+
"result"
31+
]
32+
depopts: [
33+
"kaputt" {test}
34+
]

setup.ml

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
(* setup.ml generated for the first time by OASIS v0.3.0 *)
22

33
(* OASIS_START *)
4-
(* DO NOT EDIT (digest: 8262f1c4aea1c2f319112ff96e3a5592) *)
4+
(* DO NOT EDIT (digest: 61707546127f264f3558ee487b8fab5c) *)
55
(*
6-
Regenerated by OASIS v0.4.7
6+
Regenerated by OASIS v0.4.8
77
Visit http://oasis.forge.ocamlcore.org for more information and
88
documentation about functions used in this file.
99
*)
@@ -658,6 +658,7 @@ module OASISContext = struct
658658
ignore_unknown_fields: bool;
659659
printf: level -> string -> unit;
660660
srcfs: source OASISFileSystem.fs;
661+
load_oasis_plugin: string -> bool;
661662
}
662663

663664

@@ -682,6 +683,7 @@ module OASISContext = struct
682683
ignore_unknown_fields = false;
683684
printf = printf;
684685
srcfs = new OASISFileSystem.host_fs(Sys.getcwd ());
686+
load_oasis_plugin = (fun _ -> false);
685687
}
686688

687689

@@ -3160,7 +3162,7 @@ module OASISFileUtil = struct
31603162
end
31613163

31623164

3163-
# 3163 "setup.ml"
3165+
# 3165 "setup.ml"
31643166
module BaseEnvLight = struct
31653167
(* # 22 "src/base/BaseEnvLight.ml" *)
31663168

@@ -3240,7 +3242,7 @@ module BaseEnvLight = struct
32403242
end
32413243

32423244

3243-
# 3243 "setup.ml"
3245+
# 3245 "setup.ml"
32443246
module BaseContext = struct
32453247
(* # 22 "src/base/BaseContext.ml" *)
32463248

@@ -5663,7 +5665,7 @@ module BaseCompat = struct
56635665
end
56645666

56655667

5666-
# 5666 "setup.ml"
5668+
# 5668 "setup.ml"
56675669
module InternalConfigurePlugin = struct
56685670
(* # 22 "src/plugins/internal/InternalConfigurePlugin.ml" *)
56695671

@@ -6469,7 +6471,7 @@ module InternalInstallPlugin = struct
64696471
end
64706472

64716473

6472-
# 6472 "setup.ml"
6474+
# 6474 "setup.ml"
64736475
module OCamlbuildCommon = struct
64746476
(* # 22 "src/plugins/ocamlbuild/OCamlbuildCommon.ml" *)
64756477

@@ -6842,7 +6844,7 @@ module OCamlbuildDocPlugin = struct
68426844
end
68436845

68446846

6845-
# 6845 "setup.ml"
6847+
# 6847 "setup.ml"
68466848
module CustomPlugin = struct
68476849
(* # 22 "src/plugins/custom/CustomPlugin.ml" *)
68486850

@@ -6974,7 +6976,7 @@ module CustomPlugin = struct
69746976
end
69756977

69766978

6977-
# 6977 "setup.ml"
6979+
# 6979 "setup.ml"
69786980
open OASISTypes;;
69796981

69806982
let setup_t =
@@ -7075,7 +7077,7 @@ let setup_t =
70757077
[
70767078
Executable
70777079
({
7078-
cs_name = "tlapm";
7080+
cs_name = "tlapm2";
70797081
cs_data = PropList.Data.create ();
70807082
cs_plugin_data = []
70817083
},
@@ -7446,16 +7448,16 @@ let setup_t =
74467448
plugin_data = []
74477449
};
74487450
oasis_fn = Some "_oasis";
7449-
oasis_version = "0.4.7";
7450-
oasis_digest = Some "\135\164\028I\2394\153\181HU\245\236y\192\001\016";
7451+
oasis_version = "0.4.8";
7452+
oasis_digest = Some "\024\000\131hU\200KA\150\252\184s\228.\206\131";
74517453
oasis_exec = None;
74527454
oasis_setup_args = [];
74537455
setup_update = false
74547456
};;
74557457

74567458
let setup () = BaseSetup.setup setup_t;;
74577459

7458-
# 7459 "setup.ml"
7460+
# 7461 "setup.ml"
74597461
let setup_t = BaseCompat.Compat_0_4.adapt_setup_t setup_t
74607462
open BaseCompat.Compat_0_4
74617463
(* OASIS_STOP *)

src/nunchaku/nun_mod.ml

+3-9
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ open Sexplib.Type
22
open Format
33
open CCFormat
44

5-
6-
75
(** Definition **)
86

97
type term =
@@ -99,7 +97,7 @@ and unroll_values v = match v with
9997

10098
and unroll_fun_term l = match l with
10199
| [(List vars);values] -> Fun ((unroll_vars vars),(unroll_values values))
102-
| _ -> failwith "ERROR unroll_fun_term failed"
100+
| _ -> failwith "ERROR unroll_fun_term failed"
103101

104102
let unroll_var v = match v with
105103
| [Atom var_name; var_type] -> (var_name, sexp_to_type var_type)
@@ -110,7 +108,7 @@ let rec sexp_to_fun_model_entry name var_acc t = match t with
110108
| _ -> Const (name, (Fun (var_acc,(unroll_values t))))
111109

112110
let sexp_to_model_entry t = match t with
113-
| List ((Atom "type")::tl) -> sexp_to_type_model_entry tl
111+
| List ((Atom "type")::tl) -> sexp_to_type_model_entry tl
114112
| List [(Atom "val");name;(List ((Atom "fun")::tl))] -> sexp_to_fun_model_entry (sexp_to_name name) [] (List ((Atom "fun")::tl))
115113
| List ((Atom "val")::tl) -> sexp_to_val_model_entry tl
116114
| _ -> failwith "sexp_to_model_entry failed"
@@ -138,7 +136,7 @@ let rec list_to_string print_one separator list =
138136
| t::q -> (print_one t)^separator^(list_to_string print_one separator q)
139137

140138
let comma = ", "
141-
let andand = " && "
139+
let andand = " && "
142140
let newline = " \n"
143141
let space = " "
144142

@@ -187,7 +185,3 @@ let print_nun_mod output_file mod_tree =
187185
fprintf fft "@.%!";
188186
print_flush ();
189187
close_out oc
190-
191-
192-
193-

src/nunchaku/nun_pb.ml

+20-11
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ end = struct
100100
| `Forall -> "forall"
101101
| `Exists -> "exists"
102102
| `Apply -> "app"
103-
| `Mem -> "mem"
104-
| `Intersect -> "inter"
105-
| `Union -> "union"
103+
| `Mem -> "t_mem"
104+
| `Intersect -> "t_inter"
105+
| `Union -> "t_union"
106106
| `Undefined s -> "?_" ^ s
107107

108108
let print out s = Format.pp_print_string out (to_string s)
@@ -305,7 +305,12 @@ let rec unroll_if_ t = match t with
305305

306306
let pp_list_ ~sep p = CCFormat.list ~start:"" ~stop:"" ~sep p
307307

308-
let pp_set p = CCFormat.list ~start:"(unique_unsafe (fun S. forall (x:alpha_u). mem (upcast x) S = ((upcast x) = " ~stop:")))" ~sep:") || ((upcast x) = " p
308+
(* TODO: replace the strings by symbolic represntations of the formulas *)
309+
let pp_set p = CCFormat.list
310+
~start:"(unique_unsafe (fun S. forall (x:alpha_u). t_mem (upcast x) S = ((upcast x) = "
311+
~stop:")))"
312+
~sep:") || ((upcast x) = "
313+
p
309314

310315
let rec print_term out term = match term with
311316
| Builtin s -> Builtin.print out s
@@ -341,25 +346,29 @@ let rec print_term out term = match term with
341346
| Ite (a,b,c) ->
342347
(* special case to avoid deep nesting of ifs *)
343348
let pp_middle out (a,b) =
344-
fpf out "@[<2>else if@ @[%a@]@]@ @[<2>then@ @[%a@]@]" print_term a print_term b
349+
fpf out "@[<2>else if@ @[%a@]@]@ @[<2>then@ @[%a@]@]"
350+
print_term a print_term b
345351
in
346352
let middle, last = unroll_if_ c in
347353
fpf out "@[<hv>@[<2>if@ @[%a@]@]@ @[<2>then@ %a@]@ %a@ @[<2>else@ %a@]@]"
348354
print_term a print_term b
349355
(pp_list_ ~sep:"" pp_middle) middle
350356
print_term last
351357
| Forall ((var,ty),None,t) ->
352-
fpf out "@[<2>(forall %a.@ %a)@]" print_typed_var (var,ty) print_term t (* TODO replace => by to_string Apply *)
358+
fpf out "@[<2>(forall %a.@ %a)@]" print_typed_var (var,ty)
359+
print_term t (* TODO replace => by to_string Apply *)
353360
| Forall ((var,ty),s,t) ->
354-
fpf out "@[<2>(forall %a.@ %a => %a)@]" print_typed_var (var,ty) print_mem (var,s) print_term t (* TODO replace => by to_string Apply *)
361+
fpf out "@[<2>(forall %a.@ %a => %a)@]" print_typed_var (var,ty)
362+
print_mem (var,s) print_term t (* TODO replace => by to_string Apply *)
355363
| Exists ((var,ty),None,t) ->
356364
fpf out "@[<2>(exists %a.@ %a)@]" print_typed_var (var,ty) print_term t
357365
| Exists ((var,ty),s,t) ->
358-
fpf out "@[<2>(exists %a.@ %a && %a)@]" print_typed_var (var,ty) print_mem (var,s) print_term t
366+
fpf out "@[<2>(exists %a.@ %a && %a)@]" print_typed_var (var,ty)
367+
print_mem (var,s) print_term t
359368
| Asserting (_, []) -> assert false
360-
| SetEnum l ->
369+
| SetEnum l ->
361370
begin match l with
362-
| [] -> fpf out "@[<2>%s@]" "emptyset"
371+
| [] -> fpf out "@[<2>%s@]" "t_emptyset"
363372
| _ -> fpf out "@[<2>%a@]" (pp_set print_term_inner) l
364373
end
365374
| Asserting (t, l) ->
@@ -397,7 +406,7 @@ and print_typed_var out (v,ty) = match ty with
397406

398407
and print_mem out (var,set) = match set with
399408
| None -> fpf out ""
400-
| Some t -> fpf out "@ mem %a %a" pp_var_or_wildcard (`Var var) print_term t
409+
| Some t -> fpf out "@ t_mem %a %a" pp_var_or_wildcard (`Var var) print_term t
401410

402411

403412
let pp_rec_defs out l =

src/nunchaku/simple_expr/simple_expr_ds.mli

-1
Original file line numberDiff line numberDiff line change
@@ -281,4 +281,3 @@ type simple_entry =
281281

282282

283283
type simple_term_db = (int * simple_entry) list
284-

src/nunchaku/tla_mod.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ let set_mem_main f = let (_,{cases;_}) = f in set_mem_aux cases []
7979
let nun_to_tla_fun fvar fdt = (List.map fst fvar, nun_to_tla_dt fdt)
8080

8181
let add_fun name fvar fdt model = match name with
82-
| s when s="mem" || s = "trans_mem" || s = "unique_unsafe__u" -> model
82+
| s when s="t_mem" || s = "t_trans_mem" || s = "unique_unsafe__u" -> model
8383
| "mem_raw" -> let mem' = nun_to_tla_fun fvar fdt in
8484
set_mem model (set_mem_main mem')
8585
| "app" -> let app' = nun_to_tla_fun fvar fdt in set_app model (Some app')

src/nunchaku/tla_pb.ml

-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ let print_tla_pb file obl =
1515
Format.fprintf fft "%a" fmt_tla_pb obl;
1616
Format.fprintf fft "@.%!";
1717
close_out oc
18-

0 commit comments

Comments
 (0)