# Last Day

in writing

It was unreal, but it felt real.

We are facing a giant dragon – given that all dragons are large – to fight our ways up the tower.

The tower of Yggdrasil is still looking down upon the world from the center today. Modeled after the boundary tower in Amakusa, Tokyo, which is the birthplace of a phenomenal VRMMO game, Yggdrasil is a lofty tower, too.

Like a needle piercing into the space.

A crystal one, though, to fit in the overall fantasy art style of the Second. And like the boundary tower, Yggdrasil boasts a whole lot of floors – 1000 of them, to be exact – crammed with all kinds of monsters and challenges.

And we are the first one to set our feet on the tenth floor. It is almost cliche to put some strong monster in the floors of ten’s multiples, and the AI is clearly sticking to this common practice when creating the Second.

One dragon was already beat when we first enter this tower, that is, the mother dragon. It was quite a tough one: it even nearly managed to suffocate us by burning out all the oxygen with its breath. But now, after countless battles, our team is invincible, and the dragon doesn’t stand a chance.

Whoosh! its sweeps the ground with its left claw, but in vain. It took too much damage to maintain its swift actions. Time to deliver the last strike. I called out to my little sister.

“Miu! Covering fire!” “Gotcha!”

The dragon roared in pain as the bullet penetrates the dragon’s eyes. The monster raises its head, it want to cast a breath.

“Kuon!” “Needless to say!”

Kuon cast the spell, which forms a shield protected all of us from the devastating breath. I looked to Apeiria, and she knows what I’m gonna do in an glimpse.

“You are powered up, owner, get in there!”

I run forward towards to dragon, to deliver the final blow.

“Mashiro, come back!” “Roger!” The little silouette who’s attacking with combos jumps back, agile like a humming bird.

A few steps forth, I get face to face with the hideous monster. Time for my ultimate sword.

“1/8!”

Eight beams spreads out in an instant, all of them punching the dragon, lighting the last moment of this floor master.

With a death agony, the large figure collapsed to the ground and dispersed.

After I confirmed the death of the dragon, other party members come to me.

“Miu, good shot.”

“Of course. Who you think I am?”

And I turned to my childhood friend.

“Kuon, your spells are of great help, too.” “Reiichi, it is okay to depend more on your older sister, you get it?”

“Well done, Mashiro.” “Eeh?! Th-th-thank you!” The introverted junior is still shy about compliments today.

“Apeiria.” I hugged the girl with silver hair. “You are the best.”

“Owner, plus, hug, equals, happiness.” The girl in my embrace replied with her monotonic voice, but with a tinge of delight.

“Hentai…” Complaints comes from the little sister with a cold-eyed gaze.

“…”

“Owner?”

“…”

It feels real, but it is unreal.

My eyes are open now. It’s not inside the magnificent crystal tower. Not but my monochromatic bedroom.

The window is wide open. A gust of December’s chilly wind breaks in, across my face and between my fingers.

“It’s … cold.” The wind must receive a summons for trespassing.

Today Apeiria will set off to Second, which has been already a hell. No one could return from that world of death. But there are no other options: she should have gone there a year ago, and this probation is as much as I could get.

The digital clock says it’s 7. I step into my slippers and out of my bedroom.

“Good morning, owner.” The silver-haired girl notices me.

“Morning, Apeiria.” I try to make myself sound more energetic.

The dried-up response echoes in the empty house. There is nobody besides the two of us.

Miu isn’t here. She isn’t in this world any more.

She was disposed by her mother. Miu was created as a clone of that woman, who has been haunted by the shadows of her aborted child.

I walk to the kitchen, Apeiria is preparing the breakfast.

“A few minutes and it will be done, owner.”

The breakfast time in Kirishima’s is filled with silence. The clashing sounds of utensils reverbrate in the room.

After I’m done with the meal, I speak to Apeiria.

“It’s the last day, isn’t it?”

“Affirmative, owner.”

“Then let’s hang out.”

We first arrives at the AI circle in the school. Full name “Lovable AI Circle”, the circle has had two members – I, the founder, and Mashiro, who I forcibly dragged in. After I created Apeiria here, the five of us have had a lot memories here – making the VR MMORPG Second, and playing it together as a team. But Mashiro is not here.

She is dead from radiation in Boundary’s beta test, when the machine suddenly malfunctioned.

A double-slit box sits on the table. When I turn it on, it’s still showing interference pattern.

The DNA computer is turned off now. Apeiria is accidentally created from it when a lightning cut off its power about a year ago. And I managed to get her a body by hacking the genetic research facility.

There is nothing to do here. After the door is shutted with a huge noise, and silence dominates the school again.

Next stop is the boundary tower. Usually it was once full of people, especially when Boundary was in tests. After that accident, people are showing concerns about safety issues of the VR games, and the development of Boundary is put to a halt.

“Owner, will we be seeing Kuon?”

Kuon’s father is the creator of the Boundary, so the family lives on the top floor of the boundary tower. One year ago, She had a quarrel with her mother, who fell unconscious soon afterwards and died days later. And Kuon never had a chance to apologize. Since then, I haven’t got in contact with her as much.

After having lunch in Asakusa, we decide to return.

Bang, and the door closed. It’s the familiar living room today.

The digit clock in the phone says it’s already 2pm. So the separation is only a few hours away.

In this year, we’ve been to everywhere we are able to go, done everything we are able to do. I promised to teach her what is love, but things are not going as expected.

Sometimes I doubt if I’ve made the right choice: is it fine to hold her back here, who is not supposed to be born and hated by the world, for a year? Is it right to spend so much time together, only to make the parting more heartbreaking?

And who is Thinker after all? Is he the observer who’s been peeking into this world? Why does the observer want to do with Apeiria?

I take out my phone from the pocket. In it there are the mails sent by my future self.

“There are two Thinkers.”

“The observer is human.”

And things like that. I pondered about these things again and again, but to no avail. This time I try again to find out what it means.

The observer … is human …

Wait.

The viruses, the time loop, the disappearing interference pattern.

The observer is human.

The appearing viruses in the house just confirm my thought.

It feels real, but it is unreal.

“Apeiria! Run!” I grab her hand and run for the door.

“Affirmative. What’s the heading, owner, by the way, why are viruses here?” She replies with a mite of bewilderment.

The answer to the first is clear. The way out is the way in.

Since we cannot rely on Apeiria network and the nanobots now, there is only one way into the Second.

“The boundary tower!”

in life

# Artificial Intelligence

## Resolution

If $l_i \Leftrightarrow \neg m_j$, then:

$\frac{l_1 \vee \cdots l_k \ \ \ \ m_1 \vee \cdots \vee m_n}{l_1 \vee \cdots \vee l_{i-1} \vee l_{i+1} \cdots \vee l_k \vee m_1 \vee \cdots \vee m_{j-1} \vee m_{j+1} \cdots \vee m_n}$

If there is a empty clause after a resolution, it means there are conflicts.

$$\frac{p\ \ \ \neg p}{\square}$$

Resolution algorithm to prove $\alpha$ within KB:

1. Generate CNF of the knowledge base $KB\wedge\neg\alpha$
• CNF: $(l_{1,1}\vee l_{1,2} \vee \cdots \vee l_{1,n_1}) \wedge (l_{2,1}\vee \cdots \vee l_{2,n_2})\vee\cdots \vee (l_{m,1}\vee\cdots\vee l_{m,n_m})$
• Also called k-CNF if $n_1 = n_2 = \cdots = n_m = k$
2. Repeat resolution process for every new rule
1. If there is no new rule, $\alpha$ cannot be proved.
2. If there is an empty literal, then stop and $\alpha$ is proved

Complexity: exponential

Expressiveness: better (not restricted to Horn clauses)

## Propositional logic

### Jargons

Use functions, predicates to represent relationships:

• A is a person -> $Person(A)$, Person: predicate
• Person a has a crippled left leg -> $Crippled(LeftLegOf(a))$, LeftLegOf: function (it’s OK since a human has only one left leg)
Formally,

Term ::= Function ( Term {, Term}* )
AtomicSentence ::= predicate ( Term {, Term}* )

Forgot that.

# Networking

Cisco’s proprietary software, packettracer, couldn’t be downloaded without enrolling in its network course.

## IOS

• use enable to enable the thing
• show interfaces to have a look at all interfaces, show interface [interface].
• show vlan to show vlan
• configure terminal to open the configuration in terminal
• (config) interface [interface] to select an interface

## Dynamic Trunking Protocol

A proprietary protocol invented by Cisco to negotiate trunking on a link between two VLAN-aware switches.

There is several modes for it:

• access: puts the ethernet port into non-trunking mode and negotiates to convert the link to a nontrunk one, disregarding the neigboring port
• trunk: puts the ethernet port into trunking mode and negotiates to convert the link to a trunk one, disregarding the neigboring port
• dynamic auto: willing to trunk, will be trunk if the neighboring port is dynamic desirable or trunk
• dynamic desirable: actively willing to trunk
• nonegotiate: disable DTP. No wonder, it is not compatible with dynamic modes.

Except nonegotiate, all modes are triggered by (config-if) switchport mode [mode]. Switch to no-negotiate mode using (config-if) switchport nonegotiate.

Use a no before the statement to do the opposite thing, like:

(config-if) no shutdown: set up the link
(config-if) no switchport nonegotiate: turn on DTP

# Computer Graphics

Blurring is often used in computer graphics, like, to create HDR(high dynamic range) bloom, depth of field or other post process effects.

HDR bloom: since the real-world camera cannot focus perfectly, so it will convolve the incoming image with an Airy disk. What about the Airy disk? Know what a spot of light looks like in our eyes? That would be one. A perfect lens with a circular aperture would make it because the diffraction of light.

This effect is not noticeable when it is not so bright. However, with more light we can see the blurred edge of the bright part of the image, taken by a camera. And computer graphics tries to reproduce the same effect by blurring.

You can think up an approach instantly: take the average of neighboring blocks, like below:

$$\begin{bmatrix} 1/9&1/9&1/9 \\ 1/9&1/9&1/9 \\ 1/9&1/9&1/9 \\ \end{bmatrix}$$
By all means this is bad. It will seem block-ish.

A better one is Gaussian blur. It uses the Gaussian distribution as the weight of neighboring pixels to calculate the average, or more accurately, do the convolution. The weight matrix, like the one above, is called kernel.

A 3x3 Gaussian kernel is like:

$$\begin{bmatrix} 1/16 & 1/8 & 1/16 \\ 1/8 & 1/4 & 1/8 \\ 1/16 & 1/8 & 1/16 \\ \end{bmatrix}$$

Some other kernels are here).

It also can be used before downsampling: Gaussian blur gets rid of the sharp edges in the image, thus after downsampling, it will free the image from aliasing like moire patterns. Aliasing happens because of the poor sampling makes different signals indistinguishable, and some high frequency signals might get in the way after sampling. So a low pass filter need to be applied before sampling.

Reason of problem: high freq. signal => ?
Problem: aliasing => moire pattern
Solution: low pass filter => blurring

And yes, Gaussian blur is also a low pass filter, with a Bode plot like a parabola. Possibly it seems obvious at first sight: Gaussian distribution has a factor $e^{-\frac{x^2+y^2}{2\sigma^2}}$, which is stable through Fourier transforms.

We can calculate it out. Let’s put the basic calculus into practice.
\begin{aligned} &\iint e^{i\omega x}\cdot\frac{e^{-\frac{x^2+y^2}{2\sigma^2}}}{2\pi\sigma^2}\ dxdy\ =&e^{-2\sigma^2\omega^2}\iint \frac{e^{-\frac{(x-2\sigma^2\omega i)^2+y^2}{2\sigma^2}}}{2\pi\sigma^2}\ dxdy\ =&e^{-2\sigma^2\omega^2} \end{aligned}
So the amplification is:
\begin{aligned} dB&=20\log{e^{-2\sigma^2\omega^2}}\ &=-\frac{40}{\ln 10}\cdot \sigma^2\omega^2 \end{aligned}
Perfect! It is a parabola after all.

Leave Kawase to the next day.

マシンガンでも壊せなくて
キャタピラーでも潰せなくて

# Notes for 4-10

in life

## Database

### PL/SQL

#### Anonymous and named PL/SQL block

• Anonymous PL/SQL block
• Need to compile every time
• Not stored
• Named PL/SQL block
• Can be stored in DB

#### Stored Procedure

Grammar:

Procedure ::= CREATE [OR REPLACE] PROCEDURE ProcedureName '(' Parameters ')' (AS|IS) RETURN ReturnType DECLARE Declaration BEGIN Body END ';'
Parameters ::= Nothing | Parameter {, Parameter}
Parameter ::= ParameterName (IN|OUT|IN OUT) Type ':=' DefaultValue

• Note:
• In the parameter list, varchar cannot be specified with a length.
• MySQL has no AS|IS in the procedure, and IN/OUT is put before the parameter name.
• In MySQL ,one has to change the delimiter before defining a procedure or function.

#### Loop statement

• for x in [Reverse] 1..20 loop … end loop;
• while … loop … end loop;
To escape from a loop:
• exit when …;

#### Conditional statement

• if … then … elseif … end if;

#### Cursor

• Used to process a set of records. PL/SQL record variable can only store one record at a time.
• Technically, it acts like an iterator, which means one cannot process multiple records at the same time(though we can store them as a whole).
• In declaration, a cursor is declared with a SELECT statement, and we can use this cursor to access the data returned by that SELECT statement
• A cursor is bind to one specific SELECT clause, that is, one cannot bind it to another SELECT statement
• The SELECT statement is and only is executed when the cursor is OPENed(see below).
• CLOSE the cursor to free the memory space.
Synopsis:
1. Declaration

cursor cursor_name is select statement;

2. Open cursor

OPEN cursor_name;

3. Get the data

FETCH cursor_name into variable;

• The cursor will move forward, just like python’s next function do.
1. Check if there is no more entry

IF NOT cursor_name%FOUND THEN …;

2. Close the cursor

CLOSE cursor_name;

3. For loop
Unique to Oracle.
No need to open, close, or fetch from a cursor.

FOR variable in cursor_name LOOP
– do something to the variable
END LOOP;

## Artificial Intelligence

### Knowledge base && Inferrence

* Truth table

* Brute force search

* Forward chaining
* reliable
* completeness
* -> only have these two properties for the knowledge bases able to be expressed with Horn clauses
* Horn clause: a disjunction of literals with at most one unnegated literal
* E.g. $\neg x_1 \vee \neg x_2 \vee \cdots \vee x_n \vee u$

* Backward chaining
* To prove q, with p->q now prove p
* Avoid repeating by check if a clause is already proved or disproved


## Misc

Panning derives from panorama.

## 4/11 Record

### Programming Languages

#### Polymorphic Functions

• Static: cost grows exponentially with parameters
• Dynamic:
• supply a tag when calling the function

1. Equality was overloaded as an operator
2. Make type of equality fully polymorphic
3. Make equality polymorphic in a limited way
• (==) :: ''t -> ''t -> Bool, ''t is a type t with equality
• will be a static error if t is not Eq type

#### Type Classes

2. Dictionary-passing style implementation [ESOP1988]
• Type class declaration – dictionary
• Name of a type class method – label in the dictionary

### Smalltalk: subtyping

• Object -> super class

-> method table

• If interface A contains all of interface B, then A objects can also be used as B objects

• need to look up all instances(members) at runtime

Javascript has the same problem

• v8 engine: hidden class

## Computer Architecture

### Optimizing cache

Merging write cache

# Records of 4/7 to 4/9, 2018

## Records for 4-5 and 4-6

Dancing disco at the cementry.

Mathematica 11 could not be started after a freetype upgrade.

When run in command line, it emits an error like this.

According to the gentoo forum site. Mathematica has its own libraries, and it calls the system library of freetype.

Forcing Mathematica to use the system library by removing libfreetype.so.6 and libz.so.1 in ${TopDirectory}/SystemFiles/Libraries/Linux-x86-64 could solve the problem. ## About R To do a linear fit by this: ## The one who wrote this article fell asleep halfway… # Rec 4.8 ## Computing Method If f(x) satisfies: 1.$f(x) \in [a, b], x \in [a, b]$2.$f’$is Lipschitz continuous with some$K < 1$. Then there exists a unique fixed point of f in$[a, b]$. Existence: intermediate value theorem. Uniqueness: reductio ad absurdum. Newton’s method: To find$X$s.t.$F(X) = 0$. First$X=X_0$$$\Delta X_0 = \left(\left.\frac{\partial F}{\partial X}\right|_{X=X_0}\right)^{‘}F(X_0)$$ $$X_1=X_0+\Delta X_0$$ Likewise,$X_2=X_1+\Delta X_1$Where$\frac{\partial F}{\partial X}$is the Jacobian matrix of$F$. ## Facts about Mozilla • It developed Thunderbird, a program for emails, feeds, and IM and so on. And now Thunderbird is abandoned. ### Firefox It is said starting firefox with env MOZ_USE_XINPUT2=1 firefox enables scrolling with a finger. Not working now. The bugzilla page suggests there should be a --enable-default-toolkit=cairo-gtk3 in the configure options shown in about:buildconfig. Works now after upgrading GTK. Why. ### Firefox OS Another abandoned project is Firefox OS. Refer to this post. • Starting point: Boot to Gecko(B2G), push the envelop of the web • Architecture: • Gonk: Open Linux kernel and drivers • Gecko: Web runtime with open Web APIs • Gaia: User interface with HTML5-based Web content • Firefox OS 1.0 • Imitate what already existed • Invented a lot of APIs to talk to hardware of a smartphone from Javascript(that wouldn’t come into standards) • Introduced packaged apps to Gecko to achieve both the offline(run apps without Internet connection) and security requirements(to secure privileged functions like calling and texting messages). • Packaged apps got no URLs and have to be signed by a central authority to say they are safe. -> Against the web. • Firefox OS 1.x • Just chasing the coat tails of Android • Differentiation • Affordable phones -> 1.3t •$25 smartphone: mostly done by Taipei office
• Web -> 2.0
• Haida: blur the line between apps and websites
• Overshadowed by feature requests from venders
• 3.0 -> 2.5
Come to stall and dead in the end.

# Rec 4.9

## Computer Architecture

Refer to Computer Architecture: A Quantitative Approach

### Optimization of Cache Performance

1. Nonblocking Caches to Increase Cache Bandwidth

Pipelined computers that allow out-of-order execution will benefit from this kind of cache which can supply cache hits even during a miss.

1. Multibanked Cache
Bank 1 Bank 2 Bank 3 Bank 4
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15

Increase bandwidth.

1. Compiler

2. Prefetching

## Programming Languages

Still, refer to Standford’s cs242.

### Existential types

Interface: specify what a type should be able to do, regardless of the implementation

Implementation: concretize the interface by showing how a type can implement the interface

It has two kinds of operations: pack and unpack.

Packing is the introduction of an implementation(see More monads in OCaml).

For example, this is an example of a monad interface:

And an implementation of it:

It’s an ugly example, but the point is, the detail about Option.t is erased, with only the interface(pure, bind) left.

The implementation, Just 3 is not available here, and we cannot use Just to create a Option.t as well. Wait … shit.

And an implementation by list here:

Everything works fine without the knowledge that LStack uses list for the stack. Say you create a new stack using LStack.create, there is no way for you to use it as a list, though it is one.

That’s abstraction in a nutshell.

The existential type is like this: ${*S, t} : {\exists X, T}$ means that type t, coupled with implementation S, makes a package that have an abstract type X with signature T. For the LStack, the analogy would be:

$$list \sim S\ {create = \cdots, push = \cdots, pop = \cdots} \sim t\ {create : \forall a.unit \rightarrow X[a],\ push : \forall a.X[a] \rightarrow a \rightarrow X[a],\ pop : \forall a.X[a] \rightarrow X[a] * option[a]}\sim T$$

And there is the pack operation, which erases one or more types and introduces an implementation:
$$\frac{\Gamma \vdash t : [X\rightarrow U]T}{\Gamma \vdash {*U, t}\ as\ {\exists X, T} : {\exists X, T}}$$

# Records of day Apr. 4, 2018

in diary

## Computer Architecture

• Cache Optimization
• Lower 3C:
• +cache block size -> -compulsory -> +conflict
• +cache capacity -> -capacity caused misses -> hit time
• +associativity -> +parallel comparison
• Lower cost of cache miss:
• multi-layer cache(victim cache)
• global miss rate vs. local miss rate, AMAT
• If L2 cache is much larger than L1, the global miss rate is close to that with a single level cache of L2’s size
• placeholder
• placeholder
• Small and simple first level caches
• Critical timing path:
• Direct-mapped caches can overlap tag compare and transmission
• placeholder

## Programming Languages

Since in OCaml the content of a function is not evaluated in its definition, the approach could be used to create lists with infinite length.

The good thing about it is that the function is not evaluated at once, so the infinite recursion is avoided.

And there is some other utilities:

Note that () is of type unit in OCaml, not () in Haskell.

And we can have something like 1... now in OCaml:

Or better, some Fibonacci series:

Argh.

This one, though it looks elegant, would run slow.

Imagine: you get 20 in toinfslow 10 by adding to it 1 ten times.

And a even slower Fibonacci series:

Go with take 40 (fibslow 1 1) and you would not get the result as fast as the first one.

OCaml has a lazy module that would delay the evaluation of the expression, and also cache the result. So a lazy list would be faster after calculating once.

Chinese government has banned its security researchers from participating foreign security conferences this year, and Pwn2Own on Mar. 12-14, which Chinese dominated for years, was impacted by this new policy. And Zhou Hongyi, chief executor of 360, has previously stated that these loopholes ‘should remain in China’.

## Learning Kana Input…

ろぬふあう　えおやゆよ　わほへ
 1 2 3 4 5 6 7 8 9 0 - =

たていすか　んなにらせ　゛゜む
q w e r t y u i o p [ ] \

ちとしはき　くまのりれ　け
a s d f g h j k l ; ‘

つさそひこ　みもねるめ
z x c v b n m , . /

Use shift key for smaller kana. E.g. ゃ is entered with Shift + 7`.

## Misc

Was yea erra hymme sarla yorr.

• Kemu was probably once troubled by Suzumu, a member of Kemu VOXX, and who had a similar style. Kemu came back with Haikei Doppelganger in 2017, which possibly refers to Suzumu.

• After the admitting the ghostwriting of some of his songs, Suzumu announced that he would retire from making vocaloid songs in 2017. Which means the Bookmark of Demise Project stopped without ending.

• Mafumafu is said to had bad terms with Suzumu, which brought a lot damage to him.

• Powapowa-P, a.k.a. Shiina Mota, deceased at 20, with a red pen. The cause of his death was not revealed.

• Samfree died at 31 from illness. Recommend his Promise, although a lot may have already known it from Project Diva.

• page 3 of 8

#### NoirGif

A progamer.

Student(probably)