where `i` *subsists* in <code>s[φ]</code> if there are any `i'` that *extend* `i` in <code>s[φ]</code>.
------- wrong....
-
- In our framework, we just have to convert the operation <code>>>= \[[ψ]]</code> into another operation <code>>>= \[[ψ]] >>= neg</code>, where `neg` flips the truth-value of all the `bool dpm`s it operates on:
+ Here's how to do that in our framework:
type clause_op = bool dpm -> bool dpm set;;
let negate_op (phi : clause_op) : clause_op =
- let neg : clause_op = fun one_dpm ->
- unit_set (fun (r, h) ->
- let (truth_value, r', h') = one_dpm (r, h)
- in (not truth_value, r', h'))
- in fun one_dpm -> bind_set (phi one_dpm) neg;;
-
-
- let negate_op (phi : clause_op) : clause_op =
- fun one_dpm ->
- if blah
- then unit_set one_dpm
- else empty_set
-------
+ fun one_dpm -> unit_set (
+ fun (r, h) ->
+ let extensions set = List.filter (fun one_dpm -> let (truth_value, _, _) = one_dpm (r, h) in truth_value) set
+ in let truth_value' = extensions (phi one_dpm) = []
+ in (truth_value', r, h)
+ )
* Representing \[[and φ ψ]] is simple:
let and_op (phi : clause_op) (psi : clause_op) : clause_op =
fun one_dpm -> bind_set (phi one_dpm) psi;;
-* We define the other connectives in terms of `not` and `and`:
+* Here are `or` and `if`:
let or_op (phi : clause_op) (psi : clause_op) =
- negate_op (and_op (negate_op phi) (negate_op psi))
+ (* NOT: negate_op (and_op (negate_op phi) (negate_op psi)) *)
+ fun one_dpm -> unit_set (
+ fun (r, h) ->
+ let extensions set = List.filter (fun one_dpm -> let (truth_value, _, _) = one_dpm (r, h) in truth_value) set
+ in let truth_value' = extensions (phi one_dpm) <> [] || extensions (bind_set (negate_op phi one_dpm) psi) <> []
+ in (truth_value', r, h))
+
+ let if_op (phi : clause_op) (psi : clause_op) : clause_op =
+ (* NOT: negate_op (and_op phi (negate_op psi)) *)
+ fun one_dpm -> unit_set (
+ fun (r, h) ->
+ let extensions set = List.filter (fun one_dpm -> let (truth_value, _, _) = one_dpm (r, h) in truth_value) set
+ in let truth_value' = List.for_all (fun one_dpm -> let (truth_value, _, _) = one_dpm (r, h) in truth_value = false || extensions (psi one_dpm) <> []) (phi one_dpm)
+ in (truth_value', r, h));;
- let if_op (phi : clause_op) (psi : clause_op) =
- negate_op (and_op phi (negate_op psi));;
* Now let's test everything we've developed: