Skip to content

Commit

Permalink
add coq-stdpp as dependency, add abs_examples module (#12)
Browse files Browse the repository at this point in the history
* add coq-stdpp as dependency, add abs_examples module

* Typing examples

* nits

---------

Co-authored-by: Aqissiaq <aqissiaq@gmail.com>
  • Loading branch information
palmskog and Aqissiaq authored Feb 27, 2024
1 parent d62eec2 commit 11c8549
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Formal metatheory in Coq for the ABS language.
- Additional dependencies:
- [Ott Coq library](https://github.com/ott-lang/ott) 0.33 or later
- [Equations Coq library](https://github.com/mattam82/Coq-Equations) 1.3 or later
- [Coq-Std++](https://gitlab.mpi-sws.org/iris/stdpp) 1.9.0 or later
- Coq namespace: `ABS`
- Related publication(s):
- [ABS: A Core Language for Abstract Behavioral Specification](https://link.springer.com/chapter/10.1007/978-3-642-25271-6_8) doi:[10.1007/978-3-642-25271-6_8](https://doi.org/10.1007/978-3-642-25271-6_8)
Expand All @@ -33,7 +34,7 @@ To install all dependencies, do:

```shell
opam repo add coq-released https://coq.inria.fr/opam/released
opam install coq.8.18.0 coq-ott
opam install coq.8.18.0 coq-ott coq-equations coq-stdpp
```

To build when dependencies are installed, do:
Expand Down
1 change: 1 addition & 0 deletions _CoqProject
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
-arg -w -arg -deprecated-hint-without-locality

theories/abs_defs.v
theories/abs_examples.v
theories/abs_functional_metatheory.v
1 change: 1 addition & 0 deletions coq-abs-metatheory.opam
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ depends: [
"coq" {>= "8.16"}
"coq-ott" {>= "0.33"}
"coq-equations" {>= "1.3"}
"coq-stdpp" {>= "1.9.0"}
]

tags: [
Expand Down
8 changes: 6 additions & 2 deletions meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ dependencies:
version: '{>= "0.33"}'
description: |-
[Ott Coq library](https://github.com/ott-lang/ott) 0.33 or later
- opam:
name: coq-equations
version: '{>= "1.3"}'
description: |-
[Equations Coq library](https://github.com/mattam82/Coq-Equations) 1.3 or later
- opam:
name: coq-stdpp
version: '{>= "1.9.0"}'
description: |-
[Coq-Std++](https://gitlab.mpi-sws.org/iris/stdpp) 1.9.0 or later
tested_coq_opam_versions:
- version: '8.18'
Expand All @@ -60,7 +64,7 @@ build: |-
```shell
opam repo add coq-released https://coq.inria.fr/opam/released
opam install coq.8.18.0 coq-ott
opam install coq.8.18.0 coq-ott coq-equations coq-stdpp
```
To build when dependencies are installed, do:
Expand Down
37 changes: 37 additions & 0 deletions theories/abs_examples.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From ABS Require Import abs_defs.
From stdpp Require Import prelude base.

(** * ABS Examples *)

Definition e_const_5 : e :=
e_t (t_int 5%Z).

Definition func_const_5 : F :=
F_fn T_int "const_5"%string [] e_const_5.

Definition e_call_const_5 : e :=
e_fn_call "const_5"%string [].

Definition Ctx : G :=
Map.add ("const_5"%string) (ctxv_sig (sig_sig [] T_int)) (Map.empty ctxv).

Lemma e_const_5_T_int :
typ_e Ctx e_const_5 T_int.
Proof. by apply typ_int. Qed.

Lemma e_call_const_typ_F :
typ_F Ctx func_const_5.
Proof.
apply typ_func_decl.
- easy.
- apply e_const_5_T_int.
Qed.

Lemma e_call_const_5_T_int :
typ_e Ctx e_call_const_5 T_int.
Proof.
unfold e_call_const_5.
replace [] with (map (fun (pat_:(e*T)) => match pat_ with (e_,T_) => e_ end ) [])
by auto.
by apply typ_func_expr.
Qed.

0 comments on commit 11c8549

Please sign in to comment.