1:-include(library('ec_planner/ec_test_incl')). 2:-expects_dialect(pfc). 3 % loading(always,'ecnet/Book.e'). 4%; 5%; Copyright (c) 2005 IBM Corporation and others. 6%; All rights reserved. This program and the accompanying materials 7%; are made available under the terms of the Common Public License v1.0 8%; which accompanies this distribution, and is available at 9%; http://www.eclipse.org/legal/cpl-v10.html 10%; 11%; Contributors: 12%; IBM - Initial implementation 13%; 14%; Book: book (a sort of device) 15%; 16 17% sort page: integer 18==> subsort(page,integer). 19%; agent opens book to page. 20 21% event BookOpenTo(agent,book,page) 22 % event(bookOpenTo(agent,book,page)). 23==> mpred_prop(bookOpenTo(agent,book,page),event). 24==> meta_argtypes(bookOpenTo(agent,book,page)). 25 26 27% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:18 28%; agent closes book. 29 30% event BookClose(agent,book) 31 % event(bookClose(agent,book)). 32% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:20 33==> mpred_prop(bookClose(agent,book),event). 34==> meta_argtypes(bookClose(agent,book)). 35 36 37% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:21 38%; book is open to page. 39 40% fluent BookIsOpenTo(book,page) 41 % fluent(bookIsOpenTo(book,page)). 42% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:23 43==> mpred_prop(bookIsOpenTo(book,page),fluent). 44==> meta_argtypes(bookIsOpenTo(book,page)). 45 46% fluent BookClosed(book) 47 % fluent(bookClosed(book)). 48% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:25 49==> mpred_prop(bookClosed(book),fluent). 50==> meta_argtypes(bookClosed(book)). 51 52% noninertial BookClosed 53% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:26 54==> noninertial(bookClosed). 55%; agent turns page of book to page. 56 57% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:28 58% event BookTurnPageTo(agent,book,page) 59 % event(bookTurnPageTo(agent,book,page)). 60% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:29 61==> mpred_prop(bookTurnPageTo(agent,book,page),event). 62==> meta_argtypes(bookTurnPageTo(agent,book,page)). 63 64 65% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:30 66% [book,page1,page2,time] 67% HoldsAt(BookIsOpenTo(book,page1),time) & 68% HoldsAt(BookIsOpenTo(book,page2),time) -> 69% page1=page2. 70% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:33 71axiom(Page1=Page2, 72 73 [ holds_at(bookIsOpenTo(Book, Page1), Time), 74 holds_at(bookIsOpenTo(Book, Page2), Time) 75 ]). 76 77 78% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:35 79% [book,time] 80% HoldsAt(BookClosed(book),time) <-> 81% !{page} HoldsAt(BookIsOpenTo(book,page),time). 82 83 /* holds_at(bookClosed(Book), Time) <-> 84 not(exists([Page], 85 holds_at(bookIsOpenTo(Book, Page), Time))). 86 */ 87% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:37 88axiom(holds_at(bookClosed(Book), Time), 89 [not(holds_at(bookIsOpenTo(Book, Page), Time))]). 90axiom(not(exists([Page], holds_at(bookIsOpenTo(Book, Page), Time))), 91 [holds_at(bookClosed(Book), Time)]). 92 93 94% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:39 95%; A precondition axiom states that 96%; for an agent to open a book to a page, 97%; the agent must be awake, 98%; the book must be closed, and 99%; the agent must be holding the book. 100% [agent,book,page,time] 101% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:45 102% Happens(BookOpenTo(agent,book,page),time) -> 103% HoldsAt(Awake(agent),time) & 104% HoldsAt(BookClosed(book),time) & 105% HoldsAt(Holding(agent,book),time). 106% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:48 107axiom(requires(bookOpenTo(Agent, Book, Page), Time), 108 109 [ holds_at(awake(Agent), Time), 110 holds_at(bookClosed(Book), Time), 111 holds_at(holding(Agent, Book), Time) 112 ]). 113 114 115% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:50 116%; An effect axiom states that 117%; if an agent opens a book to a page, 118%; the book will be open to the page: 119% [agent,book,page,time] 120% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:54 121% Initiates(BookOpenTo(agent,book,page),BookIsOpenTo(book,page),time). 122axiom(initiates(bookOpenTo(Agent, Book, Page), bookIsOpenTo(Book, Page), Time), 123 []). 124 125 126% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:56 127%; A precondition axiom states that 128%; for an agent to close a book, 129%; the agent must be awake, 130%; the book must not already be closed, and 131%; the agent must be holding the book. 132% [agent,book,time] 133% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:62 134% Happens(BookClose(agent,book),time) -> 135% HoldsAt(Awake(agent),time) & 136% !HoldsAt(BookClosed(book),time) & 137% HoldsAt(Holding(agent,book),time). 138% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:65 139axiom(requires(bookClose(Agent, Book), Time), 140 141 [ holds_at(awake(Agent), Time), 142 not(holds_at(bookClosed(Book), Time)), 143 holds_at(holding(Agent, Book), Time) 144 ]). 145 146 147% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:67 148%; An effect axiom states that 149%; if an agent closes a book, 150%; the book will no longer be open: 151% [agent,book,page,time] 152% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:71 153% Terminates(BookClose(agent,book),BookIsOpenTo(book,page),time). 154axiom(terminates(bookClose(Agent, Book), bookIsOpenTo(Book, Page), Time), 155 []). 156 157 158% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:73 159% [agent,book,page,time] 160% Happens(BookTurnPageTo(agent,book,page),time) -> 161% HoldsAt(Awake(agent),time) & 162% ({page1} page1 != page & HoldsAt(BookIsOpenTo(book,page1),time)) & 163% HoldsAt(Holding(agent,book),time). 164% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:77 165axiom(requires(bookTurnPageTo(Agent, Book, Page), Time), 166 167 [ holds_at(awake(Agent), Time), 168 { dif(Page1, Page) 169 }, 170 holds_at(bookIsOpenTo(Book, Page1), Time), 171 holds_at(holding(Agent, Book), Time) 172 ]). 173 174 175% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:79 176% [agent,book,page,time] 177% Initiates(BookTurnPageTo(agent,book,page),BookIsOpenTo(book,page),time). 178% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:80 179axiom(initiates(bookTurnPageTo(Agent, Book, Page), bookIsOpenTo(Book, Page), Time), 180 []). 181 182 183% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:82 184% [agent,book,page1,page2,time] 185% HoldsAt(BookIsOpenTo(book,page1),time) & 186% page1 != page2 -> 187% Terminates(BookTurnPageTo(agent,book,page2),BookIsOpenTo(book,page1),time). 188% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:85 189axiom(terminates(bookTurnPageTo(Agent, Book, Page2), bookIsOpenTo(Book, Page1), Time), 190 191 [ holds_at(bookIsOpenTo(Book, Page1), Time), 192 { dif(Page1, Page2) 193 } 194 ]). 195 196 197% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/Book.e:87 198%; End of file.