Skip to content

Commit 9536705

Browse files
Fix more warnings
1 parent 6e5700a commit 9536705

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

case-studies/tapl-exercise/tapl_exercise.v

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11

2-
(**
2+
(**
33
We were able to mechanize the first three steps of Exercise 23.6.3 of Types and Programming Languages (page 356)
44
Autosubst was a great help because it lowers the burden of starting to work on an exercise.
5-
If I didn't have Autosubst available, I would not have attempted to mechanize the exercise
5+
If I didn't have Autosubst available, I would not have attempted to mechanize the exercise
66
because the substitution boilerplate is so tedious.
77
8-
Andrej told me that the rest of the steps (3-7) are probably very hard to prove in Coq
8+
Andrej told me that the rest of the steps (3-7) are probably very hard to prove in Coq
99
because they are always talking about "forms" which is hard to control in Coq.
10-
10+
1111
I tried around a little bit, defining more well-formed predicates.
12-
It went nowehere, though, because writing proofs with them is hard.
12+
It went nowehere, though, because writing proofs with them is hard.
1313
But this is not a failing of Autosubst.
1414
*)
15-
Require Import Arith.
15+
From Stdlib Require Import Arith.
1616
Require Import sysf.
1717
Require Import core unscoped.
18-
Require List.
18+
From Stdlib Require List.
1919
Import List.ListNotations.
2020
Open Scope list.
2121

@@ -84,9 +84,9 @@ Lemma nth_error_map {X Y:Type} : forall (l:list X) (f: X -> Y) y n,
8484
List.nth_error (List.map f l) n = Some y ->
8585
exists x, List.nth_error l n = Some x /\ y = f x.
8686
Proof.
87-
intros * H.
87+
intros * H.
8888
destruct (List.nth_error l n) as [x'|] eqn:E.
89-
- exists x'. split. reflexivity.
89+
- exists x'. split. reflexivity.
9090
specialize (List.map_nth_error f _ _ E) as H'.
9191
rewrite H' in H. injection H. intros ->. reflexivity.
9292
- exfalso.
@@ -95,7 +95,7 @@ Proof.
9595
eapply Nat.le_ngt.
9696
1: eassumption.
9797
rewrite <- (List.map_length f).
98-
apply List.nth_error_Some.
98+
apply List.nth_error_Some.
9999
intros H'. rewrite H' in H. discriminate H.
100100
Qed.
101101

@@ -216,7 +216,7 @@ Proof.
216216
intros x T Hx.
217217
apply H, Hx.
218218
Qed.
219-
219+
220220
Lemma context_morphism_lemma :
221221
forall Gamma Gamma' s T sigma tau,
222222
(forall x T, List.nth_error Gamma x = Some T -> has_type Gamma' (tau x) (subst_ty sigma T)) ->
@@ -236,7 +236,7 @@ Proof.
236236
intros [|x] T Hx.
237237
+ cbn. constructor. cbn.
238238
injection Hx. intros ->. reflexivity.
239-
+ cbn.
239+
+ cbn.
240240
rewrite <- rinstId'_ty.
241241
eapply context_renaming_lemma.
242242
2: apply H, Hx.
@@ -296,7 +296,7 @@ Proof.
296296
Qed.
297297

298298
(* it was pleasantly simple to prove preservation which I can then use to prove some part of the TAPL exercise.
299-
It is a bit strange that I have to sometime `rewrite <- idSubst` to be able to
299+
It is a bit strange that I have to sometime `rewrite <- idSubst` to be able to
300300
apply the context_renaming_lemma/context_morphism_lemma *)
301301
Lemma sysf_preservation :
302302
forall Gamma s s' T, has_type Gamma s T -> eval s s' -> has_type Gamma s' T.
@@ -361,10 +361,10 @@ Fixpoint erase (s: tm) : utlc :=
361361
(* This should be a correct formalization of exercise 23.6.3 1) *)
362362
Lemma lemma_23_6_3_1:
363363
forall Gamma t T m, has_type Gamma t T -> erase t = m ->
364-
exists Gamma' s T', has_type Gamma' s T' /\ erase s = m.
364+
exists Gamma' s T', has_type Gamma' s T' /\ erase s = m.
365365
Proof.
366366
(* intros Gamma t. revert Gamma. *)
367-
intros * Htype Herase.
367+
intros * Htype Herase.
368368
induction t in Gamma, T, Htype, Herase |- *.
369369
- exists Gamma, (var_tm n), T. now split.
370370
- exists Gamma, (app t1 t2), T. now split.
@@ -402,7 +402,7 @@ Proof.
402402
Qed.
403403

404404
Print Assumptions erase_subst.
405-
405+
406406
Lemma wf_subst: forall s n l sigma_ty,
407407
wf s n l -> wf (subst_tm sigma_ty var_tm s) n l.
408408
Proof.
@@ -433,7 +433,7 @@ Proof.
433433
1, 2: assumption. constructor. constructor.
434434
- exists (app t1 t2), 0, 0. repeat split.
435435
1, 2: assumption. constructor. constructor.
436-
- inversion Htype. subst T s T2.
436+
- inversion Htype. subst T s T2.
437437
specialize (IHt Gamma (all T1) m H2 Herase) as (s & n & l & IH0 & IH1 & IH2).
438438
destruct n as [|n'].
439439
+ exists (tapp s t0), 0, (S l). repeat split.
@@ -454,7 +454,7 @@ Proof.
454454
apply wf_subst. apply H1.
455455
- exists (lam t t0), 0, 0. repeat split.
456456
1, 2: assumption. constructor. constructor.
457-
- inversion Htype. subst T s.
457+
- inversion Htype. subst T s.
458458
specialize (IHt (List.map (ren_ty S) Gamma) T0 m H0 Herase) as (s & n & l & IH0 & IH1 & IH2).
459459
exists (tlam s), (S n), l. repeat split.
460460
+ constructor. assumption.
@@ -464,7 +464,7 @@ Qed.
464464

465465
Print Assumptions lemma_23_6_3_2.
466466

467-
Require Import Lia.
467+
From Stdlib Require Import Lia.
468468
Lemma bin_size_ind (f : nat -> nat -> nat) (P : nat -> nat -> Type) :
469469
(forall x y, (forall x' y', f x' y' < f x y -> P x' y') -> P x y) -> forall x y, P x y.
470470
Proof.
@@ -518,15 +518,15 @@ Qed.
518518

519519
Lemma lemma_23_6_3_3 :
520520
forall Gamma t m n T, exposed t -> has_type Gamma t T -> erase t = app_utlc m n ->
521-
exists s u U, has_type Gamma s (arr U T) /\ erase s = m /\
522-
has_type Gamma u U /\ erase u = n /\
521+
exists s u U, has_type Gamma s (arr U T) /\ erase s = m /\
522+
has_type Gamma u U /\ erase u = n /\
523523
t = app s u.
524-
Proof.
524+
Proof.
525525
intros Gamma t. revert Gamma.
526-
destruct t; intros * Hext HTt Hert;
526+
destruct t; intros * Hext HTt Hert;
527527
try discriminate Hert. (* takes care of cases where erase does not change the constructor. *)
528528
- inversion HTt; subst.
529-
inversion Hert; subst.
529+
inversion Hert; subst.
530530
exists t1, t2, T1; repeat split; assumption.
531531
- inversion Hext. (* tapp is thrown away by erase but cannot be exposed. *)
532532
- inversion Hext. (* tlam is thrown away by erase but cannot be exposed. *)

share/rocq-autosubst-ocaml/core.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Two things are important:
1919
*)
2020

2121
(** *** List Instance *)
22-
Require Import List.
22+
From Stdlib Require Import List.
2323

2424
Notation "'list_map'" := map.
2525

@@ -101,7 +101,7 @@ Definition option_comp {A B C} {f : A -> B} {g : B -> C} {h : A -> C}:
101101
Proof.
102102
intros H. destruct p as [a|]; cbn.
103103
- f_equal. apply H.
104-
- reflexivity.
104+
- reflexivity.
105105
Defined.
106106

107107
#[export] Hint Rewrite in_map_iff : FunctorInstances.

share/rocq-autosubst-ocaml/core_axioms.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
(** *** Functional Extensionality
88
We import the axiom from the Coq Standard Library and derive a utility tactic to make the assumption practically usable.
99
*)
10-
Require Import Coq.Logic.FunctionalExtensionality.
10+
From Stdlib Require Import Logic.FunctionalExtensionality.
1111
Require Import Program.Tactics.
1212
Require Import core.
1313

0 commit comments

Comments
 (0)