Commit graph

26 commits

Author SHA1 Message Date
Dmitry Stefantsov 41f1407ca8 [kernel-f11n] Prove that valid configuration is well-formed
Bug:
Change-Id: Ib7272cbe377f9e8c71ca4d289d170a0cc173ba6b
Reviewed-on: https://dart-review.googlesource.com/12640
Reviewed-by: Samir Jindel <sjindel@google.com>
2017-10-12 14:13:58 +00:00
Dmitry Stefantsov 6a5b0c7b60 [kernel-f11n] Add missing cases of configuration_wf and step
Bug:
Change-Id: I2c521a54a3d45b3908ebe0b6147a5cef1221e040
Reviewed-on: https://dart-review.googlesource.com/12441
Reviewed-by: Samir Jindel <sjindel@google.com>
2017-10-12 14:07:44 +00:00
Dmitry Stefantsov fcd2abfe7b [kernel-f11n] Define the properties of configuration validity
Change-Id: I8f312cb914042a8713eae9171c724708d986e09f
Reviewed-on: https://dart-review.googlesource.com/10540
Reviewed-by: Samir Jindel <sjindel@google.com>
2017-10-12 14:05:13 +00:00
Dmitry Stefantsov 005f998de0 [kernel-f11n] Add skeleton for soundness properties and theorems
Change-Id: I7230398d576f922ef150ec6678fcfda6b9cbfc40
Reviewed-on: https://dart-review.googlesource.com/8620
Reviewed-by: Samir Jindel <sjindel@google.com>
2017-10-03 11:21:57 +00:00
Dmitry Stefantsov 172aecaac8 [kernel-f11n] Move another helper theorem about maps to Common.v
Change-Id: Ice6d0c2c6fec6a9ae525d300799892ca4bb563bc
Reviewed-on: https://dart-review.googlesource.com/9480
Reviewed-by: Samir Jindel <sjindel@google.com>
2017-10-02 15:15:40 +00:00
Dmitry Stefantsov fbf3c4f8f1 [kernel-f11n] Fix operational semantics w.r.t. changes in object model
Recently `member_env` was simplified in the object model, and the
corresponding changes should be done in the operational semantics.
Additionally, the existence theorem now can be fully proven.

Change-Id: I30f86bd5d7e9b89eefc02fd51d928a9af139eee1
Reviewed-on: https://dart-review.googlesource.com/9341
Reviewed-by: Samir Jindel <sjindel@google.com>
2017-09-29 08:15:03 +00:00
Samir Jindel ed0590b532 [kernel-f11n] Cleanup to object model.
- Fix force_options so it doesn't take so long to run
- Fix property get typechecking so it forces getters to be synchronized with
  methods.
- Simplify member_env.

Bug:
Change-Id: I3e2a0710c7fde950e7573ba6216820907b9ae374
Reviewed-on: https://dart-review.googlesource.com/9040
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-28 14:20:01 +00:00
Dmitry Stefantsov 1c882d8958 [kernel-f11n] Use getters in operational semantics and update hypotheses
The changes in the object model that introduce getters are reflected in
`value_of_type`, `step`, and `configuration_wf` relationships.  Additionally,
the program well-formedness hypothesis is updated, so that it uses `lib_to_env`
function defined in the object model.  A few other well-formedness hypotheses
are added.  The existence proof for the next configuration is adjusted.

Change-Id: I14ca8aac5830a6ea0fc96f3f37818fdda3fa2c07
Reviewed-on: https://dart-review.googlesource.com/8880
Reviewed-by: Samir Jindel <sjindel@google.com>
2017-09-28 13:44:10 +00:00
Samir Jindel 77736e83f2 [kernel-f11n] Fix statement typing and complete proof of statement typing consistency.
Previously, we inferred the return type of statements in a way that made it
impossible to prove the statement typing consistency. Now, we use just the
stated return type for checking statements.

The proofs of statement typing are complete, except for one result generalizing
the expression typing consistency result to multiple variables changing; this
result is obvious to see directly from the provided lemmas but very tedious to
prove in Coq.

Bug:
Change-Id: I0bbcfb613df7510015f278fa85021ba0b3e57503
Reviewed-on: https://dart-review.googlesource.com/9020
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-28 13:20:00 +00:00
Samir Jindel cf0d17df57 [kernel-coq] Correct statement of subtyping consistency, extend to statements.
Bug:
Change-Id: I48f073fa592ccdac56fb63b33b7d9961be5fc3fe
Reviewed-on: https://dart-review.googlesource.com/8220
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-27 13:39:05 +00:00
Samir Jindel 1cac4c7924 [kernel-coq] Extend interfaces to contain getters.
Bug:
Change-Id: If8411f356496017cf371349b3edfae3972725662
Reviewed-on: https://dart-review.googlesource.com/8121
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-26 17:39:15 +00:00
Samir Jindel b75f1baaf2 [kernel-coq] Cleaning up and exposing program well-formedness proof.
Bug:
Change-Id: If55a527f439a7bec39f2d286a582cb606efdabfb
Reviewed-on: https://dart-review.googlesource.com/7554
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-22 11:55:53 +00:00
Dmitry Stefantsov 5daf3c6d9d [kernel] Add the theorem about existence of next configuration
* The definition of the well-formedness property for
  configurations is added.
* The theorem that states that the abstract CESK-machine can
  make one transition step from any well-formed configuration
  is defined and proven.
* Execution of a variable declaration statement is added to
  the operational semantics formalization with all necessary
  changes (one new eval configuration, three new transition
  rules).
* Some auxiliary theorems are added. One of them states that
  any runtime value has its method bodies in the function
  environment.

Change-Id: I95f233a4db498ce0df76983d9e605c3c263100bb
Reviewed-on: https://dart-review.googlesource.com/7266
Reviewed-by: Samir Jindel <sjindel@google.com>
2017-09-22 08:55:43 +00:00
Samir Jindel 4087297d4a [kernel-coq] Proof for program well-formedness.
Bug:
Change-Id: I614d967fc0386c2c4cb0c56586f7f7c2e50b033a
Reviewed-on: https://dart-review.googlesource.com/7362
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-21 14:00:43 +00:00
Samir Jindel 8ebdd7662f [kernel-coq] Build class and function table, allow mutually recursive functions and classes.
Bug:
Change-Id: I0d1fb82bccdf8174e4ab5ffdd38301600ecf4dd2
Reviewed-on: https://dart-review.googlesource.com/6620
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-20 12:51:34 +00:00
Dmitry Stefantsov 2aef206f3f [kernel] Add the first draft of Kernel operational semantics in Coq
The semantics is defined for a small subset of Kernel.

Change-Id: I39b72c5671e9ca0dee86a5a6068fe745ad1728f1
Reviewed-on: https://dart-review.googlesource.com/5860
Reviewed-by: Samir Jindel <sjindel@google.com>
2017-09-18 15:16:23 +00:00
Samir Jindel 09f891b89b [kernel] Generalization of type equivalence to subtyping.
This revision includes changes from:
- [kernel] Completion of consistency proofs for type system of first subset of kernel.
due to the suckiness of gerrit.

We generalize type equivalence to subtyping. The contravariant property of
function parameter types causes properties for the totality checker. To
cicumvent this, we define a well-ordered relation on pairs of dart types and
prove subtyping respects it. We develop new lemmas and tactics for managing
proofs involving subtyping, includinging factoring out the messy business of
dealing with its convoluted recursion scheme.

Bug:
Change-Id: I18936168006617874a82eefc983f1b2d4d8af5af
Reviewed-on: https://dart-review.googlesource.com/5861
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-18 11:47:31 +00:00
Samir Jindel 12c4b62be8 [kernel] Completion of consistency proofs for type system of first subset of kernel.
Bug:
Change-Id: I5ae6fa1ddbb79b6f9dfecb53762b7ee5660c9117
Reviewed-on: https://dart-review.googlesource.com/5746
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-18 11:37:03 +00:00
Kevin Millikin 3df5cfa614 Add a reference interpreter in Standard ML
It's sometimes easier to read SML than text.  This is the higher-order
interpreter, we have plans for a first-order version.

Bug:
Change-Id: Ic6bcc989e6a544889d0ff3eefac266bd54f9489b
Reviewed-on: https://dart-review.googlesource.com/5420
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2017-09-15 10:42:44 +00:00
Samir Jindel 79386c100e [kernel] type_equiv proof for property_get case.
Bug:
Change-Id: Ibbaabc8ca7652eef1077fc743a9d0927a1c7911a
Reviewed-on: https://dart-review.googlesource.com/5461
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-14 12:56:40 +00:00
Samir Jindel 184d1959c5 [kernel] Proofs about type equality, beginnings of the type checking homomorphism proof.
I also added mutual induction schemes for types and expressions.
Some changes from the "Cleanup" revision are in here as well because Gerrit is terrible.

Bug:
Change-Id: I0859a6c1cba8179e0a64cc0455ab2a83fad8f26b
Reviewed-on: https://dart-review.googlesource.com/5300
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-13 12:00:19 +00:00
Samir Jindel a71d91ea62 [kernel] Cleanup of object model and coq.dart.
Bug:
Change-Id: I4a93d2ab0a052b61d3819d04316c05f534057f02
Reviewed-on: https://dart-review.googlesource.com/5266
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-13 11:43:30 +00:00
Samir Jindel 474c075794 [kernel] Simplified Coq AST and first draft of it's type system.
Details to come in discussions.

Bug:
Change-Id: Ia50d85dd27cde83e25086f64dc6746cc52036128
Reviewed-on: https://dart-review.googlesource.com/4941
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-12 16:23:16 +00:00
Samir Jindel 95c5b043fb [kernel] Infrastructure for the Coq formalization.
Summary:

Common datastructures used by both the Kernel AST definition and the object
model are factored into a shared module. A monad for partial computation is
defined to allow us to factor out termination proofs and syntactic validity
checks from the type checking and subtyping relations.

Test Plan:

Ran through coqc.

Bug:
Change-Id: I884666d7cc5b757d62541a46b868f8579a06f011
Reviewed-on: https://dart-review.googlesource.com/4700
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-11 17:22:14 +00:00
Dmitry Stefantsov 1132579731 Add the first draft of the object model formalization in Coq
Change-Id: I6c1a79f23d7a8327766cc450d4c0d6e1b1a5902a
Reviewed-on: https://dart-review.googlesource.com/3921
Reviewed-by: Samir Jindel <sjindel@google.com>
2017-09-07 14:08:00 +00:00
Samir Jindel ae8c6a9afe Dart Kernel AST in Coq
Summary:

We use a modest set of annotations in ast.dart to describe how the Kernel AST
should be converted into Coq definitions.

We define a Kernel transformation that converts the kernel tree of ast.dart into
a valid Coq file containing the corresponding definitions.

Currently generating the Coq file is not done in the build system because
compiling it requires having Coq installed, and I don't want to introduce a
depedency on Coq into the build system.

Some parts of the AST are not represented because they don't significantly
contribute to the typing semantics:

- asserts
- typedefs
- most literals/basic types (excl. bool, which is needed for "is" tests)
- switch
- for-in
- parts
- yield/await

Test Plan:

Ran the output KernelSyntax.v file through "coqc".

Change-Id: Ic573163a017eaaf3759b741b9eec5ce3ce19225c
Reviewed-on: https://dart-review.googlesource.com/2960
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2017-09-05 13:22:26 +00:00