aarjaneiro/planetmath huggingface dataset:
stable sorting algorithm

stable sorting algorithm

A

stable sorting algorithm

is any sorting algorithm that

preserves

the relative ordering of items with equal values. For

instance

, consider a list of

ordered pairs

L

:=

{

(

A

,

3

)

,

(

B

,

5

)

,

(

C

,

2

)

,

(

D

,

5

)

,

(

E

,

4

)

}

.

If a stable sorting algorithm sorts

L

on the second value in each pair using the

≤

relation

, then the result is

guaranteed

to be

{

(

C

,

2

)

,

(

A

,

3

)

,

(

E

,

4

)

,

(

B

,

5

)

,

(

D

,

5

)

}

. However, if an

algorithm

is not stable, then it is possible that

(

D

,

5

)

may come before

(

B

,

5

)

in the sorted output.

Some examples of stable sorting algorithms are

bubblesort

and mergesort (although the stability of mergesort is dependent upon how it is implemented). Some examples of unstable sorting algorithms are

heapsort

and

quicksort

(quicksort could be made stable, but then it wouldn’t be quick any more).
Stability is a useful

property

when the

total ordering

relation is dependent upon initial position. Using a stable sorting algorithm means that

sorting

by ascending position for equal keys is built-in, and need not be implemented explicitly in the comparison

operator

.

Title

stable sorting algorithm

Canonical

name

StableSortingAlgorithm

Date of creation

2013-03-22 12:31:04

Last modified on

2013-03-22 12:31:04

Owner

mathcam (2727)

Last modified by

mathcam (2727)

Numerical id

9

Author

mathcam (2727)

Entry type

Definition

Classification

msc 68P10

Synonym

stable algorithm

Related topic

Bubblesort

Defines

unstable sorting algorithm

Generated on Sat Feb 10 12:38:35 2018 by

LaTeXML
relation construction

relation construction

\PMlinkescapephrase

base

\PMlinkescapephrase

Base

\PMlinkescapephrase

components

\PMlinkescapephrase

Components

\PMlinkescapephrase

plus

\PMlinkescapephrase

Plus

Relation construction

and

relational constructibility

have to do with the ways that one

relation

is determined by an indexed family or a

sequence

of other relations, called the

relation dataset

. The relation dataset typically consists of a specified set of other relations, called the

relational base

or the

relational components

, plus a specified set of

operations on relations

, called the

method of construction

.

Relation composition

and relation

reduction

are special cases of relation constructions.

Title

relation construction

Canonical name

RelationConstruction

Date of creation

2013-03-22 17:49:31

Last modified on

2013-03-22 17:49:31

Owner

Jon Awbrey (15246)

Last modified by

Jon Awbrey (15246)

Numerical id

6

Author

Jon Awbrey (15246)

Entry type

Topic

Classification

msc 68P15

Classification

msc 08A02

Classification

msc 05C65

Classification

msc 05B30

Classification

msc 05B20

Classification

msc 03E20

Classification

msc 03B10

Classification

msc 68R01

Related topic

RelationTheory

Related topic

RelationComposition2

Related topic

RelationReduction

Related topic

TacitExtension

Generated on Sat Feb 10 12:38:44 2018 by

LaTeXML
cognitive science

cognitive science

The field of

cognitive science

consists of an interdisciplinary study of the

structures

of the human mind. These structures include our sensory/perceptual apparatus, such as vision, audition, olfaction; internal mental processes such as

language

, thinking, reasoning and problem solving; motor control and the organization of skilled behavior such as speech and musical performance; memory; consciousness; attention; and many other aspects of mind. All of these

subfields

are clearly intertwined. Disciplines included are psychology, biology, neuroscience, philosophy, anthropology, linguistics, sociology, and computer science; more recently, the academic music world has devoted some of its resources to the study of the cognitive science of music.

Often the claim is made that cognition is information processing: ”Cognitive science is the study of information processing, and insofar as a discipline studies that, then it is part of cognitive science.” (Hardcastle 1996: 8) This claim is true in the most general sense, in that the mind is continually taking in information and dealing with it in some way. In the past, the further claim was made that the mind is merely an example of a formal symbol-manipulating device that executes mental

programs

, where any such device would do (e.g. von Neumann 1951). As such, it was assumed that one could ignore the physical and biochemical particulars of the brain. Theories of mental processes then consisted of abstract mathematical models that had the correct input-output

characteristics

and various

functional

or causal

relations

. This kind of theorizing suggested a fundamental dichotomy that was assumed between the body and the mind – a problematic dichotomy that dates back to Plato.

Overall, the field of cognitive science consists of research on parallel fronts: to name a few, we have the neuroscientific study of the structure of the brain, the psychological study of mental abstractions, and the socioanthropological study of the shaping of these mental structures by culture.

Title

cognitive science

Canonical name

CognitiveScience

Date of creation

2013-03-22 15:31:48

Last modified on

2013-03-22 15:31:48

Owner

gprasad (11015)

Last modified by

gprasad (11015)

Numerical id

6

Author

gprasad (11015)

Entry type

Topic

Classification

msc 68P20

Generated on Sat Feb 10 12:38:46 2018 by

LaTeXML
descriptive metadata specification

descriptive metadata specification

Let

L

=

∪

D

⁢

k

be a set of literals defined as the union of
domains

D

⁢

k

of simple datatypes (e.g., strings, numbers, dates, etc.). Let also

R

and

P

represent sets of labels for resources and

properties

respectively. A

descriptive metadata specification

is a structure (

G

,

R

∪

L

∪

P

,

F

), where:
(1)

F

:

(

V

∪

E

)

Ã

⁢

¢

⁢

â

⁢



⁢

⁢

â

⁢



⁢



(

R

∪

L

∪

P

) can assign general labels

R

∪

P

and literals from

L

to nodes of the graph structure;
(2) for each directed edge

e

= (

v

⁢

i

,

v

⁢

j

) of

G

,

F

(

v

⁢

i

)

∈

R

∪

L

,

F

(

v

⁢

j

)

∈

R

∪

L

and

F

⁢

(

e

)

∈

P

;
(3)

F

⁢

(

v

⁢

k

)

∈

L

if and only if node vk has

outdegree

0.

Title

descriptive metadata specification

Canonical

name

DescriptiveMetadataSpecification

Date of creation

2013-03-22 15:31:29

Last modified on

2013-03-22 15:31:29

Owner

yi6604 (10640)

Last modified by

yi6604 (10640)

Numerical id

5

Author

yi6604 (10640)

Entry type

Definition

Classification

msc 68P20

Generated on Sat Feb 10 12:38:49 2018 by

LaTeXML
Hypertext

Hypertext

A hypertext is a kind of database system which allows creative linking of objects. It is essentially made by structural hyperlinks that follow the structural metadata and external referential links. Hypertext system is essentially used to better organize large information sources so that browsing through them is easier. An example of hypertext is the

World Wide Web

.

If H be a

structure

and C be a

collection

then hypertext HT = (H, Contents, P) is a triple such that:

(1) Contents

⊆

C

∪

AllSubStreams

∪

AllSubStructuredStreams

(2) P is a

function

which associates a node of the hypertext with the node content.

Title

Hypertext

Canonical

name

Hypertext

Date of creation

2013-03-22 15:31:32

Last modified on

2013-03-22 15:31:32

Owner

kahuja (10742)

Last modified by

kahuja (10742)

Numerical id

8

Author

kahuja (10742)

Entry type

Definition

Classification

msc 68P20

Generated on Sat Feb 10 12:38:57 2018 by

LaTeXML
scenario

scenario

A

scenario

is a sequence of related

transition events

(

e

1

,

e

2

,

…

,

e

n

)

on a state set S such that

e

k

=

(

s

k

,

s

k

+

1

)

for

1

≤

k

≤

n

.

Title

scenario

Canonical name

Scenario

Date of creation

2013-03-22 15:30:32

Last modified on

2013-03-22 15:30:32

Owner

PrimeFan (13766)

Last modified by

PrimeFan (13766)

Numerical id

15

Author

PrimeFan (13766)

Entry type

Definition

Classification

msc 68P20

Generated on Sat Feb 10 12:38:59 2018 by

LaTeXML
transition event

transition event

A

transition event

(or simply

event

) on a state set

S

is an

element

e

=

(

s

i

,

s

j

)

∈

(

S

×

S

)

of a

binary relation

on state set

S

that signifies the transition from one state to another. An event

e

is defined by a condition

function

c

⁢

(

s

i

)

which evaluates a

Boolean function

in state

s

i

and by an action function

p

.

Title

transition event

Canonical name

TransitionEvent

Date of creation

2013-03-22 14:05:16

Last modified on

2013-03-22 14:05:16

Owner

PrimeFan (13766)

Last modified by

PrimeFan (13766)

Numerical id

5

Author

PrimeFan (13766)

Entry type

Definition

Classification

msc 68P20

Synonym

event

Generated on Sat Feb 10 12:39:01 2018 by

LaTeXML
arithmetic encoding

arithmetic encoding

Arithmetic coding

is a technique for achieving near-optimal

entropy encoding

.

An arithmetic encoder takes a string of symbols as input and produces a

rational number

in the interval

[

0

,

1

)

as output. As each symbol is processed, the encoder will restrict the output to a smaller interval.

Let

N

be the number of distinct symbols in the input; let

x

1

,

x

2

⁢

…

⁢

x

N

represent the symbols, and let

P

1

,

P

2

⁢

…

⁢

P

N

represent the probability of each symbol appearing. At each step in the process, the output is restricted to the current interval

[

y

,

y

+

R

)

.

Partition

this interval into

N

disjoint

subintervals:

I

1

=

[

y

,

y

+

P

1

⁢

R

)

I

2

=

[

y

+

P

1

⁢

R

,

y

+

P

1

⁢

R

+

P

2

⁢

R

)

⋮

I

N

=

[

y

+

∑

i

=

1

N

-

1

P

i

⁢

R

,

y

+

R

)

Therefore the of

I

i

is

P

i

⁢

R

. If the next symbol is

x

i

, then restrict the output to the new interval

I

i

.

Note that at each stage, all the possible intervals are

pairwise disjoint

. Therefore a specific

sequence

of symbols produces exactly one unique output range, and the process can be reversed.

Since arithmetic encoders are typically implemented on binary

computers

, the actual output of the encoder is generally the shortest sequence of bits representing the

fractional part

of a rational number in the final interval.

Suppose our entire input string contains

M

symbols: then

x

i

appears exactly

P

i

⁢

M

times in the input. Therefore, the size of the final interval will be

R

f

=

∏

i

=

1

N

P

i

P

i

⁢

M

The number of bits necessary to write a binary

fraction

in this range is

-

log

2

⁡

R

f

=

-

log

2

⁢

∏

i

=

1

N

P

i

P

i

⁢

M

=

∑

i

=

1

N

-

log

2

⁡

P

i

P

i

⁢

M

=

∑

i

=

1

N

-

P

i

⁢

M

⁢

log

2

⁡

P

i

By Shannon’s

theorem

, this is the total

entropy

of the original message. Therefore arithmetic encoding is near-optimal entropy encoding.

Title

arithmetic encoding

Canonical

name

ArithmeticEncoding

Date of creation

2013-03-22 12:32:20

Last modified on

2013-03-22 12:32:20

Owner

vampyr (22)

Last modified by

vampyr (22)

Numerical id

4

Author

vampyr (22)

Entry type

Definition

Classification

msc 68P30

Classification

msc 94A24

Synonym

arithmetic coding

Synonym

arithmetic encoder

Synonym

arithmetic coder

Related topic

HuffmanCoding

Generated on Sat Feb 10 12:39:03 2018 by

LaTeXML
binary Gray code

binary Gray code

An

n

-bit binary

Gray code

is a non-repeating

sequence

of the integers from

0

to

2

n

-

1

inclusive such that the binary representation of each number in the sequence differs by exactly one bit from the binary representation of the previous number: that is, the

Hamming distance

between consecutive

elements

is

1

. In

addition

, we also define a

cyclic Gray code

to be a Gray code where an extra condition is imposed: The last number in the sequence must differ by exactly one bit from the first number in the sequence.

For example, one

3

-bit cyclic Gray code is:

000

2

010

2

011

2

001

2

101

2

111

2

110

2

100

2

There is a

one-to-one correspondence

between all possible

n

-bit Gray codes and all possible

Hamiltonian cycles

on an

n

-dimensional hypercube. (To see why this is so, imagine assigning a binary number to each vertex of a hypercube where an edge joins each pair of vertices that differ by exactly one bit.)

Title

binary Gray code

Canonical name

BinaryGrayCode

Date of creation

2013-03-22 12:30:09

Last modified on

2013-03-22 12:30:09

Owner

mathcam (2727)

Last modified by

mathcam (2727)

Numerical id

9

Author

mathcam (2727)

Entry type

Definition

Classification

msc 68P30

Classification

msc 05C45

Synonym

Gray code

Defines

cyclic Gray code

Generated on Sat Feb 10 12:39:05 2018 by

LaTeXML
entropy encoding

entropy encoding

An

entropy encoding

is a coding scheme that involves assigning codes to symbols so as to match code lengths with the probabilities of the symbols. Typically, entropy encoders are used to compress data by replacing symbols represented by equal-length codes with symbols represented by codes proportional to the

negative

logarithm of the probability. Therefore, the most common symbols use the shortest codes.

According to Shannon’s

theorem

, the optimal code length for a symbol is

-

log

b

⁡

P

where

b

is the number of symbols used to make output codes and

P

is the probability of the input symbol.

Two of the most common entropy encoding techniques are

Huffman encoding

and

arithmetic encoding

.

Title

entropy encoding

Canonical

name

EntropyEncoding

Date of creation

2013-03-22 12:32:22

Last modified on

2013-03-22 12:32:22

Owner

vampyr (22)

Last modified by

vampyr (22)

Numerical id

4

Author

vampyr (22)

Entry type

Definition

Classification

msc 68P30

Classification

msc 94A24

Synonym

entropy encoder

Synonym

entropy coding

Related topic

HuffmanCoding

Generated on Sat Feb 10 12:39:06 2018 by

LaTeXML
run-length encoding

run-length encoding

Run-length encoding

(RLE) is a lossless compression

algorithm

which counts how many times a symbol or group of symbols is repeated consecutively in the input.

For example, the values of the

prime counting function

π

⁢

(

n

)

up to 72 are: 0, 1, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 21, 21, 21, 21, 21, 21. These can be run-length encoded as: one 0, one 1, two 2s, two 3s, four 4s, two 5s, four 6s, two 7s, four 8s, six 9s, two 10s, six 11s, four 12s, two 13s, four 14ws, five 15s, etc.

Run-length encoding is obviously most effective for inputs containing many repetitions of a symbol or group of symbols, such as flat-color drawings with straight line boundaries. For example, the first line of a run-length encoding of a 720 by 481 drawing of the American flag stretched flat could look something like this: 240 BLUE, 480 RED. Below the blue field, a line-by-line second pass would result in even greater compression: 37 lines of 720 WHITE, followed by 37 lines of 720 RED, then 37 lines of 720 RED, etc. But for a more photorealistic drawing, run-length encoding would result in the opposite of compression.

Title

run-length encoding

Canonical

name

RunlengthEncoding

Date of creation

2013-03-22 17:58:03

Last modified on

2013-03-22 17:58:03

Owner

PrimeFan (13766)

Last modified by

PrimeFan (13766)

Numerical id

4

Author

PrimeFan (13766)

Entry type

Definition

Classification

msc 68P30

Synonym

RLE

Synonym

run length encoding

Generated on Sat Feb 10 12:39:12 2018 by

LaTeXML
Boolean-valued function

Boolean-valued function

A

Boolean-valued function

is a

function

of type

f

:

X

→

𝔹

, where

X

is an arbitrary set and where

𝔹

is a

Boolean domain

.

A

Boolean function

(of finite arity

k

) is a Boolean-valued function of type

f

:

𝔹

k

→

𝔹

.

In some

contexts

a Boolean-valued function may be referred to as a

predicate

or a

proposition

. In other contexts these terms may be used to describe the syntactic entities that denote or express Boolean-valued functions, or that have Boolean-valued functions among their canonical or intended models (

http://planetmath.org/Model

). When necessary to avoid confusion, terms like

propositional expression

or

predicate

formula

may be used to distinguish signs (

http://planetmath.org/SignRelation

) from their objects.

Title

Boolean-valued function

Canonical name

BooleanvaluedFunction

Date of creation

2013-03-22 17:58:12

Last modified on

2013-03-22 17:58:12

Owner

Jon Awbrey (15246)

Last modified by

Jon Awbrey (15246)

Numerical id

10

Author

Jon Awbrey (15246)

Entry type

Definition

Classification

msc 68Q01

Classification

msc 68P01

Classification

msc 06E30

Classification

msc 03G05

Classification

msc 03C55

Classification

msc 03B05

Classification

msc 68R01

Synonym

characteristic function

Synonym

indicator function

Synonym

predicate

Synonym

proposition

Related topic

BooleanDomain

Defines

Boolean function

Generated on Sat Feb 10 12:39:14 2018 by

LaTeXML
Continuant polynomial

Continuant polynomial

It is defined as follow

K

n

⁢

(

x

1

,

x

2

,

…

,

x

n

)

:=

{

1

,

if

⁢

n

=

0

;

x

1

,

if

⁢

n

=

1

;

x

1

⁢

K

n

-

1

⁢

(

x

2

,

…

,

x

n

)

+

K

n

-

2

⁢

(

x

3

,

…

,

x

n

)

,

if

⁢

n

>

1

.

It is easy to show, that

K

n

⁢

(

x

1

,

x

2

,

…

,

x

n

)

=

det

⁡

(

x

n

+

1

0

…

0

0

-

1

x

n

-

1

+

1

…

0

0

0

-

1

x

n

-

2

⋱

0

0

⋮

⋮

⋱

⋱

⋮

⋮

0

0

0

…

x

2

+

1

0

0

0

…

-

1

x

1

)

.

References: Knuth D.E.

”The Art of Computer Programming, Volume 2: Seminumerical

Algorithms

.

Title

Continuant polynomial

Canonical

name

ContinuantPolynomial

Date of creation

2013-03-22 18:03:36

Last modified on

2013-03-22 18:03:36

Owner

veselin (20506)

Last modified by

veselin (20506)

Numerical id

7

Author

veselin (20506)

Entry type

Definition

Classification

msc 68Q01

Generated on Sat Feb 10 12:39:16 2018 by

LaTeXML
currying

currying

Currying

is the technique of emulating multiple-parametered

functions

with higher-order functions. The notion is that a function
of

n

arguments

can be thought of as a function of 1 argument that
maps to a function of

n

-

1

arguments. A

curried function

is a
function represented by currying, e.g.

f

:

A

→

(

B

→

C

)

For conciseness, the

mapping

operator

→

is usually
considered right-associative, so one could drop the parentheses in the

expression

above and write

f

:

A

→

B

→

C

instead.

In contrast, an

uncurried function

is usually specified as a
mapping from a

Cartesian product

, such as

f

:

(

A

×

B

)

→

C

.

The term

currying

is derived from the name of Haskell Curry, a
20th-century logician. However, Curry was not the first person to
discover this notion, as it was first introduced by Gottlob Frege in
1893 and expanded by Moses Schönfinkel in the 1920s. Hence the
notion is sometimes referred to as

schönfinkeling

.

From the perspective of

category theory

, currying can be thought of as
exploiting the fact that

-

×

B

and

Hom

⁡

(

B

,

-

)

are

adjoint
functors

on

𝐒𝐞𝐭

. That is, for each set

B

, there is a

natural
equivalence

ν

:

Hom

𝐒𝐞𝐭

(

-

×

B

,

-

)

⟶

⋅

Hom

𝐒𝐞𝐭

(

-

,

Hom

(

B

,

-

)

)

defined by sending a map

f

:

(

A

×

B

)

→

C

to the map

ν

f

:

A

→

Hom

⁡

(

B

,

C

)

. For each

a

∈

A

,

ν

f

⁢

(

a

)

:

B

→

C

is the map defined by

ν

f

⁢

(

a

)

⁢

(

b

)

=

f

⁢

(

a

,

b

)

.

Title

currying

Canonical

name

Currying

Date of creation

2013-03-22 12:33:35

Last modified on

2013-03-22 12:33:35

Owner

mps (409)

Last modified by

mps (409)

Numerical id

8

Author

mps (409)

Entry type

Definition

Classification

msc 68Q01

Synonym

schönfinkeling

Synonym

schönfinkelization

Related topic

HigherOrderFunction

Defines

curried function

Defines

uncurried function

Generated on Sat Feb 10 12:39:18 2018 by

LaTeXML
explicit form for currying

explicit form for currying

In

lambda calculus

, we may express

Currying

functions

and their

inverses

explicitly using lambda expressions. Suppose that

f

is a function
of two

arguments

. Then, if

c

2

is the currying function which maps
of two arguments to higher order functions, we have, by

definition

,

f

⁢

(

x

,

y

)

=

(

(

c

2

⁢

(

f

)

)

⁢

(

x

)

)

⁢

(

y

)

.

We then have

c

2

⁢

(

f

)

=

λ

v

⁢

(

λ

u

⁢

f

⁢

(

u

,

v

)

)

,

hence

c

2

=

λ

w

⁢

(

λ

v

⁢

(

λ

u

⁢

w

⁢

(

u

,

v

)

)

)

.

Likewise, from the original equation, we see that

c

2

-

1

=

λ

w

⁢

(

λ

a

⁢

b

⁢

(

w

⁢

(

x

)

)

⁢

(

y

)

)

.

We can write

similar

expressions

for any number of arguments:

c

3

=

λ

w

⁢

(

λ

c

⁢

(

λ

b

⁢

(

λ

a

⁢

w

⁢

(

a

,

b

,

c

)

)

)

)

c

4

=

λ

w

⁢

(

λ

d

⁢

(

λ

c

⁢

(

λ

b

⁢

(

λ

a

⁢

w

⁢

(

a

,

b

,

c

,

d

)

)

)

)

)

c

5

=

λ

w

⁢

(

λ

e

⁢

(

λ

d

⁢

(

λ

c

⁢

(

λ

b

⁢

(

λ

a

⁢

w

⁢

(

a

,

b

,

c

,

d

)

)

)

)

)

)

,

etc.

Their inverses look as follows:

c

3

-

1

=

λ

w

⁢

(

λ

a

⁢

b

⁢

c

⁢

(

(

w

⁢

(

a

)

)

⁢

(

b

)

)

⁢

(

c

)

)

c

4

-

1

=

λ

w

⁢

(

λ

a

⁢

b

⁢

c

⁢

d

⁢

(

(

(

w

⁢

(

a

)

)

⁢

(

b

)

)

⁢

(

c

)

)

⁢

(

d

)

)

c

4

-

1

=

λ

w

⁢

(

λ

a

⁢

b

⁢

c

⁢

d

⁢

e

⁢

(

(

(

(

w

⁢

(

a

)

)

⁢

(

b

)

)

⁢

(

c

)

)

⁢

(

d

)

)

⁢

(

e

)

)

Title

explicit form for currying

Canonical

name

ExplicitFormForCurrying

Date of creation

2013-03-22 17:03:57

Last modified on

2013-03-22 17:03:57

Owner

rspuzio (6075)

Last modified by

rspuzio (6075)

Numerical id

5

Author

rspuzio (6075)

Entry type

Derivation

Classification

msc 68Q01

Generated on Sat Feb 10 12:39:21 2018 by

LaTeXML
higher-order function

higher-order function

Any

function

that maps a function to anything or maps anything to a function is a

higher-order function

. In programming language terms, a higher-order function is any function that takes one or more functions as

arguments

and/or returns a function.

For example, a

predicate

which makes some statement about a function would be a higher-order function.

Title

higher-order function

Canonical

name

HigherorderFunction

Date of creation

2013-03-22 12:33:38

Last modified on

2013-03-22 12:33:38

Owner

Logan (6)

Last modified by

Logan (6)

Numerical id

4

Author

Logan (6)

Entry type

Definition

Classification

msc 68Q01

Synonym

functional

Related topic

Currying

Generated on Sat Feb 10 12:39:23 2018 by

LaTeXML