MODELING CONTEXT WITH SITUATIONS Mehmet Surav and Varol Akman BILKENT UNIVERSITY Department of Computer Engineering and Information Science Technical Report BU-CEIS-95-07 Modeling Context with Situations Mehmet Surav and Varol Akman Department of Computer Engineering and Information Science Bilkent University , Bilkent , Ankara 06533 , Turkey Phone : +90 -LRB-312-RRB- 266 4133 -LRB- sec . -RRB- Fax : +90 -LRB-312-RRB- 266 4126 E-mail : fsurav,akmang@bilkent.edu.tr Abstract The issue of context arises in assorted areas of Artificial Intelligence . Although its importance is realized by various researchers , there is not much work towards a useful formalization . In this paper , we will present a preliminary model -LRB- based on Situation Theory -RRB- and give examples to show the use of context in various fields , and the advantages gained by the acceptance of our proposal . For the time being , all I want you to grant is that context is important | so important that we have to represent it clearly in the knowledge base . Dana Scott -LSB- 14 , p. 354 -RSB- 1 Introduction Although the term context is frequently used in explanations , proofs , etc. in Artificial Intelligence , its meaning is left to the reader 's understanding , i.e. , it is used in an implicit and intuitive manner -LSB- 1 -RSB- . However , when we are to implement a system , we have to make this notion explicit using , hopefully , a formal approach . In this work , our aim is to offer a useful formalization of context , one that can be used for automated reasoning in Artificial Intelligence , Computational Linguistics , and so on . To this end , we will first review logic-based attempts towards formalizing context . In general , the focus of our discussion will be around McCarthy 's proposal -LSB- 12 -RSB- . Our approach , on the other hand , is inspired by a pioneering work of Barwise -LSB- 3 -RSB- and will be presented using the notation and terminology of Situation Theory . We will give the necessary background to Situation Theory , and review the contributions of Barwise . Then we will advance our proposal and discuss the handles that it offers on the issue of context . We will present examples , mostly taken from the available literature , so that we convince the reader that our formalization is quite useful . 2 Previous Formalizations in Logic The notion of context was first introduced to AI in a logicist framework by McCarthy in his 1971 Turing Award talk . -LRB- This talk was later published as -LSB- 11 -RSB- . -RRB- After that introduction , research on the topic was quite silent until the late eighties . McCarthy published his recent ideas on context in -LSB- 12 -RSB- . Other notable works on formalizing context are due to Guha -LSB- 10 -RSB- , Shoham -LSB- 15 -RSB- , Giunchiglia -LSB- 9 -RSB- , S. Buva > = c and Mason -LSB- 6 -RSB- , and Attardi and Simi -LSB- 2 -RSB- . In his most recent work -LSB- 12 -RSB- , McCarthy states three reasons for introducing the formal notion of context . ffl The use of context allows simple axiomatizations . He exemplifies this by stating that axioms for blocks world situations can be lifted to contexts involving fewer assumptions . ffl Contexts allow us to use a specific vocabulary and information about a circumstance . ffl We can build AI systems which are never permanently stuck with the concepts they use at a given time because they can always transcend the context they are in . The basic relation relating contexts and propositions is ist -LRB- c ; p -RRB- . It asserts that proposition p is true in context c . Then the main formulas are sentences of the form c0 : ist -LRB- c ; p -RRB- -LRB- 1 -RRB- In other words , p is true in context c , and this itself is asserted in an outer context c0 . Some properties of context , which will form a base for our formalization , include : 1 . Contexts are abstract objects . McCarthy says -LSB- 12 , p. 1 -RSB- : \ We do not offer a definition -LSB- of context -RSB- , but we will offer some examples . '' Some contexts will be rich objects , e.g. , the situations in Situation Calculus . Some contexts will not be as rich , e.g. , some simple micro-theories -LSB- 10 -RSB- . 2 . Contexts are first-class objects . We can use contexts in our formulas in the same way we use other objects . 3 . There are some relations working between contexts . The most notable one is the more general than -LRB- ? -RRB- relation . This defines a partial ordering over contexts . Using ? , we can lift a fact from a context to one of its super-contexts using the following nonmonotonic rule : 8c1 8c2 8p -LRB- c1 ? c2 -RRB- ^ ist -LRB- c1 ; p -RRB- ^ : ab1 -LRB- c1 ; c2 ; p -RRB- ! ist -LRB- c2 ; p -RRB- Here , c2 is a super-context of c1 and p is a predicate of c1 , ab1 is an abnormality predicate and : ab1 -LRB- c1 ; c2 ; p -RRB- is used to support the nonmonotonicity . In other words , the above rule is a basic lifting rule from a context to its super-context . -LRB- Obviously , we can state a similar rule between a context and one of its sub-contexts . -RRB- 4 . There are some functions to form new contexts by specialization . One example McCarthy uses is the function specialize-time -LRB- t ; c -RRB- which returns a context related to context c in which time is specialized to have the value t. 5 . Lifting rules . According to McCarthy -LSB- 12 -RSB- , the main goal of the use of contexts is to simplify axiomatizations -LRB- by allowing us to lift axioms from one context to another -RRB- . Lifting rules are always asserted in an outer context which should be capable of supporting such rules . Using lifting rules , we can do the following while we are transferring an axiom : 1 . No operation . If two contexts are using the same terminology for a concept , this is a natural choice . For example , the following lifting rule states that we can use the axioms related to on -LRB- x ; y -RRB- relation of above-theory context in general-blocks-world context without any change : c0 : 8x8y ist -LRB- above-theory ; on -LRB- x ; y -RRB- -RRB- ! ist -LRB- general-blocks-world ; on -LRB- x ; y -RRB- -RRB- 2 . Change the arity of a predicate . In different contexts , the same predicate might take a different number of arguments . McCarthy 's example for this is on which takes two arguments in above-theory context , and three arguments in a context c in which on has a third argument denoting the situation1 . The lifting rule is c0 : 8x8y8s ist -LRB- above-theory ; on -LRB- x ; y -RRB- -RRB- ! ist -LRB- context-of -LRB- s -RRB- ; on -LRB- x ; y ; s -RRB- -RRB- where context-of returns the context associated with situation s in which the usual abovetheory axioms hold . 3 . Change the name of a predicate . Similar to the case with arities , we can change the name of a predicate via lifting rules . For example , we can translate on to ? uzerinde , when we move from above-theory to turkishabove-theory 2 : c0 : 8x8y ist -LRB- above-theory ; on -LRB- x ; y -RRB- -RRB- ! ist -LRB- turkish-above-theory ; ? uzerinde -LRB- x ; y -RRB- -RRB- 1Here the word \ situation '' is used in the Situation Calculus sense . 2Note that , in the above examples , the lifting rules are always stated in an outer context , c0 , so that ist formulas can be used without any paradoxical -LRB- circular -RRB- side effects . Attardi and Simi -LSB- 2 -RSB- criticize McCarthy for his unclear use of lifting rules , and prove that if a condition for stating lifting rules in outer contexts is not asserted , lifting rules might introduce paradoxes . When we take contexts in the natural deduction sense -LRB- as per McCarthy 's suggestion -LSB- 11 -RSB- -RRB- , the operations of entering and leaving a context might be useful and shorten the proofs involving contexts . In this case , ist -LRB- c ; p -RRB- will be analogous to c ! p , and the operation of entering c can be taken as assuming -LRB- p ; c -RRB- . Then , entering c and inferring p will be equivalent to ist -LRB- c ; p -RRB- in the outer context . Important achievements on the formalization of context include the works of Attardi and Simi -LSB- 2 -RSB- , and Giunchiglia -LSB- 9 -RSB- ; these use natural deduction as the reasoning machinery . Attardi and Simi -LSB- 2 -RSB- offer a \ viewpoint '' representation in which contexts are considered to be sets of reified sentences of the FOL . In Giunchiglia -LSB- 9 , 5 -RSB- , the notion of MultiContext -LRB- MC -RRB- System is introduced . An MC system is defined as a pair < fcigi2I ; ? > , where fcigi2I is the set of contexts and ? is the set of bridge rules . Here , context is a triple ci = < Li ; Ai ; ? i > where Li is the language of ci , Ai is the set of axioms of ci , and ? i is the set of inference rules that can be used only in ci . Bridge rules are the inference rules , similar to the lifting rules , linking different contexts . They are of the form < A ; C1 > < B ; C2 > ; allowing us to derive a formula B in context C2 from the formula A in context C1 . Relative decontextualization is another issue raised by McCarthy 's work . He proposes a mechanism of relative decontextualization to do the work of eternal sentences . The mechanism depends on the premise that when several concepts occur in a discussion , there is a common context above all of them into which all terms and predicates can be lifted . Sentences in this context are relatively eternal . A similar idea is used in the Problem Solving Contexts -LRB- PSC -RRB- of CYC -LSB- 10 -RSB- . Another place where context might be useful is a mental state -LSB- 12 -RSB- . McCarthy thinks of mental states as outer contexts . The advantage of representing mental states as outer contexts is that we can include the reasons for having a belief . Then , when we are required to do belief revision , the inclusion of the reasons for having a belief simplifies our work . When we use beliefs as usual -LRB- i.e. , no belief revision is required -RRB- , we simply enter the related context and use them . 3 Situation Theory -LRB- Barwise on Contexts -RRB- Situation Theory is a principled programme to develop a unified mathematical theory of meaning and information content , and to apply that theory to specific areas of language , computation , and cognition . Barwise and Perry -LSB- 4 -RSB- claim that for an expression to have meaning , it should convey information . They develop a theory of situations and of meaning as a relation between situations . The theory provides a system of abstract objects that make it possible to describe the meaning of both expressions and mental states in terms of the information they carry about the external world -LSB- 7 -RSB- . The two major concepts of Situation Theory are infons and situations . Infons are the basic informational units and are denoted as o P ; a1 ; : : : an ; i AE where P is an n-place relation , a1 ; : : : an are objects appropriate for the respective argument places of P , and i is the polarity -LRB- 0 or 1 -RRB- . Situations are first-class citizens of the theory , and are defined intensionally . A situation is considered to be a structured part of the reality that an agent -LRB- somehow -RRB- manages to pick out . It is desirable to have some computational tools to handle situations . Abstract situations are the mathematical constructs which are amenable to mathematical manipulation . An abstract situation is defined as a -LRB- possibly non-well-founded -RRB- set of infons . Given a real situation s , the set f j s j = g is the corresponding abstract situation . Here , s supports -LRB- denoted as s j = -RRB- means that is an infon that is true of s. Related to parametric infons , there is a construct by which we can assign \ values '' to parameters . Formally , an anchor for a set , A , of basic parameters is a function defined on A , which assigns to each parameter Ti in A an object of type T . For example , if f anchors _ a to the individual \ Sullivan , '' we write f -LRB- _ a -RRB- = Sullivan to denote this anchoring . Object-types are determined over some initial situation . Let s be a given situation . If _ x is a parameter and I is a set of infons -LRB- involving _ x -RRB- , then there is a type -LSB- _ xjs j = I -RSB- . This is the type of all those objects to which _ x may be anchored in s , for which the conditions imposed by I obtain . We refer to this process of obtaining a type from a parameter _ x , a situation s , and a set I of infons , as type-abstraction . _ x is known as the abstraction parameter and s is known as the grounding situation . In Situation Theory , the flow of information is realized via constraints . We represent a constraint as o involves ; S0 ; S1 ; 1 AE where S0 and S1 are situation-types between which the information is carried out . Cognitively , if this relation holds , then it is a fact that if S0 is realized -LRB- i.e. , there is a real situation s0 : S0 -RRB- , then so is S1 -LRB- i.e. , there is a real situation s1 : S1 -RRB- . For example , we represent the regularity \ Smoke means fire '' with the following constraint c : S0 = -LSB- _ sj _ s j = o smoke-present ; _ l ; _ t ; 1 AE -RSB- S1 = -LSB- _ sj _ s j = o fire-present ; _ l ; _ t ; 1 AE -RSB- c = o involves ; S0 ; S1 ; 1 AE In Situation Theory information is taken into account in an atomic fashion , i.e. , information at the level of the relation provided by the individuation schema . In other words , information is regarded as essentially propositional : information is information about some situation s . This either has the form s : S where s is a situation and S is a situation-type , or else x : T where x is an object and T is an object-type defined over some grounding situation u . In the latter case , if T = -LSB- _ xju j = oe -RSB- then x : T if and only if u j = oe -LSB- f -RSB- where f -LRB- _ x -RRB- = x. Barwise 's ideas on circumstance , thus on context , arise from his work on conditionals and circumstantial information -LSB- 3 -RSB- . Barwise states two innovative examples , one on a missing pollen and the other on the -LRB- wrong -RRB- proof of 1 = ? 1 . We will only mention the missing pollen example . Example : The Missing Pollen Let us consider Claire -LRB- Barwise 's then nine-month old daughter -RRB- . Barwise knows that if Claire rubs her eyes , then she is sleepy . This is expressed by the conditional If Claire rubs her eyes , then she is sleepy . For months , this was a sound piece of -LRB- conditional -RRB- knowledge that Barwise and his wife used to understand Claire , and learn when they should put her to bed . However , in the early summer , it began to fail them . Combined with other symptoms , they eventually figured out that Claire was allergic to something or other . They called it \ Pollen X '' since they did not know its precise identity . So Pollen X could also cause Claire to rub her eyes . Barwise formally approaches the above problem as follows . Briefly , with constraint C = -LSB- S -RRB- S0 -RSB- , a real situation s contains information relative to such an actual constraint C , if s : S. Clearly , s may contain various pieces of information relative to C , but the most general proposition that s contains , relative to C , is that s0 is realized , where s0 : S0 . Thus , Barwise represents the information that \ If Claire rubs her eyes , then she is sleepy '' with the following parametric constraint C : S = -LSB- _ sj _ s j = o rubs ; Claire , Claire 's eyes , _ l ; _ t ; 1 AE -RSB- S0 = -LSB- _ sj _ s j = o sleepy ; Claire , _ l ; _ t ; 1 AE -RSB- C = o involves ; S ; S0 ; 1 AE Before Pollen X was present , the above constraint represented a reasonable account . However , when Pollen X arrived , the constraint became inadequate and required revision . Barwise points out to two alternatives to this end : ffl From -LSB- if OE then -RSB- infer -LSB- if OE and , then -RSB- . ffl From -LSB- if OE then -RSB- infer -LSB- if , then if OE then -RSB- . Here corresponds to the additional background conditions . Barwise chooses the second way to deal with the problem3 , modifies involves , and makes the background assumptions explicit by introducing a third parameter . The relation now becomes : o involves ; S1 ; S2 ; B ; 1 AE 3Although these alternatives are equivalent from a logical point of view , the second is more appropriate to reflect the intuitions behind the background conditions . In the first case , the rule if OE then is directly modified to use background conditions whereas , in the second case , it is evaluated only when the background conditions hold . For example , with the new involves , the Missing Pollen Example can be solved via the introduction of a background condition B , which supports the following : o exists ; Pollen X ; _ l ; _ t ; AE We can thus reformulate the problem using B : S = -LSB- _ sj _ s j = o rubs ; Claire , Claire 's eyes , _ l ; _ t ; 1 AE -RSB- S0 = -LSB- _ sj _ s j = o sleepy ; Claire , _ l ; _ t ; 1 AE -RSB- B = -LSB- _ sj _ s j = o exists ; Pollen X ; _ l ; _ t ; AE -RSB- C = o involves ; S ; S0 ; B ; 1 AE 4 A Formalization of Context in Situation Theory The main purposes of our proposal may be categorized into three : 1 . To offer a representation schema which allows contexts in a uniform way . 2 . To support the essential properties of context . 3 . To clarify the notion of context and to reduce it to a mathematical problem . -LRB- As a future project , the computer implementation of the proposal might be considered -LSB- 16 -RSB- . -RRB- We will approach context as an amalgation of grounding situation and the rules which govern the relations within the context . Thus we will represent a context by a situation type which supports two types of infons : ffl factual infons to state the facts and the usual bindings . This infons might be saturated or unsaturated depending on the completeness of that piece of knowledge . ffl conditional infons -LRB- which correspond to parametric conditionals -RRB- representing infons to capture the if-then relations and axioms within the context . Thus , the context of an M.S. Thesis Presentation can be formulated with the following situation-theoretic constructs . Let c be Sullivan 's M.S. Thesis Presentation context . This context supports some infons to represent the basic facts , and constitutes the basis for parameter binding . Some of the infons are c j = o school ; Bilkent ; 1 AE -LRB- 2 -RRB- c j = o department ; Computer Science ; 1 AE -LRB- 3 -RRB- c j = o ms-student ; Sullivan ; 1 AE -LRB- 4 -RRB- c j = o ms-advisor ; Ackerman ; 1 AE -LRB- 5 -RRB- c j = o ms-jury-member ; Necker ; 1 AE -LRB- 6 -RRB- Within this context , we have some natural regularities valid for all thesis presentation contexts , such as c1 : S1 j = o ms-advisor ; _ a ; 1 AE -LRB- 7 -RRB- S2 j = o ms-jury-member ; _ a ; 1 AE -LRB- 8 -RRB- c1 = -LSB- S1 -RRB- S2jB -RSB- -LRB- 9 -RRB- Here B is a background situation such that B j = o school ; Bilkent ; 1 AE -LRB- 10 -RRB- The constraint c1 can be represented with the following infon : c1 j = o involves ; S1 ; S2 ; B AE -LRB- 11 -RRB- The second part , i.e. , the set of infons in Equations 7 -LCB- 11 , intuitively states that thesis advisors of are also jury members in M.S. Thesis Presentation contexts -LRB- in Bilkent -RRB- . Using the above context as a grounding situation with the anchoring f -LRB- _ a -RRB- = Ackerman , we can conclude that Ackerman is also a jury member . After this introductory example , let us review the desirable properties of context , and check whether our proposal supports them . A crucial property is that contexts are first-class objects , so that we can use them in the same way as other objects . In our approach , we are modeling contexts with situation types , and situation types are situations which have some unbound parameters . Other than having unbound parameters , situation types are ordinary situations , and thus first class objects of Situation Theory . -LRB- Having unbound parameters does not cause any problem . -RRB- Richness of the contexts was stated by McCarthy -LSB- 11 , 12 -RSB- and Guha -LSB- 10 -RSB- . In Situation Theory , situations are , by definition , rich objects -LSB- 7 -RSB- . The richness of situations leads to the partiality of contexts as McCarthy notes . Another aspect of the use of context is the flexibility of having private rules and presuppositions related to a particular viewpoint . In the logicist approach , presuppositions were represented with predicates which contained no variables -LRB- either bound or unbound -RRB- and rules were represented with quantified logical implications : c : present -LRB- Air -RRB- -LRB- 12 -RRB- c : 8x bird -LRB- x -RRB- ! f lies -LRB- x -RRB- -LRB- 13 -RRB- Equation 12 states that air is present -LRB- a presupposition -RRB- , and Equation 13 states that if something is a bird , it flies -LRB- a default rule -RRB- . The same capability is also available in our notion of context . We represent the facts related to a particular context with parameter free infons supported by the situation type which corresponds to the context . The rules of the context are represented by the constraints . Since constraints are allowed to be parametric , we can easily use them as rules related to the context . The above example might then be restated as follows : Sc j = o present ; Air ; 1 AE -LRB- 14 -RRB- S1 = -LSB- _ sj _ s j = o bird ; _ a ; 1 AE S2 = -LSB- _ sj _ s j = o f lies ; _ a ; 1 AE Sc j = o involves ; S1 ; S2 ; 1 AE -LRB- 15 -RRB- Here , the fact that air is present is represented with the infon in Equation 14 , and the rule that birds fly is represented with the constraint in Equation 15 . Therefore , we can use the situation type Sc as as the context of the logicist approach -LRB- namely , context c -RRB- . A related issue is the background information . Barwise -LSB- 3 -RSB- points out to the importance of background information in the involves relation . In our model , the context representation is designed to supply the adequate background information . Consider the context of an M.S. Thesis presentation . In this context , the advisor of the thesis is also a jury member of the thesis . This rule is stated via c1 in Equation 9 . In the constraint , the background condition is that the school is Bilkent University . This is stated by using B of Equation 10 . In our definition of context , supplying this kind of background information is simple -LRB- and in fact necessary -RRB- . Contexts define the domain of quantification . This property of context is due to its use as a grounding situation , so that in the binding of parameters , the only available objects are those available in the context . By lifting -LRB- or using bridge rules -RRB- , we can use some axioms from one context in another context . Lifting rules -LRB- whether nonmonotonic or not -RRB- are always stated in the outer one of the two contexts between which the lifting will be done . In our case , lifting has similar properties . Basically , we will state lifting rules as constraints . Nonmonotonicity of the lifting will be realized by the background conditions in the involves relation . Let C1 and C2 be the contexts between which the lifting is to be done . Let C be the outer context . Let us state a lifting rule -LRB- C below -RRB- to lift relation foo from context C1 to relation bar in context C2 : S1 = -LSB- _ sj C1 j = o foo ; _ a ; 1 AE -RSB- -LRB- 16 -RRB- S2 = -LSB- _ sj C2 j = o bar ; _ a ; 1 AE -RSB- -LRB- 17 -RRB- C j = o involves ; S1 ; S2 ; B ; 1 AE -LRB- 18 -RRB- -LRB- B is the background condition , which enables us to have nonmonotonicity while lifting . -RRB- Regarding lifting , there are some discrepancies between our approach and the logicist one . Namely , in the logicist approach we can change the arity of a relation while lifting ; in our approach this is not allowed . This is not due to a limitation on our part , but is rather a by-product of the philosophy behind Situation Theory . In Situation Theory an individuation mechanism is used to name objects , individuals , events , situations , and so on . One application area of the individuation mechanism is relations . For example , once we individuate the on relation with two parameters as o on ; _ a ; _ b ; 1 AE -LRB- 19 -RRB- we always consider on with two parameters , i.e. , in all situations and groundings we use on with this fixed number of parameters . In the logicist way , on is taken in a syntactic sense , and in some contexts it might require two parameters , while in some other contexts it might require three . -LRB- For example , the third parameter might correspond to time . -RRB- Although Situation Theory seems to be weaker at first regard , it in fact gives us the mechanisms to compensate for this weakness . In the on example , we can compensate the requirement for time in one context by simply stating an infon , which enables us to represent the dependence on time . McCarthy 's Lifting Example In -LSB- 12 -RSB- , McCarthy states the following example in a subsection titled \ Lifting Rules . '' Here , we will first present the original example , and then re-do it in our version of formal context . The Original Example McCarthy considers two contexts , namely , Above-Theory -LRB- AT -RRB- and c. Above-Theory contains some simple blocks-world assumptions , similar to Equations 20 and 21 . In AT , the notion of situation is undefined . However , c supports the situations , and the predicates usually have an additional parameter for the situation . For example on -LRB- x ; y -RRB- becomes on -LRB- x ; y ; s -RRB- , where s corresponds to the situation in which on -LRB- x ; y -RRB- holds . In c , context-of -LRB- s -RRB- is a function , which returns a specialization -LRB- a sub-context -RRB- of c , where the situation is fixed to s . The lifting rules working between c and one of its specializations are written as Equations 22 and 23 . Equation 24 is the major lifting axiom , which links AT and the sub-contexts of c . The example in McCarthy -LSB- 12 -RSB- is that from ist -LRB- c ; on -LRB- A ; B ; S0 -RRB- -RRB- we can prove ist -LRB- c ; above -LRB- A ; B ; S0 -RRB- -RRB- . In the proof , c0 is the outer context . The axioms are the following : c0 : AT : 8x 8y on -LRB- x ; y -RRB- ! above -LRB- x ; y -RRB- -LRB- 20 -RRB- c0 : AT : 8x 8y 8z above -LRB- x ; y -RRB- ^ above -LRB- y ; z -RRB- ! above -LRB- x ; z -RRB- -LRB- 21 -RRB- c0 : c : 8x 8y 8s on -LRB- x ; y ; s -RRB- $ ist -LRB- context-of -LRB- s -RRB- ; on -LRB- x ; y -RRB- -RRB- -LRB- 22 -RRB- c0 : c : 8x 8y 8s above -LRB- x ; y ; s -RRB- $ ist -LRB- context-of -LRB- s -RRB- ; above -LRB- x ; y -RRB- -RRB- -LRB- 23 -RRB- c0 : c : 8p 8s ist -LRB- AT ; p -RRB- ! ist -LRB- context-of -LRB- s -RRB- ; p -RRB- -LRB- 24 -RRB- The proof proceeds as follows : c0 : c : on -LRB- A ; B ; S0 -RRB- -LRB- 25 -RRB- c0 : c : ist -LRB- context-of -LRB- S0 -RRB- ; on -LRB- A ; B -RRB- -RRB- -LRB- 26 -RRB- c0 : c : context-of -LRB- S0 -RRB- : on -LRB- A ; B -RRB- -LRB- 27 -RRB- c0 : c : ist -LRB- context-of -LRB- S0 -RRB- ; 8x 8y on -LRB- x ; y -RRB- ! above -LRB- x ; y -RRB- -RRB- -LRB- 28 -RRB- c0 : c : context-of -LRB- S0 -RRB- : above -LRB- A ; B -RRB- -LRB- 29 -RRB- c0 : c : above -LRB- A ; B ; S0 -RRB- -LRB- 30 -RRB- Equation 25 is the assumption given in the beginning . Equation 26 is obtained from Equations 22 and 25 by binding A to x , B to y , and S0 to s. Equation 27 obtained from Equation 26 by entering the context context-of -LRB- S0 -RRB- . Equation 28 is the result of lifting Equation 20 by the lifting axiom -LRB- Equation 24 -RRB- . From Equations 27 and 28 , we obtain Equation 29 . The desired result -LRB- Equation 30 is obtained from Equations 29 and 23 . This proof is summarized in Figure 1 where contexts are represented as Venn diagrams . Atomic formulas are represented with capital letters , and transfers between contexts -LRB- i.e. , the lifting rules -RRB- are represented by arrows . We have labeled arrows in the way the proof grows . Basically , McCarthy is drawing a virtual link from the atomic formula X to the atomic formula V . Since , c has no rule to draw Above-Theory c c0 X Y Z T U V 1 2 3 4 5 6 7 Y : on -LRB- A , B -RRB- Z : on -LRB- A , B -RRB- T : above -LRB- A , B -RRB- U : above -LRB- A , B -RRB- X : on -LRB- A , B , S -RRB- V : above -LRB- A , B , S -RRB- context-of -LRB- S -RRB- 0 Figure 1 : Diagram of McCarthy 's proof a link from X to V , we first create the context context-of -LRB- S0 -RRB- , and draw a link to the atomic formula Y using the lifting rule in Equation 22 . After Y , McCarthy lifts the implication of above -LRB- x ; y -RRB- from on -LRB- x ; y -RRB- -LRB- the arc labeled with 3 in the figure -RRB- to context-of -LRB- S0 -RRB- -LRB- i.e. , he forms the link 6 -RRB- . Then from Y , by tracing link 6 , we get U . From U , by leaving context-of -LRB- S0 -RRB- , we get the desired formula V . As the reader may notice , in the proof of McCarthy , it is more natural to use the path 1-2 - 3-4-5 . However , this path requires one more lifting rule to transfer Y to Z -LRB- link 2 -RRB- . In Attardi and Simi -LSB- 2 -RSB- , this link is explicitly stated and a proof is carried out with the path 1-2-3-4-5 . The Original Example Revisited The main difference between the statement of McCarthy and ours will be in the language used . We will use Situation Theory to state the example , and will be required to make the following changes : ffl Logical implications -LRB- such as Equation 20 -RRB- will be represented with constraints . ffl In McCarthy 's original example , on has different arities in different contexts , i.e. , in AT its arity is two whereas in c its arity is three . However , in Situation Theory , we are required to refer to on in different contexts with different names4 . ffl context-of -LRB- S0 -RRB- will be represented with infons of type o context-of ; A ; B ; 1 AE where A is a parameter which is of type situation -LRB- of Situation Calculus -RRB- and B is a parameter of type situation -LRB- of Situation Theory -RRB- , which corresponds to A. ffl The contexts c0 , c , and AT of McCarthy will be represented with the contexts Sc0 , cc , and cAT , respectively . In fact , all of the equations in the sequel are supported by the situation Sc0 . -LRB- This situation will be the outermost grounding situation in our proof . -RRB- 4Once again , the reason behind this change is the schema of individuation used when we identify the on relation . Basically , on in context AT has no notion of situation , but on in context c has this notion . In this case , we can not refer to the first on in the same way as we refer to the second . Thus , we will name our on relations as onAT and onc . Note that we can not simply regard onAT as onc with a missing parameter . In Giunchiglia -LSB- 9 -RSB- , each context has its own language , and therefore on may have different semantics in different contexts . However , Situation Theory is a semantical theory , and since on has different senses in these different contexts , we have to distinguish them . ffl The background conditions BAT ; Bc-AT ; BAT - c5 will not be explicitly stated in the proof , for the original proof does not involve any nonmonotonic inference . The axioms and assumptions of McCarthy will be represented with the following situationtheoretic constructs : S11 = -LSB- _ sj _ s j = o onAT ; _ x ; _ y ; 1 AE -RSB- S12 = -LSB- _ sj _ s j = o aboveAT ; _ x ; _ y ; 1 AE -RSB- cAT j = o involves ; S11 ; S12 ; BAT AE -LRB- 31 -RRB- S21 = -LSB- _ sj _ s j = o aboveAT ; _ x ; _ y ; 1 AE ^ _ s j = o aboveAT ; _ y ; _ z ; 1 AE -RSB- S22 = -LSB- _ sj _ s j = o aboveAT ; _ x ; _ z ; 1 AE -RSB- cAT j = o involves ; S21 ; S22 ; BAT AE -LRB- 32 -RRB- S31 = -LSB- _ sj _ s j = o onc ; _ x ; _ y ; _ s31 ; 1 AE -RSB- cAT = -LSB- _ sj _ s j = o onAT ; _ x ; _ y ; 1 AE -RSB- cc j = o context-of ; _ s ; _ s31 ; 1 AE cc j = o involves ; S31 ; cAT ; Bc-AT AE -LRB- 33 -RRB- S31 = -LSB- _ sj _ s j = o abovec ; _ x ; _ y ; _ s41 ; 1 AE -RSB- cAT = -LSB- _ sj _ s j = o aboveAT ; _ x ; _ y ; 1 AE -RSB- cc j = o context-of ; _ s ; _ s41 ; 1 AE cc j = o involves ; S41 ; cAT ; Bc-AT AE -LRB- 34 -RRB- cAT j = oep cc j = o context-of ; _ s ; _ s51 ; 1 AE _ s51 j = oep cc j = o involves ; cAT ; _ s51 ; Bc-AT AE -LRB- 35 -RRB- In addition to McCarthy 's axioms , we will need a further rule to lift facts from cAT to cc : S61 = -LSB- _ sj _ s j = o abovec ; _ x ; _ y ; _ s61 ; 1 AE -RSB- cAT = -LSB- _ sj _ s j = o aboveAT ; _ x ; _ y ; 1 AE -RSB- cc j = o context-of ; _ s ; _ s61 ; 1 AE cc j = o involves ; cAT ; S61 ; BAT - c AE -LRB- 36 -RRB- In McCarthy , we have c0 : ist -LRB- c ; on -LRB- A ; B ; S0 -RRB- -RRB- : -LRB- 37 -RRB- This can be represented with oe0 = o onc ; A ; B ; S0 ; 1 AE and then Equation 37 corresponds to cc j = oe0 : -LRB- 38 -RRB- In Situation Theory , this kind of logical proof corresponds to finding the anchoring function , by which we can show that cc also supports the predicate to be proven , i.e. , we must show that cc j = o abovec ; A ; B ; S0 ; 1 AE -LRB- 39 -RRB- In the proof , we will first transfer the fact to cAT , then reason that on implies above , and carry this new fact to cc . This is the path 1-2-3-4-5 in Figure 1 . Using the constraint in Equation 33 with the anchoring f1 -LRB- _ s -RRB- = S0 f1 -LRB- _ x -RRB- = A f1 -LRB- _ y -RRB- = B 5BAT is the background condition used in the constraint in AT , Bc-AT is the background condition used in lifting from c to AT , and BAT-c is the background condition used in lifting from AT to c. we transfer o onc ; A ; B ; S0 ; 1 AE from cc to o onAT ; A ; B ; 1 AE in cAT . This corresponds to tracing links 1 and 2 in Figure 1 . Note that , we did not lose the parameter S0 , since we will use the same anchoring function when we return to cc . In cAT , using the anchoring f2 -LRB- _ x -RRB- = A f2 -LRB- _ y -RRB- = B and Equation 31 , we get o aboveAT ; A ; B ; 1 AE . This corresponds to link 3 in Figure 1 . After this implication of above from on , we should transfer the fact to cc . This is done using Equation 36 with f1 . The result is o abovec ; A ; B ; S0 ; 1 AE . This completes the proof path 1-2-3-4-5 in Figure 1 . Once more , by using one constraint , we have traced two links , namely , 4 and 5 , in Figure 1 . During this pass , we are in fact referring to U when we use f1 . Consequently , using two anchoring functions -LRB- f1 grounded at the outermost context Sc0 and f2 grounded at cAT -RRB- , we have carried out the proof of McCarthy in our situation-theoretic framework . Barwise 's Missing Pollen Example Revisited The following are the constituents of the constraint C , which was the solution to the missing pollen problem : S = -LSB- _ sj _ s j = o rubs ; Claire , Claire 's eyes , _ l ; _ t ; 1 AE -RSB- -LRB- 40 -RRB- S0 = -LSB- _ sj _ s j = o sleepy ; Claire , _ l ; _ t ; 1 AE -RSB- -LRB- 41 -RRB- B = -LSB- _ sj _ s j = o exists ; Pollen X ; _ l ; _ t ; AE -RSB- -LRB- 42 -RRB- C = o involves ; S ; S0 ; B ; 1 AE -LRB- 43 -RRB- Initially , it was winter and there were no pollens . The context , call it c1 , must be a situation type which supports c1 j = o exists ; Pollen X ; _ l ; _ t ; AE -LRB- and possibly other things related to Claire , rubbing one 's eyes , etc. -RRB- . Using context c1 as the grounding situation , we do not violate the background condition B -LRB- Equation 42 -RRB- of constraint C -LRB- Equation 43 -RRB- , and thus can conclude that \ Claire is sleepy . '' Later , in summer , the new context , c2 , supports the infon c2 j = o exists ; Pollen X ; _ l ; _ t ; 1 AE and when we use c2 as the grounding situation , we are faced with an inconsistency between B and c2 . Therefore , C becomes void for the new context of the talk , and the conclusion \ Claire is sleepy '' can not be reached . A Nonmonotonicity Example In Equation 13 , if x is somehow bound to a non-flying bird like a penguin , this implication is invalidated using some nonmonotonic technique . As we have stated before , in Situation Theory , we represent implications with constraints . While stating the constraints , we can use background conditions to add nonmonotonicity : S1 = -LSB- _ sj _ s j = o bird ; _ x ; 1 AE -RSB- -LRB- 44 -RRB- S2 = -LSB- _ sj _ s j = o f lies ; _ x ; 1 AE -RSB- -LRB- 45 -RRB- B = -LSB- _ sj _ s j = o penguin ; _ x ; AE ^ _ s j = o present ; Air ; 1 AE -RSB- -LRB- 46 -RRB- C = o involves ; S1 ; S2 ; B ; 1 AE -LRB- 47 -RRB- C states that every bird flies unless it is a penguin or there is no air . Here , the important contribution of the situation-theoretic account is that the environmental factors can be easily included in the reasoning phase by suitably varying B. 5 Conclusion In the literature , there are number of attempts towards a formalization of context in a logicist framework . Our approach differs from these in being stated in the framework of Situation Theory and is primarily an extension of Barwise 's conception of context . In -LSB- 3 -RSB- , Barwise uses Mc87 Mc93 Gu91 Ba86 Sh91 Gi93 BM93 AS94 Ours Logic vs. Situation Theory Logic Logic Logic S.T. Logic Logic Logic Logic S.T. Modal Treatment No No No No Yes No No No No Natural Deduction Yes Yes Yes No No Yes Yes Yes No Paradox-Free No No No ? ? Yes Yes Yes ? Legend : Mc87 McCarthy : Generality in AI -LSB- 11 -RSB- Mc93 McCarthy : Notes on formalizing context -LSB- 12 -RSB- Gu91 Guha : A formalization of contexts -LSB- 10 -RSB- Ba86 Barwise : Constraints and conditional information -LSB- 3 -RSB- Sh91 Shoham : Varieties of context -LSB- 15 -RSB- Gi93 Giunchiglia : Contextual Reasoning -LSB- 9 -RSB- BM93 S. Buva > = c and Mason : Propositional logic of context -LSB- 6 -RSB- AS94 Attardi and Simi : A formalization of viewpoints -LSB- 2 -RSB- Ours This paper Table 1 : Comparison of the previous approaches and our approach grounding situations similar to our contexts . However , in his work , content of the grounding situations is not fully described . In our work , we are explicitly stating what a context includes : parameter free infons to state the facts and the usual bindings , and parametric infons to state if-then rules . Table 1 summarizes the essential elements of previous research on context and our proposal . Compared to other approaches , ours has the following notable properties : ffl We might easily require the content of a context change dynamically . We can add -LRB- delete -RRB- assumptions and rules into -LRB- from -RRB- a context . Having a dynamic notion of context is not a novel thing for the logicist , since one can always add -LRB- delete -RRB- axioms into -LRB- from -RRB- a theory . However , when we fortify our context with dynamic constraints whose background conditions are also dynamic , we get nonmonotonicity in the framework of Situation Theory . ffl Since contexts are first-class objects , we can use them in the same way we use the other objects -LRB- in the framework of Situation Theory -RRB- provided that we are given an appropriate outer context to do this . In this view , our contexts have exactly the same properties as the logicists ' contexts . ffl Our contexts can also support uncertainty to some extent : we can have unsaturated infons and leave the uncertain part of a piece of information unsaturated so that if we have further knowledge about that piece of information , we can fill the missing portions of an infon . Obviously , our proposal is not complete . A tentative list for the future work includes : ffl Extension to temporal domain : In the statement of our proposal , we have not dealt with temporal relations . In Guha 's work -LSB- 10 -RSB- , most of the examples are related to time . As a future project , the study of the temporal relations and information within our contexts might be useful . ffl The need for a Situation Theory tool : Since we are using a situation theoretic framework , we should have a programming environment for Situation Theory . There are two serious attempts to do this : BABY-SIT -LSB- 16 -RSB- and PROSIT -LSB- 13 -RSB- . As these attempts progress , the computational aspects of our approach can be better investigated . ffl Some classical problems : We have not discussed the application of our approach to epistemic puzzles -LRB- ? a la Smullyan -RRB- . However , a similar study by Ersan and Akman -LSB- 8 -RSB- can be adopted to our formalization of context . Acknowledgments We are grateful to Fausto Giunchiglia for his expert advice , help , and encouragement . Akman 's research is supported in part by a NATO Science for Stability grant -LRB- TU-LANGUAGE -RRB- . References -LSB- 1 -RSB- V. Akman and E. T?n . What is in a context ? In E. Ar?kan , editor , Proceedings of the 1990 Bilkent International Conference on New Trends in Communication , Control , and Signal Processing , volume II , pages 1670 -LCB- 1676 . Elsevier , Amsterdam , Holland , 1990 . -LSB- 2 -RSB- G. Attardi and M. Simi . Proofs in context . In Principles of Knowledge Representation and Reasoning : Proceedings of the Fourth Conference , 1994 . -LSB- 3 -RSB- J. Barwise . Conditionals and conditional information . In E. C. Traugott , C. A. Ferguson , and J. S. Reilly , editors , On Conditionals , pages 21 -LCB- 54 . Cambridge University Press , Cambridge , UK , 1986 . -LSB- 4 -RSB- J. Barwise and J. Perry . Situations and Attitudes . MIT Press , Cambridge , MA , 1983 . -LSB- 5 -RSB- P. Bouquet and F. Giunchiglia . Reasoning about theory adequacy : A new solution to the qualification problem . Technical Report 9406-13 , Istituto Per La Ricerca Scientifica e Tecnologica , Trento , Italy , 1994 . To appear in Fundamenta Informaticae . -LSB- 6 -RSB- S. Buva > = c and I. A. Mason . Propositional logic of context . In Proceedings of the Eleventh National Conference on Artificial Intelligence , pages 412 -LCB- 419 , Washington , DC , 1993 . -LSB- 7 -RSB- K. Devlin . Logic and Information . Cambridge University Press , New York , NY , 1991 . -LSB- 8 -RSB- M. Ersan and V. Akman . Situated modeling of epistemic puzzles . Bulletin of the IGPL , 1995 . To appear . -LSB- 9 -RSB- F. Giunchiglia . Contextual reasoning . Epistemologia , XVI :345 -LCB- 364 , 1993 . Short version in Proceedings of the IJCAI '93 Workshop on Using Knowledge in Its Context , Chambery , France , 1993 . -LSB- 10 -RSB- R. V. Guha . Contexts : A Formalization and Some Applications . PhD thesis , Computer Science Department , Stanford University , Stanford , CA , 1991 . -LSB- 11 -RSB- J. McCarthy . Generality in artificial intelligence . Communications of the ACM , 30:1030 -LCB- 1035 , 1987 . -LSB- 12 -RSB- J. McCarthy . Notes on formalizing context . In Proceedings of the Thirteenth International Joint Conference in Artificial Intelligence -LRB- IJCAI ' 93 -RRB- , Chambery , France , 1993 . -LSB- 13 -RSB- H. Nakashima , H. Suzuki , P. K. Halvorsen , and S. Peters . Towards a computational interpretation of situation theory . In Proceedings of the International Conference on Fifth Generation Computer Systems , pages 489 -LCB- 498 , Institute for New Generation Computer Technology , Tokyo , Japan , 1988 . -LSB- 14 -RSB- D. S. Scott . Capturing concepts with data structures . In R. A. Meersman and A. C. Sernadas , editors , Data and Knowledge , pages 341 -LCB- 354 . Elsevier , Amsterdam , Holland , 1988 . -LSB- 15 -RSB- Y. Shoham . Varieties of context . In V. Lifschitz , editor , Artificial Intelligence and Mathematical Theory of Computation : Papers in Honor of John McCarthy , pages 393 -LCB- 408 . Academic Press , Boston , MA , 1991 . -LSB- 16 -RSB- E. T?n and V. Akman . BABY-SIT : A computational medium based on situations . In C. Mart ?? nVide , editor , Current Issues in Mathematical Linguistics , pages 299 -LCB- 308 . Elsevier , Amsterdam , Holland , 1994 .

O B O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O B O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O B I O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O B O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O O O O O O O O B O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O B O O O O O O O O O O O O O B O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O B O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O B O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O B O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O B I O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O B O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


Visual Simulation of Lightning Todd Reed and Brian Wyvill The University of Calgary1 ABSTRACT A method for rendering lightning using conventional raytracing techniques is discussed . The approach taken is directed at producing aesthetic images for animation , rather than providing a realistic physically based model for rendering . A particle system is used to generate the path of the lightning channel , and subsequently to animate the lightning . A technique , using implicit surfaces , is introduced for illuminating objects struck by lightning . CR Categories : I. 3.3 -LSB- Computer Graphics -RSB- : Picture/Image Generation ; I. 3.7 -LSB- Computer Graphics -RSB- : Three-Dimensional Graphics and Realism , Animation . 1 INTRODUCTION The synthetic reproduction of natural scenes has been a primary goal of the computer graphics community . Much attention has been given to the problem of rendering plant life , mountainous terrain , clouds , fire , etc. . Surprisingly , lightning , one of nature 's most spectacular phenomena , has been largely ignored . This paper presents a simple method for modeling and rendering lightning and objects struck by lightning , using raytracing techniques . Lightning is represented as a collection of connected , finite length rays in 3D space . A particle system is used to generate the segments for a complete lightning stroke , and subsequently for animating a lightning strike . For some time we have been working on skeletalimplicit surface modeling techniques and have built a number of models -LSB- 7 -RSB- . Such models are represented as an iso-surface in a scalar field . A method is presented for using the scalar field to provide a value for the brightness of the glow around an object that has been struck by lightning . The best understood source of lightning is cumulonimbus , ordinary thunderstorm clouds . The majority of cloud related lightning discharges are intracloud , and are not visible from earth . Visible types of discharges include cloud-to-cloud , cloud-to-air , ground-to - 1Department of Computer Science , The University of Calgary , 2500 University Drive NW , Calgary , Alberta , Canada T2N 1N4 , E-mail : reedt@cpsc.ucalgary.ca, blob@cpsc.ucalgary.ca cloud , and cloud-to-ground2 . Research on lightning has focused on the familiar cloud-to-ground lightning for the practical reason of minimizing its damaging effect on our environment . This interaction with our environment is also what makes cloud-to-ground lightning so visually stimulating . Photographs of lightning strikes that encounter ? ground zero ? are among the best3 -LRB- see Figure 9 -RRB- , and provided the inspiration for rendering lightning . Research in physically based lightning models has been reported -LRB- see -LSB- 2 -RSB- , for example -RRB- . However , the mathematical complexity and the numerous parameters required to describe the complete lightning environment make these models impractical for the computer artist . The primary goal of this research is to produce visually realistic images of lightning with minimal complexity and computational cost . Hence , the technique developed in this paper does not attempt to model cloud physics , atmospheric conditions , or the physics of lightning discharges . Photographs of lightning from -LSB- 4 , 5 -RSB- provided a yardstick for measuring the accuracy of the images produced . 2 A TYPICAL LIGHTNING STRIKE Eventhough our model is not physically based , a short discussionof lightning physics is essential to introduce terminology and concepts . A typical -LRB- negative -RRB- cloud-to-ground lightning strike is initiated within a cloud that is positively charged in its upper region , and negatively charged in its lower region ; sparse positive charges also occupy the lowest region of the cloud -LRB- see Figure 1 -RRB- . The stepped leader , a negative stream of electrons , propogates toward ground zero in discrete steps . The stepped leader itself is initiated by an unknown process termed the preliminary breakdown -LRB- a -RRB- . The descending stepped leader forms a jagged and branching channel , still invisible , that attracts an upward positive leader from the ground , thus starting the attachment process -LRB- b -RRB- . The meeting of the downward and upward leaders triggers the first return stroke , which is responsible for illuminating the channel , and creating thunder -LRB- c -RRB- . The return stroke begins at the point of contact between the downward and upward leader , usually close to the ground . If sufficient charge remains in the cloud , dart leaders may travel through the residual channel and create subsequent return strokes -LRB- d -RRB- . A lightning strike will typically have less than five return strokes , but can have many more . Returns strokes subsequent to the first usually do not illuminate branches off the main channel . The entire discharge , termed a flash , lasts about half a second . 2If you happen to be a shuttle astronaut , include cloud-to-space lightning in this list of visible discharges . On April 28 , 1990 , a cloud-to-space discharge was recorded for the first time by a payload-bay camera aboard the space shuttle . See -LSB- 6 -RSB- for details . 3See -LSB- 4 -RSB- for an excellent collection of lightning photographs . Stepped leader + + + + + + + + + + - -- + + + -- -- Upward positive leader + + + + + + + + + + - -- + + + -- -- + + + + + + + + + + + + + + + + + + + + - -- + + + -- -- Dartleader -LRB- a -RRB- -LRB- b -RRB- -LRB- c -RRB- -LRB- d -RRB- -- - -- + + + -- - Figure 1 : A lightning flash . The above description is admittedly scant . Readers interested in the physical details of the lightning phenomena are referred to -LSB- 5 -RSB- . 3 LIGHTNING MODEL The skeletal structure of lightning is generated by a particle system which simulates the stepped leader progression toward ground zero . Starting with a seed segment -LRB- in the clouds -RRB- , new segments are spawnedand randomly rotated about the seed segment . Always rotating children segments with respect to the initial seed segment guarantees the channel assumes a linear shape4 . The segments are concatenated to form a complete channel . Enough segments are generated so that the main channel hits ground zero . During the leader progression , branches are recursively generated . Branches are allocated a number of segments , chosen from a uniform distribution , and grow until its segments are depleted , or ground zero is encountered . Uman reports that the directional changes between successive channel segmentsare randomly distributed , independentof segment length , with a mean absolute value of about 16 degrees -LSB- 5 -RSB- . This is simulated by rotating non-seed segments ? degrees with respect to the seed segment , where is chosenfrom a normal distribution with mean 16 degrees and variance of about 0.15 . In three dimensions , two rotations in orthogonal planes are required . Segment lengths 4Lightning usually obeys the philosophy that the shortest path is the best path , so most channels are linear . Nonetheless , it is not difficult to find photographs showing channels of irregular shape . 5The variance was experimentally determined . are chosen from a uniform distribution ; segment lengths reportedly vary from less than 1 metre to over 1 kilometre . For the purpose of rendering , small segments provide more visually realistic results . Branching is controlled by a probability function . From the main channel , branching is usually more frequent near the ground . In practice , the erratic behavior of the pseudo-randomnumber generator used6 made it difficult to consistently control branching . The lightning strokes generated were very sensitive to the seed selected for the number generator . Some seeds completely eliminated branching , while others produced excessive branching -LRB- see Figure 2 -RRB- . Figure 2 : Various lightning skeletons obtained with different seeds for the pseudo-random number generator . 4 RENDERING Although conventional raytracing techniques are used for rendering , the line-segment representation of lightning prevents us from treating lightning strokes as geometric objects . The usual shading methods employed by raytracers are inappropriate because lightning does not have a definable surface . The proposed shading method modifies the conventional shading algorithm by adding a color contribution from the lightning . For each ray , r , the following shading calculation is made : Itotal > = = X i Ii > = Ii > = = mi > = exp ? ? ? di wi > = ? ni > = ? -LRB- 1 -RRB- where ffl > = is the wavelength -LRB- red , green or blue -RRB- . ffl Ii > = is the light contribution from segment Si for wavelength > = . ffl mi > = ffl -LSB- 0 ; 1 -RSB- is the maximum value of Ii > = ffl di is the shortest distance between the ray r and the segment Si . ffl wi > = > is half the width of the lightning channel segment Si . If di > wi > = , then Ii > = is essentially zero . ffl ni > = > 1 controls the contrast of the lightning channel with respect to the background . Small values of n create fuzzy lightning channels , and large values -LRB- n > 8 -RRB- create sharp lightning channels . 6The random number generator and distributions used are from GNU 's libg + + . Most photographs of lightning show a strong glow surrounding the main channel of the lightning stroke . Reproducing this effect is achieved by a secondary illumination function which is added to equation 1 : Gtotal > = = X i Gi > = -LRB- 2 -RRB- Gi > = = g > = li exp ? ? ? di W ? 2 ? -LRB- 3 -RRB- where ffl Gi > = is the glow light contribution for wavelength > = . ffl g > = is the maximum value of Gi > = . ffl li ffl -LSB- 0 ; 1 -RSB- is a ? life ? factor that describes the brightness of segment Si . ffl W is half the width of the glow -LRB- when l = 1 -RRB- . ffl di is the shortest distance between the ray r and the segment Si . The left-most image of Figure 5 was generated with equation 1 ; the second and third images show the effect of adding a blue and red glow with equation 2 to the lightning channel . The calculation of di -LSB- 3 -RSB- for each segment Si is a computational bottleneck . By generating the lightning in a plane parallel to the view plane , the rendering process can be optimized by simplifying the calculation of di . If L is the plane containing the lightning stroke to render , and p is the point where the ray r intersects L , then let di be the shortest distance between the segment Si and the point p. Using this technique , rendering time can be reduced by a factor of 2-5 . While a boon to the time conscious artist , this method has the disadvantage of requiring the plane L to be oriented perpendicular to the line of sight . For the purposes of animation , the more general approach is adopted , thus allowing free motion of the camera . As the particle system proceeds , appropriate values for m , w , n , and l are assigned to each segment . Seed values for m , w , and n are input parameters , and l is automatically initialized to 1 . For the main channel , the width attribute , w , is fixed for all segments , thus maintaining a uniform thickness for the entire channel . To simulate the gradual narrowing of branches , w = :95 wpredecessor for branch segments . For a primary branch seed segment7 , w = cwparent , where cffl -LSB- a ; b -RSB- is chosen from a uniform distribution , and < a < b < 1 . Branches off the main channel are consistently less than half as thick as the main channel , so b < :5 is appropriate . For branch seeds not attached to the main channel , w = wparent . The ? life ? factor , l , which controls the glow around a segment , is modified in a similar fashion , except for all branch seeds , l = c2lparent , where c is defined as above . All segments share the same values for m and n. 5 MAKING LIGHTNING A LIGHT SOURCE Employing the method described aboveproduces realistic lightning images which provide a good background for raytracing scenes . However , if other objects surround the lightning channel , then the lightning must behave as a light source . An expensive , but adequate solution is to add line-segment light sources to each segment . The light source for segment Si is scaled by li , so that the main channel contributes more light than the branches . When calculating the 7A branch off the main channel . light contribution from segment Si to point p on some object the light intensity is attenuated by the scalar 1 = d2i , where di is the shortest distance between Si and p ; this attenuation factor prevents the lightning from illuminating distant objects . 6 ANIMATION A single lightning flash , lasting about 0.5 seconds , is composed of at least one return stroke , and possibly subsequent return strokes . Each return stroke is identified by a surge of light illuminating the channel . The first return stroke illuminates the main channel and the branches , while subsequent return strokes typically illuminate only the main channel . Numerous return strokes account for the flickering of lightning . This can be simulated by appropriately modulating the attributes li and mi over time . For animation , additional attributes are assigned to each segment : ffl the age of the segment -LRB- one unit of time = one frame -RRB- ffl the branch level -LRB- 0 for the main channel , 1 for branches off the main channel , etc. -RRB- ffl the position of the segment within a branch -LRB- 0 for the first segment , 1 for the next segment , etc. -RRB- The particle system used for generating the segments is extended to account for time . The animation of a lightning strike is done in two distinct phases : Progression In this phase , the lightning is initiated from a seed segment , and propogates toward ground zero , as described above . Traveling up to 160,000 kilometres per hour , the appearance of a lightning stroke is instantaneous to the human eye . However , for an animation , this gives unsatisfactory results . Recall that a lightning channel is not illuminated until the first return stroke is initiated by the contact of the downward and upward leaders . Rather than replicate this process , we have adopted to illuminate the channel as it progresses toward the ground . This technique , although not physically accurate , is effective for animation because it agrees with people 's intuition of how lightning should appear . Regression The flickering of lightning is a result of multiple return strokes down the main channel -LRB- but not the branches -RRB- . To simulate this effect , a positive , decaying , sinusoidal function is used to calculate the intensity of main-channel segments for each frame . The intensity of branch segments decreases monotonically . To enhance the visual impression of a lightning stroke , we have doubled the time duration of a typical flash to one second , or 30 frames . Figure 6 shows selected frames from a lightning animation . The first five images correspond to the progression stage , and the last image starts the regression phase . 7 GLOWING OBJECTS The visual effects of lightning striking an object depend on a number of factors , such as the shape of the object , the material from which it is made , etc. . Since our goal is to provide a reasonable visual impression of lightning , particularly for animation , making an object glow when it is struck is sufficient for our purposes . Since we already have a skeletal implicit surface system , a value for the glow can be obtained directly from the field in which such models are defined . Readers unfamiliar with implicit surface modeling are directed to -LSB- 1 , 7 -RSB- . Given a scalar field defined by the implicit function F , an implicit surface is defined by the set of points fp : F -LRB- p -RRB- = kg , where kffl -LRB- 0 ; 1 -RRB- is a chosen constant . For a non-trivial model , F is the aggregate of several fields , each associated with a primitive skeletal element . The train and coach in Figure 6 , for example , are composed of several ellipsoids , each with its own field , Fi . Hence , the surface of the train is defined by the implicit function F -LRB- p -RRB- = N X i = 1 ciFi -LRB- p -RRB- -LRB- 4 -RRB- where N is the number of ellipsoids , and ci is a scalar value used to adjust the contribution of Fi . In our system , k is conventionally :5 . Thus , if F -LRB- p -RRB- < :5 , p is outside the surface , and if F -LRB- p -RRB- > :5 , p is inside the surface . The objective is to make the field between the surfaces defined by fp : F -LRB- p -RRB- = :5 g and fp : F -LRB- p -RRB- = :0 g glow ; the latter surface , the zero-contour , defines the outer extent of the glow . For each ray r spawned by the raytracer , the closest point on r to each primitive is found , giving N points , p1 ; p2 ; : : : ; pN . For each point pi , the implicit value vi = Fi -LRB- pi -RRB- is calculated . The largest vi , vmax , is used to calculate the brightness of the glow as follows : G > = = m > = v0 -LRB- 5 -RRB- where v0 = -LRB- if vmax < k if vmax > k vmax otherwise -LRB- 6 -RRB- and m > = ffl -LSB- 0 ; 1 -RSB- are scalars controlling the intensity of independent wavelengths . If m > = = g > = -LRB- from equation 3 -RRB- , then the glow around the implicit surface will coincide with the lightning channel glow , if this is desired . Figure 7 illustrates the glowing effect on two spherical implicit surfaces blending . The animation frames in Figure 6 show lightning striking the train 's coach , causing it to glow . The advantage of using implicit surface models is that the glow can be calculated directly from the field as shown above . However , the technique can produce undesirable results in certain instances . Problems arise when the zero-contour surface , which defines the edge of the glow , does not faithfully follow the k-contour surface , which defines the model . This problem is especially evident when negative primitives , obtained by setting ci in equation 4 to a negative value , are used . 8 CONCLUSION We have presented a workable model of lightning , which produces aesthetic images sufficient for most animation requirements . Our lightning model takes account of the following features of real lightning : ffl Accurate shape according to statistical data available . ffl The glow around lightning which is often observed . ffl Glow around objects that are struck -LRB- provided that they are modeled as implicit surface objects -RRB- . ffl Lightning as a light source . The following points still require further attention : ffl Implementing a physically based model and formalizing the branching algorithm used to generate lightning channels . ffl Improving the appearance of objects struck by lightning ; investigating further how glowing objects can be modeled with implicit surfaces . ffl Improving rendering time . 9 ACKNOWLEDGEMENTS We would like to thank the members of the GraphicsJungleresearch lab at the University of Calgary and the support of the computer science department . We would also like to thank Andrew Glassner of Xerox PARC for his encouragementand advice . Thanks go to all those who have contributed to Rayshade development , particularly Craig Kolb and Rod Bogart , at Yale and Princeton Universities respectively . This work is partially supported by the Natural Sciences and Engineering Research Council of Canada . A LIGHTNING SPECIFICATION Figure 3 shows an example of the new commands added to the Rayshade input language to specify the lightning and glow around implicit surfaces . The contents of the file light.zap are shown in Figure 4 . The file train.soft is a binary file generated by the implicit surface editing system . This file contains the specifications of the skeletal elements which define the train model . / * Lightning specification * / lightning light.zap / * Implicit surface description for glow * / glow train.soft Figure 3 : An example of the new commands added to Rayshade for rendering lightning and glowing objects . REFERENCES -LSB- 1 -RSB- Jules Bloomenthal and Brian Wyvill . Interactive Techniques for Implicit Modeling . Computer Graphics , 24 -LRB- 2 -RRB- :109 ? 116 , 1990 . -LSB- 2 -RSB- L Dellera and E. Garbagnati . Lightning stroke simulation by means of the leader progression model . IEEE Transactions on Power Delivery , 5 -LRB- 4 -RRB- :2009 ? 22 , October 1990 . -LSB- 3 -RSB- Ronald Goldman . Intersection of Two Lines in Three-Space . Graphics Gems , page 304 , 1992 . Edited by David Krik . -LSB- 4 -RSB- William Newcott . Lightning , nature 's high-voltage spectacle . National Geographic , 184 -LRB- 1 -RRB- :83 ? 103 , July 1993 . Photographs by Peter Menzel . -LSB- 5 -RSB- Martin A. Uman . The Lightning Discharge . Academic Press , Inc. , 1987 . -LSB- 6 -RSB- O.H. Vaughan , R. Blackesleee , et al. . A cloud-to-spacelightning as recorded by the Space Shnuttle payload-bay TV cameras . Monthy Weather Review , 120 -LRB- 7 -RRB- :1459 ? 61 , July 1992 . -LSB- 7 -RSB- Brian Wyvill , Craig McPheeters , and Geoff Wyvill . Animating Soft Objects . The Visual Computer , 2 -LRB- 4 -RRB- :235 ? 242 , February 1986 . LIGHTNING -LRB- -- seed point POINT -LCB- 830.0,1150.0,3800.0 -RCB- , -- random number generator seed 2 , -- ground elevation , 1055.0 , -- initial value for w parameter VECTOR -LCB- 0.4 , 0.4 , 0.64 -RCB- , -- value for m parameter VECTOR -LCB- 0.7 , 1.0 , 0.7 -RCB- , -- value for n parameter VECTOR -LCB- 10.0 , 10.0 , 4.0 -RCB- , -- colour of glow COLOUR -LCB- 0.1 , 0.05 , 0.07 -RCB- , -- width of glow 3.84 , -- angle -LRB- in radians -RRB- and std . deviation -- for tortuosity -LRB- twist -RRB- of channel NORMAL -LCB- 0.179 , 0.1 -RCB- , -- length of each segment ; uniform -- distribution UNIFORM -LCB- 0.1 , 0.25 -RCB- , -- number of branch segments ; discrete -- uniform distribution DISC_UNIFORM -LCB- 10,20 -RCB- , -- angle of branches wrt -- parent segment ; UNIFORM -LCB- 0.18 , 0.75 -RCB- , -- width of branch relative -- to parent UNIFORM -LCB- 0.45 , 0.6 -RCB- , -- branch probability 0.025 , -RRB- Figure 4 : Sample input for lightning specification . Figure 5 : Various lightning images ; the left-most lightning image was generated without the additional glow . Figure 6 : Selected frames from a lightning animation . Figure 7 : Glowing ? soft ? objects . Figure 8 : Lightning over a plane of water . Photo not available . Figure 9 : A real photograph of lightning striking a tree ; courtesy of Johnny Autery .

O O O B O O O O O O O O O O O O O O B O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O B O O O O O B I O O O O O O O O B O O O O O O O B I O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O B O O O O B O O B O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O B O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O B O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O B O O O O O O O O O B O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O B O O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O B O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O B O O O O O O O B O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O B I O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O B O O O O O O O O O B O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O B O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O B O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O B O O O O B O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O B O O O O O O O O O

computer graphics
implicit surfaces
lightning
raytracing