Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctx-dependent effects #2

Merged
merged 131 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
1fb93b4
flake
Kaptch Oct 12, 2023
1ab428c
init continuation-dependent effects
Kaptch Oct 30, 2023
74e9d27
lang
Kaptch Nov 1, 2023
e98cfa7
revert
Kaptch Nov 1, 2023
3616768
revert
Kaptch Nov 1, 2023
277b509
reifiers change
Kaptch Nov 3, 2023
9ab561b
minor reifier changes
Kaptch Nov 7, 2023
f746be4
missed lemma
Kaptch Nov 7, 2023
4146d46
Merge
Nov 8, 2023
167583c
Ins and Outs for callcc/throw, reify_io ok & comment out old work
Nov 9, 2023
4e4acef
Now with good reifiers + signatures
Nov 9, 2023
74edd87
backwards comp
Kaptch Nov 9, 2023
16ffc73
backwards comp
Kaptch Nov 9, 2023
b3efae3
backward comp + todos
Kaptch Nov 9, 2023
c83913d
Merge branch 'callcc' of github.com:logsem/gitrees into callcc
Nov 10, 2023
8cf5cc2
Changed a possibly non-terminating `rewrite`
Nov 13, 2023
1a26bb4
denot callcc wip
Kaptch Nov 16, 2023
0cde5d4
Merge pull request #1 from logsem/origin/callcc
Kaptch Nov 16, 2023
3c9ea91
non-cps
Kaptch Nov 17, 2023
647c340
Some refactoring and pretification
Nov 20, 2023
41bd6b8
WIP on ectx hom
Nov 20, 2023
aeb4b10
If homomorphism
Nov 21, 2023
89dec73
make syntax not cbv-targeted
Kaptch Nov 21, 2023
ef5a3b8
Hom instances for the rest of ctx (but mayb unreasonable assptions)
Nov 21, 2023
b5256c5
ectx
Kaptch Nov 21, 2023
2205ae7
Merge remote-tracking branch 'origin/callcc-non-cps' into callcc-non-cps
Kaptch Nov 21, 2023
4abe96d
Less unreasonable assumptions + style
Nov 21, 2023
b108a37
Merge branch 'callcc-non-cps' of github.com:logsem/gitrees into callc…
Nov 21, 2023
8af4b3f
fix
Nov 21, 2023
d02c6bd
lines
Nov 22, 2023
ce6f0fb
More sensible and consistent variable naming
Nov 22, 2023
28ab6f7
throw interp + soundness wip + weak versions of subreifier lemmas
Kaptch Nov 23, 2023
48e02e7
Merge branch 'callcc-non-cps' of github.com:logsem/gitrees into callc…
Kaptch Nov 23, 2023
07a7d59
wp_safety + some progress on denotsem
Kaptch Nov 24, 2023
edaf886
almost solved annoying issue with extra ticks (wip)
Kaptch Nov 24, 2023
bf50262
bin rel
Kaptch Nov 28, 2023
b9d2fff
a few admits away from adequacy
Kaptch Nov 29, 2023
cff35e3
reifiy tick ok
Nov 29, 2023
121c7b2
Merge branch 'callcc-non-cps' of github.com:logsem/gitrees into callc…
Nov 29, 2023
52643d6
soundness last clause
Kaptch Nov 29, 2023
302c6c2
typo
Nov 29, 2023
d8c0032
adequacy, output clause
Kaptch Nov 29, 2023
d5f30f5
lang fix ectx
Kaptch Nov 29, 2023
704f822
same for natops
Kaptch Nov 29, 2023
99ad4ab
upd soundness
Kaptch Nov 29, 2023
40ab847
fl app
Kaptch Nov 29, 2023
0619e89
small cleanup
Kaptch Nov 29, 2023
cc6b382
todos upd
Kaptch Nov 29, 2023
22721ec
Merge branch 'callcc-non-cps' of github.com:logsem/gitrees into callc…
Kaptch Nov 29, 2023
5bba999
last admit ok
Nov 29, 2023
aa936ac
cleanup stray spaces
Nov 30, 2023
1789447
todo upd
Kaptch Dec 4, 2023
36109f4
Merge branch 'callcc-non-cps' of github.com:logsem/gitrees into callc…
Kaptch Dec 4, 2023
2e9aac2
todo upd
Kaptch Dec 4, 2023
e951175
Some proof cleanup
Dec 6, 2023
a493deb
Merge branch 'callcc-non-cps' of github.com:logsem/gitrees into callc…
Dec 6, 2023
c27183c
Some refactoring
Dec 6, 2023
5146604
notation for variables
Kaptch Dec 6, 2023
44dd464
some cleanup
Kaptch Dec 7, 2023
06717bc
Refactor compat_recv
Dec 8, 2023
43a90f4
notations
Kaptch Dec 8, 2023
f07661b
Merge branch 'callcc-non-cps' of github.com:logsem/gitrees into callc…
Kaptch Dec 8, 2023
c0837ca
ci + bw-comp
Kaptch Dec 10, 2023
410b665
Natop refactored + a useful rewriting lemma
Dec 11, 2023
f2ce3da
upstream version of iris and stdpp
Kaptch Dec 11, 2023
c840fe3
Merge branch 'callcc-non-cps' of github.com:logsem/gitrees into callc…
Dec 11, 2023
899ec45
opam upd
Kaptch Dec 11, 2023
53af87e
Merge branch 'callcc-non-cps' of github.com:logsem/gitrees into callc…
Kaptch Dec 11, 2023
247d0db
last admits, delete redundant lemmas, upd todo
Kaptch Dec 11, 2023
83f01e1
throw
Dec 12, 2023
9b442f7
callcc
Dec 14, 2023
531a4b0
Merge branch 'main' into callcc-non-cps
Kaptch Dec 14, 2023
5632aaa
move HOM out
Kaptch Dec 14, 2023
1c5a26e
compat nat
Kaptch Dec 14, 2023
bb31947
cleanup
Kaptch Dec 14, 2023
a576f2b
more cleanup
Kaptch Dec 14, 2023
93e6dc9
more rework on callcc
Dec 14, 2023
2cc1911
Merge branch 'callcc-non-cps' of github.com:logsem/gitrees into callc…
Dec 14, 2023
13a0441
Merge branch 'callcc-non-cps' of github.com:logsem/gitrees into callc…
Kaptch Dec 14, 2023
e5ebc9a
Better context indep reifiers
Dec 15, 2023
4e7d6a8
Merge branch 'callcc-non-cps' of github.com:logsem/gitrees into callc…
Dec 15, 2023
6159a22
Fixing some proofs re new reifiers
Dec 15, 2023
5ea4b47
coq 8.18
Dec 15, 2023
8d31bf8
Revert "coq 8.18"
Dec 15, 2023
a3b9b82
remove problematic solve_proper
Dec 15, 2023
167a7b0
comments
Kaptch Dec 15, 2023
6d384ef
Files + First ideas on ope semantics
Jan 5, 2024
d2148b4
work re: contexts as stacks
Jan 5, 2024
d386f86
some rules for head_step
Jan 8, 2024
4bae225
head_step maybe complete? incomplete computable head_step
Jan 9, 2024
9b05924
Some work on interpretation
Jan 9, 2024
350352c
some interp of ctxs, some rework of the op sem
Jan 10, 2024
4729118
interpretation of ctxs and properties
Jan 11, 2024
f8ba784
more on ctx. however maybe not homomorphisms? Might be a problem
Jan 11, 2024
2237d73
Corrections re contexts: no Resets -> homomorphism
Jan 12, 2024
d68c45b
some proof elements in interpretation
Jan 12, 2024
cb5d7e9
better head_step and prim_step, work on soundness
Jan 15, 2024
a317e08
reify reset, still some admits on shift
Jan 16, 2024
ef6848f
Changed op sem for shift but still extra tick
Jan 17, 2024
1b6ede9
yes_reify OK
Jan 18, 2024
8a055f8
better proofs, more lemmas. Need to figure sthg out for soundness
Jan 19, 2024
cfcf08a
better head/prim_step BUT /!\ Reset probably wrong...
Jan 22, 2024
3188e35
simplify ctxdep
Kaptch Jan 29, 2024
733ff1d
simplify ctxdep reifiers
Kaptch Jan 29, 2024
d5cbc77
coercion
Kaptch Jan 30, 2024
3c34ea1
refactoring (affine)
Kaptch Jan 31, 2024
ddddc3f
minor proof simplification (fundamental for affine)
Kaptch Feb 1, 2024
12c70c5
cleanup
Kaptch Feb 1, 2024
0487b73
minor simplification
Kaptch Feb 2, 2024
3c93d64
mostly trying stuff out because none of the previous stuff works
Feb 8, 2024
8dd1fe5
Abstract machine sem for delim_lang (cf biernack(a/i) danvy 2005)
Feb 8, 2024
881b6b2
more stuff on this sem, now onto interpretation of configurations
Feb 9, 2024
a00e547
whitespace
Feb 14, 2024
c5465e1
Reintroduce shift/reset as effects, some hope
Feb 14, 2024
59f6a2a
some notations, refactoring, and soundness for no reifying and reset
Feb 15, 2024
18b7c60
half solution to a problem with shift and meta
Feb 15, 2024
328bfe0
Soundness for shift and meta
Feb 16, 2024
01004f4
Separate appcont constructor + soundness for all rules
Feb 16, 2024
7309cca
Soundness
Feb 16, 2024
4a128e7
Rename META into POP, change output arity to 0
Feb 23, 2024
b2c9453
fixed some rules + a tiny example that takes way too long to prove
Feb 26, 2024
c29257b
Merge branch 'callcc-non-cps' of github.com:logsem/gitrees into callc…
Feb 26, 2024
40d672b
Add the delim language
Feb 27, 2024
ebe09ac
Adapted for CtxDep + some fix
Feb 27, 2024
4ce0705
removed hom file from delim example while not implemented
Feb 27, 2024
b3c82d1
removed logrel while not implemented + temporary tacs for ex proof
Feb 27, 2024
426db0a
cleanup the branch and make is_ctx_dep implicit
co-dan Feb 26, 2024
195a7b0
rename input_lang_delim -> delim_lang
co-dan Feb 27, 2024
aa9ae7a
get rid of later_car
co-dan Feb 27, 2024
15dc2a2
factor out the IO tape effects
co-dan Feb 27, 2024
cfb890a
final tweaks
co-dan Feb 27, 2024
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
11 changes: 10 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,22 @@ name: Docker CI
on: [push, pull_request]

jobs:
build_nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix build .#coq-artifact

build:
runs-on: ubuntu-latest
strategy:
matrix:
image:
- 'coqorg/coq:8.17'
- 'coqorg/coq:8.18'
max-parallel: 4
fail-fast: false

Expand All @@ -21,7 +31,6 @@ jobs:
install: |
startGroup "Install dependencies"
sudo apt-get update -y -q
opam repo add iris-dev https://gitlab.mpi-sws.org/iris/opam.git
opam pin add -n -y -k path $PACKAGE $WORKDIR
opam update -y
opam install --confirm-level=unsafe-yes -j 2 $PACKAGE --deps-only
Expand Down
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Guarded Interaction Trees

This is the Coq formalization of guarded interaction trees, associated examples and case studies.
Read the [GITrees POPL paper](https://iris-project.org/pdfs/2024-popl-gitrees.pdf) describing our work.

## Installation instructions

To install the formalization you will need the Iris, std++, and Equations packages.
To install the formalization you will need Iris and std++ libraries.
The dependencies can be easily installed using [Opam](https://opam.ocaml.org/) with the following commands:

```
opam repo add coq-released https://coq.inria.fr/opam/released
opam repo add iris-dev https://gitlab.mpi-sws.org/iris/opam.git
opam update
opam install . --deps-only
```
Expand All @@ -25,14 +25,24 @@ All the code lives in the `theories` folder. Below is the quick guide
to the code structure.

- `gitree/` -- contains the core definitions related to guarded interaction trees
- `input_lang/` -- formalization of the language with io, the soundness and adequacy
- `affine_lang/` -- formalization of the affine language, type safety of the language interoperability
- `examples/` -- some other smaller examples
- `lang_generic.v` -- generic facts about languages with binders and their interpretations, shared by `input_lang` and `affine_lang`
- `lib/` -- derived combinators for gitrees
- `effects/` -- concrete effects, their semantics, and program logic rules
- `examples/input_lang/` -- formalization of the language with io, the soundness and adequacy
- `examples/affine_lang/` -- formalization of the affine language, type safety of the language interoperability
- `examples/input_lang_callcc/` -- formalization of the language with io, throw and call/cc, the soundness and adequacy
- `examples/delim_lang/` -- formalization shift/reset effects, of a language with delimited continuations and its soundness
- `prelude.v` -- some stuff that is missing from Iris
- `lang_generic.v` -- generic facts about languages with binders and their interpretations, shared by `input_lang` and `affine_lang`

For the representation of binders we use a library implemented by
Filip Sieczkowski and Piotr Polesiuk, located in the `vendor/Binding/`
folder.

### References from the paper to the code

The version of the formalization that corresponds to the paper can be found under the [tag `popl24`](https://github.com/logsem/gitrees/releases/tag/popl24).
Below we describe the correspondence per-section.

- **Section 3**
+ Definition of guarded interaction trees, constructors, the
recursion principle, and the destructors are in `gitree/core.v`
Expand All @@ -42,7 +52,7 @@ to the code structure.
+ The factorial example is in `examples/factorial.v`, and
the pairs example is in `examples/pairs.v`
- **Section 4**
+ The definition of reifiers and the reify function are in `gitree/reify.v`
+ The definition of context-dependent versions of reifiers and the reify function are in `gitree/reify.v`
+ The reduction relation is in `gitree/reductions.v`
+ The specific reifiers for IO and state are in `examples/store.v`
and `input_lang/interp.v`
Expand Down Expand Up @@ -70,12 +80,6 @@ to the code structure.

## Notes

### Representations of binders
For the representation of languages with binders, we follow the
approach of (Benton, Hur, Kennedy, McBride, JAR 2012) with well-scoped
terms and substitutions/renamings.


### Disjunction property
Some results in the formalization make use of the disjunction property
of Iris: if (P ∨ Q) is provable, then either P or Q are provable on
Expand Down
49 changes: 37 additions & 12 deletions _CoqProject
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
-Q theories gitrees
-Q vendor/Binding Binding
-arg -w -arg -ssr-search-moved

vendor/Binding/Properties.v
vendor/Binding/Lib.v
vendor/Binding/Set.v
vendor/Binding/Auto.v
vendor/Binding/Core.v
vendor/Binding/Inc.v
vendor/Binding/Intrinsic.v
vendor/Binding/TermSimpl.v
vendor/Binding/Product.v
vendor/Binding/Env.v
vendor/Binding/Resolver.v

theories/prelude.v
theories/lang_generic.v

Expand All @@ -15,18 +28,30 @@ theories/gitree.v

theories/program_logic.v

theories/input_lang/lang.v
theories/input_lang/interp.v
theories/input_lang/logpred.v
theories/input_lang/logrel.v
theories/effects/store.v
theories/effects/io_tape.v

theories/lib/pairs.v
theories/lib/while.v
theories/lib/factorial.v
theories/lib/iter.v

theories/examples/delim_lang/lang.v
theories/examples/delim_lang/interp.v
theories/examples/delim_lang/example.v

theories/examples/input_lang_callcc/lang.v
theories/examples/input_lang_callcc/interp.v
theories/examples/input_lang_callcc/hom.v
theories/examples/input_lang_callcc/logrel.v

theories/affine_lang/lang.v
theories/affine_lang/logrel1.v
theories/affine_lang/logrel2.v
theories/examples/input_lang/lang.v
theories/examples/input_lang/interp.v
theories/examples/input_lang/logpred.v
theories/examples/input_lang/logrel.v

theories/examples/store.v
theories/examples/pairs.v
theories/examples/while.v
theories/examples/factorial.v
theories/examples/iter.v
theories/examples/affine_lang/lang.v
theories/examples/affine_lang/logrel1.v
theories/examples/affine_lang/logrel2.v

theories/utils/finite_sets.v
3 changes: 3 additions & 0 deletions check_admits.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /bin/sh

grep -n -e 'admit' -e 'Admitted' $(find . -name '*.v' -type f)
11 changes: 5 additions & 6 deletions coq-gitrees.opam
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ opam-version: "2.0"
name: "coq-gitrees"
synopsis: "Guarded Interaction Trees"
version: "dev"
maintainer: "..."
authors: "..."
maintainer: "Logsem"
authors: "Logsem"
license: "BSD"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-rf" "%{lib}%/coq/user-contrib/gitrees"]
depends: [
"coq-equations" { (= "1.3+8.17") }
"coq-iris" { (= "dev.2023-09-29.0.4f3a385f") }
"coq-iris-heap-lang" { (= "dev.2023-09-29.0.4f3a385f") }
"coq-stdpp" { (= "dev.2023-09-21.2.7f6df4fa") }
"coq-iris" { (= "4.1.0") }
"coq-iris-heap-lang" { (= "4.1.0") }
"coq-stdpp" { (= "1.9.0") }
"coq" { (>= "8.17") | (= "dev") }
]
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
description = "gitrees";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-23.11;
flake-utils.url = github:numtide/flake-utils;
};
outputs = { self, nixpkgs, flake-utils }:
with flake-utils.lib; eachSystem allSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
coq = pkgs.coq_8_17;
coqPkgs = pkgs.coqPackages_8_17;
in {
packages = {
coq-artifact = coqPkgs.mkCoqDerivation {
pname = "coq-artifact";
version = "main";
src = ./.;
buildPhase = "make";
propagatedBuildInputs = [
coqPkgs.stdpp
coqPkgs.iris
coqPkgs.equations
];
};
};
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
coq
];
inputsFrom = [ self.packages.${system}.coq-artifact ];
};
});
}
Loading
Loading