Skip to content
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

Demo.v without tuples #271

Merged
merged 5 commits into from
Nov 24, 2017
Merged

Demo.v without tuples #271

merged 5 commits into from
Nov 24, 2017

Conversation

JasonGross
Copy link
Collaborator

No description provided.

Local Ltac push := autorewrite with push_eval push_map distr_length
push_flat_map push_fold_right push_nth_default cancel_pair natsimplify.
Definition zeros n : list Z
:= List.map (fun _ => 0) (seq 0 n).
Copy link
Contributor

Choose a reason for hiding this comment

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

List.replicate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

(weight_nz : forall i, weight i <> 0).

Definition to_associational (xs:list Z) : list (Z*Z)
:= combine (map weight (List.seq 0 (List.length xs))) xs.
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a nat argument for the length, require it to be equal to length xs as a precondition to the correctness proof. (I am not sure about this, but it seems like a direct translation from tuple code).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done. Turns out that precondition isn't needed to prove eval_to_associational. Should I insert it anyway? (And eval_add_to_nth could take a weaker hypothesis, namely i < min n (length xs) rather than i < length xs and n = length xs; which hypotheses should I use?

Section mulmod.
Context (m:Z) (m_nz:m <> 0) (s:Z) (s_nz:s <> 0)
(c:list (Z*Z)) (Hm:m = s - Associational.eval c).
Definition mulmod (a b:list Z) : list Z
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, to blindly match the tuple code, I would add another argument that gets used as length a, length b, and max (length a) (length b).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

_CoqProject Outdated
@@ -3,6 +3,7 @@
Bedrock/Nomega.v
Bedrock/Word.v
src/Demo.v
src/DemoWithReification.v
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps src/Experiments/SimplyTypedArithmetic ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@JasonGross
Copy link
Collaborator Author

Quoting #271 (comment) here so it's not collapsed:
@andres-erbsen said:

Add a nat argument for the length, require it to be equal to length xs as a precondition to the correctness proof. (I am not sure about this, but it seems like a direct translation from tuple code).

@JasonGross said:

Done. Turns out that precondition isn't needed to prove eval_to_associational. Should I insert it anyway? (And eval_add_to_nth could take a weaker hypothesis, namely i < min n (length xs) rather than i < length xs and n = length xs; which hypotheses should I use?

@andres-erbsen
Copy link
Contributor

Looks good to me as-is, still.

@JasonGross JasonGross merged commit f02acb1 into mit-plv:master Nov 24, 2017
Pipeline without CPS automation moved this from To Do to Done Nov 24, 2017
@JasonGross JasonGross deleted the demo-no-tuples branch November 24, 2017 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants