Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

3 new programming languages for digital narratives Praxis & Prompter:

Slide 4

Slide 4 text

4 OLD programming languages for digital narratives(?) LOGIC

Slide 5

Slide 5 text

5 old programming languages for digital narratives LINEAR LOGIC

Slide 6

Slide 6 text

6 used linear logic as a programming language (Celf) for specifying narrative worlds; used proof search to generate structured stories. What we did:

Slide 7

Slide 7 text

THREE ACTS 7 I. Setup: agent simulation, linear logic, and logic programming II. Payoff: Stories as Proofs III. Promise and Limitations

Slide 8

Slide 8 text

8

Slide 9

Slide 9 text

9 greet insult compliment gossip flirt ... social verbs: social state: knowledge sentiment emotional state personality belief

Slide 10

Slide 10 text

10 verbs: rules causal relationships: resource dependencies

Slide 11

Slide 11 text

RULES 11 Narrative Actions ~ Logical implication

Slide 12

Slide 12 text

12 the problem with standard logical implication: buy_soda : has(Alice, $1) ^ wants(Alice, soda) 㱺 has(Alice, soda)

Slide 13

Slide 13 text

LINEAR LOGIC 13 A -o B

Slide 14

Slide 14 text

14 buy_soda : has(Alice, $1) * wants(Alice, soda) -o has(Alice, soda)

Slide 15

Slide 15 text

15 A * B A -o B !A

Slide 16

Slide 16 text

16 A * B A -o {B} !A

Slide 17

Slide 17 text

Logic Programming 17 proof search as program execution

Slide 18

Slide 18 text

18 initial state Σ Δ0 Celf query (optional) A Δ0, …, Δ Δ ⊢ A? narrative actions

Slide 19

Slide 19 text

Logic Programming 19 A -o {B} Δ, A → Δ, B Δ = arbitrary context of resources A1, …, An

Slide 20

Slide 20 text

20 Example in our paper: Shakespearean tragedy world

Slide 21

Slide 21 text

21 Shakespearean tragedy world state components: character location, possession, sentiment toward other characters, goals

Slide 22

Slide 22 text

22 Shakespearean tragedy world at has anger philia depressed

Slide 23

Slide 23 text

23 Shakespearean tragedy world !dead !killed

Slide 24

Slide 24 text

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’}.

Slide 25

Slide 25 text

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}.

Slide 26

Slide 26 text

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}.

Slide 27

Slide 27 text

27 do/mourn : at C L * philia C C’ * dead C’ -o {philia C C’ * at C L * depressed C * depressed C}.

Slide 28

Slide 28 text

28 do/becomeSuicidal : at C L * depressed C * depressed C * depressed C * depressed C -o {at C L * suicidal C * wants C weapon}.

Slide 29

Slide 29 text

29 do/loot : at C L * dead C' * has C' O * wants C O -o {at C L * has C O}.

Slide 30

Slide 30 text

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}.

Slide 31

Slide 31 text

31 initial state

Slide 32

Slide 32 text

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 * ...

Slide 33

Slide 33 text

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}.

Slide 34

Slide 34 text

34 final state

Slide 35

Slide 35 text

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}.

Slide 36

Slide 36 text

36 proofs as stories

Slide 37

Slide 37 text

37 query: init -o {final}

Slide 38

Slide 38 text

Nondeterminism 38 A -o {B} Δ, B A -o {C} Δ, C Δ, A

Slide 39

Slide 39 text

Nondeterminism 39 A -o {B} C -o {D}

Slide 40

Slide 40 text

Nondeterminism 40 A -o {B} Δ, B, C C -o {D} Δ, A, D Δ, A, C

Slide 41

Slide 41 text

Nondeterminism 41 A -o {B} Δ, B, C C -o {D} Δ, A, D Δ, A, C Δ, B, D

Slide 42

Slide 42 text

42 proof of init -o {final}: function (x:init) = let [xs] = r [ys] in …

Slide 43

Slide 43 text

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 ...

Slide 44

Slide 44 text

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

Slide 45

Slide 45 text

45 graphical representation of traces

Slide 46

Slide 46 text

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

Slide 47

Slide 47 text

47 do/insult/private do/formOpinion/dislike do/compliment/witnessed do/travelTo private do/murder do/marry do/steal do/thinkVengefully do/mourn do/becomeSuicidal do/suicide ete

Slide 48

Slide 48 text

48 queries on sets of traces

Slide 49

Slide 49 text

49 > exists ending_1 > exists do/thinkVengefully && ̃link do/thinkVengefully do/murder

Slide 50

Slide 50 text

generative exploration informative structure character perspective-agnosticism 50 what does this accomplish?

Slide 51

Slide 51 text

51 how do simulation designs fail their authors?

Slide 52

Slide 52 text

52 orphan verbs vs causally connected chains

Slide 53

Slide 53 text

ACT III Potential & Limitations 53

Slide 54

Slide 54 text

54 combining reactive/exploratory + goal-driven behavior: A -o G vs A -o {B} (backward & forward chaining) Additional potential of LL

Slide 55

Slide 55 text

55 higher-order rules: (A -o B) -o C Additional potential of LL

Slide 56

Slide 56 text

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

Slide 57

Slide 57 text

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}

Slide 58

Slide 58 text

58 limitations

Slide 59

Slide 59 text

59 limitations (of the tool) (of the underlying formalism)

Slide 60

Slide 60 text

60 limitations of the tool: interactivity history tracking debugging facilities drama management

Slide 61

Slide 61 text

61 limitations of the formalism: ability to broadcast actions nondeterminism and control over probabilities

Slide 62

Slide 62 text

62 what I plan to address: interactivity debugging facilities ability to “broadcast” actions

Slide 63

Slide 63 text

63 PHASES

Slide 64

Slide 64 text

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}.

Slide 65

Slide 65 text

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

Slide 66

Slide 66 text

Phases (Example) interactivity phase world = { rule1 : do Action * … -o {…}. rule2 : do Action * … -o {…}. } phase player = { get_input : player_turn -o {read #STDIN}. } 66

Slide 67

Slide 67 text

67 also possible to implement: broadcast

Slide 68

Slide 68 text

68 also ongoing: phase invariants for each phase, constraints on the context… - as an invariant of the phase - at quiescence programmer-specified, machine-checked!

Slide 69

Slide 69 text

FINALE 69

Slide 70

Slide 70 text

70 the point of formalism is to be able to run readable specifications

Slide 71

Slide 71 text

71 the point of formalism is to be able to reason about readable specifications

Slide 72

Slide 72 text

72

Slide 73

Slide 73 text

73

Slide 74

Slide 74 text

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

Slide 75

Slide 75 text

FINALE 75 Celf: https://github.com/clf/celf Example from the paper: http://tinyurl.com/int2014-clf Me: Chris Martens @chrisamaphone [email protected] Planning to graduate Summer 2015

Slide 76

Slide 76 text

MINUS WORLD (bonus slides) 76

Slide 77

Slide 77 text

Cut 77 Δ1 ⊢ A Δ 2, A ⊢ C Δ 1, Δ 2 ⊢ C

Slide 78

Slide 78 text

Frame Property 78 If Δ1 ⊢ A then Δ1, Δ2 ⊢ A * ⨂Δ2

Slide 79

Slide 79 text

Frame Property (alt) 79 If Δ1 → Δ2 then Δ1, Δ’ → Δ2, Δ’

Slide 80

Slide 80 text

Relationship between step and deductions 80 Δ1 → Δ2 iff for all C Δ2 ⊢ C implies Δ1 ⊢ C

Slide 81

Slide 81 text

81 LOGICS are formalisms with composable consequences

Slide 82

Slide 82 text

82 LOGICS are formalisms with composable consequences Δ ⊢ A Δ’, A ⊢ C Δ’, Δ ⊢ C

Slide 83

Slide 83 text

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

Slide 84

Slide 84 text

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}.

Slide 85

Slide 85 text

Phases delimited subsignatures connected by specifications of quiescence behavior. 85 quiesced P * State -o {phase P’ * State’}. arbitrarily many phases looping + branching