- 03 Mar, 2013 1 commit
-
-
Andrei Paskevich authored
In programs, but also in pure theories, it is not safe to compare arbitrary types. For example, if we have a record with ghost fields, a comparison may produce different results before and after ghost code elimination. Even for pure types like 'map' or 'set', it is unlikely that the result of logical equality will be the same as the result of OCaml structural equality on the implemented type. This commit makes the first step towards fixing this issue. We proceed in the following way: 1. Every lsymbol (pure function or predicate symbol) carries a subset of type variables of its signature, called "opaque type variables". By marking a type variable 'a opaque in an lsymbol's signature, the user guarantees that this lsymbol can be implemented without ever comparing values of type 'a. In other words, this is a promise not to break into a type variable. The corresponding syntax is: "predicate safe (x y : ~'a)". All type variables in undefined symbols are non-opaque, unless annotated otherwise. Non-opaque is the default to keep the change conservative. Opacity of type variables in defined symbols is inferred from the definition. If the definition violates a given opacity annotation, an exception is raised. Notice that we only check definitions in _theory_ declarations. One can define an lsymbol in a _task_ in a way that violates opacity. We cannot forbid it, because various elimination transformations would replace safe operations (such as matching) with equalities. This is not a problem, since in the pure logical realm of provers opacity is not required One exception would be Coq, whose transformation chain must never perform such operations. All type variables in inductive predicates are non-opaque. Indeed, we can redefine equality via an inductive predicate. [TODO: find safe forms of inductive definitions and implement more reasonable restrictions.] All type variables in constructors and field symbols are opaque. It is forbidden to instantiate an opacity-preserving symbol with an opacity-breaking one in a clone substitution. 2. Similar type variable tracking is implemented for program symbols. Type variables in the signature of a "val" are non-opaque unless annotated otherwise. Opacity of type variables in defined symbols is inferred from the definition, and an exception is raised, if a given annotation is violated. The internal mechanism of tracking is different: the "eff_compar" field in effects contains the type variables that occur under equality or any other opacity-breaking operation. In this respect, our API is inconsistent between lsymbols and psymbols: the former asks for the opaque tvsymbols, the latter requires us to fill the spec with "comparison effects" for the non-opaque ones. [TODO: add the "~opaque" argument to create_psymbol and make the WhyML core fill the effect under the hood.] Every time an lsymbol or a psymbol is applied in a program, we check the substitution into its signature's type variables. If a non-opaque type variable is instantiated with a program type, an exception is raised. [TODO: be more precise and reject only types with ghost and model components - being mutable, private, or carrying an invariant doesn't conflict with equality.] Notice that we do not allow to compare program types even in the ghost code. This is not needed if we only consider the problems of the code extraction, but _might_ be necessary, if we also want to protect Coq realisations (see below). This commit fixes the immediate problem of breaking the ghost guarantees when equality or some other opacity-breaking lsymbol is applied in a program to a type with ghost or "model" parts. This leaves the problem of code extraction for programs that compare complex types such as maps or sets (Coq driver is affected by this, too, I guess). The next step is to provide annotations for problematic type constructors. A declaration "type ~map 'a 'b" would mean "logical equality on this type is likely to be different from the structural equality on any implementation of this type - therefore do not apply equality to it: neither in programs (because this can't be implemented), nor in pure functions (because they are extracted, too, and because this can't be realized with Leibniz equality in Coq)." [TODO: discuss and implement.] [TODO: mb choose better term for "opaque" and notation for ~'a.]
-
- 07 Feb, 2013 1 commit
-
-
Andrei Paskevich authored
-
- 04 Feb, 2013 1 commit
-
-
Andrei Paskevich authored
-
- 03 Feb, 2013 4 commits
-
-
Andrei Paskevich authored
Now, there are three kinds of types used in WhyML API: ity -- the type of first-order values, "i" stands for "individual" aty -- the type of higher-order values, "a" stands for "arrow" vty -- the sum of the previous two, "v" stands for "value" We should probably rename the VTvalue constructor, since it carries an ity, and not a vty. And I would gladly rename ity to something more appropriate, too.
-
Andrei Paskevich authored
-
Andrei Paskevich authored
Instead, we now store the ghostness boolean directly in pvsymbols, pssymbols, ppatterns, and exprs. We thus remove one level of indirection, and vty_value becomes a one-field record which we remove in the next commit.
-
Andrei Paskevich authored
This simplifies semantics, makes a lot of checks unnecessary, and makes us compatible with OCaml.
-
- 21 Jan, 2013 1 commit
-
-
Andrei Paskevich authored
the Set signature is moved to a separate Extset module, instead of being included into Extmap.S. The module hierarchy becomes simpler, we don't shadow OCaml standard modules anymore, and the bug #15270 is fixed, too.
-
- 19 Dec, 2012 2 commits
-
-
Andrei Paskevich authored
+ rename Mlw_ty.ity_pure to ity_immutable
-
Andrei Paskevich authored
-
- 13 Nov, 2012 2 commits
-
-
Andrei Paskevich authored
-
Andrei Paskevich authored
-
- 21 Oct, 2012 5 commits
-
-
Andrei Paskevich authored
export Why3's extended hash tables as Stdlib.XHashtbl in order to keep OCaml's Hashtbl accessible. Unlike Stdlib.Map which fully covers the OCaml's interface, Stdlib.XHashtbl does not provide polymorphic hash tables.
-
Andrei Paskevich authored
Util now is a small module containing misc functions.
-
Andrei Paskevich authored
-
Andrei Paskevich authored
+ fix a bug in "compare"
-
Andrei Paskevich authored
+ rename Debug.Opt to Debug.Args to avoid conflicts
-
- 20 Oct, 2012 1 commit
-
-
Andrei Paskevich authored
+ create AUTHORS file + fix the linking exception in LICENSE + update the "About" in IDE + remove the trailing whitespace + inflate my scores at Ohloh
-
- 17 Oct, 2012 1 commit
-
-
Andrei Paskevich authored
+ do not build src/programs/ + build the library in lib/why3/ + fix use_api.ml for the case when Alt-Ergo is not present + distribute lib/coq/BuiltIn.v + rename src/config to src/why3config + rename src/bench to src/why3bench + move src/config.ml to src/util/
-
- 23 Sep, 2012 1 commit
-
-
Andrei Paskevich authored
-
- 22 Sep, 2012 1 commit
-
-
Andrei Paskevich authored
-
- 11 Sep, 2012 1 commit
-
-
Claude Marche authored
-
- 24 Aug, 2012 1 commit
-
-
Jean-Christophe Filliâtre authored
-
- 03 Aug, 2012 1 commit
-
-
Andrei Paskevich authored
-
- 02 Aug, 2012 1 commit
-
-
Andrei Paskevich authored
-
- 28 Jul, 2012 2 commits
-
-
Andrei Paskevich authored
-
Andrei Paskevich authored
-
- 23 Jul, 2012 1 commit
-
-
Andrei Paskevich authored
-
- 17 Jul, 2012 2 commits
-
-
Andrei Paskevich authored
-
Andrei Paskevich authored
-
- 16 Jul, 2012 2 commits
-
-
Andrei Paskevich authored
-
Andrei Paskevich authored
- get rid of val_decl, the psymbol/pvsymbol is enough - get rid of vtv_vars, keep the varset in pvsymbol - include fresh regions in pd_news (will serve for clone)
-
- 14 Jul, 2012 2 commits
-
-
Andrei Paskevich authored
-
Andrei Paskevich authored
-
- 12 Jul, 2012 2 commits
-
-
Andrei Paskevich authored
-
Andrei Paskevich authored
-
- 11 Jul, 2012 1 commit
-
-
Andrei Paskevich authored
Merge specifications into program types, as JCF intended.
-
- 08 Jul, 2012 1 commit
-
-
Andrei Paskevich authored
-
- 07 Jul, 2012 1 commit
-
-
Andrei Paskevich authored
-
- 24 Jun, 2012 1 commit
-
-
Andrei Paskevich authored
-