Skip to content

Commit

Permalink
Change some styling
Browse files Browse the repository at this point in the history
  • Loading branch information
dbp committed Jan 20, 2018
1 parent 605d0c4 commit 0424852
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
9 changes: 8 additions & 1 deletion css/default.css
Expand Up @@ -160,13 +160,20 @@ tr:nth-child(even){
}

blockquote {
border-left: 7px solid #900;
border-left: 10px solid #900;
padding: 5px;
padding-left: 10px;
margin-left: 15px;
background-color: #efefef;
}

pre {
border-left: 10px solid gray;
padding-left: 15px;
margin-left: 10px;
}
}

blockquote p {
padding: 0;
margin: 0;
Expand Down
30 changes: 15 additions & 15 deletions essays/2018-01-16-how-to-prove-a-compiler-correct.markdown
Expand Up @@ -250,11 +250,11 @@ induction a; intros; simpl; iauto.
We now end up with _better_ inductive hypotheses:

```
IHa1 : forall xs : list StackOp, eval nil (compile a1 ++ xs) = eval (eval' a1 :: nil) xs
IHa2 : forall xs : list StackOp, eval nil (compile a2 ++ xs) = eval (eval' a2 :: nil) xs
============================
eval nil ((compile a1 ++ compile a2 ++ SPlus :: nil) ++ xs) =
eval ((eval' a1 + eval' a2)%Z :: nil) xs
IHa1 : forall xs : list StackOp, eval nil (compile a1 ++ xs) = eval (eval' a1 :: nil) xs
IHa2 : forall xs : list StackOp, eval nil (compile a2 ++ xs) = eval (eval' a2 :: nil) xs
============================
eval nil ((compile a1 ++ compile a2 ++ SPlus :: nil) ++ xs) =
eval ((eval' a1 + eval' a2)%Z :: nil) xs
```

We need to reshuffle the list associativity and then we can rewrite using the first hypotheses:
Expand All @@ -270,11 +270,11 @@ the same). The issue is that `IHa2` needs the stack to be empty, and the stack
we now have (since we used `IHa1`) is `eval' a1 :: nil`, so it can't be used:

```
IHa1 : forall xs : list StackOp, eval nil (compile a1 ++ xs) = eval (eval' a1 :: nil) xs
IHa2 : forall xs : list StackOp, eval nil (compile a2 ++ xs) = eval (eval' a2 :: nil) xs
============================
eval (eval' a1 :: nil) ((compile a2 ++ SPlus :: nil) ++ xs) =
eval ((eval' a1 + eval' a2)%Z :: nil) xs
IHa1 : forall xs : list StackOp, eval nil (compile a1 ++ xs) = eval (eval' a1 :: nil) xs
IHa2 : forall xs : list StackOp, eval nil (compile a2 ++ xs) = eval (eval' a2 :: nil) xs
============================
eval (eval' a1 :: nil) ((compile a2 ++ SPlus :: nil) ++ xs) =
eval ((eval' a1 + eval' a2)%Z :: nil) xs
```

The solution is to go back to what our Lemma statement said and generalize it
Expand All @@ -295,11 +295,11 @@ induction a; intros; simpl; iauto.
We run into an odd problem. We have a silly obligation:

```
match s with
| nil => eval (i :: s) xs
| (_ :: nil)%list => eval (i :: s) xs
| (_ :: _ :: _)%list => eval (i :: s) xs
end = eval (i :: s) xs
match s with
| nil => eval (i :: s) xs
| (_ :: nil)%list => eval (i :: s) xs
| (_ :: _ :: _)%list => eval (i :: s) xs
end = eval (i :: s) xs
```

Which will go away once we break apart the list `s` and simplify (if you look
Expand Down

0 comments on commit 0424852

Please sign in to comment.