To play this document inside your browser use ALT-N and ALT-P. If you get stack overflow errors, try to use Google Chrome or Chromium with the command line option --js-flags="--harmony-tailcalls".

You can save your edits inside your browser and load them back (edits are also saved when you close the window). Finally you can download the file for offline editing.


Classical logic is somewhat surprising! Prove that given two arbitrary propositions a and b, either a implies b or the converse

Enrico is a lazy student. When asked to reverse and filter a list he comes up with the following ugly code.

The teacher asks him to prove that his ugly code is equivalent to the nicer code [seq x <- rev l | p x] he could have written by reusing the seq library.

Such proof is not trivial:

  • filtrev has an accumulator, rev (at least apparently) does not.
  • which is the invariant linking the accumulator acc and p in the code of filtrev? Depending on how you expose the accumulator on the right hand side of the goal, such invariant may need to be taken into account by the induction.

Relevant keywords for Search are: rev cons cat filter rcons Hint: it is perfectly fine to state intermediate lemmas

Prove the equivalence of these two sums. E.g. (n=8)

    1 + 3 + 5 + 7 = 7-0 + 7-2 + 7-4 + 7-6

Even the Mathematical Components library misses some theorems, for example the following one.

Would you help us improve the library with this lemma?

Hint: check out the theory of iota

Now, some algebra.

Big operations and zmodType. Now that ring_scope is open we are in an algebraic setting. Think about the meaning of + now, and find the right injectivity lemma.

We remind what Gauss integer are and recall some theory about it.

Prove these two facts. (Hint: conjugation is a morphism)

Question: Prove that GI euclidean for the stasm gaussNorm.

  • i.e. ∀ (a, b) ∈ GI × GI*, ∃ (q, r) ∈ GI² s.t. a = q b + r and φ(r) < φ(b)
  • Suggested strategy: sketch the proof on a paper first, don't let Coq divert you from your proofsketch
  • We first sketch the paper proof here and then do it in Coq:
    • take a / b = x + i y
    • take u the closest integer to x, and v the closest integer to y
    • satisfy the existential with q = u + i v and r = a - q b, which are both Gauss integers.
    • We want to show that |a - q b|² < |b|².
    • It suffices to show |a / b - q|² < 1
    • But |a / b - q|² = (u - x)² + (v - x)² ≤ ‌½² + ½² < 1
  • Now we give a Coq proof with holes, fill in the holes.

Definition and properties of Lagrange polynomials.

Prove only one of the following lemmas

Taylor formula for polynomials

Endomorphisms u such that Ker u ⊕ Im u = E.

The endomorphisms of a space E of finite dimension n, such that u o v = 0 and v + u is invertible are exactly the endomorphisms such that Ker u ⊕ Im u = E.

  • Assume u o v = 0 and v + u is invertible,
    • we have rank (v + u) = n
    • we have rank v + rank u = n and we have Im v ⊂ Ker u
    • Hence we have Im v = Ker u
    • We deduce that Ker u ⊕ Im u = Im v ⊕ Im u = E