Question: ` ` ` Set Default Goal Selector ! . Require Import Coq.Strings.Ascii. Require Import Coq.Lists.List. Import ListNotations. Open scope char _ scope. Require

```
Set Default Goal Selector "!".
Require Import Coq.Strings.Ascii.
Require Import Coq.Lists.List.
Import ListNotations.
Open scope char_scope.
Require Import Hw5Util.
```
```
(**
Use 'Yield_def`.
*)
Theorem yield_eq:
forall G A W, List.In (A, w)(Hw5Util.grammar_rules G)-> Hw5Util.Yield G [A] w.
Proof.
Admitted.
(**
Use 'yield_def' and 'app_assoc' to correct the parenthesis.
*)
Theorem yield_right:
forall G w1 w2 r w3 w4, Hw5Util.Yield G w1 w2-> w3= w1++ r -> w4= w2++ r -> Hw5Util.Yield G w3 w4.
Proof.
Admitted.
(**
Similar proof than 'yield_right', but you should rewrite with
'app_assoc' after using 'yield_def', not before.
*)
Theorem yield_left:
forall G w1 w2 l w3 w4, Hw5Util.Yield G w1 w2-> w3= l ++ w1-> w4= l ++ w2-> Hw5Util.Yield G w3 w4.
Proof.
Admitted.
(**
Consider using one of the lemmas you have just proved.
When your goal is 'In ("C",...)(grammar_rules gl)', 'simpl; auto`
should solve it.
*)
Theorem gl_rule_1:
Hw5util.Yield g1["C"]["{"; "C"; "}"].
Proof.
Admitted.
(**
Consider using one of the lemmas you have just proved.
When your goal is 'In ("C",...)(grammar_rules gl)', 'simpl; auto`
should solve it.
*)
``````
Theorem g1_rule_2:
Hw5util.Yield g1["C"]["C"; "C"].
Proof.
Admitted.
(**
Consider using one of the lemmas you have just proved.
When your goal is `In ("C",...)(grammar_rules gl)`,`simpl; auto`
should solve it.
*)
Theorem g1_rule_3:
Hw5util.Yield`g1["C"][].
Proof.
Admitted.
(**
The proof should proceed by inversion and then case analysis on
string `u`.
*)
Theorem yield_inv_start:
forall G w, Hw5til.Yield G [Hw5util.grammar_start G] w -> In (Hw5Util.grammar_start G, w)(Hw5Util.gramma
Proof.
Admitted.
(**
You will want to use `yield_inv_start`. Recall that that `List.In`
simplifies to a series of disjunctions.
*)
Theorem g1_ex1:
~ Hw5Util.Yield g1["C"]["{"].
Proof.
Admitted.
(**
The idea is to use either: `yield_left`,`yield_right`, or `yield_def`.
*)
Theorem g1_step_1:
Hw5util.Yield g1["C"; "C"]["{"; "C"; "}"; "C"].
Proof.
Admitted.
(**
The idea is to use either: `yield_left`,`yield_right`, or `yield_def`.
*)
Theorem g1_step_2:
Hw5util.\ield g1["{"; "C"; "}"; "C"]["{"; "}"; "C"].
Proof.
Admitted.
``````
l**
The idea is to use either: `yield_left`,`yield_right`, or `yield_def`.
*)
Theorem g1_step_3:
Hw5util.\ield g1["{"; "}"; "C"]["{"; "}"; "{"; "C"; "}"].
Proof.
Admitted.
(**
The idea is to use either: `yield_left`,`yield_right`, or `yield_def`.
*)
Theorem g1_step_4:
Hw5util.\ield g1["{"; "}"; "{"; "C"; "}"]["{"; "}"; "{"; "}"].
Proof.
Admitted.
(**
Use either `derivation_nil` or `derivation_cons`.
*)
Theorem g1_der_1:
Hw5util.DDerivation g1[["C"]].
Proof.
Admitted.
(**
Use either `derivation_nil` or `derivation_cons`.
*)
Theorem g1_der_2:
Hw5util.Derivation g1[["C"; "C"]; ["C"]].
proof.
Admitted.
(**
Use either `derivation_nil` or `derivation_cons`.
*)
Theorem g1_der_3:
Hw5util.D\erivation g1[["{"; "C"; "}"; "C"]; ["C"; "C"]; ["C"]].
Proof.
Admitted.
Theorem g1_der_4:
Hw5util.Derivation g1[
["{"; "}"; "C"];
["{"; "C"; "}"; "C"];
["C"; "C"];
["C"]
```
Proof.
Admitted.
Theorem al der 5: ```
Theorem gl_der_5:
Hw5Util.Derivation g1[
["{"; "}"; "{"; "C"; "}"];
["{"; "}"; "C"];
["{"; "C"; "}"; "C"];
["C"; "C"];
["C"]
```
].
Proof.
Admitted.
Theorem g1_der_6:
Hw5util. Derivation g1|
["\{"; "\}"; "\{"; "\}"];
["\{"; "\}"; "\{"; "C"; "\}"];
["\{"; "\}"; "C"];
["\{"; "C"; "\}"; "C"];
["C"; "C"];
["C"]
Proof.
Admitted.
\[
\begin{array}{l}
(**\\
\text { Use }\\
\text {*)}
\end{array}
\]
Theorem exl:
Accept g1["\{"; "\}"; "\{"; "\}"].
Proof.
Admitted.
```
*)
Require Import Coq.Strings.Ascii.|
Require Import Coq.Lists.List.
Import ListNotations.
Open Scope char_scope.
Definition rule :=(ascii * list ascii)% type.
Structure grammar :={
grammar_vars : list ascii;
grammar_terminals : list ascii;
grammar_rules : list rule;
grammar_start : ascii;
}.
Definition g1 :={|
grammar_vars :=["C"];
grammar_terminals :=["{"; "}"];
grammar_start :="C";
grammar_rules :=[
("C",[

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!