Introduction to Software Technology


WebHome
- Education page
- Course schedule
- Assignments
- Solutions

Master Program
Center

Answers To Some Questions

Ist
-- DoaitseSwierstra - 24 Oct 2002 I got the following questions:

  • What should the items be removed from in step 4?

Answer: From the state. The state contains a set of items. A predicate selects a subset of those items that together satisfy the predicate. Another way of looking at it is that the prediucate selects a subset of the items in the state.

  • Can you give an example of what should be the result of each step?

Answer: no, since not all steps produce a result.

After asking the user for his identity the system shows all tasks for which sufficient ingredient are available. Note that an item contains two kinds of information:

  • fixed information that is of the same type for all items. This information is used to filter a subset of items out of the state, that subsequently is used to try to satisfy predicates
  • a flexible part (the dictionary) that may contain different information for different items, and thus is modelled by a dictionary. Note that either element may not be used in a specific system (collection of predicates). It is quite likely that the user identifier is used either in the selection process, or to initialise the environment with or possibly both. The result of a select is a set of item sets, each representing the ingredients for a task.

  • What is a predicate and what is a state?

Answer:

  1. A state is a set of items (think of it as a collection of available ingredients)
  2. A predicate can be evaluated against a state (or a subset of a state), and selects a set of items out of its arguments.

  • If you have an item (1, Item "make bread" [("ingredient", "flour"),("ingredient", "sugar")] is in that case make bread the task and are flour=and =sugar the ingredients?

Answer: Yes and No. I would model things differently. In the state I would expect items like:

  1. Item "baker" [("task", "make bread"), ("flour","")]
  2. Item "baker" [("task", "make bread"), ("sugar","")]
  3. Item "lecturer" [("task", "lecture"), ("course","IST"), ...]
  4. ...

and then one might define the predicate

makebread  = PrItem  (ItAnd (IsField "task" "make bread") (Hasfield "flour))
                                              `PrAnd `
                          PrItem  (ItAnd (IsField "task" "make bread") (Hasfield "flour))

If the user now logs in with user name "baker" only the first two items apply, but fortunately they are sufiicient to make the predicate make_bread to hold.