GithubHelp home page GithubHelp logo

federicobruzzone / software-foundations Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 8.79 MB

Solutions (in Coq) of the exercises in the software foundation books.

License: GNU General Public License v3.0

Coq 46.46% Makefile 0.04% TeX 0.23% HTML 52.03% CSS 0.98% JavaScript 0.25%
coq coq-library functional-programming ocaml software-foundations

software-foundations's Introduction

Software Foundations

Solutions (in Coq) of the exercises in the software foundation books.

Useful links

Contributing

Contributions to this project are welcome! If you have any suggestions, improvements, or bug fixes, feel free to submit a pull request.

License

This repository is licensed under the GNU General Public License (GPL). Please review the license file provided in the repository for more information regarding the terms and conditions of the GPL license.

Contact

If you have any questions, suggestions, or feedback, do not hesitate to contact me.

software-foundations's People

Contributors

federicobruzzone avatar

Stargazers

 avatar

Watchers

 avatar

software-foundations's Issues

Issue with double_injective_take2 theorem

There is the Theorem on the Vol. 1 - Tactics page

Theorem double_injective_take2 : forall n m,
  double n = double m ->
  n = m.
Proof.
  intros n m.
  (* [n] and [m] are both in the context *)
  generalize dependent n.
  (* Now [n] is back in the goal and we can do induction on
     [m] and get a sufficiently general IH. *)
  induction m as [| m' IHm'].
  - (* m = O *) simpl. intros n eq. destruct n as [| n'] eqn:E.
    + (* n = O *) reflexivity.
    + (* n = S n' *) discriminate eq.
  - (* m = S m' *) intros n eq. destruct n as [| n'] eqn:E.
    + (* n = O *) discriminate eq.
    + (* n = S n' *) f_equal.
      apply IHm'. injection eq as goal. apply goal. Qed.

Coq 8.17.1 fails on apply goal. command with the following error message:

In environment
m' : nat
IHm' : forall n : nat, double n = double m' -> n = m'
n, n' : nat
E : n = S n'
goal : n' + S n' = m' + S m'
Unable to unify "n' + S n' = m' + S m'" with
 "double n' = double m'".

It seems that there is typo in the theorem. I have fixed it cumbersome way:

Theorem double_injective_take2 : forall n m,
  double n = double m ->
  n = m.
Proof.
  intros n m.
  (* [n] and [m] are both in the context *)
  generalize dependent n.
  (* Now [n] is back in the goal and we can do induction on
     [m] and get a sufficiently general IH. *)
  induction m as [| m' IHm'].
  - (* m = O *) simpl. intros n eq. destruct n as [| n'] eqn:E.
    + (* n = O *) reflexivity.
    + (* n = S n' *) discriminate eq.
  - (* m = S m' *) intros n eq. destruct n as [| n'] eqn:E.
    + (* n = O *) discriminate eq.
    + (* n = S n' *) apply f_equal.
      apply IHm'.
      injection eq as goal. 
      rewrite add_comm in goal. simpl in goal.
      symmetry in goal.
      rewrite add_comm in goal. simpl in goal. 
      symmetry in goal.
      apply S_injective in  goal.
      apply goal.      
Qed. 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.