Skip to content

Commit 8a42a5d

Browse files
committed
coq: Update for 8.12, 8.13 compatibility
Closes GH-8.
1 parent 69ca343 commit 8a42a5d

17 files changed

+74
-72
lines changed

README.rst

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,9 @@ Installing dependencies and building from source
3030

3131
* OCaml 4.07 through 4.09, `opam <https://opam.ocaml.org/doc/Install.html>`_ 2.0 or later, GNU make.
3232

33-
* Coq 8.9, 8.10, or 8.11::
33+
* Coq 8.11 through 8.13::
3434

35-
opam install coq=8.10.2
36-
37-
* Coq's Ltac2 plugin, if using Coq < 8.9 or 8.10 (newer versions have it built-in)::
38-
39-
opam repo add coq-released https://coq.inria.fr/opam/released
40-
opam install coq-ltac2
35+
opam install coq=8.12.2
4136

4237
* Dune 2.5 or later::
4338

coq/CircuitOptimization.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Section CircuitOptimizer.
4242

4343
Fixpoint unannot {sz} (c: circuit sz) : circuit sz :=
4444
match c with
45-
| CAnnot annot c => unannot c
45+
| CAnnot _ c => unannot c
4646
| c => c
4747
end.
4848

@@ -55,7 +55,7 @@ Section CircuitOptimizer.
5555
Definition asconst {sz} (c: circuit sz) : option (bits sz) :=
5656
match unannot c with
5757
| CConst cst => Some cst
58-
| c => None
58+
| _ => None
5959
end.
6060

6161
Definition isconst {sz} (c: circuit sz) (cst: bits sz) :=
@@ -368,7 +368,7 @@ Section CircuitOptimizer.
368368
if select ~~ b1 then fun _ => c1
369369
else if select ~~ b0 then fun _ => c2
370370
else fun c0 => c0
371-
| c => fun c0 => c0
371+
| _ => fun c0 => c0
372372
end c.
373373

374374
(** This pass performs the following simplification:

coq/Common.v

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
(*! Utilities | Shared utilities !*)
2-
Require Export Coq.omega.Omega.
2+
Require Export Coq.micromega.Lia.
3+
Require Export Coq.Arith.Arith.
34
Require Export Coq.Lists.List Coq.Bool.Bool Coq.Strings.String.
45
Require Export Koika.EqDec Koika.Vect Koika.FiniteType Koika.Show.
56

@@ -288,7 +289,7 @@ Section Lists.
288289
skipn n (List.app l1 l2) = List.app (skipn n l1) l2.
289290
Proof.
290291
induction l1; destruct n; cbn; try (inversion 1; reflexivity).
291-
- intros; apply IHl1; omega.
292+
- intros; apply IHl1; lia.
292293
Qed.
293294

294295
Lemma forallb_pointwise {A} :

coq/Environments.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ Section Folds.
375375
| CtxCons k v ctx => cfoldl ctx (f k v init)
376376
end.
377377

378-
Fixpoint cfoldl' {sig} (ctx: context V sig) (init: T) :=
378+
Definition cfoldl' {sig} (ctx: context V sig) (init: T) :=
379379
match sig return context V sig -> T with
380380
| [] => fun _ => init
381381
| k :: sig => fun ctx => cfoldl (ctl ctx) (f k (chd ctx) init)

coq/EqDec.v

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ Qed.
1919
Lemma beq_dec_false_iff {A} (EQ: EqDec A) a1 a2 :
2020
beq_dec a1 a2 = false <-> a1 <> a2.
2121
Proof.
22-
unfold beq_dec; destruct eq_dec; subst.
23-
- firstorder.
24-
- split; intro; (eauto || congruence).
22+
unfold beq_dec; destruct eq_dec; subst;
23+
intuition congruence.
2524
Qed.
2625

2726
Hint Extern 1 (EqDec _) => econstructor; decide equality : typeclass_instances.

coq/FiniteType.v

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(*! Utilities | Finiteness typeclass !*)
22
Require Import Coq.Lists.List.
3-
Require Import Coq.omega.Omega.
3+
Require Import Coq.micromega.Lia.
4+
Require Import Coq.Arith.Arith.
45
Import ListNotations.
56

67
Class FiniteType {T} :=
@@ -41,15 +42,15 @@ Proof.
4142
induction l; intros n H n' Hle Habs.
4243
- auto.
4344
- apply Bool.andb_true_iff in H; destruct H; apply PeanoNat.Nat.ltb_lt in H.
44-
destruct Habs as [ ? | ? ]; subst; try omega.
45-
eapply IHl; [ eassumption | .. | eassumption ]; omega.
45+
destruct Habs as [ ? | ? ]; subst; try lia.
46+
eapply IHl; [ eassumption | .. | eassumption ]; lia.
4647
Qed.
4748

4849
Lemma increasing_not_In' :
4950
forall l n, increasing (n :: l) = true -> forall n', n' <? n = true -> ~ In n' (n :: l).
5051
Proof.
5152
unfold not; intros l n Hincr n' Hlt [ -> | Hin ]; apply PeanoNat.Nat.ltb_lt in Hlt.
52-
- omega.
53+
- lia.
5354
- eapply increasing_not_In;
5455
[ eassumption | apply Nat.lt_le_incl | eassumption ]; eauto.
5556
Qed.

coq/IndexUtils.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ Lemma list_sum_member_le:
143143
list_sum l.
144144
Proof.
145145
induction l; destruct idx.
146-
- cbn; omega.
147-
- specialize (IHl a0); unfold list_sum, list_sum' in *; cbn; omega.
146+
- cbn; lia.
147+
- specialize (IHl a0); unfold list_sum, list_sum' in *; cbn; lia.
148148
Qed.
149149

150150
Instance Show_index (n: nat) : Show (index n) :=

coq/Interop.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Section Compilation.
215215
(s: @koika_package_t pos_t var_t fn_name_t rule_name_t reg_t ext_fn_t)
216216
(opt: let circuit sz := circuit (lower_R s.(koika_reg_types))
217217
(lower_Sigma s.(koika_ext_fn_types)) sz in
218-
forall {sz}, circuit sz -> circuit sz)
218+
forall sz, circuit sz -> circuit sz)
219219
: circuit_package_t :=
220220
let _ := s.(koika_reg_finite) in
221221
let _ := s.(koika_var_names) in

coq/LoweredSyntaxFunctions.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Section LoweredSyntaxFunctions.
3535
Definition action_footprint {sig tau} (a: action sig tau) :=
3636
action_footprint' [] a.
3737

38-
Fixpoint action_registers {sig tau} {EQ: EqDec reg_t} (a: action sig tau) : list reg_t :=
38+
Definition action_registers {sig tau} {EQ: EqDec reg_t} (a: action sig tau) : list reg_t :=
3939
dedup [] (List.map (fun '(rs, _) => rs) (action_footprint a)).
4040

4141
Context (rules: rule_name_t -> rule).

coq/Member.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ Proof.
234234
+ exact (MemberTl k k' (sig ++ infix ++ sig') (minfix _ infix sig sig' k m')).
235235
Defined.
236236

237-
Fixpoint mprefix_pair {K sig} (k: K) (p: {k': K & member k' sig})
237+
Definition mprefix_pair {K sig} (k: K) (p: {k': K & member k' sig})
238238
: {k': K & member k' (k :: sig)} :=
239239
let '(existT _ k' m) := p in
240240
existT _ k' (MemberTl k' k _ m).

0 commit comments

Comments
 (0)