SICP 読み (217) 4.3.2 非決定性プログラムの例

昨晩は久々の外メシ。昼間も本読む暇は無いだろう、と思っていたんですが次の項に目を通す事ができたのはできたんですが、エントリ入れるまでには至らず。
今日もへろへろだったんですが、なんとかエントリ投入にチャレンジ、とゆー事で。

問題 4.45

英語微妙なんですがやってみると、さっと思い浮かぶのは以下の三つ

  • クラスの中で猫を連れているのは教授
  • クラスの中の学生にレクチャしているのは猫を連れた教授
  • 学生はクラスの中で猫と一緒

これは自分がマシンと化す必要あり、ではないかと。あるいは parse-verv-phrase とゆーか、再帰が渡される amb がきちんとイメージできてないから、か。
で、色々見ているのですが

(parse '(the professor lectures to the student with the cat))

の最初の評価はイメージできるんですが、次にどこまで戻るのか、が微妙。あ、成程。最初のケースは parse-noun-phrase で再帰していない (=> noun-phrase は出力されていない)。のですが次の評価では parse-noun-phrase で再帰なソレ、というのが分かる。
でも、問題のソレはさくっとイメージできんな。一日サボるとこんなになってしまうとは。継続は大切だなぁ。
もう少し見てみますが、追記するかどうかは微妙。

ちょっと追記

とりあえず最初に出てきそうなのは

(verb-phrase
 (verb-phrase
  (verb-phrase
   (verb lectures)
   (prep-phrase (prep to)
		(simple-noun-phrase
		 (article the) (noun student))))
  (prep-phrase (prep in)
	       (simple-noun-phrase
		(article the) (noun class))))
 (prep-phrase (prep with)
	      (simple-noun-phrase
	       (article the) (noun cat))))

なんだと思うんですが、次は何だろ。in のナニで複数かなぁ。

(verb-phrase
 (verb-phrase
  (verb-phrase
   (verb lectures)
   (prep-phrase (prep to)
		(simple-noun-phrase
		 (article the) (noun student))))
  (prep-phrase (prep in)
	       (noun-phrase
		(simple-noun-phrase
		 (article the) (noun class))
		(prep-phrase (prep with)
			     (simple-noun-phrase
			      (article the) (noun cat)))))))

うーん。微妙。最初のソレを簡単なリストにすると

((((lecture) 
   (to the student)) 
  (in the class)) 
 (with the cat))

で、次のは

((((lecture) 
   (to the student)))
 ((in the class) 
  (with the cat)))

になるのかな??
この次にどこまでバックトラックするかがイメージできとらん。

(((lecture)
  ((to the student)
   (in the class)))
 (with the cat))

これが次なのかなぁ。パターン解析できんかなぁ。明日朝もアタマがはっきりしてる時間帯に微妙なコトしてるはずなんでナニ。(謎
ちょっとイキオイついてきたんで検討するかもしれませんが、追記できるレベルになるかどうかは微妙 (何