Skip to content

Commit e505849

Browse files
RatCornulafeychine
authored andcommitted
chore: apply comments
1 parent c4f6477 commit e505849

7 files changed

Lines changed: 79 additions & 81 deletions

File tree

theories/Base.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(**
2-
This project contains formalisation in Coq of the 2.7.1 MPRI course:
2+
This project contains formalisation in Rocq of the 2.7.1 MPRI course:
33
Foundations of proof systems.
44
*)
55

theories/FirstOrderLogic/Deduction.v

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ Inductive Derivable: list formula -> formula -> Type :=
8383

8484
(**
8585
This lemma states that if Γ ⊢ φ in our representation of the first-order
86-
logic, then it also holds in Coq [Prop].
86+
logic, then it also holds in Rocq [Prop].
8787
*)
8888
Lemma derivable_correctness (fcts: nat -> list nat -> nat) (preds: nat -> list nat -> Prop)
8989
(gamma: list formula) (phi: formula):
9090
Derivable gamma phi ->
91-
forall (sigma: list nat),
92-
(forall (idx: nat), formula_eval fcts preds sigma (nth idx gamma FTop)) ->
93-
formula_eval fcts preds sigma phi.
91+
forall (σ: list nat),
92+
(forall (idx: nat), formula_eval fcts preds σ (nth idx gamma FTop)) ->
93+
formula_eval fcts preds σ phi.
9494
Proof.
9595
induction 1 as
9696
[ | | ? ? _ IHind |
@@ -99,7 +99,7 @@ Proof.
9999
(* RDisj *) ? ? ? _ IHind | ? ? ? _ IHind | ? ? ? ? _ IHind1 _ IHind2 _ IHind3 |
100100
(* RForAll *) ? ? _ IHind | ? ? phi _ IHind |
101101
(* RExists *) ? ? phi _ IHind | ? ? ? _ IHind1 _ IHind2 ];
102-
simpl in *; intros sigma IHtree; intros.
102+
simpl in *; intros σ IHtree; intros.
103103

104104
(* RAxiom *)
105105
- apply IHtree.
@@ -109,11 +109,11 @@ Proof.
109109

110110
(* RBot_e *)
111111
- exfalso.
112-
apply (IHind sigma).
112+
apply (IHind σ).
113113
apply IHtree.
114114

115115
(* RImp_i *)
116-
- apply (IHind sigma).
116+
- apply (IHind σ).
117117
intros [|].
118118
+ assumption.
119119
+ apply IHtree.
@@ -150,7 +150,7 @@ Proof.
150150
apply IHtree.
151151

152152
(* RDisj_e *)
153-
- destruct (IHind1 sigma IHtree).
153+
- destruct (IHind1 σ IHtree).
154154
+ apply IHind2.
155155
intros [|]; [ assumption | apply IHtree ].
156156
+ apply IHind3.
@@ -159,30 +159,30 @@ Proof.
159159
(* RForAll_i *)
160160
- apply IHind; intros n.
161161
rewrite formula_lift_nth.
162-
apply formula_eval_S with (sigma := nil).
162+
apply formula_eval_S with (σ := nil).
163163
apply IHtree.
164164

165165
(* RForAll_e *)
166166
- rewrite <- (term_lift_0 phi 0).
167-
apply formula_eval_subst_lift with (sigma := nil).
167+
apply formula_eval_subst_lift with (σ := nil).
168168
apply IHind.
169169
apply IHtree.
170170

171171
(* RExists_i *)
172-
- exists (term_eval fcts sigma phi).
173-
apply formula_eval_subst_lift with (sigma := nil).
172+
- exists (term_eval fcts σ phi).
173+
apply formula_eval_subst_lift with (σ := nil).
174174
rewrite term_lift_0.
175175
apply IHind.
176176
apply IHtree.
177177

178178
(* RExists_e *)
179-
- destruct (IHind1 sigma IHtree) as [ n ? ].
180-
apply formula_eval_S with (sigma := nil) (idx := n).
179+
- destruct (IHind1 σ IHtree) as [ n ? ].
180+
apply formula_eval_S with (σ := nil) (idx := n).
181181
apply IHind2.
182182

183183
intros [|]; [ assumption |].
184184
rewrite formula_lift_nth.
185-
apply formula_eval_S with (sigma := nil).
185+
apply formula_eval_S with (σ := nil).
186186
apply IHtree.
187187
Qed.
188188

theories/FirstOrderLogic/Definitions.v

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(**
22
This section defines the first-order logic with some properties on derivations.
33
4-
This file contains terms, formulas, and an evaluation of formulas into Coq [Prop].
4+
This file contains terms, formulas, and an evaluation of formulas into Rocq [Prop].
55
*)
66

77
From FormArith Require Export Base.
@@ -28,7 +28,7 @@ Inductive term :=
2828
| TApp : nat -> list term -> term.
2929

3030
(**
31-
As Coq cannot induce an induction principle with induction hypothesis for
31+
As Rocq cannot induce an induction principle with induction hypothesis for
3232
indirect terms, for example the ones in lists, here is a better induction
3333
principle that includes [Forall P terms] in the [TApp] case.
3434
*)
@@ -91,38 +91,38 @@ Inductive formula :=
9191

9292
(**
9393
Auxiliary function of [formula_eval] that evaluates a term [t] in the
94-
environment [sigma] with the environment of functions [fcts].
94+
environment [σ] with the environment of functions [fcts].
9595
*)
96-
Fixpoint term_eval (fcts: nat -> list nat -> nat) (sigma: list nat) (t: term): nat :=
96+
Fixpoint term_eval (fcts: nat -> list nat -> nat) (σ: list nat) (t: term): nat :=
9797
match t with
98-
| TVar idx => nth idx sigma 0
99-
| TApp fct_idx terms => fcts fct_idx (map (term_eval fcts sigma) terms)
98+
| TVar idx => nth idx σ 0
99+
| TApp fct_idx terms => fcts fct_idx (map (term_eval fcts σ) terms)
100100
end.
101101

102102
(**
103-
Evaluates a formula into a Coq [Prop].
103+
Evaluates a formula into a Rocq [Prop].
104104
105105
Here, [fcts] is the environment of functions that are used in [term]
106106
definition: a function is denoted by a natural number, and maps a list of
107107
[nat] into a [nat].
108108
109109
With the same idea, [preds] is the environment of predicates that are the
110110
atomic formulas: a predicate is denoted by a natural number, and maps a list
111-
of terms to a Coq [Prop].
111+
of terms to a Rocq [Prop].
112112
*)
113113
Fixpoint formula_eval
114114
(fcts: nat -> list nat -> nat) (preds : nat -> list nat -> Prop)
115-
(sigma: list nat) (phi: formula): Prop :=
115+
(σ: list nat) (phi: formula): Prop :=
116116
match phi with
117-
| FAtom pred_idx terms => preds pred_idx (map (term_eval fcts sigma) terms)
117+
| FAtom pred_idx terms => preds pred_idx (map (term_eval fcts σ) terms)
118118

119-
| FConj phi phi' => (formula_eval fcts preds sigma phi) /\ (formula_eval fcts preds sigma phi')
120-
| FDisj phi phi' => (formula_eval fcts preds sigma phi) \/ (formula_eval fcts preds sigma phi')
121-
| FImp phi phi' => (formula_eval fcts preds sigma phi) -> (formula_eval fcts preds sigma phi')
119+
| FConj phi phi' => (formula_eval fcts preds σ phi) /\ (formula_eval fcts preds σ phi')
120+
| FDisj phi phi' => (formula_eval fcts preds σ phi) \/ (formula_eval fcts preds σ phi')
121+
| FImp phi phi' => (formula_eval fcts preds σ phi) -> (formula_eval fcts preds σ phi')
122122

123123
| FBot => False
124124
| FTop => True
125125

126-
| FForAll phi => forall x, formula_eval fcts preds (x :: sigma) phi
127-
| FExists phi => exists x, formula_eval fcts preds (x :: sigma) phi
126+
| FForAll phi => forall x, formula_eval fcts preds (x :: σ) phi
127+
| FExists phi => exists x, formula_eval fcts preds (x :: σ) phi
128128
end.

theories/FirstOrderLogic/Lifts.v

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,12 @@ Qed.
351351

352352
(** *** Evaluations *)
353353

354-
Lemma term_eval_lift_n (fcts: nat -> list nat -> nat) (sigma sigma': list nat) (idx: nat) (t: term):
355-
term_eval fcts (sigma ++ (idx :: sigma')) (term_lift (length sigma) 1 t) =
356-
term_eval fcts (sigma ++ sigma') t.
354+
Lemma term_eval_lift_n (fcts: nat -> list nat -> nat) (σ σ': list nat) (idx: nat) (t: term):
355+
term_eval fcts (σ ++ (idx :: σ')) (term_lift (length σ) 1 t) =
356+
term_eval fcts (σ ++ σ') t.
357357
Proof.
358358
induction t as [ idx' | ? terms IHterms ]; simpl.
359-
- destruct (PeanoNat.Nat.ltb_spec idx' (length sigma)); simpl.
359+
- destruct (PeanoNat.Nat.ltb_spec idx' (length σ)); simpl.
360360
+ rewrite !app_nth1 by assumption.
361361
reflexivity.
362362

@@ -365,26 +365,26 @@ Proof.
365365
rewrite PeanoNat.Nat.sub_succ_l by assumption.
366366
simpl; lia.
367367

368-
- replace (map _ _) with (map (term_eval fcts (sigma ++ sigma')) terms); [ reflexivity |].
368+
- replace (map _ _) with (map (term_eval fcts (σ ++ σ')) terms); [ reflexivity |].
369369
solve_TApp_case terms IHterms.
370370
Qed.
371371

372-
Lemma term_eval_lift_0 (fcts: nat -> list nat -> nat) (sigma sigma': list nat) (t: term):
373-
term_eval fcts sigma t = term_eval fcts (sigma' ++ sigma) (term_lift 0 (length sigma') t).
372+
Lemma term_eval_lift_0 (fcts: nat -> list nat -> nat) (σ σ': list nat) (t: term):
373+
term_eval fcts σ t = term_eval fcts (σ' ++ σ) (term_lift 0 (length σ') t).
374374
Proof.
375375
induction t as [ idx | ? terms IHterms ]; simpl.
376376
- rewrite app_nth2 by lia.
377377
replace (idx + _ - _) with idx by lia.
378378
reflexivity.
379379

380-
- replace (map _ (map _ _)) with (map (term_eval fcts sigma) terms); [ reflexivity |].
380+
- replace (map _ (map _ _)) with (map (term_eval fcts σ) terms); [ reflexivity |].
381381
solve_TApp_case terms IHterms.
382382
Qed.
383383

384384
Lemma term_eval_lift_n_iter (fcts: nat -> list nat -> nat)
385-
(sigma sigma': list nat) (idx: nat) (terms: list term):
386-
map (term_eval fcts (sigma ++ idx :: sigma')) (map (term_lift (length sigma) 1) terms) =
387-
map (term_eval fcts (sigma ++ sigma')) terms.
385+
(σ σ': list nat) (idx: nat) (terms: list term):
386+
map (term_eval fcts (σ ++ idx :: σ')) (map (term_lift (length σ) 1) terms) =
387+
map (term_eval fcts (σ ++ σ')) terms.
388388
Proof.
389389
induction terms; simpl.
390390
{ reflexivity. }
@@ -393,20 +393,20 @@ Proof.
393393
f_equal; assumption.
394394
Qed.
395395

396-
Lemma term_eval_subst_lift (fcts: nat -> list nat -> nat) (sigma sigma': list nat) (t t': term):
397-
term_eval fcts (sigma ++ sigma') (term_subst (length sigma) (term_lift 0 (length sigma) t') t)
398-
= term_eval fcts (sigma ++ (term_eval fcts sigma' t') :: sigma') t.
396+
Lemma term_eval_subst_lift (fcts: nat -> list nat -> nat) (σ σ': list nat) (t t': term):
397+
term_eval fcts (σ ++ σ') (term_subst (length σ) (term_lift 0 (length σ) t') t)
398+
= term_eval fcts (σ ++ (term_eval fcts σ' t') :: σ') t.
399399
Proof.
400400
induction t as [ idx | ? terms IHterms ]; simpl.
401401
2: { f_equal; solve_TApp_case terms IHterms. }
402402

403-
destruct (PeanoNat.Nat.eqb_spec (length sigma) idx) as [ Heq |]; simpl.
403+
destruct (PeanoNat.Nat.eqb_spec (length σ) idx) as [ Heq |]; simpl.
404404
{ rewrite <- Heq.
405405
rewrite nth_middle.
406406
rewrite <- term_eval_lift_0.
407407
reflexivity. }
408408

409-
destruct (PeanoNat.Nat.ltb_spec (length sigma) idx) as [ Heq |]; simpl.
409+
destruct (PeanoNat.Nat.ltb_spec (length σ) idx) as [ Heq |]; simpl.
410410
{ destruct idx; [ lia |]; simpl.
411411
rewrite PeanoNat.Nat.sub_0_r.
412412
rewrite !app_nth2; [| lia.. ].
@@ -481,14 +481,14 @@ Proof.
481481
Qed.
482482

483483
Lemma formula_eval_S (fcts: nat -> list nat -> nat) (preds: nat -> list nat -> Prop)
484-
(phi: formula) (sigma sigma': list nat) (idx: nat):
485-
formula_eval fcts preds (sigma ++ idx :: sigma') (formula_lift (length sigma) 1 phi) <->
486-
formula_eval fcts preds (sigma ++ sigma') phi.
484+
(phi: formula) (σ σ': list nat) (idx: nat):
485+
formula_eval fcts preds (σ ++ idx :: σ') (formula_lift (length σ) 1 phi) <->
486+
formula_eval fcts preds (σ ++ σ') phi.
487487
Proof.
488-
generalize sigma.
488+
generalize σ.
489489

490490
induction phi as [ | ? IHphi1 ? IHphi2 | ? IHphi1 ? IHphi2 | ? IHphi1 ? IHphi2 | | | ? IHphi | ? IHphi ];
491-
simpl; intros sigma''.
491+
simpl; intros σ''.
492492

493493
(* FAtom *)
494494
- rewrite term_eval_lift_n_iter.
@@ -517,28 +517,28 @@ Proof.
517517

518518
(* FForAll *)
519519
- split; intros Hphi x.
520-
all: apply (IHphi (x :: sigma'')).
520+
all: apply (IHphi (x :: σ'')).
521521
all: apply Hphi.
522522

523523
(* FExists *)
524524
- split; intros [x Heval].
525525
all: exists x.
526-
all: apply (IHphi (x :: sigma'')).
526+
all: apply (IHphi (x :: σ'')).
527527
all: apply Heval.
528528
Qed.
529529

530530
Lemma formula_eval_subst_lift (fcts: nat -> list nat -> nat) (preds: nat -> list nat -> Prop)
531-
(phi: formula) (sigma sigma': list nat) (t: term):
532-
formula_eval fcts preds (sigma ++ sigma') (formula_subst (length sigma) (term_lift 0 (length sigma) t) phi)
533-
<-> formula_eval fcts preds (sigma ++ (term_eval fcts sigma' t) :: sigma') phi.
531+
(phi: formula) (σ σ': list nat) (t: term):
532+
formula_eval fcts preds (σ ++ σ') (formula_subst (length σ) (term_lift 0 (length σ) t) phi)
533+
<-> formula_eval fcts preds (σ ++ (term_eval fcts σ' t) :: σ') phi.
534534
Proof.
535-
generalize sigma.
535+
generalize σ.
536536

537537
induction phi as [ ? terms | ? IHphi1 ? IHphi2 | ? IHphi1 ? IHphi2 | ? IHphi1 ? IHphi2 | | | ? IHphi | ? IHphi ];
538-
simpl; intros sigma''.
538+
simpl; intros σ''.
539539

540540
(* FAtom *)
541-
- replace (map _ _) with (map (term_eval fcts (sigma'' ++ term_eval fcts sigma' t :: sigma')) terms); [ reflexivity |].
541+
- replace (map _ _) with (map (term_eval fcts (σ'' ++ term_eval fcts σ' t :: σ')) terms); [ reflexivity |].
542542
induction terms as [| ? ? IHterms ]; simpl.
543543
{ reflexivity. }
544544

@@ -570,28 +570,28 @@ Proof.
570570

571571
(* FForAll *)
572572
- split; intros Hphi x; simpl.
573-
+ apply (IHphi (x :: sigma'')).
574-
replace (term_lift _ _ _) with (term_lift 0 1 (term_lift 0 (length sigma'') t)).
573+
+ apply (IHphi (x :: σ'')).
574+
replace (term_lift _ _ _) with (term_lift 0 1 (term_lift 0 (length σ'') t)).
575575
{ apply Hphi. }
576576

577577
rewrite term_lift_0_lift_0.
578578
reflexivity.
579579

580-
+ specialize (IHphi (x :: sigma'')).
580+
+ specialize (IHphi (x :: σ'')).
581581
rewrite term_lift_0_lift_0.
582582
apply IHphi.
583583
apply Hphi.
584584

585585
(* FExists *)
586586
- split; intros [x Hphi]; exists x; simpl.
587-
+ apply (IHphi (x :: sigma'')).
588-
replace (term_lift _ _ _) with (term_lift 0 1 (term_lift 0 (length sigma'') t)).
587+
+ apply (IHphi (x :: σ'')).
588+
replace (term_lift _ _ _) with (term_lift 0 1 (term_lift 0 (length σ'') t)).
589589
{ apply Hphi. }
590590

591591
rewrite term_lift_0_lift_0.
592592
reflexivity.
593593

594-
+ specialize (IHphi (x :: sigma'')).
594+
+ specialize (IHphi (x :: σ'')).
595595
rewrite term_lift_0_lift_0.
596596
apply IHphi.
597597
apply Hphi.

theories/SimplyTypedLambdaCalculus/ChurchRosser.v

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ From FormArith.SimplyTypedLambdaCalculus Require Import Term.
1010

1111
(** ** Definitions *)
1212

13-
(** ***
14-
Local confluence
15-
13+
(** *** Local confluence
14+
1615
A rewrite rule → is said to be locally confluent if:
1716
∀ t u v, t → u ∧ t → v ⇒ ∃ w, u → w ∧ v → w.
1817
*)
@@ -22,8 +21,7 @@ Definition local_confluence (P: term -> term -> Prop): Prop :=
2221
P t v ->
2322
exists (w : term), P u w /\ P v w.
2423

25-
(** ***
26-
Church-Rosser propery
24+
(** *** Church-Rosser propery
2725
2826
It is defined as the local confluence for the reflexive and transitive
2927
closure of the rewrite rule.

theories/SimplyTypedLambdaCalculus/StrongNormalisation.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ From FormArith.SimplyTypedLambdaCalculus Require Import Term Typing.
1414
Intuitively, a [term] is strongly normalising if all of its successor for the
1515
β-reduction are also strongly normalising.
1616
17-
This definition is equivalent but easier to deal with in Coq than the usual
17+
This definition is equivalent but easier to deal with in Rocq than the usual
1818
definition "There is no infinite path starting with this term".
1919
*)
2020
Inductive SN: term -> Prop :=

0 commit comments

Comments
 (0)