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

ProofObjects #31

Merged
merged 5 commits into from
Aug 3, 2017
Merged

ProofObjects #31

merged 5 commits into from
Aug 3, 2017

Conversation

clayrat
Copy link
Collaborator

@clayrat clayrat commented Jul 25, 2017

It seems so far this chapter will be mostly useless for us, as the distinction between proofs and terms they keep talking about doesn't really exist in Idris. Maybe something interesting will come up later.

@clayrat clayrat changed the title WIP ProofObjects ProofObjects Jul 25, 2017
@clayrat
Copy link
Collaborator Author

clayrat commented Jul 25, 2017

Should be ready.

So yeah, in its current form it's not so useful. It does contain some good-to-know theory, but if you've made it this far, you most likely already have some intuitive understanding of the things it talks about.

We could try putting it earlier in the book, but it depends on IndProp-level stuff. So not sure what to do with it for now.

@clayrat clayrat requested a review from yurrriq July 25, 2017 18:49
@yurrriq
Copy link
Collaborator

yurrriq commented Jul 25, 2017

Let's keep collecting the rough translations and we can edit later. Maybe after ten chapters we should focus on editing and then do a "release" (merge to master and regenerate the PDF).

@clayrat
Copy link
Collaborator Author

clayrat commented Jul 25, 2017

According to the book itself, the first part ("Logical Foundations") ends after Rel, the other part ("Programming Foundations") then starts focusing on modelling lambda calculus and such. So that might be a good point to do editing.

@yurrriq
Copy link
Collaborator

yurrriq commented Jul 25, 2017

Sounds like a solid plan to me.

@clayrat
Copy link
Collaborator Author

clayrat commented Jul 26, 2017

Any remarks/edits on this chapter specifically?

@yurrriq
Copy link
Collaborator

yurrriq commented Jul 28, 2017

I've been busy, but will make sure to review this and the other PRs properly by Monday at the latest.

@yurrriq
Copy link
Collaborator

yurrriq commented Jul 31, 2017

I've got some comments and edits locally. Will post them tonight.

@clayrat
Copy link
Collaborator Author

clayrat commented Aug 1, 2017

So, according to https://softwarefoundations.cis.upenn.edu/draft/lf-current/toc.html , "Logical foundations" actually end on Auto, not Rel. We should still probably review drafts every 6-8 chapters.

@yurrriq
Copy link
Collaborator

yurrriq commented Aug 1, 2017

Cool. Let's do a "release" up to Auto then and merge Rel in lot develop after. I got a bit sick last night and likely won't have time tonight, but I can definitely review all the PRs that are ready tomorrow.

\idr{Void} is equally simple — indeed, so simple it may look syntactically wrong
at first glance!

\todo[inline]{Edit, this actually is wrong, stdlib uses \idr{%runElab} to define
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should use just \idr{runElab} until we solve #22.

evidence) and returns a piece of evidence! Here it is:

```coq
Definition ev_plus4' : ∀n, ev n -> ev (4 + n) :=
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use forall so as not to upset minted.


> module ProofObjects

\[
Copy link
Collaborator

Choose a reason for hiding this comment

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

We'll need to add the following to book.tex:

- \usepackage{dirtytalk}

> module ProofObjects

\[
\say{"\textit{Algorithms are the computational content of proofs.}" - Robert
Copy link
Collaborator

Choose a reason for hiding this comment

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

This works for me:

\say{Algorithms are the computational content of proofs.} -- Robert Harper

\idr{Or}, without resorting to tactics.


==== Exercise: 2 stars, optional (or_commut'')
Copy link
Collaborator

Choose a reason for hiding this comment

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

or_commut'' should be or_comm

$\square$


=== \idr{Unit} and \idr{Void}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here's a dirty hack to work around #24:

-=== \idr{Unit} and \idr{Void}
+\subsection{\idr{Unit} and \idr{Void}}

| conj HP HQ => conj HQ HP
end.

Definition and_comm' P Q : P ∧ Q ↔ Q ∧ P :=
Copy link
Collaborator

Choose a reason for hiding this comment

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

/\ <-> /\

pattern-matching. For instance:

```coq
Definition and_comm'_aux P Q (H : P ∧ Q) :=
Copy link
Collaborator

Choose a reason for hiding this comment

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

/\

{n : Nat} -> Ev n -> Ev (S (S n))
```

expresses this functionality, in the same way that the polymorphic type \idr{{x
Copy link
Collaborator

Choose a reason for hiding this comment

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

\idr{...} needs to be on one line

only one constructor, so only one subgoal gets generated. Now, though, the form
of the \idr{EqRefl} constructor does give us some extra information: it tells us
that the two arguments to \idr{PropEq} must be the same! The `inversion` tactic
adds this fact to the context.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here's a diff with all my suggestions:

diff --git a/src/ProofObjects.lidr b/src/ProofObjects.lidr
index 7e465b3..2f24cd4 100644
--- a/src/ProofObjects.lidr
+++ b/src/ProofObjects.lidr
@@ -2,10 +2,7 @@
 
 > module ProofObjects
 
-\[
-  \say{"\textit{Algorithms are the computational content of proofs.}" - Robert
-Harper}
-\]
+\say{Algorithms are the computational content of proofs.} -- Robert Harper
 
 We have seen that Idris has mechanisms both for _programming_, using inductive
 data types like \idr{Nat} or \idr{List} and functions over these types, and for
@@ -103,9 +100,10 @@ wants to be further applied to evidence that that number is even; its type,
       {n : Nat} -> Ev n -> Ev (S (S n))
 ```
 
-expresses this functionality, in the same way that the polymorphic type \idr{{x
-: Type} -> List x} expresses the fact that the constructor \idr{Nil} can be
-thought of as a function from types to empty lists with elements of that type.
+expresses this functionality, in the same way that the polymorphic type
+\idr{{x : Type} -> List x} expresses the fact that the constructor \idr{Nil} can
+be thought of as a function from types to empty lists with elements of that
+type.
 
 \todo[inline]{Edit or remove}
 
@@ -219,7 +217,7 @@ n)} — that is, a function that takes two arguments (one number and a piece of
 evidence) and returns a piece of evidence! Here it is:
 
 ```coq
-Definition ev_plus4' : ∀n, ev n -> ev (4 + n) :=
+Definition ev_plus4' : forall n, ev n -> ev (4 + n) :=
   fun (n : Nat) => fun (H : ev n) =>
     ev_SS (S (S n)) (ev_SS n H).
 ```
@@ -359,12 +357,12 @@ we've been doing. We can also use it to build proofs directly, using
 pattern-matching. For instance:
 
 ```coq
-Definition and_comm'_aux P Q (H : P ∧ Q) :=
+Definition and_comm'_aux P Q (H : P /\ Q) :=
   match H with
   | conj HP HQ => conj HQ HP
   end.
 
-Definition and_comm' P Q : P ∧ Q ↔ Q ∧ P :=
+Definition and_comm' P Q : P /\ Q <-> Q /\ P :=
   conj (and_comm'_aux P Q) (and_comm'_aux Q P).
 ```
 
@@ -396,11 +394,11 @@ Once again, we can also directly write proof objects for theorems involving
 \idr{Or}, without resorting to tactics.
 
 
-==== Exercise: 2 stars, optional (or_commut'')
+==== Exercise: 2 stars, optional (or_comm)
 
 \ \todo[inline]{Edit}
 
-Try to write down an explicit proof object for \idr{or_commut} (without using
+Try to write down an explicit proof object for \idr{or_comm} (without using
 `Print` to peek at the ones we already defined!).
 
 > or_comm : Or p q -> Or q p
@@ -450,7 +448,7 @@ Complete the definition of the following proof object:
 $\square$
 
 
-=== \idr{Unit} and \idr{Void}
+\subsection{\idr{Unit} and \idr{Void}}
 
 The inductive definition of the \idr{Unit} proposition is simple:
 
@@ -465,7 +463,7 @@ a proof of\idr{Unit} is not informative.)
 \idr{Void} is equally simple — indeed, so simple it may look syntactically wrong
 at first glance!
 
-\todo[inline]{Edit, this actually is wrong, stdlib uses \idr{%runElab} to define
+\todo[inline]{Edit, this actually is wrong, stdlib uses \idr{runElab} to define
 it}
 
 ```idris
@@ -570,8 +568,8 @@ In general, the `inversion` tactic...
     - adds these equalities to the context (and, for convenience, rewrites them
       in the goal), and
 
-    - if the equalities are not satisfiable (e.g., they involve things like `S n
-      = Z`), immediately solves the subgoal.
+    - if the equalities are not satisfiable (e.g., they involve things like
+      \idr{S n = Z}), immediately solves the subgoal.
 
 _Example_: If we invert a hypothesis built with \idr{Or}, there are two
 constructors, so two subgoals get generated. The conclusion (result type) of the
diff --git a/src/book.tex b/src/book.tex
index a7632b4..6ee6846 100644
--- a/src/book.tex
+++ b/src/book.tex
@@ -42,6 +42,7 @@ header-includes:
 - \usepackage{todonotes}
 -
 - \usepackage{ebproof}
+- \usepackage{dirtytalk}
 include-before: \frontmatter
 ---
 

@clayrat
Copy link
Collaborator Author

clayrat commented Aug 1, 2017

But Auto isn't done yet, it's like 5 chapters after Rel in the new version :) My point was that the "first part" doesn't end as fast as I thought.

@yurrriq
Copy link
Collaborator

yurrriq commented Aug 1, 2017

Ha, ok. I misunderstood. 👍 to a "release" after Rel then.

@@ -2,10 +2,8 @@

> module ProofObjects

\[
\say{"\textit{Algorithms are the computational content of proofs.}" - Robert
\say{"\textit{Algorithms are the computational content of proofs.}" - Robert
Copy link
Collaborator

Choose a reason for hiding this comment

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

This results in the following in the PDF.

“”Algorithms are the computational content of proofs.” - Robert Harper”

I'm not married to this exact solution, but I don't like the double quotes as it is now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

\say{\textit{Algorithms are the computational content of proofs.}}
-- Robert Harper

... results in:

“Algorithms are the computational content of proofs.” – Robert Harper

@yurrriq
Copy link
Collaborator

yurrriq commented Aug 3, 2017

Actually I'm just gonna merge this and #33 and make the \say tweak. Thanks!

@yurrriq yurrriq merged commit 39def30 into develop Aug 3, 2017
@yurrriq yurrriq deleted the proofobjects branch August 3, 2017 03:26
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.

2 participants