Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b4ea4c4

Browse files
committedJan 28, 2025·
Document derive.param2 commands
1 parent a014af2 commit b4ea4c4

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
 

‎apps/derive/README.md

+28
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,34 @@ Inductive is_nat : nat -> Type :=
120120
| is_S : forall n : nat, is_nat n -> is_nat (S n) *)
121121
```
122122

123+
### `param2`
124+
125+
Binary parametricity translation.
126+
127+
Main command is `derive.param2`
128+
```coq
129+
Elpi derive.param2 nat.
130+
Print nat_R. (*
131+
Inductive nat_R : nat -> nat -> Set :=
132+
| O_R : nat_R 0 0
133+
| S_R : forall H H0 : nat, nat_R H H0 -> nat_R (S H) (S H0).
134+
```
135+
136+
The command `derive.param2.register` can be used to register
137+
handcrafted parametricity rules, so that they can be used by further
138+
`derive.param2` commands.
139+
```coq
140+
Definition fa := 0.
141+
Definition fb := fa.
142+
143+
Fail Elpi derive.param2 fb.
144+
(* derive.param2: No binary parametricity translation for fa *)
145+
146+
Definition fa_R := O_R.
147+
Elpi derive.param2.register fa fa_R.
148+
Elpi derive.param2 fb.
149+
```
150+
123151
### `param1_functor`
124152

125153
```coq

0 commit comments

Comments
 (0)
Please sign in to comment.