我有一些信息:
如果X是人、动物或植物,则wings.
H19鸟用肺呼吸,产卵,用肺呼吸,用肺呼吸,有鳞片。ovoviviparous.
Amphibian用肺呼吸,viviparous.
Plant可以产生oxygen.
Human,动物不能产生氧气。--
我根据这些信息制定了一个规则:
organism :- human; animal; plant
organism :- can_breathe, can_move.
animal :- mammal.
animal :- fish.
animal :- reptile.
animal :- amphibian.
animal :- bird.
fish :- breathe_with_gills, have_scales, oviparous, have_fin.
bird :- breathe_with_lungs, oviparous, have_wings.
mammal :- breathe_with_lungs, viviparous.
reptile :- breathe_with_lungs, have_scales, ovoviviparous.
amphibian :- breathe_with_lungs, viviparous.
plant :- produce_oxygen.
human :- not(produce_oxygen).
animal :- not(produce_oxygen).
然后,我尝试在prolog中使用它,并使用assert在知识库中添加事实。我要这样的输出:
?- assert(animal).
true.
?- organism.
true.
但我得到了这样的输出:
?- assert(animal).
ERROR: No permission to modify static procedure `animal/0'
ERROR: Defined at c:/users/user/documents/prolog/file.pl:4
ERROR: In:
ERROR: [10] assert(animal)
ERROR: [9] <user>
我怎么才能修好它?
发布于 2021-12-07 15:41:44
您不应该在代码中详细说明如何证明(也不需要) assert
;您应该通过任何其他方法来证明assert
(例如,produce_oxygen
)。
https://stackoverflow.com/questions/70260693
复制相似问题