Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Generative Story Worlds as Linear Logic Programs

Chris
June 27, 2014

Generative Story Worlds as Linear Logic Programs

Talk for the paper of the same title, available here: http://www.cs.cmu.edu/~cmartens/int7.pdf

Presented at (INT)7 (Intelligent Narrative Technologies) in Milwaukee on June 18, 2014.

Chris

June 27, 2014
Tweet

More Decks by Chris

Other Decks in Programming

Transcript

  1. Generative Story Worlds as Linear Logic Programs Chris Martens, João

    Ferreira, Anne-Gwenn Bosser, and Marc Cavazza 1 Presented at Interactive Narrative Technologies June 18, 2014
  2. Generative Story Worlds as Linear Logic Programs Chris Martens, João

    Ferreira, Anne-Gwenn Bosser, and Marc Cavazza 2 Presented at Interactive Narrative Technologies June 18, 2014
  3. 6 used linear logic as a programming language (Celf) for

    specifying narrative worlds; used proof search to generate structured stories. What we did:
  4. THREE ACTS 7 I. Setup: agent simulation, linear logic, and

    logic programming II. Payoff: Stories as Proofs III. Promise and Limitations
  5. 8

  6. 9 greet insult compliment gossip flirt ... social verbs: social

    state: knowledge sentiment emotional state personality belief
  7. 12 the problem with standard logical implication: buy_soda : has(Alice,

    $1) ^ wants(Alice, soda) 㱺 has(Alice, soda)
  8. 18 initial state Σ Δ0 Celf query (optional) A Δ0,

    …, Δ Δ ⊢ A? narrative actions
  9. Logic Programming 19 A -o {B} Δ, A → Δ,

    B Δ = arbitrary context of resources A1, …, An
  10. 22 Shakespearean tragedy world at <character> <location> has <character> <object>

    anger <character> <character> philia <character> <character> depressed <character>
  11. 24 do/insult : at C L * at C’ L

    * anger C C’ -o {at C L * at C’ L * anger C C’ anger C’ C * depressed C’}.
  12. 25 do/compliment : at C L * at C’ L

    * philia C C’ -o {at C L * at C’ L * philia C C’ * philia C’ C}.
  13. 26 do/murder : anger C C’ * anger C C’

    * anger C C’ * anger C C’ * at C L * at C’ L * has C weapon -o {at C L * !dead C’ * !murdered C C’ * has C weapon}.
  14. 27 do/mourn : at C L * philia C C’

    * dead C’ -o {philia C C’ * at C L * depressed C * depressed C}.
  15. 28 do/becomeSuicidal : at C L * depressed C *

    depressed C * depressed C * depressed C -o {at C L * suicidal C * wants C weapon}.
  16. 29 do/loot : at C L * dead C' *

    has C' O * wants C O -o {at C L * has C O}.
  17. 30 do/comfort : at C L * at C' L

    * suicidal C' * philia C C' * philia C' C -o {at C L * at C' L * philia C C' * philia C' C * philia C' C}.
  18. 32 story_start : init -o { at romeo town *

    at montague mon_house * at capulet cap_house * at mercutio town * at nurse cap_house * at juliet town * at tybalt town * at apothecary town * has tybalt weapon * has romeo weapon * has apothecary weapon * ...
  19. 33 ... * anger montague capulet * anger capulet montague

    * anger tybalt romeo * anger capulet romeo * anger montague tybalt * philia mercutio romeo * philia romeo mercutio * philia montague romeo * philia capulet juliet * philia juliet nurse * philia nurse juliet * neutral nurse romeo * neutral mercutio juliet * neutral juliet mercutio * neutral apothecary nurse * neutral nurse apothecary}.
  20. 35 ending_happy : nonfinal * actor C * actor C’

    * at C L * at C’ L * married C C’ -o {final}. ending_vengeance : nonfinal * actor C1 * actor C2 * actor C3 * killed C1 C2 * philia C3 C2 * killed C3 C1 -o {final}.
  21. Nondeterminism 41 A -o {B} Δ, B, C C -o

    {D} Δ, A, D Δ, A, C Δ, B, D
  22. 43 ... let {[X73, [X74, [X75, [X76, X77]]]]} = do/insult/private

    [a-tybalt, [a-romeo, [X68, [X66, X72]]]] in let {[X85, [X86, X87]]} = do/becomeSuicidal [a-romeo, [X79, [X41, [X59, [X52, X77]]]]] in let {[X88, [X89, [X90, [X91, X92]]]]} = do/comfort [a-mercutio, [a-romeo, [X78, [X85, [X86, [X81, X83]]]]]] in let {[X101, [!X102, [!X103, X104]]]} = do/murder [a-romeo, [a-tybalt, [X58, [X40, [X76, [X51, [X94, [X96, X27]]]]]]]] in let {[X105, [X106, [X107, X108]]]} = do/compliment/private [a-nurse, [a-juliet, [X46, [X47, X30]]]] in let {[X109, [X110, [X111, X112]]]} = do/compliment/private [a-juliet, [a-nurse, [X106, [X105, X108]]]] in let {[X113, X114]} = do/loot [a-romeo, [a-tybalt, [X101, [X102, [X26, X87]]]]] in ...
  23. Concurrent Equality 44 r1: A -o B r2: C -o

    D “apply r1; apply r2” ~= “apply r2; apply r1” if A and C are disjoint
  24. 46 init do/insult/private do/formOpinion/dislike do/compliment/witnessed do/travelTo do/compliment/private do/murder do/marry ending_1

    do/steal do/thinkVengefully do/mourn do/becomeSuicidal cleanup/1 do/eroticize do/suicide do/flirt/discrete
  25. 54 combining reactive/exploratory + goal-driven behavior: A -o G vs

    A -o {B} (backward & forward chaining) Additional potential of LL
  26. 56 higher-order rules: (A -o B) -o C “serendipity:” Forall

    L. at romeo L * at juliet L -o {eros romeo juliet * at romeo L * at juliet L}) Additional potential of LL
  27. 57 Additional potential of LL dynamic object generation: Exists x:A.

    ... makeRoom : has(C, magic door) * at C R -o {Exists r:room. !adjacent R r}
  28. Phases (Example) 64 deduplication phase act { … } quiesced

    act -o {phase dedup}. phase dedup { wants C O * wants C O -o {wants C O}. } quiesced dedup -o {phase act}.
  29. Phases phase p1 = {...} phase p2 = {...} quiesced

    p1 -o {some_token * phase p2}. quiesced p2 -o {phase p1}. Blocks connected by specification of quiescence behavior 65
  30. Phases (Example) interactivity phase world = { rule1 : do

    Action * … -o {…}. rule2 : do Action * … -o {…}. } phase player = { get_input : player_turn -o {read #STDIN}. } 66
  31. 68 also ongoing: phase invariants for each phase, constraints on

    the context… - as an invariant of the phase - at quiescence programmer-specified, machine-checked!
  32. 70 the point of formalism is to be able to

    run readable specifications
  33. 71 the point of formalism is to be able to

    reason about readable specifications
  34. 72

  35. 73

  36. 74 linear logic can be used as a programming language

    for specifying narrative worlds; to generate narratives & analyze their structure; potentially the basis for a richer PL. Takeaway
  37. Relationship between step and deductions 80 Δ1 → Δ2 iff

    for all C Δ2 ⊢ C implies Δ1 ⊢ C
  38. Phases (Example) Broadcast phase act { do C A *

    in_room C R -o {broadcast C A R}. } quiesced act -o {phase broadcast}. phase broadcast { broadcast C A R * in_room C' R -o {notice C' C A * broadcast C A R}. } quiesced broadcast -o {phase notice}. 83
  39. Phases (Example) Broadcast 84 phase notice { broadcast C A

    R * notice C' C A -o {react C' C A * in_room C' R * broadcast C A R}. } quiesced notice * broadcast _ _ _ -o {phase react}. phase react { react C C' (murder ...) * philia C C' -o {...} } quiesced react -o {phase act}.
  40. Phases delimited subsignatures connected by specifications of quiescence behavior. 85

    quiesced P * State -o {phase P’ * State’}. arbitrarily many phases looping + branching