Question: Hw 5 util: Require Import Coq.Strings.Ascii. Require Import Coq.Lists.List. Import ListNotations. Open Scope char _ scope. Definition rule : = ( ascii * list ascii
Hwutil:
Require Import Coq.Strings.Ascii.
Require Import Coq.Lists.List.
Import ListNotations.
Open Scope charscope.
Definition rule :ascii list ascii type.
Structure grammar :
grammarvars : list ascii;
grammarterminals : list ascii;
grammarrules : list rule;
grammarstart : ascii;
Definition g :
grammarvars :C;
grammarterminals :; ;
grammarstart :C;
grammarrules :
C; C; ;
CC; C;
C
;
Inductive Yield G:grammar : list ascii list ascii Prop :
yielddef:
forall u v w A w w
In A wgrammarrules G
w u A v
w u w v
Yield G w w
Inductive Derivation G:grammar: list list ascii Prop :
derivationnil:
Derivation G grammarstart G
derivationcons:
forall u v ws
Derivation G u :: ws
Yield G u v
Derivation G v :: u :: ws
Inductive Accept G:grammar : list ascii Prop :
acceptdef:
forall w ws
Derivation G w::ws
Forall fun c List.In c grammarterminals G w
Accept G w
Hw:
#####################################################
### PLEASE DO NOT DISTRIBUTE SOLUTIONS PUBLICLY ###
#####################################################
Set Default Goal Selector
Require Import Coq.Strings.Ascii.
Require Import Coq.Lists.List.
Import ListNotations.
Open Scope charscope.
Require Import HwUtil.
Use yielddef
Theorem yieldeq:
forall G A w List.In A wHwUtil.grammarrules G HwUtil.Yield G A w
Proof.
Admitted.
Use yielddef and appassoc to correct the parenthesis.
Theorem yieldright:
forall G w w r w w HwUtil.Yield G w w w w r w w r HwUtil.Yield G w w
Proof.
Admitted.
Similar proof than yieldright but you should rewrite with
appassoc after using yielddef not before.
Theorem yieldleft:
forall G w w l w w HwUtil.Yield G w w w l w w l w HwUtil.Yield G w w
Proof.
Admitted.
Consider using one of the lemmas you have just proved.
When your goal is In Cgrammarrules gsimpl; auto
should solve it
Theorem grule:
HwUtil.Yield gC; C;
Proof.
Admitted.
Consider using one of the lemmas you have just proved.
When your goal is In Cgrammarrules gsimpl; auto
should solve it
Theorem grule:
HwUtil.Yield gCC; C
Proof.
Admitted.
Consider using one of the lemmas you have just proved.
When your goal is In Cgrammarrules gsimpl; auto
should solve it
Theorem grule:
HwUtil.Yield gC
Proof.
Admitted.
The proof should proceed by inversion and then case analysis on
string u
Theorem yieldinvstart:
forall G w HwUtil.Yield G HwUtil.grammarstart G w In HwUtil.grammarstart G wHwUtil.grammarrules G
Proof.
Admitted.
You will want to use yieldinvstart Recall that that ListIn
simplifies to a series of disjunctions.
Theorem gex:
~ HwUtil.Yield gC
Proof.
Admitted.
The idea is to use either: yieldleftyieldright or yielddef
Theorem gstep:
HwUtil.Yield gC; C; C; ; C
Proof.
Admitted.
The idea is to use either: yieldleftyieldright or yielddef
Theorem gstep:
HwUtil.Yield g; C; ; C; ; C
Proof.
Admitted.
The idea is to use either: yieldleftyieldright or yielddef
Theorem gstep:
HwUtil.Yield g; ; C; ; ; C;
Proof.
Admitted.
The idea is to use either: yieldleftyieldright or yielddef
Theorem gstep:
HwUtil.Yield g; ; ; C; ; ; ;
Proof.
Admitted.
Use either derivationnil or derivationcons
Theorem gder:
HwUtil.Derivation gC
Proof.
Admitted.
Use either derivationnil or derivationcons
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
