text:
# Elixir Umbrellas Applications and Testing With Mox

13.03.2019

What's the big deal with Elixir umbrellas?

An Elixir umbrella is a container for mix apps; a structure useful to separate the application's concerns as each app is contained within its own mix project.

Why is this cool?

Because it's like Lego and Lego is cool.

Mox is cool too... Let's dive in!

## Breethe

Throughout this post, we will use Breethe as an example. Breethe is a Progressive Web App that gives users quick and easy access to air quality data for locations around the world. Pollution and global warming are getting worse. The first step to understanding and solving these problems is to raise awareness by providing everyone with easy access to accurate data.

The application is open source and we encourage everyone interested to look through the source for reference. The server for this application was implemented using an Elixir umbrella application which will be the focus of this post. The client for Breethe was built with Glimmer.js, which we discussed in previous posts:

## Umbrella applications and separating concerns

When we first started building Breethe, we asked ourselves a simple question which would dictate the structure of the application and our motivation for using an umbrella app to organise our code. This question was: what if we want to change our air quality data provider? It turns out this wasn't just speculation as we are now in the process of doing just that and our decision to use an umbrella app will make the process tremendously easy.

Using an umbrella allowed us to split our server into two very distinct applications, communicating together by way of rigorously defined APIs. The first application functions as the data handling entity of the project - named breethe (see below). It communicates with the air quality data provider (a third-party API) to gather the data, then processes and caches it for future use. The second application in the umbrella is the web interface built with Phoenix - named breethe_web. It requests the data from the first application, serializes it to JSON and delivers the payload to the client in compliance with the JSON:API specification.

Here's an overview of the umbrella structure used for Breethe:

apps
├── breethe
│   ├── config
│   ├── lib
│   ├── mix.exs
│   ├── priv
│   └── test
└── breethe_web
├── config
├── lib
├── mix.exs
├── priv
└── test

We have defined a clear boundary between the business logic and the webserver. This is cool because the umbrella becomes modular like Lego and who doesn't like Lego? Need to change the air quality data provider? No problem, simply change the data application, leaving the webserver untouched as long as the data app continues to implement the same interface. The same would work the other way round if we wanted to change the webserver.

However, for this approach to work well, the APIs used to communicate between the different applications in the umbrella need to be carefully defined. We want to keep the interfaces as little as possible to keep complexity contained. As an example, here are the publicly available functions on the breethe app in the umbrella:

# apps/breethe/lib/breethe.ex
def get_location(location_id), do: # ...

def search_locations(search_term), do: # ...

def search_locations(lat, lon), do: # ...

def search_measurements(location_id), do: # ...

Equally, these are the only functions the Phoenix web app (or any other app in the umbrella) can call on the breethe app. These principles are of course not only applicable at the top level of the application but also within its internal logical contexts. For example, within the breethe app, we have isolated the functions explicitly making requests to third-party APIs and abstracted them away behind an interface. This, again, reduces complexity and facilitates testing as we can isolate the different components of the business logic. This philosophy lends itself very well to being tested using Mox.

## Testing domains independently using Mox

Mox, as the name suggests, is a library that defines mocks bound to specific behaviours. A behaviour is a set of function signatures that must be implemented by a module. Consequently, Mox guarantees the mocks for a module be consistent with the original functions they replace during testing. This rigidity makes the tests more maintainable and requires that the behaviours for each module be meticulously defined; precisely the qualities desired when implementing the APIs within our umbrella.

For example, let's consider mocking the public API for the breethe application when testing breethe_web. As the bridge between the two is only composed of the four functions shown in the previous section, mocking the breethe application's public interface when testing the webserver only requires mocking those four functions. Naturally, this is only reasonable if we separately test the breethe application in full, from interface to database. Crucially, it is the singularity of the interface which allows this degree of separation between the two applications in the umbrella both in testing and in production.

Let's take a look at the controller action for a location search by id:

# apps/breethe_web/lib/breethe_web/controllers/location_controller.ex
@source Application.get_env(:breethe_web, :source)

def show(conn, %{"id" => id}) do
location =
id
|> String.to_integer()
|> @source.get_location()

render(conn, "show.json-api", data: location, opts: [])
end

The interesting part is in the call to the breethe application:

|> @source.get_location()

The reason we're using the @source module attribute is to be able to switch between the mock and the real function defined on the breethe application; this is defined in the config files:

# config/config.exs
config :breethe_web, source: Breethe

# config/test.exs
config :breethe_web, source: Breethe.Mock

By default @source points to the Breethe module - the breethe application's public API used in production and development. During testing it switches to the Breethe.Mock module, which defines the mocks.

The test for this controller action is meant to check two things. Firstly, that the router redirects the connection to the appropriate controller action. Secondly, that the controller action processes the call and queries the breethe application correctly using the right function defined on the latter's API - in this case get_location(location_id).

# apps/breethe_web/test/breethe_web/controllers/location_controller_test.exs
describe "show route: returns location" do
test "by id" do
location = insert(:location, measurements: [])

Breethe.Mock
|> expect(:get_location, fn _location_id -> location end)

conn = get(build_conn(), "api/locations/#{location.id}", [])

assert json_response(conn, 200) == %{
"data" => %{
...
}
}
end
end

I've broken it down into its four main parts:

1. It sets up the test data with ExMachina.

location = insert(:location, measurements: [])

1. It defines a mock in the Breethe.Mock module for the get_location(location_id) function defined in the breethe application's API and sets the return value to the location we created at 1. The mock is passed as an argument to the expect clause which verifies the mock is executed during the test (instead of the real function).

Breethe.Mock
|> expect(:get_location, fn _location_id -> location end)

As long as we’ve established the callback in the behaviour implemented by the Breethe module, we don’t need to explicitly define the Breethe.Mock module (Mox creates it). Here's the callback for this particular function (for reference, it isn't coded in the test).

# apps/breethe/lib/breethe.ex
defmodule Behaviour do
@callback get_location(location_id :: integer) :: %Breethe.Data.Location{}
end

1. It builds a connection and makes a call to the webserver's route designed to handle a location search by id.

conn = get(build_conn(), "api/locations/#{location.id}", [])

1. It tests the JSON response (abridged for brevity) is correct by asserting on the attributes of the location created in 1. and returned from the mock in 2.

assert json_response(conn, 200) == %{
"data" => %{
...
}
}

Using mocks greatly simplifies the testing process. Each test can be smaller and more specific. Each test is faster as we are not making calls to the database or external systems; we are only running the anonymous functions that define the mocks. For instance, the mock in our example above only executes:

fn _location_id -> location end

Finally, each mock is self-contained in the test defining it and the callback insures the mock matches the original function signature. The result is robust, fast and modularised tests.

## Conclusion

Elixir umbrella apps shine when structuring projects containing clear boundaries between their constituent parts. The philosophy they implement deeply resembles that of functional programming (and Lego), where small building blocks combine into a larger whole. It is however important to be precise when defining the internal APIs of the application as they act as the glue holding everything together. Lastly, Mox is a wonderful tool for testing. Not only does it make mocking APIs very simple and elegant, it also encourages best practices such as defining behaviours to keep the code consistent and robust.

This post was originally published on the simplabs tech blog.


text:
# Questions by Kriss Singh

1
Tanenbaum connection establishment
2
Plz xplain
3
What is the intial pc value meaning 530=Pc + value what should be the pc value 631 or 632 or 633 basically the instruction length is not give so how can i determine the addr loaded in pc hen instructtion at 630 is executing because if instruction length is 4 bytes it should be 634 thanks in advance
4
1 vote
5
Cycle steal mode
6
in microprogrammed cu every computer instruction has its own microprogammed routine in control memory (mano ) Does this mean than every m/c instruction would have its own implementation of fetch routine loaded ?
Consider an instruction pipeline with five stages without any branch prediction: Fetch Instruction (FI), Decode Instruction (DI), Fetch Operand (FO), Execute Instruction (EI) and Write Operand (WO). The stage delays for FI, DI, FO, EI and WO are ... is taken during the execution of this program, the time (in ns) needed to complete the program is $132$ $165$ $176$ $328$
add \$so,\$to,\$t1 sub \$t2,\$S0,\$t3 Num of stall cyles i am getting 2 stall but the books says 3 1.No data data forwarding 2.Write to register file in first half and read from second half in clock cycle my timing dig goes like this add IF ID EX MEM WB NOP NOP IF ID EXE .....

format: plain


text:
Skip to main content

# 2.5: Soundness

[ "article:topic", "authorname:learykristiansen" ]

$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$

Mathematicians are by nature a conservative bunch. We speak not of political or social leanings, but of their professional outlook. In particular, a mathematician likes to know that when something has been proved, it is true. In this section we will prove a theorem that shows that the logical system that we have developed has this highly desirable property. This result is called the Soundness Theorem.

Let us restate the list of requirements that we set for our axioms and rules of inference:

1. There will be an algorithm that will decide, given a formula $$\theta$$, whether or not $$\theta$$ is a logical axiom.
2. There will be an algorithm that will decide, given a finite set of formulas $$\Gamma$$ and a formula $$\theta$$, whether or not $$\left( \Gamma, \theta \right)$$ is a rule of inference.
3. For each rule of inference $$\left( \Gamma, \theta \right)$$, $$\Gamma$$ will be a finite set of formulas.
4. Each logical axiom will be valid.
5. Our rules of inference will preserve truth. In other words, for each rule of inference $$\left( \Gamma, \theta \right)$$, $$\Gamma \models \theta$$.

These requirements serve two purposes: They allow us to verify mechanically that an alleged deduction is in fact a deduction, and they provide the basis of the Soundness Theorem. Of course, we must first verify that the system of axioms and rules that we have set out in the preceding two sections satisfies these requirements.

That the first three requirements above are satisfied by our deduction system was noted as the axioms and rules were presented. These are the rules that are needed for deduction verification. We will discuss the last two requirements in more detail and then use those requirements to prove the Soundness Theorem.

Theorem 2.5.1. The logical axioms are valid.

Proof. We must check both the equality axioms and the quantifier axioms. First, consider equality axioms of type (E2). [(E1) and (E3) will be proved in the Exercises.]

Chaff: Let us mention that we will use Theorem 2.6.2 in this proof. Although the presentation of that result has been delayed in order to aid the flow of the exposition, you may want to look at the statement of that theorem now so you won't be surprised when it appears.

So fix a structure $$\mathfrak{A}$$ and an assignment function $$s \: : \: Vars \rightarrow A$$. We must show that

$\mathfrak{A} \models \left( \left[ \left( x_1 = y_1 \right) \land \left( x_2 = y_2 \right) \land \cdots \land \left( x_n = y_n \right) \right] \rightarrow \left( f \left( x_1, x_2, \ldots, x_n \right) = f \left( y_1, y_2, \ldots, y_n \right) \right) \right) \left[ s \right].$

As the formula in question is an implication, we may assume that the antecedent is satisfied by the pair $$\left( \mathfrak{A}, s \right)$$, and thus $$s \left( x_1 \right) = s \left( y_1 \right)$$, $$s \left( x_2 \right) = s \left( y_2 \right), \ldots,$$ and $$s \left( x_n \right) = s \left( y_n \right)$$. We must prove that $$\mathfrak{A} \models \left( f \left( x_1, x_2, \ldots, x_n \right) = f \left( y_1, y_2, \ldots, y_n \right) \right) \left[ s \right]$$. From the definition of satisfaction (Definition 1.7.4), we know this means that we have to show

$\bar{s} \left( f \left( x_1, x_2, \ldots, x_n \right) \right) = \bar{s} \left( f \left( y_1, y_2, \ldots, y_n \right) \right).$

Now we look at the definition of term assignment function (Definition 1.7.3) and see that we must prove

$f^\mathfrak{A} \left( \bar{s} \left( x_1 \right), \bar{s} \left( x_2 \right), \ldots, \bar{s} \left( x_n \right) \right) = f^\mathfrak{A} \left( \bar{s} \left( y_1 \right), \bar{s} \left( y_2 \right), \ldots, \bar{s} \left( y_n \right) \right).$

But since $$\bar{s} \left( x_i \right) = s \left( x_i \right) = s \left( y_i \right) = \bar{s} \left( y_i \right)$$, and since $$f^\mathfrak{A}$$ is a function, this is true. Thus our equality axiom (E2) is valid.

Now we examine the quantifier axiom of type (Q1), reserving (Q2) for the Exercises. Once again, fix $$\mathfrak{A}$$ and $$s$$, and assume that the term $$t$$ is substitutable for the variable $$x$$ in the formula $$\phi$$. We must show that

$\mathfrak{A} \models \left[ \left( \forall x \phi \right) \rightarrow \phi_t^x \right] \left[ s \right].$

So once again, we assume that $$\mathfrak{A} \models \left( \forall x \phi \right) \left[ s \right]$$, and we show that $$\mathfrak{A} \models \phi_t^x \left[ s \right]$$. By assumption, $$\mathfrak{A} \models \phi \left[ s \left[ x | a \right] \right]$$ for any element $$a \in A$$, so in particular, $$\mathfrak{A} \models \phi \left[ s \left[ x | \bar{s} \left( t \right) \right] \right]$$.

Informally, this says that $$\phi$$ is true in $$\mathfrak{A}$$ with assignment function $$s$$, where you interpret $$x$$ as $$\bar{s} \left( t \right)$$. It is plausible, given our assumption that $$t$$ is substitutable for $$x$$ in $$\phi$$, that if we altered the formula $$\phi$$ by replacing $$x$$ by $$t$$, then $$\phi_t^x$$ would be true in $$\mathfrak{A}$$ with assignment function $$s$$. This is the content of Theorem 2.6.2. Since we know that $$\mathfrak{A} \models \phi \left[ s \left[ x | \bar{s} \left( t \right) \right] \right]$$ and Theorem 2.6.2 states that this is equivalent to $$\mathfrak{A} \models \phi_t^x \left[ s \right]$$, we have established $$\mathfrak{A} \models \phi_t^x \left[ s \right]$$, so we have proved that axioms of type (Q1) are valid.

Thus, modulo your proofs of (E1), (E3), and (Q2), and the delayed proof of Theorem 2.6.2, all of our logical axioms are valid, and our proof is complete.

This leaves one more item on our list of requirements to check. We must show that our rules of inference preserve truth.

Theorem 2.5.2. Suppose that $$\left( \Gamma, \theta \right)$$ is a rule of inference. Then $$\Gamma \models \theta$$.

Proof. First, assume that $$\left( \Gamma, \theta \right)$$ is a rule of type (PC). Then $$\Gamma$$ is finite, and by Lemma 2.4.2, we know that

$\left[ \gamma_{1 \: P} \land \gamma_{2 \: P} \land \cdots \land \gamma_{n \: P} \right] \rightarrow \theta_P$

is a tautology, where $$\Gamma_P = \{ \gamma_{1 \: P}, \gamma_{2 \: P}, \ldots, \gamma_{n \: P} \}$$ is the set of propositional formulas corresponding to $$\Gamma$$ and $$\theta_P$$ is the propositional formula corresponding to $$\theta$$. But then, by Exercise 6 of Section 2.4, we know that

$\left[ \gamma_1 \land \gamma_2 \land \cdots \land \gamma_n \right] \rightarrow \theta$

is valid, and thus $$\Gamma \models \theta$$.

The other possibility is that our rule of inference is a quantifier rule. So, suppose that $$x$$ is not free in $$\psi$$. We show that $$\left( \psi \rightarrow \phi \right) \models \left[ \psi \rightarrow \left( \forall x \phi \right) \right]$$, leaving the other (Q2) rule for the Exercises.

So fix a structure $$\mathfrak{A}$$ and assume $$\mathfrak{A} \models \left( \psi \rightarrow \phi \right)$$. Thus our assumption is that for any assignment $$s$$, $$\mathfrak{A} \models \left( \psi \rightarrow \phi \right) \left[ s \right]$$. We must show that $$\mathfrak{A} \models \left( \psi \rightarrow \forall x \phi \right)$$, which means that we must show that $$\left( \psi \rightarrow \forall x \phi \right)$$ is satisfied in $$\mathfrak{A}$$ under every assignment function. So let an assignment function $$t \: : \: Vars \rightarrow A$$ be given. We must show that $$\mathfrak{A} \models \left( \psi \rightarrow \forall x \phi \right) \left[ t \right]$$. If $$\mathfrak{A} \not\models \psi \left[ t \right]$$, we are done, so assume that $$\mathfrak{A} \models \psi \left[ t \right]$$. We want to prove that $$\mathfrak{A} \models \forall x \phi \left[ t \right]$$, which means that if $$a$$ is any element of $$A$$, we must show that $$\mathfrak{A} \models \phi \left[ t \left[ x | a \right] \right]$$.

We know, by assumption, that $$\mathfrak{A} \models \left( \psi \rightarrow \phi \right) \left[ t \left[ x | a \right] \right]$$. Furthermore, Proposition 1.7.7 tells us that $$\mathfrak{A} \models \psi \left[ \left[ x | a \right] \right]$$, as $$\mathfrak{A} \models \psi \left[ t \right]$$, and $$t$$ and $$t \left[ x | a \right]$$ agree on all of the free variables of $$\psi$$ ($$x$$ is not free in $$\psi$$ by assumption). But then, by the definition of satisfaction, $$\mathfrak{A} \models \phi \left[ t \left[ x | a \right] \right]$$, and we are finished.

We are now at a point where we can prove the Soundness Theorem. The idea behind this theorem is very simple. Suppose that $$\Sigma$$ is a set of $$\mathcal{L}$$-formulas and suppose that there is a deduction of $$\phi$$ from $$\Sigma$$. What the Soundness Theorem tells us is that in any structure $$\mathfrak{A}$$ that makes all of the formulas of $$\Sigma$$ true, $$\phi$$ is true as well.

Theorem 2.5.3 (Soundness). If $$\Sigma + \phi$$, then $$\Sigma \models \phi$$.

Proof. Let Thm$$_\Sigma$$ $$= \{ \phi | \Sigma \vdash \phi \}$$, and let $$C = \{ \phi | \Sigma \models \phi \}$$. We show that Thm$$_\Sigma$$ $$\subseteq C$$, which proves the theorem.

Notice that $$C$$ has the following characteristics:

1. $$\Sigma \subseteq C$$. If $$\sigma \in \Sigma$$, then certainly $$\Sigma \models \sigma$$.
2. $$\Lambda \subseteq C$$. As the logical axioms are valid, they are true in any structure. Thus $$\Sigma \models \lambda$$ for any logical axiom $$\lambda$$, which means that if $$\lambda \in \Lambda$$, then $$\lambda \in C$$, as needed.
3. If $$\left( \Gamma, \theta \right)$$ is a rule of inference and $$\Gamma \subseteq C$$, then $$\theta \in C$$. So assume that $$\Gamma \subseteq C$$. To prove $$\theta \in C$$ we must show that $$\Sigma \models \theta$$. Fix a structure $$\mathfrak{A}$$ such that $$\mathfrak{A} \models \Sigma$$. We must prove that $$\mathfrak{A} \models \theta$$.
If $$\gamma$$ is any element of $$\Gamma$$, then since $$\gamma \in C$$, we know that $$\Sigma \models \gamma$$. Since $$\mathfrak{A} \models \Sigma$$ and $$\Sigma \models \gamma$$, we know that $$\mathfrak{A} \models \gamma$$. But this says that $$\mathfrak{A} \models \gamma$$ for each $$\gamma \in \Gamma$$, so $$\mathfrak{A} \models \Gamma$$. But Theorem 2.5.2 tells us that $$\Gamma \models \theta$$, since $$\left( \Gamma, \theta \right)$$ is a rule of inference. Therefore, since $$\mathfrak{A} \models \Gamma$$ and $$\Gamma \models \theta$$, $$\mathfrak{A} \models \theta$$, as needed.

So $$C$$ is a set of the type outlined in Proposition 2.2.4, and by that proposition, Thm$$_\Sigma$$ $$\subseteq C$$, as needed.

Notice that the Soundness Theorem begins to tie together the notions of deducibility and logical implication. It says, "If there is a deduction from $$\Sigma$$ of $$\phi$$, then $$\Sigma$$ logically implies $$\phi$$." Thus the purely syntactic notion of deduction, a notion that relies only upon typographical considerations, is linked to the notions of truth and logical implication, ideas that are inextricably tied to mathematical structures and their properties. This linkage will be tightened in Chapter 3.

Chaff: The proof of the Soundness Theorem that we have presented above has the desirable qualities of being net and quick. It emphasizes a core fact about the consequences of $$\Sigma$$, namely that Thm$$_\Sigma$$ is the smallest set of formulas satisfying the given three conditions. Unfortunately, the proof has the less desirable attribute of being pretty abstract. Exercise 5 outlines a more direct, less abstract proof of the Soundness Theorem.

### Exercises

1. Ingrid walks into your office one day and announces that she is puzzled. She has a set of axioms $$\Sigma$$ in the language of number theory, and she has a formula $$\phi$$ that she has proved using the assumptions in $$\Sigma$$. Unfortunately, $$\phi$$ is a statement that is not true in the standard model $$\mathfrak{N}$$. Is this a problem? If it is a problem, what possible explanations can you think of that would explain what went wrong? If it is not a problem, why is it not a problem?
2. Prove that the equality axioms of type (E1) and (E3) are valid.
3. Show that the quantifier axioms of type (Q2) is valid.
4. Show that, if $$x$$ is not free in $$\psi$$, $$\left( \phi \rightarrow \psi \right) \models \left[ \left( \exists x \phi \right) \rightarrow \psi \right]$$.
5. Prove the Soundness Theorem by induction on the complexity of the proof of $$\phi$$. For the base cases, $$\phi$$ is either a logical axiom or a member of $$\Sigma$$. Then assume that $$\phi$$ is proved by reference to a rule of inference. Show that in this case as well, $$\Sigma \models \phi$$.


text:
# Theorem of absolute purity

In algebraic geometry, the theorem of absolute (cohomological) purity is an important theorem in the theory of étale cohomology. It states:[1] given

• a regular scheme X over some base scheme,
• ${\displaystyle i:Z\to X}$ a closed immersion of a regular scheme of pure codimension r,
• an integer n that is invertible on the base scheme,
• ${\displaystyle {\mathcal {F}}}$ a locally constant étale sheaf with finie stalks and values in ${\displaystyle \mathbb {Z} /n\mathbb {Z} }$,

for each integer ${\displaystyle m\geq 0}$, the map

${\displaystyle \operatorname {H} ^{m}(Z_{\text{ét}};{\mathcal {F}})\to \operatorname {H} _{Z}^{m+2r}(X_{\text{ét}};{\mathcal {F}}(r))}$

is bijective, where the map is induced by cup product with ${\displaystyle c_{r}(Z)}$.

The theorem was introduced in SGA 5 Exposé I, § 3.1.4. as an open problem. Later, Thomason proved it for large n and Gabber in general.


text:
Matrix

What is a matrix? Ever wondered what do the elements in a matrix mean? Why is it represented in a particular form? Why do we study a matrix? Does it really have any real-life application? I would say yes, matrices are the most important and are a basic part of maths which are used in higher studies and real-life problems.

Matrices are one of the most powerful tools in mathematics. The evolution of the concept of matrices is the result of an attempt to obtain compact and simple methods of solving the system of linear equations. Let’s find what is a matrix and its applications.

Definition of a Matrix

Matrix is an ordered rectangular arrangement of numbers (real or complex) or functions which may be represented as

Matrix is enclosed by [ ] or ( )

What is a Matrix?

Suppose we wish to express the information that Ram has 20 pens. We may express it as [20] with the understanding that the number inside [ ] is the number of pens that Ram has. Now, if we have to express that Ram has 20 pens and 7  pencils. We may express it as [20 7] with the understanding that first number inside [ ] is the number of pens while the other one is the number of pencils.

Let us now suppose that we wish to express the information of possession of pens and pencils by Ram and his two friends Rohan and Yash which is as follows:

Ram       has      20     pens       and       7       pencils,
Rohan    has      15     pens       and       5       pencils,
Yash       has      12     pens       and       3       pencils.

Now, this could be arranged in tabular form as follows,

Pens              Pencils

Ram                 20                    7

Rohan              15                    5

Yash                 12                    3

and this can be expressed as, $$\begin{bmatrix} 20 && 7 \\ 15 && 5 \\ 12 && 3 \end{bmatrix}$$

In the above arrangement, the entries in the first column represent the number of pens possessed by Ram, Rohan, and Yash, respectively and the entries in the second column represents the number of pencils possessed by Ram, Rohan, and Yash, respectively.

Order of a Matrix

A matrix having m rows and n columns is called a matrix of order m × n or simply m × n matrix (read as an m by n matrix). In general, an m × n matrix has the following rectangular array;

$$A =\begin{bmatrix} a_{11} & a_{12} & a_{13} & …a_{1j} & …a_{1n}\\ a_{21} & a_{22} & a_{23} & …a_{2j} & …a_{2n}\\ . & . & . & . & .\\ : & : & : & : & :\\ a_{i1} & a_{i2} & a_{i3} & …a_{ij} & …a_{im}\\ a_{m1} & a_{m2} & a_{m3} & …a_{mj} & …a_{mn} \end{bmatrix}$$

Application of Matrices

Most Scientific Fields have Applications of Matrices in some or the other form. Almost every branch of physics, including classical mechanics, optics, electromagnetism, quantum mechanics, and quantum electrodynamics, matrices are used to study physical phenomena, such as the motion of rigid bodies.

In computer graphics, they are used to project a 3-dimensional image onto a 2-dimensional screen. In probability theory and statistics, stochastic matrices are used to describe sets of probabilities; for instance, they are used within the Page Rank algorithm that ranks the pages in a Google search.

Matrix calculus generalizes classical analytical notions such as derivatives and exponentials to higher dimensions. The graphics software uses the concept of a matrix to process linear transformations to render images.

Solved Examples For You

Question 1: If [1  2  3], then order is

1. 3 × 2
2. 3 × 1
3. 2 × 2
4. 1 × 3

Answer : An m×n matrix has m row and n columns. The given matrix [1  2  3has row and columns. Thus, the order of is × 3. Hence, option D is correct.

Question: $$If \begin{bmatrix} r + 4 & 6\\ 3 & r + 3\end{bmatrix} = \begin{bmatrix} 5 & r + 5\\ r + 2 & 4\end{bmatrix}$$
1. 1
2. 2
3. 3
4. -1

Solution: We know that two matrices are equal iff their corresponding elements are equal. Thus comparing corresponding elements we get, for the first entry of the given matrices r + 4 = 5. Therefore r = 1. Hence, option A is correct.

Question 3: Give a simple definition of matrix?

Answer: A matrix refers to a collection of numbers such that their arrangement is into a fixed number of rows and columns. Usually, matrix deals with real numbers. A matrix displays data in a structured format.

Question 4: Explain the elements in a matrix?

Answer: A matrix refers to a rectangular array of numbers arranged in columns and rows. Elements in a matrix refer to the numbers that exist in the rows and columns of a particular matrix.

Question 5: Name the types of matrix?

Answer: Matrices can be classified into various types which are column matrix, row matrix, square matrix, zero or null matrix, scalar matrix, diagonal matrix, unit matrix, upper triangular matrix, and lower triangular matrix.

Question 6: What is meant by matrix multiplication?

Answer: For matrix multiplication, the number of columns that belongs to the first matrix must be equal to the number of rows that belongs to the second matrix. The result matrix is also called as the matrix product. The result matrix shall have the number of rows of the first matrix while its number of columns will be those of the second matrix.

Share with friends

Customize your course in 30 seconds

Which class are you in?
5th
6th
7th
8th
9th
10th
11th
12th
Get ready for all-new Live Classes!
Now learn Live with India's best teachers. Join courses with the best schedule and enjoy fun and interactive classes.
Ashhar Firdausi
IIT Roorkee
Biology
Dr. Nazma Shaik
VTU
Chemistry
Gaurav Tiwari
APJAKTU
Physics
Get Started

0 Followers

Most reacted comment
1 Comment authors
Recent comment authors
Subscribe
Notify of
Guest
KAINAT

MATHEMATICS WAS TOO DIFFICULT FOR ME BUT WHEN I LEARN FROM TOPPR I FEEL MATHEMATICS IS TOO EASY I LIKE IT

Guest
ghbn

shut up


text:
MathOverflow will be down for maintenance for approximately 3 hours, starting Monday evening (06/24/2013) at approximately 9:00 PM Eastern time (UTC-4).

## How to compute $\mathcal{Ext}^{i}_{X}(\mathcal{O}_{Y_{1}},\mathcal{O}_{Y_{2}})$?

Given a smooth variety $X$ and two smooth subvarieties $Y_{1},Y_{2} \subset X$ with smooth intersection $Z=Y_{1} \cap Y_{2}$, I'd like to compute $\mathcal{Ext}^{i}_{X}(\mathcal{O}_{Y_{1}},\mathcal{O}_{Y_{2}})$. Something that I am reading seems to suggest that the answer should be $\Omega^{i}_Z$, or at least something in terms of the normal bundle of $Z$ in $X$. But I don't see this myself.

-
See Hartshorne, proof of Theorem III 7.11 - there he computes ${\scr E}xt^r(\mathcal{O}_{Y_1}, \omega_X)$ by applying $Hom(-, \Omega_X)$ to the Koszul complex of $\mathcal{O}_{Y_1}$. The Koszul complex exists only locally, but then he shows that these local calculations glue together. I think you can apply the same argument to $\mathcal{O}_{Y_2}$ in place of $\omega_X$. – Piotr Achinger Feb 27 2012 at 18:26

If $c$ is the codimension of $Z$ in $Y_{2}$, then $$\mathcal{E}xt^{i}_{X}(\mathcal{O}_{Y_{1}},\mathcal{O}_{Y_{2}}) = \wedge^{c} N_{Z/Y_{2}}\otimes \wedge^{i -c} \left( N_{Z/X}/N_{Z/Y_{2}}\right).$$ You can see this by Hom-ing one Koszul complex into another. You can find the calculation e.g. in Appendix A.3 of this paper of Katz and Sharpe.


text:
# Headers and page numbers in external borders

I am trying to recreate in *TeX the same aspect that you can see in the following picture showing a document that I created a while ago with MS Publisher.

As you can see, page numbers are rendered with a custom font, as well as headers that only display tilted chapter names (on one side for odd pages, and on the other side for even pages). Both are positioned in the page border rather than in the usual position (typically the external header and footer of the page).

If possible, I would like to use the least number of packages: so far I have introduced KOMA script, fontspec and xcolor. If these packages do not allow to get the desired result, I would accept any package that gets the work done, but I would still like to use the the least number of packages. In that case, which are the best packages to use? Unfortunately, I have no clue about how to do it... could you provide some examples please? I guess tikz will be used, but is it possible to avoid to use fancyhdr (with whom I am really not familiar)?

In addition, I would like to understand how to insert logo on the top external corners, the external page borders, the internal page border, and the chapter openings into the *TeX sources. I am trying to recreate those elements with tikz but, again, I do not know how to include them in the relevant parts of the page.

I would add a minimal work example to start you with, but at the moment I do not have my sources at hand, sorry. I will possibly attach them in a second time, thanks for the understanding.

-
At least it's easy to avoid fancyhdr: KOMA-Script has it's own scrpage2 package if needed. If that helps with respect to familiarity is another question... :) –  cgnieder Jan 18 '13 at 23:30
Thanks again cgnieder! I'll have a look to it with fresh energies and I'll let you know if I managed to get the above result. Cheers! –  Stefano Bragaglia Jan 19 '13 at 0:03
I agree with you that TikZ is the right way to go and, to place elements in the page you might want to have a look to the packages tikzpagenodes and background. An example in which they are used together to set different colored rules in the margin of the page is How to set colored ruled margins for different pages?. –  Claudio Fiandrino Jan 19 '13 at 7:47
Ciao Claudio, thanks for pointing me out these packages... I'll definitely give them a look! Cheers! –  Stefano Bragaglia Jan 19 '13 at 10:08
@StefanoBragaglia if you want people to notice that you've answerwed them add a @ in front of the user name: they get notified then. –  cgnieder Jan 19 '13 at 15:18

I have something that might get you started. It has still many open construction zones, though... This is how it looks:

It uses - as you've suspected - TikZ to draw the boxes, fill the page with gray, draw the lines... The idea is to put a tikz picture with options remember picture, overlay in the heading (with commands provided by KOMA's scrpage2) and use TikZ's current page node to position them.

To get the first page of a chapter with the gray background and only the second of two columns I'm going to use etoolbox to patch the internals of \chapter.

The start is pretty standard. We're going to use geometry for the layout instead of KOMA's typearea as it is easier to choose definite values for margins with it:

\documentclass[twocolumn]{scrbook}
\usepackage{fontspec}
\setmainfont{Linux Biolinum O}

\usepackage{polyglossia}
\setmainlanguage{italian}
% -------------------------------------------------
% page layout:
\setlength\parindent{15pt}

\usepackage[a4paper]{geometry}
\newlength\imargin
\newlength\omargin
\setlength\imargin{.7in}
\setlength\omargin{.7in}
\geometry{
inner  = \imargin ,
outer  = \omargin ,
top    = 1in ,
bottom = .7in
}

% -------------------------------------------------
% colors:
\usepackage{tikz,xcolor}
\usetikzlibrary{positioning}
\definecolor{darkred}{cmyk}{0.0,0.87,0.87,0.50}
\colorlet{mygray}{black!20}

The next part now uses scrpage2 and tikz for the header and footer. The first thing is to choose a page style, make sure that chapter pages use it, too, and clear it. Then I set up some TikZ styles which then are used when the TikZ magic happens in the header. The code uses KOMA's \ifthispageodd to draw things differently for even and odd pages:

% -------------------------------------------------
\usepackage{scrpage2}

% the page logo - needs to be improved
\newcommand*\logo{%
\textcolor{darkred}{\scalebox{1.3}{ITALIAN} \scalebox{2}{SRD}} \\
d20\scalebox{2}{MODERN}}

% tikz styles:
\tikzset{
logo/.style={
color = mygray ,
font  = \normalfont\sffamily\Large\bfseries ,
inner sep = .25in ,
align = center
},
page/.style={
color  = mygray ,
fill   = darkred ,
font   = \normalfont\sffamily\Huge\bfseries ,
minimum size = \omargin-.2in ,
yshift = 2in
},
chapter/.style={
color = mygray ,
scale = 1.5 ,
transform shape ,
font  = \normalfont\sffamily\Huge\bfseries ,
}
}
\begin{tikzpicture}[remember picture, overlay]
% logo:
\ifthispageodd
{\node[below left,logo] at (current page.north east)}
{\node[below right,logo] at (current page.north west)}
{\logo} ;
% page number:
\ifthispageodd
{\node[left,page] at (current page.east)}
{\node[right,page] at (current page.west)}
{\thepage} ;
% chapter mark:
\ifthispageodd
{\node[anchor=north east,rotate=-90,chapter] at (current page.south east)}
{\node[anchor=north west,rotate=90,chapter] at (current page.south west)}
{\chaptertitle} ;
\ifthispageodd
{
\draw[mygray,very thin]
(current page.south east)++(-.6in,0)--++(0,.6\paperheight) ;
}
{
\draw[mygray,very thin]
(current page.south west)++(.6in,0)--++(0,.6\paperheight) ;
}
\end{tikzpicture}
}

The next thing is the chapter layout which starts with the patching of the internals. The patching is twofold: setting a boolean to determine if a chapter is numbered or not and insert a \newpage at the appropriate place to let the text start in the second column. Next we abuse the koma font chapter to safe the chapter name in \chaptertitle (which has been used in the code above for the footer already) and write the chapter name in a dark red box:

% -------------------------------------------------
% chapter layout:
\usepackage{etoolbox}
\newbool{schapter}
\makeatletter
\patchcmd\@chapter
{\ifnum \scr@osectarg}
{\boolfalse{schapter}\ifnum \scr@osectarg}
{}{\error}
\patchcmd\@schapter
{\if@twocolumn}
{\booltrue{schapter}\if@twocolumn}
{}{\error}
\patchcmd\@chapter
{}{\error}
\patchcmd\@schapter
{}{\error}
\makeatother

\newcommand\savechapter[1]{\gdef\chaptertitle{#1}}
\newcommand*\chapterbox[1]{%
\savechapter{#1}%
\begin{tikzpicture}[remember picture, overlay]
\fill[mygray] (current page.north west) rectangle (current page.south) ;
\draw (current page.north) ++(0,-2in)
node[mygray,fill=darkred,inner sep=1em,align=center,minimum width=.75\textwidth]
(chapapp)
{\ifbool{schapter}{}{\rlap{\Huge\chapapp\space\thechapter:}}} ;
\node[anchor=north,mygray,fill=darkred!85,inner sep=1em,xshift=-.6in]
at (chapapp.south)
{\scalebox{2.5}{\bfseries\MakeUppercase{#1}\hspace*{.2in}}} ;
\end{tikzpicture}
}
\setkomafont{chapter}{\chapterbox}

Last thing: the section layout. This is basically the code from your previous question.

% -------------------------------------------------
% section layout:
\setcounter{secnumdepth}{0}
\newcommand\sectionrule{%
\makebox[0pt][l]{\rule[-.25ex]{\linewidth}{1pt}}}
\newcommand\sectionformat[1]{%
\sffamily\huge\color{darkred}%
\sectionrule
\hfill\MakeUppercase{#1}}
\setkomafont{section}{\sectionformat}

Now let's put everything together. The code for the picture above:

\documentclass[twocolumn]{scrbook}
\usepackage{fontspec}
\setmainfont{Linux Biolinum O}

\usepackage{polyglossia}
\setmainlanguage{italian}
% -------------------------------------------------
% page layout:
\setlength\parindent{15pt}

\usepackage[a4paper]{geometry}
\newlength\imargin
\newlength\omargin
\setlength\imargin{.7in}
\setlength\omargin{.7in}
\geometry{
inner  = \imargin ,
outer  = \omargin ,
top    = 1in ,
bottom = .7in
}

% -------------------------------------------------
% colors:
\usepackage{tikz,xcolor}
\usetikzlibrary{positioning}
\definecolor{darkred}{cmyk}{0.0,0.87,0.87,0.50}
\colorlet{mygray}{black!20}

% -------------------------------------------------
\usepackage{scrpage2}

\newcommand*\logo{%
\textcolor{darkred}{\scalebox{1.3}{ITALIAN} \scalebox{2}{SRD}} \\
d20\scalebox{2}{MODERN}}
\tikzset{
logo/.style={
color = mygray ,
font  = \normalfont\sffamily\Large\bfseries ,
inner sep = .25in ,
align = center
},
page/.style={
color  = mygray ,
fill   = darkred ,
font   = \normalfont\sffamily\Huge\bfseries ,
minimum size = \omargin-.2in ,
yshift = 2in
},
chapter/.style={
color = mygray ,
scale = 1.5 ,
transform shape ,
font  = \normalfont\sffamily\Huge\bfseries ,
}
}
\begin{tikzpicture}[remember picture, overlay]
% logo:
\ifthispageodd
{\node[below left,logo] at (current page.north east)}
{\node[below right,logo] at (current page.north west)}
{\logo} ;
% page number:
\ifthispageodd
{\node[left,page] at (current page.east)}
{\node[right,page] at (current page.west)}
{\thepage} ;
% chapter mark:
\ifthispageodd
{\node[anchor=north east,rotate=-90,chapter] at (current page.south east)}
{\node[anchor=north west,rotate=90,chapter] at (current page.south west)}
{\chaptertitle} ;
\ifthispageodd
{
\draw[mygray,very thin]
(current page.south east)++(-.6in,0)--++(0,.6\paperheight) ;
}
{
\draw[mygray,very thin]
(current page.south west)++(.6in,0)--++(0,.6\paperheight) ;
}
\end{tikzpicture}
}

% -------------------------------------------------
% chapter layout:
\usepackage{etoolbox}
\newbool{schapter}
\makeatletter
\patchcmd\@chapter
{\ifnum \scr@osectarg}
{\boolfalse{schapter}\ifnum \scr@osectarg}
{}{\error}
\patchcmd\@schapter
{\if@twocolumn}
{\booltrue{schapter}\if@twocolumn}
{}{\error}
\patchcmd\@chapter
{}{\error}
\patchcmd\@schapter
{}{\error}
\makeatother

\newcommand\savechapter[1]{\gdef\chaptertitle{#1}}
\newcommand*\chapterbox[1]{%
\savechapter{#1}%
\begin{tikzpicture}[remember picture, overlay]
\fill[mygray] (current page.north west) rectangle (current page.south) ;
\draw (current page.north) ++(0,-2in)
node[mygray,fill=darkred,inner sep=1em,align=center,minimum width=.75\textwidth]
(chapapp)
{\ifbool{schapter}{}{\rlap{\Huge\chapapp\space\thechapter:}}} ;
\node[anchor=north,mygray,fill=darkred!85,inner sep=1em,xshift=-.6in]
at (chapapp.south)
{\scalebox{2.5}{\bfseries\MakeUppercase{#1}\hspace*{.2in}}} ;
\end{tikzpicture}
}
\setkomafont{chapter}{\chapterbox}

% -------------------------------------------------
% section layout:
\setcounter{secnumdepth}{0}
\newcommand\sectionrule{%
\makebox[0pt][l]{\rule[-.25ex]{\linewidth}{1pt}}}
\newcommand\sectionformat[1]{%
\sffamily\huge\color{darkred}%
\sectionrule
\hfill\MakeUppercase{#1}}
\setkomafont{section}{\sectionformat}

% -------------------------------------------------
\usepackage{lipsum}% dummy text

\begin{document}

\chapter*{Introduzzione}
\lipsum[1-2]

\section{Foo Bar Baz}
\lipsum[3-11]

\chapter{Personaggi}
\lipsum[1-2]

\section{Foo Bar Baz}
\lipsum[3-11]

\end{document}

-
Thanks so much! I have spent almost all the weekend to make experiments... with results that are not even comparable to yours! Every time I was achieving a marginal improvement on a direction, I was breaking something somewhere else... By the way, how long did it take to put together such an astonishing result?!? I am a bit busy today so I have no time to immediately try out your code, but I bet it will be the Answer to my question! –  Stefano Bragaglia Jan 21 '13 at 15:04
Hard to say... I was watching snooker at the same time and was often distracted... –  cgnieder Jan 21 '13 at 16:41
Are you trying to annihilate my self-esteem, aren't you?!? Just kidding: I will give a look to your code as soon as possible... I am sure I will learn a lot from it! Thanks! –  Stefano Bragaglia Jan 21 '13 at 17:13
No, I'm not :) What I meant to say that it coes not say much how long it took me. This depends on so many points: 1. how familiar are with the class? 2. How familiar are you with the packages involved? 3. How familiar are you with LaTeX programming? 4. Have you done something similar before? Do you know where to start and did you think it through? 5. Are you distracted (as I were)? And so on and so on... –  cgnieder Jan 21 '13 at 18:00
Well, don't be so modest! You gave a huge contribution! I just finished to merge your code with my additional customisations: I couldn't believe how well and vivid the document was becoming after each addition! New questions, however, were raised... Tomorrow, if I have time, I'll look for answers and if I don't find them, I'll post the question. Goodnight and thanks again! –  Stefano Bragaglia Jan 22 '13 at 0:01


text:
Locale::Po4a::TeX(3) convert TeX documents and derivates from/to PO files

## DESCRIPTION

The po4a (PO for anything) project goal is to ease translations (and more interestingly, the maintenance of translations) using gettext tools on areas where they were not expected like documentation.

Locale::Po4a::TeX is a module to help the translation of TeX documents into other [human] languages. It can also be used as a base to build modules for TeX-based documents.

Users should probably use the LaTeX module, which inherite from the TeX module and contains the definitions of common LaTeX commands.

## TRANSLATING WITH PO4A::TEX

This module can be used directly to handle generic TeX documents. This will split your document in smaller blocks (paragraphs, verbatim blocks, or even smaller like titles or indexes).

There are some options (described in the next section) that can customize this behavior. If this doesn't fit to your document format you're encouraged to write your own module derived from this, to describe your format's details. See the section WRITING DERIVATE MODULES below, for the process description.

This module can also be customized by lines starting with % po4a:'' in the TeX file. These customizations are described in the INLINE CUSTOMIZATION section.

## OPTIONS ACCEPTED BY THIS MODULE

These are this module's particular options:
debug
Activate debugging for some internal mechanisms of this module. Use the source to see which parts can be debugged.
no_wrap
Comma-separated list of environments which should not be re-wrapped.

Note that there is a difference between verbatim and no_wrap environments. There is no command and comments analysis in verbatim blocks.

If this environment was not already registered, po4a will consider that this environment does not take any parameters.

exclude_include
Colon-separated list of files that should not be included by \input and \include.
definitions
The name of a file containing definitions for po4a, as defined in the INLINE CUSTOMIZATION section. You can use this option if it is not possible to put the definitions in the document being translated.
verbatim
Comma-separated list of environments which should be taken as verbatim.

If this environment was not already registered, po4a will consider that this environment does not take any parameters.

Using these options permits to override the behaviour of the commands defined in the default lists.

## INLINE CUSTOMIZATION

The TeX module can be customized with lines starting by % po4a:. These lines are interpreted as commands to the parser. The following commands are recognized:
% po4a: command command1 alias command2
Indicates that the arguments of the command1 command should be treated as the arguments of the command2 command.
% po4a: command command1 parameters
This permit to describe in detail the parameters of the command1 command. This information will be used to check the number of arguments and their types.

You can precede the command1 command by

an asterisk (*)
po4a will extract this command from paragraphs (if it is located at the beginning or the end of a paragraph). The translators will then have to translate the parameters that are marked as translatable.
a plus (+)
As for an asterisk, the command will be extracted if it appear at an extremity of a block, but the parameters won't be translated separately. The translator will have to translate the command concatenated to all its parameters. This permits to keep more context, and is useful for commands with small words in parameter, which can have multiple meanings (and translations).

Note: In this case you don't have to specify which parameters are translatable, but po4a must know the type and number of parameters.

a minus (-)
In this case, the command won't be extracted from any block. But if it appears alone on a block, then only the parameters marked as translatable will be presented to the translator. This is useful for font commands. These commands should generally not be separated from their paragraph (to keep the context), but there is no reason to annoy the translator with them if a whole string is enclosed in such a command.

The parameters argument is a set of [] (to indicate an optional argument) or {} (to indicate a mandatory argument). You can place an underscore (_) between these brackets to indicate that the parameter must be translated. For example:
% po4a: command *chapter [_]{_}

This indicates that the chapter command has two parameters: an optional (short title) and a mandatory one, which must both be translated. If you want to specify that the href command has two mandatory parameters, that you don't want to translate the URL (first parameter), and that you don't want this command to be separated from its paragraph (which allow the translator to move the link in the sentence), you can use:
% po4a: command -href {}{_}

In this case, the information indicating which arguments must be translated is only used if a paragraph is only composed of this href command.

% po4a: environment env parameters
This permits to define the parameters accepted by the env environment. This information is latter used to check the number of arguments of the \begin command, and permit to specify which one must be translated. The syntax of the parameters argument is the same as described for the ??? commands. The first parameter of the \begin command is the name of the environment. This parameter must not be specified in the list of parameters. Here are some examples:
% po4a: environment multicols {}
% po4a: environment equation

As for the commands, env can be preceded by a plus (+) to indicate that the \begin command must be translated with all its arguments.

% po4a: separator env "regex"
Indicates that an environment should be split according to the given regular expression.

The regular expression is delimited by quotes. It should not create any backreference. You should use (?:) if you need a group. It may also need some escapes.

For example, the LaTeX module uses the (?:&|\\\\)'' regular expression to translate separately each cell of a table (lines are separated by '\\' and cells by '&').

The notion of environment is expended to the type displayed in the PO file. This can be used to split on \\\\'' in the first mandatory argument of the title command. In this case, the environment is title{#1}.

% po4a: verbatim environment env
Indicate that env is a verbatim environment. Comments and commands will be ignored in this environment.

If this environment was not already registered, po4a will consider that this environment does not take any parameters.

## WRITING DERIVATE MODULES

pre_trans
post_trans
translate
Wrapper around Transtractor's translate, with pre- and post-processing filters.

Comments of a paragraph are inserted as a PO comment for the first translated string of this paragraph.

get_leading_command($buffer) This function returns: A command name If no command is found at the beginning of the given buffer, this string will be empty. Only commands that can be separated are considered. The %separated_command hash contains the list of these commands. A variant This indicates if a variant is used. For example, an asterisk (*) can be added at the end of sections command to specify that they should not be numbered. In this case, this field will contain *''. If there is no variant, the field is an empty string. An array of tuples (type of argument, argument) The type of argument can be either '{' (for mandatory arguments) or '[' (for optional arguments). The remaining buffer The rest of the buffer after the removal of this leading command and its arguments. If no command is found, the original buffer is not touched and returned in this field. get_trailing_command($buffer)
The same as get_leading_command, but for commands at the end of a buffer.
translate_buffer
Recursively translate a buffer by separating leading and trailing commands (those which should be translated separately) from the buffer.

If a function is defined in %translate_buffer_env for the current environment, this function will be used to translate the buffer instead of translate_buffer().

Recursively read a file, appending included files which are not listed in the @exclude_include array. Included files are searched using the kpsewhich command from the Kpathsea library.

Except from the file inclusion part, it is a cut and paste from Transtractor's read.

parse_definition_file
Subroutine for parsing a file with po4a directives (definitions for new commands).
parse_definition_line
Parse a definition line of the form % po4a: ''.

See the INLINE CUSTOMIZATION section for more details.

is_closed
parse

## INTERNAL FUNCTIONS used to write derivated parsers

Command and environment functions take the following arguments (in addition to the \$self object):
A command name
A variant
An array of (type, argument) tuples
The current environment

The first 3 arguments are extracted by get_leading_command or get_trailing_command.

Command and environment functions return the translation of the command with its arguments and a new environment.

Environment functions are called when a \begin command is found. They are called with the \begin command and its arguments.

The TeX module only proposes one command function and one environment function: generic_command and generic_environment.

generic_command uses the information specified by register_generic_command or by adding definition to the TeX file:
% po4a: command command1 parameters

generic_environment uses the information specified by register_generic_environment or by adding definition to the TeX file:
% po4a: environment env parameters

Both functions will only translate the parameters that were specified as translatable (with a '_'). generic_environment will append the name of the environment to the environment stack and generic_command will append the name of the command followed by an identifier of the parameter (like {#7} or [#2]).

## STATUS OF THIS MODULE

This module needs more tests.

It was tested on a book and with the Python documentation.

## TODO LIST

Automatic detection of new commands
The TeX module could parse the newcommand arguments and try to guess the number of arguments, their type and whether or not they should be translated.
Translation of the environment separator
When \item is used as an environment separator, the item argument is attached to the following string.
Some commands should be added to the environment stack
These commands should be specified by couples. This could allow to specify commands beginning or ending a verbatim environment.
Others
Various other points are tagged TODO in the source.

## KNOWN BUGS

Various points are tagged FIXME in the source.

## AUTHORS

Nicolas François <[email protected]>


text:
# Function without fixed points

Get a function $$f:\mathbb{R} \longrightarrow \mathbb{R} \in C^{\infty}$$ such that $$\forall x \in \mathbb{R}$$ :

$$\vert f'(x) \vert < 1, f(x) \neq x$$

My attempt was to give the function $$f : \mathbb{R} \longrightarrow \mathbb{R}$$ where $$f(x) = \sqrt{1+x^2}$$. A quick calculation shows that :

$$f'(x)=\dfrac{x}{\sqrt{1+x^2}}$$

Clearly for $$x \in \mathbb{R} \implies x^2+1>x^2$$ and :

$$\vert x \vert < \sqrt{1+x^2} \implies -\sqrt{1+x^2}

So : $$\vert f'(x) \vert <1$$ and it is clear that $$f(x) \neq x, \forall x\in \mathbb{R}$$.

$$f \in C^{\infty}$$?

My attempt was to put $$f$$ as $$f=h \circ g$$ where $$h(x)=\sqrt{x}, x>0$$ and $$g(x)=1+x^2$$. Both are $$C^{\infty}$$ so $$f$$ is too.

Is correct?

• Yes, to be complete, you may quote the fact that $C^k$ is closed under composition – GNUSupporter 8964民主女神 地下教會 Mar 2 '19 at 4:48
• For extra credit, show that if you force $|f'(x)| < c$, for a fixed $c < 1$, then there must be a fixed point. – Jair Taylor Mar 2 '19 at 4:54
• Yes, because of the contraction theorem that point exists and it is more, it is unique – Juan Daniel Valdivia Fuentes Mar 2 '19 at 4:55
• Alternatively, start with any smooth $h$ such that $h$ is bounded and $h'>0$ (e.g., $h(x)=\arctan x$, $h(x)=\frac{e^x}{1+e^x}$, or - loosely related to your solution - $h(x)=\frac x{\sqrt{1+x^2}}$), and use $f(x)=-a (h(x)-b)+x$ with $a=1/\sup|h'|$ and $b=\sup h$ – Hagen von Eitzen Mar 2 '19 at 5:57


text:
## Deepen an existing shallow clone with git

By admin | January 31, 2012

In git, the new revolutionary DVCS system, to shallow clone a repository means to check out only the latest snapshot of a git repository, unlike a normal clone which pulls the entire repository. A shallow git repository can save bandwidth and take up less space.

git clone --depth=1 git://repo.example.com/mycoolapp

However, let’s say that once you checkout the project, compile it and decide that you want to contribute to it, then a shallow clone would probably not suffice. In this case, one can deepen the repository by using the following command inside the git repository, where n = number of revisions to deepen to:

git fetch --depth=n origin master

Saves more than having to re-clone everything from scratch and lose your working tree.

Topics: Linux | 8 Comments »

### 8 Responses to “Deepen an existing shallow clone with git”

1. dewaqq daftar Says:
November 8th, 2021 at 12:02

[…] There you will find 7195 additional Info to that Topic: compdigitec.com/labs/2012/01/31/deepen-an-existing-shallow-clone-with-git/ […]

2. good shop dumps Says:
November 17th, 2021 at 17:23

[…] Read More on that Topic: compdigitec.com/labs/2012/01/31/deepen-an-existing-shallow-clone-with-git/ […]

3. relx Says:
December 27th, 2021 at 19:05

[…] Read More on that Topic: compdigitec.com/labs/2012/01/31/deepen-an-existing-shallow-clone-with-git/ […]

4. cancer hemp oil Says:
December 28th, 2021 at 03:23

5. kardinal stick Says:
January 1st, 2022 at 18:59

[…] There you can find 5183 more Information to that Topic: compdigitec.com/labs/2012/01/31/deepen-an-existing-shallow-clone-with-git/ […]

6. 토토사이트 Says:
January 7th, 2022 at 12:11

7. medical marijuana for sale Says:
January 13th, 2022 at 10:50


text:
# Two equation turbulence models

Two-equation turbulence models are one of the most common type of turbulence models. Models like the k-epsilon model and the k-omega model have become industry standard models and are commonly used for most types of engineering problems. Two-equation turbulence models are also very much still an active area of research and new refined two-equation models are still being developed.

By definition, two-equation models include two extra transport equations to represent the turbulent properties of the flow. This allows a two-equation model to account for history effects like convection and diffusion of turbulent energy.

Most often one of the transported variables is the turbulent kinetic energy, $k$. The second transported variable varies depending on what type of two-equation model it is. Common choices are the turbulent dissipation, $\epsilon$, or the specific dissipation, $\omega$. The second variable can be thought of as the variable that determines the scale of the turbulence (length-scale or time-scale), whereas the first variable, $k$, determines the energy in the turbulence.

The basis for all two-equation models is the Boussinesq eddy viscosity assumption, which postulates that the Reynolds stress tensor, $\tau_{ij}$, is proportional to the mean strain rate tensor, $S_{ij}$, and can be written in the following way:

$\tau_{ij} = 2 \, \mu_t \, S_{ij}$

Where $\mu_t$ is a scalar property called the eddy viscosity. The same equation can be written more explicitly as:

$-\overline{\rho u'_i u'_j} = \mu_t \, \left( \frac{\partial U_i}{\partial x_j} + \frac{\partial U_j}{\partial x_i} \right)$

The Boussinesq assumption is both the strength and the weakness of two equation models. This assumption is a huge simplification which allows one to think of the effect of turbulence on the mean flow in the same way as molecular viscosity affects a laminar flow. The assumption also makes it possible to introduce intuitive scalar turbulence variables like the turbulent energy and dissipation and to relate these variables to even more intuitive variables like turbulence intensity and turbulence length scale.


text:
# Natural density

In number theory, natural density (also referred to as asymptotic density or arithmetic density) is one method to measure how "large" a subset of the set of natural numbers is. It relies chiefly on the probability of encountering members of the desired subset when combing through the interval [1, n] as n grows large.

Intuitively, it is thought that there are more positive integers than perfect squares, since every perfect square is already positive, and many other positive integers exist besides. However, the set of positive integers is not in fact larger than the set of perfect squares: both sets are infinite and countable and can therefore be put in one-to-one correspondence. Nevertheless if one goes through the natural numbers, the squares become increasingly scarce. The notion of natural density makes this intuition precise for many, but not all, subsets of the naturals (see Schnirelmann density, which is similar to natural density but defined for all subsets of ${\displaystyle \mathbb {N} }$).

If an integer is randomly selected from the interval [1, n], then the probability that it belongs to A is the ratio of the number of elements of A in [1, n] to the total number of elements in [1, n]. If this probability tends to some limit as n tends to infinity, then this limit is referred to as the asymptotic density of A. This notion can be understood as a kind of probability of choosing a number from the set A. Indeed, the asymptotic density (as well as some other types of densities) is studied in probabilistic number theory.

## Definition

A subset A of positive integers has natural density α if the proportion of elements of A among all natural numbers from 1 to n converges to α as n tends to infinity.

More explicitly, if one defines for any natural number n the counting function a(n) as the number of elements of A less than or equal to n, then the natural density of A being α exactly means that[1]

a(n)/nα as n → ∞.

It follows from the definition that if a set A has natural density α then 0 ≤ α ≤ 1.

### Upper and lower asymptotic density

Let ${\displaystyle A}$ be a subset of the set of natural numbers ${\displaystyle \mathbb {N} =\{1,2,\ldots \}.}$ For any ${\displaystyle n\in \mathbb {N} }$, define ${\displaystyle A(n)}$ to be the intersection ${\displaystyle A(n)=\{1,2,\ldots ,n\}\cap A,}$ and let ${\displaystyle a(n)=|A(n)|}$ be the number of elements of ${\displaystyle A}$ less than or equal to ${\displaystyle n}$.

Define the upper asymptotic density ${\displaystyle {\overline {d}}(A)}$ of ${\displaystyle A}$ (also called the "upper density") by

${\displaystyle {\overline {d}}(A)=\limsup _{n\rightarrow \infty }{\frac {a(n)}{n}}}$
where lim sup is the limit superior.

Similarly, define the lower asymptotic density ${\displaystyle {\underline {d}}(A)}$ of ${\displaystyle A}$ (also called the "lower density") by

${\displaystyle {\underline {d}}(A)=\liminf _{n\rightarrow \infty }{\frac {a(n)}{n}}}$
where lim inf is the limit inferior. One may say ${\displaystyle A}$ has asymptotic density ${\displaystyle d(A)}$ if ${\displaystyle {\underline {d}}(A)={\overline {d}}(A)}$, in which case ${\displaystyle d(A)}$ is equal to this common value.

This definition can be restated in the following way:

${\displaystyle d(A)=\lim _{n\rightarrow \infty }{\frac {a(n)}{n}}}$
if this limit exists.[2]

These definitions may equivalently be expressed in the following way. Given a subset ${\displaystyle A}$ of ${\displaystyle \mathbb {N} }$, write it as an increasing sequence indexed by the natural numbers:

${\displaystyle A=\{a_{1}
Then
${\displaystyle {\underline {d}}(A)=\liminf _{n\rightarrow \infty }{\frac {n}{a_{n}}},}$
${\displaystyle {\overline {d}}(A)=\limsup _{n\rightarrow \infty }{\frac {n}{a_{n}}}}$
and
${\displaystyle d(A)=\lim _{n\rightarrow \infty }{\frac {n}{a_{n}}}}$
if the limit exists.

A somewhat weaker notion of density is the upper Banach density ${\displaystyle d^{*}(A)}$ of a set ${\displaystyle A\subseteq \mathbb {N} .}$ This is defined as

${\displaystyle d^{*}(A)=\limsup _{N-M\rightarrow \infty }{\frac {|A\cap \{M,M+1,\ldots ,N\}|}{N-M+1}}.}$

## Properties and examples

• For any finite set F of positive integers, d(F) = 0.
• If d(A) exists for some set A and Ac denotes its complement set with respect to ${\displaystyle \mathbb {N} }$, then d(Ac) = 1 − d(A).
• Corollary: If ${\displaystyle F\subset \mathbb {N} }$ is finite (including the case ${\displaystyle A=\emptyset }$), ${\displaystyle d(\mathbb {N} \setminus F)=1.}$
• If ${\displaystyle d(A),d(B),}$ and ${\displaystyle d(A\cup B)}$ exist, then
${\displaystyle \max\{d(A),d(B)\}\leq d(A\cup B)\leq \min\{d(A)+d(B),1\}.}$
• If ${\displaystyle A=\{n^{2}:n\in \mathbb {N} \}}$ is the set of all squares, then d(A) = 0.
• If ${\displaystyle A=\{2n:n\in \mathbb {N} \}}$ is the set of all even numbers, then d(A) = 0.5. Similarly, for any arithmetical progression ${\displaystyle A=\{an+b:n\in \mathbb {N} \}}$ we get ${\displaystyle d(A)={\tfrac {1}{a}}.}$
• The set of all square-free integers has density ${\displaystyle {\tfrac {6}{\pi ^{2}}}.}$ More generally, the set of all nth-power-free numbers for any natural n has density ${\displaystyle {\tfrac {1}{\zeta (n)}},}$ where ${\displaystyle \zeta (n)}$ is the Riemann zeta function.
• The set of abundant numbers has non-zero density.[3] Marc Deléglise showed in 1998 that the density of the set of abundant numbers is between 0.2474 and 0.2480.[4]
• The set
${\displaystyle A=\bigcup _{n=0}^{\infty }\left\{2^{2n},\ldots ,2^{2n+1}-1\right\}}$
of numbers whose binary expansion contains an odd number of digits is an example of a set which does not have an asymptotic density, since the upper density of this set is
${\displaystyle {\overline {d}}(A)=\lim _{m\to \infty }{\frac {1+2^{2}+\cdots +2^{2m}}{2^{2m+1}-1}}=\lim _{m\to \infty }{\frac {2^{2m+2}-1}{3(2^{2m+1}-1)}}={\frac {2}{3}},}$
whereas its lower density is
${\displaystyle {\underline {d}}(A)=\lim _{m\to \infty }{\frac {1+2^{2}+\cdots +2^{2m}}{2^{2m+2}-1}}=\lim _{m\to \infty }{\frac {2^{2m+2}-1}{3(2^{2m+2}-1)}}={\frac {1}{3}}.}$
• The set of numbers whose decimal expansion begins with the digit 1 similarly has no natural density: the lower density is 1/9 and the upper density is 5/9.[1] (See Benford's law.)
• Consider an equidistributed sequence ${\displaystyle \{\alpha _{n}\}_{n\in \mathbb {N} }}$ in ${\displaystyle [0,1]}$ and define a monotone family ${\displaystyle \{A_{x}\}_{x\in [0,1]}}$ of sets:
${\displaystyle A_{x}:=\{n\in \mathbb {N} :\alpha _{n}
Then, by definition, ${\displaystyle d(A_{x})=x}$ for all ${\displaystyle x}$.

## Other density functions

Other density functions on subsets of the natural numbers may be defined analogously. For example, the logarithmic density of a set A is defined as the limit (if it exists)

${\displaystyle \mathbf {\delta } (A)=\lim _{x\rightarrow \infty }{\frac {1}{\log x}}\sum _{n\in A,n\leq x}{\frac {1}{n}}\ .}$

Upper and lower logarithmic densities are defined analogously as well.

For the set of multiples of an integer sequence, the Davenport–Erdős theorem states that the natural density, when it exists, is equal to the logarithmic density.[5]


text:
How to prove that given operators form an algebra? [closed]

I am new to Group theory and representations and I'm having trouble with this problem in an exercise:

Given the two oscillator algebra $$[a, a^†] = 1$$ $$[b, b^†] = 1$$ $$[a, b] = 0$$ show that the forgoing generators satisfy $SU(1,1)$ algebra. $$[K_+, K_−] = 2K_z$$ $$[a, K_+] = a^†b^†$$ $$[a, K_−] = ab$$

I've read that $SU(1,1)$ algebra is defined by the the commutations: $[K_1, K_2] = −iK_0$ , $[K_0, K_1] = iK_2$ , $[K_2, K_0] = iK_1$ .

I assumed that it was just a matter of plugging in the given generators and obtaining these relations to show that they satisfy the given algebra but I'm unable to do this.

I would really appreciate it if someone could provide me with some tips on commutator manipulation and the general strategy one would use in solving such problems.

closed as off-topic by ACuriousMind♦Mar 10 '18 at 16:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Homework-like questions should ask about a specific physics concept and show some effort to work through the problem. We want our questions to be useful to the broader community, and to future users. See our meta site for more guidance on how to edit your question to make it better" – ACuriousMind
If this question can be reworded to fit the rules in the help center, please edit the question.

• Please note that homework-like questions and check-my-work questions are generally considered off-topic here. We intend our questions to be potentially useful to a broader set of users than just the one asking, and prefer conceptual questions over those just asking for a specific computation. – ACuriousMind Mar 10 '18 at 16:13


text:
# Install the .NET SDK or the .NET Runtime on CentOS

.NET is supported on CentOS. This article describes how to install .NET on CentOS.

Install the SDK (which includes the runtime) if you want to develop .NET apps. Or, if you only need to run apps, install the Runtime. If you're installing the Runtime, we suggest you install the ASP.NET Core Runtime as it includes both .NET and ASP.NET Core runtimes.

If you've already installed the SDK or Runtime, use the dotnet --list-sdks and dotnet --list-runtimes commands to see which versions are installed. For more information, see How to check that .NET is already installed.

Important

Package manager installs are only supported on the x64 architecture. Other architectures, such as ARM, must install .NET by some other means such as with Snap, an installer script, or through a manual binary installation.

For more information on installing .NET without a package manager, see one of the following articles:

## Supported distributions

The following table is a list of currently supported .NET releases on both CentOS 7 and CentOS 8. These versions remain supported until either the version of .NET reaches end-of-support or the version of CentOS is no longer supported.

• A ✔ indicates that the version of CentOS or .NET is still supported.
• A ❌ indicates that the version of CentOS or .NET isn't supported on that CentOS release.
• When both a version of CentOS and a version of .NET have ✔, that OS and .NET combination is supported.
CentOS .NET Core 3.1 .NET 5 .NET 6
✔ 7 ✔ 3.1 ✔ 5.0 ✔ 6.0
✔ 8* ✔ 3.1 ✔ 5.0 ❌ 6.0

Warning

*CentOS 8 will reach an early End Of Life (EOL) on December 31st, 2021. For more information, see the official CentOS Linux EOL page. Because of this, .NET 6 won't be supported on CentOS Linux 8.

The following versions of .NET are ❌ no longer supported. The downloads for these still remain published:

• .NET Core 3.0
• .NET Core 2.2
• .NET Core 2.1
• .NET Core 2.0

Important

Package manager installs are only supported on the x64 architecture. Other architectures, such as ARM, must install .NET by some other means such as with Snap, an installer script, or through a manual binary installation.

For more information on installing .NET without a package manager, see one of the following articles:

## Install preview versions

Preview and release candidate versions of .NET aren't available in package managers. You can install previews and release candidates of .NET in one of the following ways:

## Remove preview versions

When using a package manager to manage your installation of .NET, you may run into a conflict if you've previously installed a preview release. The package manager may interpret the non-preview release as an earlier version of .NET. To install the non-preview release, first uninstall the preview versions. For more information about uninstalling .NET, see How to remove the .NET Runtime and SDK.

## CentOS 7 ✔

Before you install .NET, run the following commands to add the Microsoft package signing key to your list of trusted keys and add the Microsoft package repository. Open a terminal and run the following commands:

sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm

### Install the SDK

The .NET SDK allows you to develop apps with .NET. If you install the .NET SDK, you don't need to install the corresponding runtime. To install the .NET SDK, run the following command:

sudo yum install dotnet-sdk-6.0

### Install the runtime

The ASP.NET Core Runtime allows you to run apps that were made with .NET that didn't provide the runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET. In your terminal, run the following command:

sudo yum install aspnetcore-runtime-6.0

As an alternative to the ASP.NET Core Runtime, you can install the .NET Runtime, which doesn't include ASP.NET Core support: replace aspnetcore-runtime-6.0 in the previous command with dotnet-runtime-6.0:

sudo yum install dotnet-runtime-6.0

## CentOS 8 ✔

Warning

*CentOS 8 will reach an early End Of Life (EOL) on December 31st, 2021. For more information, see the official CentOS Linux EOL page. Because of this, .NET 6 won't be supported on CentOS Linux 8.

.NET 5 is available in the default package repositories for CentOS 8.

### Install the SDK

The .NET SDK allows you to develop apps with .NET. If you install the .NET SDK, you don't need to install the corresponding runtime. To install the .NET SDK, run the following command:

sudo dnf install dotnet-sdk-5.0

### Install the runtime

The ASP.NET Core Runtime allows you to run apps that were made with .NET that didn't provide the runtime. The following command install the ASP.NET Core Runtime, which is the most compatible runtime for .NET. In your terminal, run the following command:

sudo dnf install aspnetcore-runtime-5.0

As an alternative to the ASP.NET Core Runtime, you can install the .NET Runtime, which doesn't include ASP.NET Core support: replace aspnetcore-runtime-5.0 in the previous command with dotnet-runtime-5.0:

sudo dnf install dotnet-runtime-5.0

## How to install other versions

All versions of .NET are available for download at https://dotnet.microsoft.com/download/dotnet, but require manual installation. You can try and use the package manager to install a different version of .NET. However, the requested version may not be available.

The packages added to package manager feeds are named in a hackable format, for example: {product}-{type}-{version}.

• product
The type of .NET product to install. Valid options are:

• dotnet
• aspnetcore
• type
Chooses the SDK or the runtime. Valid options are:

• sdk
• runtime
• version
The version of the SDK or runtime to install. This article will always give the instructions for the latest supported version. Valid options are any released version, such as:

• 5.0
• 3.1
• 3.0
• 2.1

It's possible the SDK/runtime you're trying to download is not available for your Linux distribution. For a list of supported distributions, see Install .NET on Linux.

### Examples

• Install the ASP.NET Core 5.0 runtime: aspnetcore-runtime-5.0
• Install the .NET Core 2.1 runtime: dotnet-runtime-2.1
• Install the .NET 5 SDK: dotnet-sdk-5.0
• Install the .NET Core 3.1 SDK: dotnet-sdk-3.1

### Package missing

If the package-version combination doesn't work, it's not available. For example, there isn't an ASP.NET Core SDK, the SDK components are included with the .NET SDK. The value aspnetcore-sdk-2.2 is incorrect and should be dotnet-sdk-2.2. For a list of Linux distributions supported by .NET, see .NET dependencies and requirements.

## Troubleshoot the package manager

This section provides information on common errors you may get while using the package manager to install .NET.

### Unable to find package

Important

Package manager installs are only supported on the x64 architecture. Other architectures, such as ARM, must install .NET by some other means such as with Snap, an installer script, or through a manual binary installation.

For more information on installing .NET without a package manager, see one of the following articles:

### Failed to fetch

While installing the .NET package, you may see an error similar to signature verification failed for file 'repomd.xml' from repository 'packages-microsoft-com-prod'. Generally speaking, this error means that the package feed for .NET is being upgraded with newer package versions, and that you should try again later. During an upgrade, the package feed should not be unavailable for more than 2 hours. If you continually receive this error for more than 2 hours, please file an issue at https://github.com/dotnet/core/issues.

For more information about solving these problems, see Troubleshoot fxr, libhostfxr.so, and FrameworkList.xml errors.

## Dependencies

When you install with a package manager, these libraries are installed for you. But, if you manually install .NET Core or you publish a self-contained app, you'll need to make sure these libraries are installed:

• krb5-libs
• libicu
• openssl-libs
• zlib

If the target runtime environment's OpenSSL version is 1.1 or newer, you'll need to install compat-openssl10.


text:
Free modules are another instance of free objects. (see this post for a discussion on free objects and the construction of the free group.) They are the modules satisfying a universal property analogue to that of free groups. Here is a more constructive definition:

Definition: Let $S$ be a set and $R$ be a ring. An $R$-module $F$ is free on $S$ if for all $0 \neq x \in F,$ there exist unique non-zero $r_1, \ldots r_n \in R$ and unique non-zero $s_1, \ldots, s_n \in S$ such that $x = \sum_{i=1}^nr_is_i$ for some $n \in \textbf{N}.$ The set $S$ is said to be a basis or a set of free generators for $F.$ If $R$ is commutative, we call $|S|$ the rank of $F.$

Note that there is a natural injection $\iota : S \to F$ identifying $s \in S$ with $1_Rs \in F.$

This definition coincides with our intuition that the only relations among elements of $F$ should be the minimal relations required for $F$ to be a module. For example, the integers modulo $n$, $\mathbf{Z}_n$ is not a free $\mathbf{Z}$-module on any set. Indeed, although any element $x\in \mathbf{Z}_n$ can be uniquely written as an element of the underlying set, we have $x = (n+1)x = (2n+1)x = \cdots$ so we don’t have unicity in the ring elements, as the definition requires.

To construct a free $R$-module on a set $S,$ consider the free abelian group on $S,$ which you can obtain by quotienting the free group on $S$, $FG(S)$ by the normal subgroup generated by the set of all elements of the form $ab - ba$ in $FG(S).$ (This will satisfy the analog universal property for abelian groups.) This group can be identified with

$\textbf{Ab}(S) := \{ \displaystyle\sum_{finite} \epsilon_is_i \mid s_i \in S; \epsilon_i \in \{ -1_R, 1_R \} \}$

where the operation is still concatenation of words but written additively. We now naturally define the free $R$-module over $A$ by

$F(S) = \{ \displaystyle\sum_{finite}r_is_i \mid r_i \in R; s_i \in S \}$

with the $R$-action defined as $r(\sum r_is_i) = \sum (rr_i)s_i.$ This is easily seen to satisfy the defining properties of a module and the universal property of free modules:

Theorem: (Universal property) For $S$ a set and $R$ a unitary ring, the $R$-module $F(S)$ constructed above satisfy the universal property of free modules. In other words, for every $R$-module $M$ and every map $\varphi : S \to M,$ there exists a unique $R$-module homomorphism $\phi : F(S) \to M$ such that the following diagram commutes:

Proof: Let $\iota : S \hookrightarrow F(S)$ be the natural inclusion $\iota(s) = 1s.$ Define $\phi : F(S) \to M$ on $\iota(S) \subset F(S)$ as $\phi(1s) = \varphi(s).$ Then, since $\iota(S)$ generates $F(S),$ $\phi$ extends uniquely by linearity to an $R$-module homomorphism on $F(S)$ and we have $\varphi = \phi \circ \iota$ as wanted.

QED

Note that as in the case of the free groups, this property uniquely characterizes free modules up to isomorphism.

Reference: D. S. Dummit, R. M. Foote, Abstract Algebra, 3rd ed.

One Comment


text:
# Tag Info

7

The general scheme is called Three-pass protocol and works for all commutative ciphers. It is secure for some of them, but xor (and modular addition) are insecure choices. Your scheme: A->B: $c_1 = m \oplus a$ B->A: $c_2 = c_1 \oplus b$ A->B: $c_3 = c_2 \oplus a$ B computes $m = c_3 \oplus b$ an attacker sees all of $c_1$, $c_2$ and $c_3$. So they can ...

5

One observation is that if we modify the problem so that $M, A, B$ are random invertible matrices, then it is easy to prove the security of the system. In fact, we can prove that the system is informationally secure; that is, for any observed $C_1, C_2$ pair, for any possible value of $K$, there is a unique set of values of $A, B, M$ that yield that $K$ ...

5

I think it is still possible to use UC in this case. Recall the setup for the UC framework. We have an ideal world and a real world. There are parties $P_1,\dots,P_n$ in each world and an environment $\mathcal{Z}$ in each. In the real world we have the adversary $\mathcal{A}$ while in the ideal world, we have an ideal functionality $\mathcal{F}$ and a ...

5

The fact that a given cipher has a key length of 296 bits doesn't mean at all that it provides 296 bits of security or even that a brute force attack would take $2^{296}$ steps. The problem of mono-alphabetic substitution cipher is the ridiculously small block size (in this case, barely $\log 64 = 6$ bits). If absolutely nothing about the plaintext is ...

4

There are a couple of options for protocol analysis tools. (I don't know any established tool for their design - as said by someone else, designing your own protocols is not really recommended.) If you are looking for formal methods based, symbolic tools, some well-known tools that have been applied to many protocols are ProVerif and Scyther. Given that you ...

3

An implementation should generate the IV from any cryptographically secure PRNG. TLS 1.1 further details the possible ways to do that: The IV can be obtained from a PRNG. A random string $r$ can be generated from a PRNG, and added to the plaintext to encrypt where the IV should go; then the whole lot is encrypted with either a fixed IV, or even the last ...

2

I don't think the approach you sketched helps very much. If the server is compromised, the attacker can pretty easily modify the server-side software to log and record all the cryptographic keys, and then you haven't gained anything. Therefore, I don't think the approach you sketch is likely to be a great way to spend your limited software development ...

2

Encrypting the AES key does not actually make a brute force search any harder: an attacker doesn't need to know the encrypted key to decode messages, they only need to know the actual AES key. Thus, the attacker only(!) needs to search the 256 bit AES keyspace, not the roughly 296+256 = 552 bit encrypted keyspace. Besides, even if the attacker did try an ...

1

Yes, SILC is still used daily by a few of us die hards. :-) I, too, noticed the other day that the official source repos are dead. Perhaps we can get them up on Github or other hosting site. I haven't heard of any flaws discovered in the protocol itself, but I haven't heard of anyone reviewing it lately either.

Only top voted, non community-wiki answers of a minimum length are eligible