Skip to content

Commit 152676c

Browse files
committed
start mapping to rocq stdlib
1 parent f33f97d commit 152676c

File tree

6 files changed

+103
-0
lines changed

6 files changed

+103
-0
lines changed

rocq/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.*.aux
2+
*.v
3+
!mappings.v
4+
*.vo*
5+
*.glob
6+
rocq.mk
7+
rocq.mk.conf
8+
.rocq.mk.d

rocq/Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
LPFILES := $(wildcard ../*.lp)
2+
VFILES := $(LPFILES:../%.lp=%.v)
3+
VOFILES := $(VFILES:%=%o)
4+
5+
default: v
6+
7+
v: $(VFILES)
8+
9+
%.v: encoding.lp mappings.lp ../%.lp
10+
lambdapi export -o stt_coq --encoding encoding.lp --use-notations --mapping mappings.lp --requiring mappings ../$*.lp > $@ #--renaming $(HOL2DK_DIR)/renaming.lp --requiring "$(REQUIRING)"
11+
12+
clean-v:
13+
rm -f $(VFILES)
14+
15+
rocq.mk: _CoqProject
16+
rocq makefile -f _CoqProject -o $@
17+
18+
vo: rocq.mk
19+
$(MAKE) -f rocq.mk
20+
21+
clean-vo:
22+
rm -f $(VOFILES)

rocq/_CoqProject

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-R . Stdlib
2+
.

rocq/encoding.lp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// dk/lp symbols used for encoding simple type theory
2+
3+
builtin "El" ≔ τ;
4+
builtin "Prf" ≔ π;
5+
6+
// symbols with special notations in Coq
7+
builtin "Set"Set;
8+
builtin "prop"Prop;
9+
builtin "arr" ≔ ⤳;
10+
builtin "imp" ≔ ⇒;
11+
builtin "all" ≔ ∀;
12+
builtin "eq" ≔ =;
13+
builtin "or" ≔ ∨;
14+
builtin "and" ≔ ∧;
15+
builtin "ex" ≔ ∃;
16+
builtin "not" ≔ ¬;

rocq/mappings.lp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Prop.lp
2+
builtin "Prop"Prop;
3+
builtin "True" ≔ ⊤;
4+
builtin "I" ≔ ⊤ᵢ;
5+
builtin "False" ≔ ⊥;
6+
builtin "False_ind" ≔ ⊥ₑ;
7+
builtin "imp" ≔ ⇒;
8+
builtin "not" ≔ ¬;
9+
builtin "and" ≔ ∧;
10+
builtin "conj" ≔ ∧ᵢ;
11+
builtin "proj1" ≔ ∧ₑ₁;
12+
builtin "proj2" ≔ ∧ₑ₂;
13+
builtin "or" ≔ ∨;
14+
builtin "or_intro1" ≔ ∨ᵢ₁;
15+
builtin "or_intro2" ≔ ∨ᵢ₂;
16+
builtin "or_elim" ≔ ∨ₑ;
17+
builtin "ex_intro" ≔ ∃ᵢ;
18+
builtin "ex_elim" ≔ ∃ₑ;
19+
builtin "iff" ≔ ⇔;
20+
21+
// Set.lp
22+
builtin "Type'"Set;
23+
builtin "nat" ≔ ι;
24+
builtin "el"el;
25+
26+
// FOL.lp
27+
builtin "all" ≔ ∀;
28+
builtin "ex" ≔ ∃;
29+
30+
// HOL.lp
31+
builtin "arr" ≔ ⤳;
32+
// Eq.lp
33+
builtin "eq" ≔ =;
34+
builtin "eq_refl"eq_refl;
35+
builtin "ind_eq"ind_eq;
36+
builtin "neq" ≔ ≠;

rocq/mappings.v

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
(* Prop.lp *)
2+
Definition imp (p q : Prop) : Prop := p -> q.
3+
4+
(* Set.lp *)
5+
Record Type' := { type :> Type; el : type }.
6+
7+
(* Fol.lp *)
8+
Definition all {a : Set} (P: a -> Prop) : Prop := forall x:a, P x.
9+
10+
(* Hol.lp *)
11+
Definition arr a (b : Type') := {| type := a -> b; el := fun _ => el b |}.
12+
Canonical arr.
13+
14+
(* Eq.lp *)
15+
Lemma ind_eq : forall {a : Type'} {x y : a}, (x = y) -> forall p, (p y) -> p x.
16+
Proof.
17+
intros a x y e p py. rewrite e. exact py.
18+
Qed.
19+
Definition neq {a : Type'} (x y : a) := ~ (x = y).

0 commit comments

Comments
 (0)