Question: OCAML The code for B to complete: let form1 = Imp (And (Prop p,Prop q),Or (Prop r,Prop s)) let form2 = And (Or (Prop p,

OCAML

OCAML The code for B to complete: let form1 = Imp (And

(Prop "p",Prop "q"),Or (Prop "r",Prop "s")) let form2 = And (Or (Prop

The code for B to complete:

let form1 = Imp (And (Prop "p",Prop "q"),Or (Prop "r",Prop "s"))

let form2 = And (Or (Prop "p", Prop "q"), Prop "r")

let form3 = Or (Or (Or (Or (Prop "p1",Neg (Prop "p2")),

Prop "fill in here"),

Prop "fill in here"),

Or (Prop "p6",Prop "p"))

(* TODO: Problem 1b: Complete the above definition of form3 and

uncomment the 3 lines of test code below.

let _ = pretty_print_form form1

let _ = pretty_print_form form2

let _ = pretty_print_form form3

*)

(*

- : string = "((p ^ q) => (r v s))"

- : string = "((p v q) ^ r)"

- : string = "((((p1 v (~p2)) v ((p3 ^ p4) => r)) v (p5 => q)) v (p6 v p))"

*)

"p", Prop "q"), Prop "r") let form3 = Or (Or (Or (Or

NOTE THAT ALL OF THIS IS PART OF THE SAME QUESTION. ONLY ANSWER IF YOU KNOW WHAT YOU ARE DOING.

1. Consider the grammar below for formulas of propositional logic, where the set of terminals is {T, F,p, q, T, s, Pl, P2, ..J and the set of non-terminals is {F, P) Formulas in this language can be represented in OCaml using the following data structure similar to one used in a previous assignment: type prop- string type form - | True l False l Prop of prop I And of form * form l Or of formform Imp of form * form | Neg of form 1. Consider the grammar below for formulas of propositional logic, where the set of terminals is {T, F,p, q, T, s, Pl, P2, ..J and the set of non-terminals is {F, P) Formulas in this language can be represented in OCaml using the following data structure similar to one used in a previous assignment: type prop- string type form - | True l False l Prop of prop I And of form * form l Or of formform Imp of form * form | Neg of form

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 Databases Questions!