8.5 AutoRewrite

## 8.5 `AutoRewrite`

Here are two examples of `AutoRewrite` use. The first one (Ackermann function) shows actually a quite basic use where there is no conditional rewriting. The second one (Mac Carthy function) involves conditional rewritings and shows how to deal with them using the optional tactic of the `Hint Rewrite` command.
Example 1: Ackermann function
`Coq` `<``Require Arith.`
`Coq` `<```
`Coq` `<``Variable Ack:nat-``>``nat-``>``nat.`
`Coq` `<```
`Coq` `<``Axiom Ack0:(m:nat)(Ack (0) m)=(S m).`
`Coq` `<``Axiom Ack1:(n:nat)(Ack (S n) (0))=(Ack n (1)).`
`Coq` `<``Axiom Ack2:(n,m:nat)(Ack (S n) (S m))=(Ack n (Ack (S n) m)).`
`Coq` `<``Hint Rewrite [ Ack0 Ack1 Ack2 ] in base0.`
`Coq` `<```
`Coq` `<``Lemma ResAck0:(Ack (3) (2))=(29).`
`1 subgoal`
``
`============================`
`(Ack (3) (2))=(29)`
`Coq` `<``AutoRewrite [ base0 ] using Try Reflexivity.`
`Subtree proved!`
Example 2: Mac Carthy function
`Coq` `<``Require Omega.`
`Coq` `<```
`Coq` `<``Variable g:nat-``>``nat-``>``nat.`
`Coq` `<```
`Coq` `<``Axiom g0:(m:nat)(g (0) m)=m.`
`Coq` `<``Axiom g1:`
`Coq` `<``(n,m:nat)(gt n (0))-``>``(gt m (100))-``>``(g n m)=(g (pred n) (minus m (10))).`
`Coq` `<``Axiom g2:`
`Coq` `<``(n,m:nat)(gt n (0))-``>``(le m (100))-``>``(g n m)=(g (S n) (plus m (11))).`
`Coq` `<``Hint Rewrite [ g0 g1 g2 ] in base1 using Omega.`
`Coq` `<```
`Coq` `<``Lemma Resg0:(g (1) (110))=(100).`
`1 subgoal`
``
`============================`
`(g (1) (110))=(100)`
`Coq` `<``AutoRewrite [ base1 ] using Reflexivity Orelse Simpl.`
`Subtree proved!`
`Coq` `<``Lemma Resg1:(g (1) (95))=(91).`
`1 subgoal`
``
`============================`
`(g (1) (95))=(91)`
`Coq` `<``AutoRewrite [ base1 ] using Reflexivity Orelse Simpl.`
`Subtree proved!`