## Prove that the number of circuits with bounded fan-in (of 2) of size \$s\$ is at most \$s^{O(s)}\$

Prove that the number of circuits with bounded fan-in (of 2) of size $$s$$ is at most $$s^{O(s)}$$.
Give the best explicit bound you can get.

I know that for a circuit of size $$s$$ in order to generate a string to represent it I need for every edge, which I have at most $$s$$ of those, to represent from which vertice it start and in which vertice it ends and for that I need $$2s log(s)$$ bits.
In addition I need another 2 bit for every vertice to mark whether it is an input, an OR AND NOT Gate.
So overall I need $$O(s log(s))$$ bits to represent a circuit, and there are $$2^{O(s log(s))} = s^{O(s)}$$ circuits like that.

Am I in the right direction or am I missing something? And is $$2^{3(s log(s))} = 8s^{O(s)}$$ the bound?
Thanks:)

## analysis – Can I use geometry to prove that the square root of 2 is real?

For high school students, it is a common exercise to prove that $$sqrt2$$ is irrational. They assume $$sqrt2 = frac{p}{q}$$ for some coprime $$p$$ and $$q$$, and derive a contradiction.

But being not rational doesn’t mean it’s irrational. It must be also proven that $$sqrt2$$ is real. Indeed, high school students are aware of imaginary numbers.

It is widely said that to prove $$sqrt2$$ is real, they must learn real analysis.

But can’t we just use geometry? I could argue the following:

By Pythagoras’ Law, $$sqrt2 = sqrt{1^2+1^2}$$ is the length of a diagonal of the unit square. Since a length is a positive real number, $$sqrt2$$ is real.

To think about it, it seems hard to build geometry from the standard axioms, namely ZFC. Does that mean the argument above is just a harder way of a proof?

## real analysis – Prove Cantor Function maps rationals to rationals

Let $$Lambda$$ be the Cantor function and $$C$$ be the Cantor set. I need to show two things

(1) $$Lambda(x) in mathbb Q$$ when $$x in (0,1)cap mathbb Q$$

(2) $$x in mathbb Q$$ when $$Lambda(x) in mathbb Q$$ and $$x in C$$

## mathematics – I just wanted to prove Fermat’s last theorem true for the first 1000 numbers using a python script, but there is an error I’m not able to find

Fermat’s last theorem states that there are no natural numbers (1, 2, 3,…) x, y, and z such that x^n + y^n = z^n, in which n is a natural number greater than 2.

Here is the code, you can ignore the first 2 functions.

def diff(n, mid) :
if (n > (mid * mid * mid)) :
return (n - (mid * mid * mid))
else :
return ((mid * mid * mid) - n)

def cubicRoot(n):
start = 0
end = n

e = 0.0000001
while (True):

mid = (start + end) / 2
error = diff(n, mid)

if (error <= e):
return mid

if ((mid * mid * mid) > n):
end = mid

else:
start = mid

def proof(n):
for a in range(1,n):
for b in range(a, n):
c = cubicRoot(a * a * a + b * b * b)
if c.is_integer() and c <= n:
print(f"{a},{b},{int(c)}")
else:
print(f"{a},{b}")
proof(1000)

Although for some reason my program stops with the output ‘1,728’ in the console and doesn’t print anything further. Any help on improving the code and fixing this solution will be appreciated.

Thank you.

## How does one prove one’s residency to a given US state when flying to Costa Rica?

https://www.iatatravelcentre.com/world.php (-> Costa Rica):

Costa Rica. > Published 15.10.2020.

1. Passengers are not allowed to enter.
• This does not apply to:

(…)

• residents of the following states of the United States: Arizona, California, Colorado, Connecticut, Florida, Georgia, Maine, Maryland,
Massachusetts, Michigan, New Hampshire, New Jersey, New Mexico, New
York, Ohio, Oregon, Pennsylvania, Rhode Island, Texas, Vermont,
Virginia, Washington, Washington D.C. and Wyoming;

How does one prove one’s residency to a given US state when flying to Costa Rica?

## How to prove that a language is context-free?

A practical approach that in many examples works (but not always, I know) is trying to find the nesting structure of the strings in the language. “Nested dependencies” have to be generated at the same time in different parts of the string.

Also we have the basic toolbox:

1. concatenation: $$Sto S_1S_2$$ if you can split the language in two consecutive parts use this production

2. union: $$Sto S_1 mid S_2$$ split into disjoint parts

3. iteration: $$Sto S_1S mid varepsilon$$

### Example 1

Unequal numbers can be handled using a simple trick.

$$L= { a^mb^n mid mneq n }$$

Now clearly
$$L= { a^mb^n mid m< n } cup { a^mb^n mid m> n }$$.

Consider first half: $$L_1 = { a^mb^n mid m< n }$$. If there must be more $$b$$‘s we can generate an equal numbers of $$a$$‘s and $$b$$‘s on the one and and add at least one extra $$b$$:
$$L_1 = { a^mb^m b^i mid mge 0, i>0 } = { a^mb^m mid mge 0 }cdot { b^i mid i>0}$$. This we can handle with concatenation from the basic toolbox.

Now the complete language also deal with the case we have more $$a$$‘s. This we handle by using union.

$$S to S_1 mid S_2$$ (choose which part)

$$S_1 to XB$$ (extra $$b$$ part)

$$Xto aXbmid varepsilon$$ (equal number of $$a$$ and $$b$$)

$$B to Bb mid b$$ (one or more $$b$$‘s)

$$S_2 to AX$$ (extra $$a$$ part)

$$A to Aa mid a$$ (one or more $$a$$‘s)

### Example 2

Here an example for the nesting (thank you Raphael).

$$L={b^ka^l(bc)^ma^nb^o mid k,l,m,n,oin {Bbb N},kneq o,2l=n,mge 2 }$$

Replace $$n$$ by $$2l$$. We can now drop $$n$$ in conditions.

Replace $$k neq o$$ by $$k > o text{ or } k < o$$ (confused? $$o$$ is ‘oh’ not ‘zero’). Apply tools for union. We work with $$k > o$$ here. Also $$k>o$$ iff $$k=s+o$$ and $$s>0$$ where $$s$$ is a new variable. Replace $$k$$ by $$s+o$$.

$$L_1 ={b^{s+o}a^l(bc)^ma^{2l}b^o mid l,m,o,sin {Bbb N},s>0,mge 2 }$$

Some simple rewrites.

$$L_1 ={bb^sb^o a^l bcbc(bc)^m (aa)^{l}b^o mid l,m,o,sin {Bbb N} }$$

Now we see the nesting structure, and start building a grammar.

$$S_1 to TV$$, $$Tto bU$$, $$Uto bU mid varepsilon$$ (see: concatenation and iteration here)

$$V to bVb mid W$$ (we generate $$o$$ $$b$$‘s on both sides)

$$W to aWaamid X$$

$$Xto YZ$$, $$Yto bcbc$$, $$Zto bcZmid varepsilon$$

### Example 3

$$K ={ a^kb^lc^m mid l=m+k}$$

A first “obvious” rewrite.

$$K ={ a^kb^{m+k}c^m mid m,kge 0} = { a^kb^mb^kc^m mid m,kge 0}$$

In linguistice this is called “cross-serial dependency”: the interleaving $$k,m,k,m$$ (usually) strongly indicates non-contextfreeness. Of course $$m+k=k+m$$ and we are saved.

$$K ={ a^kb^{k+m}c^m mid m,kge 0} = { a^kb^kb^mc^m mid m,kge 0}$$

with productions $$Sto XY$$, $$Xto aXbmid varepsilon$$, $$Yto bYcmid varepsilon$$

Similarly $$K’= { a^kb^lc^m mid m=k+l} = { a^kb^lc^lc^k mid k,lge 0}$$

with productions $$Sto aSc mid X$$, $$Xto bXcmid varepsilon$$

Final comment: these techniques help you come up with a candidate context-free grammar that will hopefully recognize your language. A correctness proof may still be needed, to ensure that the grammar really works to recognize your language (nothing more, and nothing less).

## number theory – How to prove this identity related to multiplicative functions

This is question 2.6 of textbook Apostol introduction to analytic number theory and I am unable to solve it.

Prove that $$sum_{d^2 | n} mu(d) = {mu}^2(n)$$ .

RHS = r where $$n = p_{1} … p_{r} {p_{r+1}}^{a_{r+1}}…{ p_{k}}^{a_k}$$ , $$a_{r+i}$$ such that i>0 .

But i am not able to prove lhs equal to it. So, can you please help! !

## logic – How to prove the following arguments (Fitch style natural deduction proofs)

I’m trying to do a bunch of proofs to get better at them but it seems like I need some help with negation. Can anyone who has time prove the following arguments? I would really appreciate it! This is really not homework, all of them are practice questions. I am just looking for more sample negation proofs to understand the material better. Thank you!

¬(P ∧ ¬Q), ¬P → Q ∴ Q

P → ¬Q, ¬Q → P ∴ ¬(Q ↔︎ P)

R ∨ (P ∨ Q), Q → ¬Q, R → P ∴ P

and from no premises (R → ¬S)→ (¬S ∨ ¬R)

I would appreciate even just a few of them.

## Prove |f + f’| = |f| + |f’|?

Let G = (V, E) be a flow network with source s and sink t, and let f be a flow in G. Let Gf be the residual network of G induced by f, and let f’ be a flow in Gf. Then, the flow sum f + f’ defined by equation (27.4) is a flow in G with value |f + f’| = |f| + |f’|.