Skip to content

Removing lemmas #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft

Removing lemmas #79

wants to merge 19 commits into from

Conversation

DafinaTrufas
Copy link
Contributor

No description provided.

@DafinaTrufas DafinaTrufas changed the title Remmoving a lemma from FinExtras.v Remmoving lemmas Aug 2, 2022
Copy link
Contributor

@wkolowski wkolowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far so good, but is it the final version of this PR or are you going to add more commits?

If it's not final, then it's a good idea to mark it as a "draft PR" and only request a review when it's ready to be merged.

@DafinaTrufas
Copy link
Contributor Author

It's not final, I'm going to add more commits. Sorry, I wasn't aware of the possibility to mark a PR as draft.

@DafinaTrufas DafinaTrufas marked this pull request as draft August 2, 2022 12:10
@DafinaTrufas DafinaTrufas changed the title Remmoving lemmas Removing lemmas Aug 2, 2022
@DafinaTrufas DafinaTrufas marked this pull request as ready for review August 2, 2022 17:21
@traiansf
Copy link
Contributor

traiansf commented Aug 3, 2022

I feel a little biased about removing some results about streams and stream filtering and also about topological sorting (maybe because I've been working on them).

My feeling is that some are general purpose lemmas, which might not be used now, but could be eventually (e.g., about streams / stream filtering), while others help make the argument about the correctness of an algorithm (e.g., about topological sorting).

On the other hand, we don't really know when we're going to need those and might not make sense to maintain them in the hope that they would sometime be useful. So I'm wondering whether it would make sense to tag the current master and remove them, keeping it mind that if we sometime need them, we can take a look at the tagged version.

Copy link
Contributor

@palmskog palmskog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DafinaTrufas an important goal with removing lemmas is to remove code, that is, to make files smaller and more surveyable. Hence, you should remove lemmas and not comment them out.

However, that is not to say that all currently commented-out lemmas in this PR should actually be removed in the end. But please change the PR to use full removal, and we'll take it from there.

@DafinaTrufas
Copy link
Contributor Author

@DafinaTrufas an important goal with removing lemmas is to remove code, that is, to make files smaller and more surveyable. Hence, you should remove lemmas and not comment them out.

However, that is not to say that all currently commented-out lemmas in this PR should actually be removed in the end. But please change the PR to use full removal, and we'll take it from there.

Ok. I'm changing it now.

Copy link
Contributor

@wkolowski wkolowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You removed a lemma I recently added (elem_of_list_split_2), which will break casper-cbc-proofs. You should certainly add it back.

Regarding the other changes, I have mixed feelings. I think removing lemmas that refer to StrictlyComparable or other in-house stuff seems fine, but these extras that refer to EqDecision etc. seem pretty general and useful.

Maybe we should try to submit these lemmas to the standard library and stdpp before we remove them?

Also, I wonder: does the script consider usage cross-project? Removing elem_of_list_split_2 is clearly a false positive, as it is used in casper-cbc-proofs.

Comment on lines 341 to -474
(* TODO(palmskog): consider submitting a PR to Coq's stdlib. *)
Lemma set_diff_nodup' `{EqDecision A} (l l' : list A)
: NoDup l -> NoDup (set_diff l l').
Proof.
induction 1 as [|x l H H' IH]; simpl.
- constructor.
- case_decide.
+ by apply IH.
+ by apply set_add_nodup, IH.
Qed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe if we're removing this one, @palmskog should really submit a PR to the stdlib?

And if you delete it, you should also delete the TODO.

Comment on lines -6 to -14
(** This lemma is needed in fault_weight_state_backwards **)
Lemma Rplusminus_assoc : forall r1 r2 r3,
(r1 + r2 - r3)%R = (r1 + (r2 - r3))%R.
Proof.
intros. unfold Rminus.
apply Rplus_assoc.
Qed.

(** This lemma is needed in fault_weight_state_sorted_subset **)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree that removing these looks like a good idea, but what about the comment? @traiansf

@@ -4,4 +4,4 @@ From Coq Require Export ssreflect.
#[export] Set SsrOldRewriteGoalsOrder.
#[export] Set Asymmetric Patterns.
#[export] Set Bullet Behavior "None".
Definition iYC2 := True.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@palmskog What is this line doing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wkolowski some of the tooling (coq-dpdgraph, I think) requires there to be a constant defined in each file. So we add this dummy constant.

Copy link
Contributor

@wkolowski wkolowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see my suggestions were addressed, but I still don't know whether these changes are for good. I will let Karl decide.

@palmskog
Copy link
Contributor

palmskog commented Aug 5, 2022

There are still too many removals here that require more discussion. I think we should trim the PR to only the uncontroversial removals. I may be able to get to this next week.

@palmskog palmskog marked this pull request as draft August 22, 2022 11:15
@wkolowski
Copy link
Contributor

@palmskog It seems this PR has been stale for around 1.5 years and also I have removed plenty of duplicated/unnecessary lemmas over time, e.g. some of the stuff in ListExtras.v and almost everything from RealsExtras.v. Should this PR be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants