Skip to content

Commit

Permalink
Fix errors when using coq v8.19.2
Browse files Browse the repository at this point in the history
The changes in the stdlib regarding `Nat` broke some proofs.
  • Loading branch information
Columbus240 committed Aug 6, 2024
1 parent 0aab07c commit 24a446c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion theories/Topology/Completeness.v
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ intros y Hy.
inversion Hy; subst; clear Hy.
rename x0 into n. clear Hx d_metric.
constructor.
destruct (le_or_lt N n).
destruct (Nat.le_gt_cases N n).
- apply Rlt_le_trans with 1; auto.
unfold Rmax.
destruct (Rle_dec _ _); lra.
Expand Down
2 changes: 1 addition & 1 deletion theories/Topology/TietzeExtension.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Require Export RTopology SeparatednessAxioms.
Require Import RFuncContinuity UniformTopology ContinuousFactorization.
From Coq Require Import Description Max Psatz ClassicalChoice.
From Coq Require Import Description Psatz ClassicalChoice.
From ZornsLemma Require Import Proj1SigInjective.
Require Import UrysohnsLemma.

Expand Down
1 change: 0 additions & 1 deletion theories/Topology/UniformTopology.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Require Export MetricSpaces.
Require Import FunctionalExtensionality.
Require Export Completeness.
Require Import Description.
Require Import Max.
Require Import Psatz.
Require Import Lra.
From Coq Require ProofIrrelevance.
Expand Down
46 changes: 24 additions & 22 deletions theories/Topology/UrysohnsLemma.v
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ Qed.

Require Export TopologicalSpaces.
Require Export InteriorsClosures.
Require Import Div2.
Require Import Even.
Require Import Arith.
Require Export RTopology.

Expand Down Expand Up @@ -226,12 +224,12 @@ destruct n as [|].
red; intros; constructor.
Qed.

Definition expand_U_dyadic (f:nat->Ensemble X)
Definition expand_U_dyadic (f:nat -> Ensemble X)
(Hopen: forall n:nat, open (f n))
(Hincr: forall n:nat, Included (closure (f n)) (f (S n)))
(n:nat) : Ensemble X :=
if (even_odd_dec n) then f (div2 n) else
let m := div2 n in proj1_sig
if (Nat.Even_Odd_dec n) then f (Nat.div2 n) else
let m := Nat.div2 n in proj1_sig
(normal_sep_fun (closure (f m)) (f (S m))
(closure_closed _) (Hopen _) (Hincr _)).

Expand All @@ -240,7 +238,7 @@ Lemma expand_U_dyadic_open: forall f Hopen Hincr n,
Proof.
intros.
unfold expand_U_dyadic.
destruct even_odd_dec.
destruct Nat.Even_Odd_dec.
- apply Hopen.
- destruct normal_sep_fun.
simpl.
Expand All @@ -254,22 +252,28 @@ Proof.
intros.
unfold expand_U_dyadic.
simpl.
destruct even_odd_dec.
destruct Nat.Even_Odd_dec.
- destruct normal_sep_fun.
simpl.
destruct n.
+ simpl.
apply a.
+ rewrite <- odd_div2.
+ rewrite <- Nat.Odd_div2.
* apply a.
* now inversion e.
* apply Nat.Even_succ.
exact e.
- simpl.
destruct normal_sep_fun.
destruct normal_sep_fun as [x [Hx0 [Hx1 Hx2]]].
simpl.
destruct o.
rewrite even_div2.
+ now apply a.
+ trivial.
destruct n.
{ (* ~ Nat.Odd 0 *)
contradict o. clear.
intros []. lia.
}
apply Nat.Odd_succ in o.
rewrite Nat.Even_div2.
+ exact Hx2.
+ exact o.
Qed.

Definition packaged_expand_U_dyadic :
Expand Down Expand Up @@ -325,14 +329,12 @@ simpl.
unfold expand_U_dyadic.
change ((m + (m + 0))%nat) with ((2*m)%nat).
rewrite div2_double.
assert (forall m:nat, even (2*m)).
{ induction m0.
{ constructor. }
replace ((2 * S m0)%nat) with ((S (S (2 * m0)))%nat) by ring.
constructor.
now constructor. }
destruct even_odd_dec; trivial.
now contradiction not_even_and_odd with ((2 * m)%nat).
assert (forall m:nat, Nat.Even (2*m)).
{ intros ?. apply Nat.Even_mul_l.
exists 1%nat. reflexivity.
}
destruct Nat.Even_Odd_dec; trivial.
now contradiction Nat.Even_Odd_False with (2 * m)%nat.
Qed.

Lemma U_dyadic_open: forall x:dyadic_rational,
Expand Down
2 changes: 1 addition & 1 deletion theories/ZornsLemma/ReverseMath/ReverseCSB.v
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ Proof.
rewrite Nat.ltb_ge in Heqb.
rewrite Nat.le_succ_r in Heqb.
destruct Heqb; auto.
apply lt_not_le in Heqb0.
apply Nat.lt_nge in Heqb0.
contradiction.
}
rewrite H1. assumption.
Expand Down

0 comments on commit 24a446c

Please sign in to comment.