Archive for the '電影' Category

潛行凶間的奇異迴路 Inception is a strange loop

2010/08/05

「我」是個怎樣的概念?「我」跟世界有甚麼關係?「我」這意識又是怎樣構成的?這都是普主茲獎得主侯世達教授(Douglas Hofstadter)於零七年出版的《I am a strange loop》一書裏嘗試解答的問題。侯世達認為,人類的腦袋是一個結構複雜的迴路(feedback loop)。一個剛出生的嬰兒對世界一無所知,甚至不知道有「我」的存在。然而於成長中,嬰兒的大腦每分每秒在收集外界的資訊,整理然後儲存在記憶裏,同時大腦又運用記憶指揮身體活動。我們的意識便是由嬰兒期開始,一層一層地疊在腦海裏。這個不斷跟外界相互影響的過程,便是侯世達所指的「迴路」。

在電影《潛行凶間》,Cobb及其黨羽有闖進他人夢境的能力,他們可以游走於別人夢境,從他人的潛意識偷取有用資訊。能源大亨Saito要求Cobb等人更進一步,要他們把一些商業決定無聲無色地植入其競爭對手Fischer的腦海裏,令Fischer以為那決定是他自己的想法。然而,潛植新思想遠比偷取資訊困難,因為新思想需要配合被植者的性格和背景,否則這個新思想很容易被忘掉。於是,Cobb等人要從Fischer最根本的意識著手。要達至這目的,單單進入夢境並不足夠,他們要進入被植者夢境裏的夢境裏的夢境,一層層地闖進他人的潛意識裏。於最底層的夢境,Fischer所見的是兒時的玩具和他跟父親的合照,那是他最根深蒂固的意識,Cobb等人就最透過改變這個根本關係,讓Fischer的腦袋從潛意識起透過腦裏的迴路一層一層傳遞(propagate)至他現實裏的商業決定。

事實上,Cobb不止一次把意念植於他人潛意識中,他曾把一些思想潛植於他的妻子Mal,最終卻令Mal神經錯亂而自殺。於是,Cobb間接地背負了殺妻的罪名,這沉重的包伏一直埋藏於他的腦海裏揮之不去。每當他於夢裏執行任務時,Mal總會突如其來地出現而把行動拖跨。本來Cobb只打算把些想法植進他人腦裏,可是經過無數次思想和行動的傳遞下,反過來影響Cobb自己。

這就正正是侯世達所言的「迴路」。每個人由出生起一直接觸外界,大腦不斷學習和整理訊息,大腦亦指揮身體行動,從而影響外界。外界其實亦不獨立於每個個體,它是由數以億計的人和其他生物死物組成的,我們每個行動都在影響其他人,他人所作的行動到頭來又會影嚮自己。

問題來了:這個迴路究竟是怎樣開始的?大腦不過是由無數腦細胞組成,它們怎樣化成我們的意識?侯世達未能解析這個迴路的源起,於是以「奇異」去形容我們的意識。《潛行凶間》亦出現類似的問題:夢境是怎樣開始的?其實無從憶起,仿彿整個世界是突如其來的出現。電影反覆強調一個調子「Take a leap of faith」,我們的意識是怎樣開始的?即管信便好了。

廣告

The Inception of Computer Science (Spoiler)

2010/07/28

The Inception of Computer Science

Justin Yip
Brown University
Box 1910, Providence, RI02912, USA

Abstract

A recently released movie, Inception, illustrates human ability of inception, implanting ideas to others mind through dreams. The story line is based on “Little Harmonic Labyrinth” by Douglas Hofstadter, a professor of Cognitive Science at Indiana University. The key aspect of inception is to secretly implant ideas to the subject’s subconscious that he will never know it is implanted. This article discusses the movie in a computer science perspective, and argues that the movie itself is an attempt of inception of computer science concepts into the audience’s mind.

Procedure Call

In the movie, people enter and share the same dream via a device and the dream context is created by the mental projection of all dreamers. Cobb and his teammates dash in the subject’s mind and perform certain task, i.e. extraction or inception. When success, or dead, or timeout, the dreamer leaves the dream and returns to the reality. This mechanism indeed mimics procedure call in computer programming. Variables and objects (dreamers) enter a routine (dream) and perform some tasks, when they are done, they leave the routine and resume in the caller (reality).

Sometimes, the subject’s (for example, Fischer) subconscious is trained to guard against intruder, and he may also be well-informed about mind inception/extraction hence a single dream may not be suffice to carry the operation out. Multi-level dream is therefore applied. In a dream, Cobb sedates the victim again and enter another level of dream, dream-within-a-dream. They come closer to the subject’s subconscious and the subject is more apt to accept new ideas. The same thing is very common in computer science too. A procedure often invoke other procedures for a finer grained task.

Recursion

Indeed every procedure can invoke other procedure, and such process can go infinitely. Here we consider a special case: a recursion, a self-invoking procedure.

Cobb experimented it with Mal, his wife, they went into very deep level in the dream. It was good when it started, as they had so much time and they created their world freely in the dream. However, as time goes by, they lost track of reality. Mal failed to distinguish dream and reality. She thought the reality is yet another level of dream and killed herself in hopes of getting back to the “reality”.

This problem, in computer science, is commonly known as “Stack overflow error”. Stack is a piece of memory that stores information during a procedure call. When a procedure is invoked, the invoking program will store the current position and other meta-information in the stack. Once the procedure is terminated, it uses the meta-information stored in the stack to return to its caller. But computer has limited memory capacity. A finite amount of meta-information can be kept in the stack. When the stack reaches its limit and can no longer store more information, a “Stack overflow error” is casted and the program goes to limbo. The human brain may not be as discrete as a computer, which leads to a problem of failure to detect when the brain capacity is reached. Instead, the brain may overwrite information in a lower level, and this might be the cause of Mal’s problem of messing up dream and reality.

Cobb attempts to eliminate this problem alternatively. He forbids Ariadne to create the dream context using the details in reality. He insists that the dream world should contain some inconsistent structure (inconsistent in the sense of physical reality) to allow the dreamer to distinguish dream and reality. He is essentially trying to prevent self-invoking calls. In addition, a Totem, which has different behavior in reality and dream, is also used. The Totem is actually the base condition in a recursion.

Garbage Collection

Under normal circumstance, death in a dream results in awakening in reality. When special sedative, which provides stability for multi-level dream, is used, a dead person will be sent to the state of limbo and the person in reality will turn into a state of coma, and all his memory will be gone. Saito is severely injured in the gun fight at the first level, and eventually he is dead in the third. This poses a problem for Cobb, as Saito agreed to remove Cobb’s criminal charges when the inception is succeeded. If Saito losts in the limbo, coma in reality make him impossible to honor the arrangement and Cobb will be arrested immediately at the time he reaches the immigration. Therefore Cobb needs to secure Saito in limbo. It took Saito 50 years to be located by Cobb.

If we regard each passenger in the first class cabin as a memory space, a man in coma is essentially an useless piece of memory. Such piece of useless memory is merely a waste of memory space. We call it memory leak. The object is lost (all memory references are disconnected from the root) in the course of a procedure leads to lost of a person in reality. Therefore dead people in the dream has to be garbage collected, no matter actively or passively, by someone to reclaim the memory space. Cobb is the garbage collector. First he collected Mal, then Saito. Garbage collection exists in most modern programming languages, it makes our life so much easier. Thanks Cobb!

Exponential Runtime

In optimization, we often tackle NP-complete problems by enumerating all possible solutions (in a smart way). Enumeration is often implemented as a depth-first-search, which is usually a self-invoking procedure. Every level in the search procedure usually invoke a polynomial number (to the input size) of self-invoking calls. As a direct consequence, assume every procedure takes the same running time, the whole search takes exponential time. Despite enormous effort has been made to squeeze the runtime, the optimization researchers are all in limbo thanks to the NP-hardness nature.

Our dream goes faster than the reality. 5 minutes in reality equals to 1 hour in the dream. The same mechanism applies in dream-within-a-dream. It took a split seconds for the van to drop from the bridge to the water, while so much things happened in the deeper level. It is the best demonstration of exponential explosion when we tackle NP-hard problems. Cobb and Mal created the whole world in dream, since they had so much time.

This also imposes a substantial line of research. Instead of spawning the search procedure into thousands of sub-processes to arrays of hundreds of multi-core processors, hoping one of them gets into the right branch and find a solution, we may simply dive into a dream of deeper level and solve all kinds of NP-hard problems there, and report the wall-clock time in reality. What a good way to tweak experiment! I guess I can publish 1000 papers a year. As the reader would expect, I will write them in the dream.

Conclusion

The director has hidden a vast amount of computer science concept in the movie. It is obvious that he is trying to implant computer science concepts into the audience mind. Nonetheless, of course, the author of this paper, being a computer scientist, is fully aware of that.

Acknowledgement

Thank you Pascal Van Hentenryck for an insightful discussion (GC is actually his idea).

Fifteen movies you’ve seen that will always stick with you

2009/08/21

1. 龍咁威 – I really enjoy this movie. And this movie came off the top of my head when I started writing this list.

2. Adaptation – I love this one. The movie itself demonstrates the meaning of adaptation to the furthest extent.

3. 逃學威龍 – It is just funny.

4. 無間道二 – Those were the old days of colonial hong kong.

5. 花樣年華 – 試吓者,又唔係真嘅。

6. 回魂夜 – Pretty sure that the director has read the madness and civilization.

7. Monster Inc. – The best of Pixar. I like the movie’s message.

8. Green Miles – All about an innocent and good man who was born with a wrong color.

9. 竊聽者 – 難得糊塗。

10. Closer – Men are all weak.

11. Bean – Rowan Atkinson demonstrated mechanical reproduction. I watched it the second time right after SY’s movie course. YEAH!

12. Keeping Mum – Another Rowan Atkinson excellent movie. Imagine if Jesus come to the world now, would we ever notice?

13. 六樓后座 – If I ever had a chance, I want to have an apartment similar to the movie and live with my frds.

14. 我不賣身我賣子宮 – I have never thought about this question.

15. 黑社會以和為貴 – It fully reflects the tense political and economic situation in hong kong.

When we left earth

2009/01/11

530651_xl

小時候,大概是七歲吧,跟家人到佛羅理達州的甘乃迪太空中心,看見一支二支巨型的火箭,心中自是驚嘆無比,在仿制的駕駛艙裏扮太空人揸穿梭機,一次又一次重覆地看火箭上太空的電視重播,從此以後NASA四隻字便刻在心裏。

後來家裏出現了很多關於火箭穿梭機和太空的書,我亦立志要成為太空人。

於是便開始研究火箭。一支大的可以上月球(它還分幾節,剛離開地面就掉最尾的,飛遠一點就再掉下一節⋯),兩支細加一支大就可以多運一架飛機。那麼要去火星木星似乎難度不大,在大火箭裏多加幾節再捆多幾支小火箭不就行麼?美國的科學家實在太蠢。那些用作著陸的小飛船也有考慮過,基本原則是把任何物件外包一層反光錫紙來擋幅斜。

未幾,覺得征服太陽系簡直是a piece of cake,不如去其他星系。《十萬個為甚麼》說離地球最近的星系是人馬座,閱畢,大喜,這是我的星座呀,我要成為全宇宙第一個到人馬座的人。

萬事俱備,只欠東風。我自覺也應該接受太空人訓練。可惜,捱得過滑浪飛船和跳樓機,玩完海盜船後嘔吐大作,一個成功的太空人豈能只懂起飛與降落?電視上見穿降機不斷在轉,那,我,只好投降(查實曾幾何時我搭93K也會暈浪)。

******

想起太空,因為最近看了Discovery Channel的一套紀錄片,When we left earth,全長二百五十多分鐘,關於美國太空總署,由五十年代冷戰時代美國跟蘇聯的太空競賽開始,一步一步到今日多個國家(包括俄羅斯)合力維持的國際太空站。

隔離房做機械人的研究生常說,要令機械人向正北行龜速無多無少的十米已很不容易。紀錄片裏的卻是每小時行十九萬里的火箭,要令登月艙準確無誤地落在月球表面上,然後平安返回地球,是何等困難。那是多少個工程師科學家日以繼夜,千算萬算,重覆驗證,不斷模擬、除錯下的心血結晶。那邊廂攝影機在月球上對著岩士唐,他說這是一類的一大步,鏡頭一轉,這邊廂是侯斯頓控制中心裏工程人員滿足的會心微笑,那一定是一生人裏最愜意的一刻了。

然後我想,究竟我會不會有機會有這樣愜意的一刻?望著自己多年的心血結晶完成目標,全國人都因而感到自豪,是多麼的快慰。但,不禁想到,我是美國的過客,NASA當然不會要我;那麼偉大的祖國呢?我來自二世祖的香港,根不正曲不紅⋯⋯總覺得有點隔隔不入。

每當我看見美國的科技成就時,就不禁想,為甚麼我不在美國出世。

逃學威龍3之忽然愛國

2008/11/23

可以由六分三十秒開始睇。

陳百祥話亂噏兩句扮公安就可以橫行兼嚇人,佢唔係香港警察你又吹佢唔脹,老屈你犯左唔知邊條罪又得。

一向都話周星馳既電影好有前瞻性,一九九三年已經估到有回歸後唔少人會忽然變紅忽然愛國,「九七年落黎砌你老母生豬肉。」

近年閱報見香港政局有感。

Mechanical Reproduction

2008/10/04

獵狐行動

2008/07/28

明報:一通電話令卡拉季奇落網

電影《獵狐行動》一直強調,北約/聯合國一直無意捉拿fox。只要把他困在某個山區就成。fox在黑山邊境山區的茂密樹林裏快快樂樂地生活,北約可繼續申請大量撥款買請人請顧問飛機大炮。大型電視台都不敵對方的包圍網,他們由始至終都在別人的監視下活動,監視記者的並不是敵方的手下,而是北約/聯合國。北約/聯合國希望全世界都以為他們在努力行動就好,不想讓記者們知道事實,所以要密切地監視,並且不斷威嚇山區危險重重,就是怕記者們掘出真相。北約/聯合國讓他們看見fox後,就眾目睽睽下讓fox逃走,就更顯出主事人從來無意捉拿他們。諷刺的更是後來以三人之力就能找出fox,電影在諷刺聯合國的「保護」下從來沒有打算捉fox。

太空奇兵·威E

2008/07/21

(警告:含電影內容)

自從擁有iphone後,我變得更懶惰。以前,夢醒後要爬落床走到電腦前,才可以上網查電郵,要花上二三十秒。現在,伸手到床頭,拿起電話,按四個掣,已可以瀏覽喜歡的網誌,方便容易。讀畢,轉個身,繼續發下半埸的夢。

還記得曾幾何時跟人相約於七時半在五支旗杆嗎?還有旺地恆、山林道老麥等等長青而準確的地標。今日約朋友已變為「七點幾到左尖咀打畀我」的模糊概念,臨時失約改時間改地點亦只消撥通一個電話。世界上出現過一種關係叫「筆友」,今天已大概被「網友」取代。不過人們都怪在網絡時代人與人的關係太過疏離,回家後不再大家暢聚歡樂今宵,取而代之的是各自在發聲機器面前笑著忙。科技公司強調網絡發展可以減少世界的隔幕,促進人與人的交流,改善生活質素,但事實又是否如此?

電影《Wall-E》的故事場境設置於七百年後,人類生活已全由機器代勞。每人都擁有一張附有螢幕會移動的椅子。想見朋友,可即時進行視像會議;想到某地,椅子會自動導航;想飲想食,開句聲汽水薄餅即時送上。人類的軀體從此局限於方寸的椅子裏,手腳退化至又短又無力;目光再離不開螢光幕,看不見週遭的美麗風景。

機械人Wall-E看見人類手拖手的愛情故事,很羨慕,覺得是個奇妙的感覺。「發明」拖手的人類,忙著在冰冷的虛擬世界天涯若比鄰地會面,反而忘卻了簡單帶著微溫的身體接觸更能傳達感情。電影強調能打動人的,是最原始的感覺,是伸出手作簡單的接觸,是以肉眼仰望絢麗的星空,是赤腳在池裏感受微涼的水溫。

吊詭的更是電影裏處處看見蘋果公司產品的踪影,Wall-E充電完畢的開機聲,在電影院裏引來很多想是蘋果用家的笑聲。這當然十分合理,蘋果電腦創辦人Steve Jobs曾擁電影製作公司Pixar過半股權,更是發行商迪士尼最大的個人股東兼董事。蘋果產品一向以簡易的操作見稱,它推銷網上電影租賃,我們不再需要落街買碟上電影院,只要安坐於電腦前,按幾個掣,幾十秒後電影自動送上,這像不像電影裏坐在椅上幾近殘廢的人?電影是否在自打嘴巴?

我一直享受科技帶來的方便。今日我躺在床上打下這篇文章,然後把稿件以電郵送到太平洋另一端的報館去。每天生活在網絡裏,打倉頡快過寫字的我,看過電影後,頓然覺得,好應該多拿起鉛筆,離開冷氣房,赤腳走在青草地上,呼吸自然的空氣。

(同刊於同日香港經濟日報)

%d 位部落客按了讚: