Cookies disclaimer

I agree Our site saves small pieces of text information (cookies) on your device in order to deliver better content and for statistical purposes. You can disable the usage of cookies by changing the settings of your browser. By browsing our website without changing the browser settings you grant us permission to store that information on your device.

Homework 2

This is the task corresponding to homework 2.

Resources

Download Files

Definitions File

theory Defs
  imports "HOL-IMP.AExp"
begin

declare [[names_short]]

datatype bexp' = V vname | And "bexp'" "bexp'" | Not "bexp'" | TT | FF
type_synonym assignment = "vname \<Rightarrow> bool"

fun has_const where
  "has_const TT = True"
| "has_const FF = True"
| "has_const (Not a) = has_const a"
| "has_const (And a b) \<longleftrightarrow> has_const a \<or> has_const b"
| "has_const _ = False"

definition "simplified \<phi> \<longleftrightarrow> \<phi> = TT \<or> \<phi> = FF \<or> \<not> has_const \<phi>"


consts sat :: "bexp' \<Rightarrow> assignment \<Rightarrow> bool"

consts models :: "bexp' \<Rightarrow> assignment set"

consts simplify :: "bexp' \<Rightarrow> bexp'"


end

Template File

theory Submission
  imports Defs
begin

fun sat :: "bexp' \<Rightarrow> assignment \<Rightarrow> bool"  where
  "sat _ = undefined"

fun models :: "bexp' \<Rightarrow> assignment set" where
  "models (V x) = {\<sigma>. \<sigma> x}"
| "models TT = UNIV"
| "models _ = undefined"

theorem sat_iff_model: "sat \<phi> \<sigma> \<longleftrightarrow> \<sigma> \<in> models \<phi>"
  sorry

fun simplify :: "bexp' \<Rightarrow> bexp'"  where
  "simplify f = f"

value "simplify (And (Not FF) (V ''x'')) = V ''x''"

theorem simplify_simplified: "simplified (simplify \<phi>)"
  sorry

theorem simplify_models: "models (simplify \<phi>) = models \<phi>"
  sorry

end

Check File

theory Check
  imports Submission
begin

theorem sat_iff_model: "sat \<phi> \<sigma> \<longleftrightarrow> \<sigma> \<in> models \<phi>"
  by (rule Submission.sat_iff_model)

theorem simplify_simplified: "simplified (simplify \<phi>)"
  by (rule Submission.simplify_simplified)

theorem simplify_models: "models (simplify \<phi>) = models \<phi>"
  by (rule Submission.simplify_models)

end

Terms and Conditions