Question: hw 3 . v I need the code help please not the explanation to the questions - ( * ##################################################### ### PLEASE DO NOT DISTRIBUTE

hw3.v
I need the code help please not the explanation to the questions-(*
#####################################################
### PLEASE DO NOT DISTRIBUTE SOLUTIONS PUBLICLY ###
#####################################################
*)
Set Default Goal Selector "!".
Require Import Coq.Strings.Ascii.
Require Import Coq.Lists.List.
From Turing Require Import Lang.
From Turing Require Import Util.
Import LangNotations.
Import ListNotations.
Import Lang.Examples.
Open Scope lang_scope.
Open Scope char_scope.
(*---------------------------------------------------------------------------*)
(* I worked with my teammate (* Brandon Siscoe *)*)
(**
Show that any word that is in L4 is either empty or starts with "a".
*)
Theorem ex1:
forall w, L4 w -> w =[]\/ exists w', w ="a" :: w'.
Proof.
intros.
unfold L4 in H.
destruct H.
apply app_in_inv in H.
destruct H as (w1,(w2, H)).
destruct H as (H1,(H2, H3)).
subst.
destruct x.
- inversion H2.
inversion H3.
simpl.
left.
reflexivity.
- inversion H2; subst; clear H2.
inversion H3; subst; clear H3.
inversion H1; subst; clear H1.
right.
simpl.
exists (w3++w1++w4).
reflexivity.
Qed.
(**
Show that the following word is accepted by the given language.
*)
Theorem ex2:
In ["a"; "b"; "b"; "a"]("a">>"b"*>>"a").
Proof.
apply concat_intro with (w1 :=["a"])(w2 :=["b"; "b"; "a"]).
split.
- simpl. left. reflexivity. (* Matches the first "a"*)
- split.
+ apply in_star_app.
* apply repeat_intro. constructor. (* Matches the "b"* part containing two "b"s *)
+ simpl. right. reflexivity. (* Matches the final "a"*)
Qed.
(**
Show that the following word is rejected by the given language.
*)
Theorem ex3:
~ In ["b"; "b"]("a">>"b"*>>"a").
Proof.
Admitted.
(**
Show that the following language is empty.
*)
Theorem ex4:
"0"*>>{}=={}.
Proof.
Admitted.
(**
Rearrange the following terms. Hint use the distribution and absorption laws.
*)
Theorem ex5:
("0" U Nil)>>("1"*)==("0">>"1"*) U ("1"*).
Proof.
Admitted.
(**
Show that the following langue only accepts two words.
*)
Theorem ex6:
("0">>"1" U "1">>"0")== fun w =>(w =["0"; "1"]\/ w =["1"; "0"]).
Proof.
Admitted.
Theorem ex7:
"b">>("a" U "b" U Nil)*>> Nil =="b">>("b" U "a")*.
Proof.
Admitted.
Theorem ex8:
(("b">>("a" U {})) U (Nil >>{}>>"c")*)*==("b">>"a")*.
Proof.
Admitted.

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!