Skip to content

Commit 5fb2c3a

Browse files
committed
Port from paramcoq to coq-elpi derive
1 parent 4bb4715 commit 5fb2c3a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

coq-addition-chains.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ build: ["dune" "build" "-p" name "-j" jobs]
1818
depends: [
1919
"dune" {>= "2.5"}
2020
"coq" {>= "8.18"}
21-
"coq-paramcoq" {>= "1.1.3"}
21+
"coq-elpi" {>= "2.0"}
2222
"coq-mathcomp-ssreflect" {>= "2.0" & < "2.4"}
2323
"coq-mathcomp-algebra"
2424
]

theories/additions/Addition_Chains.v

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
21
(** * Addition Chains
32
Pierre Casteran, LaBRI, University of Bordeaux
43
54
*)
65

6+
From elpi Require Import derive param2.
7+
78
From additions Require Export Monoid_instances Pow.
89
From Coq Require Import Relations RelationClasses Lia List.
9-
From Param Require Import Param.
10-
10+
1111
From additions Require Import More_on_positive.
1212
Generalizable Variables A op one Aeq.
1313
Infix "==" := Monoid_def.equiv (at level 70) : type_scope.
@@ -232,7 +232,7 @@ Abort.
232232
(** Binary trees of multiplications over A *)
233233

234234
Inductive Monoid_Exp (A:Type) : Type :=
235-
Mul_node (t t' : Monoid_Exp A) | One_node | A_node (a:A).
235+
Mul_node (t t' : Monoid_Exp) | One_node | A_node (a:A).
236236

237237
Arguments Mul_node {A} _ _.
238238
Arguments One_node {A} .
@@ -399,7 +399,7 @@ the corresponding variables of type A and B are always bound to related
399399

400400

401401
(* begin snippet paramDemo *)
402-
Parametricity computation.
402+
Elpi derive.param2 computation.
403403

404404
Print computation_R.
405405
(* end snippet paramDemo *)
@@ -507,7 +507,7 @@ Lemma power_R_is_a_refinement (a:A) :
507507
(computation_eval (M:= Natplus) gamma_nat).
508508
(* end snippet powerRRef *)
509509
Proof.
510-
induction 1;simpl;[auto | ].
510+
induction 1 as [|x1 x2 x_R y1 y2 y_R];[auto | ].
511511
apply H; destruct x_R, y_R; split.
512512
unfold mult_op, nat_plus_op.
513513
+ lia.
@@ -560,9 +560,9 @@ Proof.
560560
(fun n p => n = Pos.to_nat p) 1 xH
561561
(refl_equal 1)).
562562
unfold the_exponent, the_exponent_nat, chain_execute, chain_apply.
563-
generalize (c nat 1), (c _ 1%positive); induction 1.
563+
generalize (c nat 1), (c _ 1%positive); induction 1 as [|x1 x2 x_R y1 y2 y_R].
564564
- cbn; assumption.
565-
- apply (H (x₁ + y₁)%nat (x₂ + y₂)%positive); rewrite Pos2Nat.inj_add;
565+
- apply (H (x1 + y1)%nat (x2 + y2)%positive); rewrite Pos2Nat.inj_add;
566566
now subst.
567567
Qed.
568568

0 commit comments

Comments
 (0)