## history – Is the discrepancy in Turing’s representation of complete configurations intentional?

On page 235 of Turing’s 1936 paper, in the figure marked (C), the illustration appears not to match the description. The description states that

space has been made on the left of the scanned symbol, and the m-configuration written in its place

but the illustration shows no scanned symbol for the first complete configuration:

``````b:əəo0 0:əəq0 0: ...
``````

It’s hard to tell if this is meant to me something special about the starting state, or a general part of the representation so that one would have

``````b:əəo0 0:əəq0 0:əə0 q0:əə0 0 q:əə0 0p 1:əə0p 0 1:əpə0 0 1:...
``````

rather than the representation corresponding to the description:

``````b :əəo0 0:əəq0 0:əə0 q0:əə0 0 q :əə0 0p 1:əə0p 0 1:əpə0 0 1:...
``````

Is there significance to this discrepancy? Is it intentional?

## compilers – Haskell Graph Reduction/Graph Representation

I know that under the hood, for a Haskell program, the GHC compiler uses graph reduction for optimization. Is there any way to view this graphical representation of the program? I haven’t been able to find an existing plugin that, given a Haskell program, produces a graphical representation, but I’m relatively new to Haskell.

## rt.representation theory – Question on geometric lemma in the \$p\$-adic group representation

To check whether my understaning on the geometric lemma is right, I would like to ask some specific question related to it.

Let $$F$$ be a $$p$$-adic local field of characteristic zero. Let $$W_n$$ be a symplectic space over $$F$$ of dimension $$2n$$. Let $$Sp_{n}(W_n)$$ be a symplectic group and $$B_n$$ its standard Borel subgroup. Let $$Q_{t,n-t}$$ be a standard parabolic subgroup of $$G$$ preserving a totally isotropic subspace of $$W_n$$ of dimension $$t$$.

Let $${chi_i}_{1 le i le n}$$ be unramified characters of $$GL_1(F)$$ such that $$chi_i(omega)=1$$ and let $$pi$$ be the normalized parabolic induced representation $$text{Ind}_{Q_{3,n-3}}^{Sp_{n}}(chi_1 circ text{det}_{GL_3},chi_2,cdots,chi_{n-2})$$.

I am considering $$J_{Q_{2,n-2}}(pi)$$, the normalized Jacquet module of $$pi$$ to $$Q_{2,n-2}$$. By the geometric lemma, there is some filtration of $$J_{Q_{2,n-2}}(pi)$$

$$0=tau_0 subset tau_1 subset cdots subset tau_m=J_{Q_2}(pi)$$ such that $$tau_{i}backslashtau_{i+1}$$ is some induced representation of the Jacquet module of the inducing data of $$pi$$.

I guess that such subquotient appearing in this filtration has the form $$|cdot|^{-frac{1}{2}}cdot(chi_1 circ text{det}_{GL_2}) boxtimes text{Ind}_{B_{n-2}}^{Sp_{n-2}}(chi_1′,chi_2′,cdots,chi_{n-2}’)$$ or
$$text{Ind}_{B_2}^{GL_2}(chi_1′,chi_2′) boxtimes text{Ind}_{Q_{3,n-5}}^{Sp_{n-2}}(chi_1 circ text{det}_{GL_3},chi_4′,cdots,chi_{n-2}’)$$?

(Here, $${chi_1′,cdots,chi_{n-2}’} subset {chi_1,cdots,chi_{n-2},chi_1^{-1},cdots,chi_{n-2}^{-1}}.)$$

## co.combinatorics – A question regarding an analog of Young symmetrizer: the product row and column preserving subgroups without sign representation

Consider a rectangular Young diagram $$lambda$$ with $$n = pq$$ boxes, with $$p$$ rows and $$q$$ columns. If $$C$$ is the column preserving subgroup of $$lambda$$ and $$R$$ is the row preserving subgroup, then we normaly construct the Young symmetrizer by defining
$$b = sum_{g in C} text{sign}(g) g,$$ and, $$a = sum_{g in R} g,$$ and the Young symmetrizer is $$c = ba.$$

I am studying a slightly different problem, where one defines $$b$$ without $$text{sign}(g)$$:
$$b’ = sum_{g in C} g,$$ and then the analog of the Young symmetrizer is $$c’ =b’ a$$, the product of row and column preserving subgroups.

It is easy to see that unlike $$c$$, $$c’$$ is not an idempotent, i.e., $$c’ c’ neq alpha c’$$ for any $$alpha$$. Nevertheless, I would like to compute $$frac{1}{n!}text{tr} (c’ c’)$$ in the regular representation, i.e. the number of $$(r_1,c_1,r_2,c_2)$$ with $$r_1,r_2 in R$$ and $$c_1,c_2 in C$$ where $$r_1 c_1 r_2 c_2 = id$$.

Indeed, one simple lower bound for $$frac{1}{n!}text{tr} (c’ c’)$$ is $$frac{1}{n!}text{tr} (c c) = text{hook length}(lambda) times frac{1}{n!}text{tr}(c) =text{hook length}(lambda).$$

Is there anything known in the literature about the unsigned row and column product $$c’$$? or the particular trace that I wish to compute?

## python – follow up: Blackjack with card representation visuals

This is a follow-up to my original post of Blackjack with card representation visuals

I was given some very helpful advice by @Reinderien and @Linny which I greatly appreciate.

I have done my best to implement the changes. However, I am unsure if I actually implemented these changes in the best way, and would love if anybody can take a look/ provide any feedback. I’m always looking to learn more and improve, so I greatly appreciate any feedback or additional comments.

With regards to typing, is it common practice to include type annotations on every function? I can’t help but feel it makes the file more cluttered?
But if so, what is the best practice with class methods where the only parameter is the instance `self` ?

Additionally, some of my methods don’t actually return anything, but rather, they update the state of something. in these cases, did I handle them correctly, with the type hint of `-> None`

I also added `from __future__ import annotations` in order to use type hints for classes I created. Is this the intended usage of the library/ correct way to handle these cases?

To implement the various changes, I ended up needing to import a few more modules; but I’m curious if it’s frowned upon to have too many imports? At a certain point, can it actually impact performance?

Here is the link to Github Blackjack game which also contains a `visuals.py` file.

Thank you so much in advance:
The updated code:

``````from __future__ import annotations
import random
import collections
import time
import os
from typing import Sequence
import subprocess as sp
import visuals

"""
BLACKJACK GAME:
visuals file imported: numerous pretty ways to display cards
"""

def clear():
sp.run(('cls' if os.name == 'nt' else 'clear'), shell=True)

def validate_answer(question: str, choices: Sequence(str)) -> bool:

YES_NO = 'yn'

Card = collections.namedtuple('Card', ('value', 'suit'))

class Deck:

values = (str(v) for v in range(2, 11)) + list('JQKA')
suits = "Spades Diamonds Hearts Clubs".split()
suit_symbols = ('♠','♦','♥','♣')

def __init__(self, num_decks = 1):
self.num_decks = num_decks
self.cards = (Card(value, suit) for suit in self.suits for value in self.values) * self.num_decks
self.length = len(self)

def __repr__(self):
deck_cards = "Deck()n"
for card in self.cards:
deck_cards += f"({card.value}-{card.suit})"
return deck_cards

def __len__(self):
return len(self.cards)

def __getitem__(self, position):
return self.cards(position)

def draw_card(self):
return self.cards.pop()

def shuffle(self):
random.shuffle(self.cards)

#Shuffle when deck is < 50% full length
def is_shuffle_time(self):
return  len(self) < (self.length / 2)

def shuffle_time(self):
clear()
print("Reshuffling the Deck...n")
time.sleep(1)
self.reset()
self.shuffle()

def reset(self):
self.cards = (Card(value, suit) for suit in self.suits for value in self.values) * self.num_decks

class Hand:

def __init__(self):
self.hand = ()

def __repr__(self):
hand_cards = "Hand()n"
for card in self.hand:
hand_cards += f"({card.value}-{card.suit})"
return hand_cards

def add_card(self, *cards: tuple) -> None:
for card in cards:
self.hand.append(card)

def remove_card(self):
return self.hand.pop()

def hit(self, deck: Deck) -> None:
card = deck.draw_card()

def hand_score(self):
self.card_val = (10 if card.value in ('J','Q','K') else 1 if card.value == 'A'
else int(card.value) for card in self.hand)

self.card_scores = dict(zip(self.hand, self.card_val))
score = 0
for card in self.hand:
card_score = self.card_scores(card)
score += card_score
if any(card.value == 'A' for card in self.hand) and score <= 11:
score += 10

return score

def card_visual(self):
card_list = ()
for card in self.hand:
card_vis = visuals.reg_card_visual(card)
card_list.append(card_vis)
visuals.print_cards(card_list)
print(f"nTotal of: {self.hand_score()}n")

def mini_card_visual(self):
card_list = ()
for card in self.hand:
card_vis = visuals.mini_card_visual(card)
card_list.append(card_vis)
visuals.print_cards(card_list)
print(f"nTotal of: {self.hand_score()}n")

class Player(Hand):

def __init__(self, chips, bet=0, split_cards = False):
super().__init__()
self.chips = chips
self.bet = bet
self.profit = 0
self.alive = True
self.split_cards = split_cards
self.has_blackjack = False

def deal_cards(self, deck: Deck) -> None:
self.hit(deck)
self.hit(deck)
print_line('Player Cards')
self.card_visual()
self.has_blackjack = self.check_for_blackjack()
self.split_cards = self.check_for_split()
self.apply_split(deck)

def add_chips(self, chips: float) -> None:
self.chips += chips

def remove_chips(self, chips: float) -> None:
self.chips -= chips

def print_balance(self):

def check_for_blackjack(self):
return len(self.hand) == 2 and self.hand_score() == 21

def check_for_split(self):
if self.hand(0).value == self.hand(1).value:
return validate_answer("Do you want to split your cards?: (y / n): ", YES_NO)
return False

def wager(self):
while True:
self.print_balance()
bet = input(f"How much would you like to bet?: \$")
if not bet.isdecimal():
continue
elif float(bet) > self.chips:
print("sorry, you don't have enough chips. Try again")
else:
self.bet = float(bet)
self.remove_chips(float(bet))
break

while True:
self.print_balance()
bet = input(f"Enter additional wager. You may bet up to your original \${self.bet} or less: \$")
if not bet.isdecimal() or float(bet) > self.bet:
continue
elif float(bet) > self.chips:
print("You don't have enough chips. Try again")
else:
self.bet_two = float(bet)
self.remove_chips(float(bet))
break

def confirm_double(self):
return validate_answer("nYou will only get 1 more card. Confirm you want to double down: (y / n): ", YES_NO)

def double_down(self, deck: Deck) -> None:
self.bet += self.bet_two
self.visual_move(deck)
if self.hand_score() > 21:
self.alive = False

def apply_split(self, deck: Deck) -> None:
if self.split_cards:
self.hand_two = Player(0, split_cards=True, bet=self.bet_two)

transfer_card = self.remove_card()
self.hit(deck)
self.hand_two.hit(deck)

print("nFirst Hand: ")
self.mini_card_visual()
time.sleep(1)
self.player_move(deck)
print("nSecond Hand: ")
self.hand_two.mini_card_visual()
time.sleep(1)
self.hand_two.player_move(deck)
time.sleep(1)

def visual_move(self, deck: Deck) -> None:
self.hit(deck)
if self.split_cards:
self.mini_card_visual()
else:
self.card_visual()

def player_move(self, deck: Deck) -> None:
while True:
if self.hand_score() > 21 or self.has_blackjack:
self.alive = False
break
if self.hand_score() == 21:
break
if len(self.hand) == 2:
action = input("Would you like to hit, stand, or double-down? Enter (h, s, or d): ")
else:
action = input("Would you like to hit or stand: Enter (h or s): ")
if action == 'd':
if len(self.hand) == 2:
if self.confirm_double():
self.double_down(deck)
break
if action == "h":
self.visual_move(deck)
if action == "s":
break

def compute_results(self, dealer: Dealer) -> None:
if self.alive and dealer.alive:
if self.hand_score() > dealer.hand_score():
print("WINNER!n")
self.profit = 2
elif self.hand_score() == dealer.hand_score():
print("PUSH!n")
self.profit = 1
else:
print("LOSER! Dealer Winsn")

elif not self.alive:
if self.has_blackjack:
print("YOU HAVE BLACKJACK!n")
self.profit = 2.5
else:
print("BUST! LOSER!n")
else:
print("DEALER BUSTS. YOU WIN!n")
self.profit = 2
self.settle()

def settle(self):

def reset(self):
self.hand = ()
self.alive = True
self.split_cards = False
self.profit = 0
self.bet, self.bet_two = 0, 0

class Dealer(Hand):

def __init__(self):
super().__init__()
self.alive = True

def deal_cards(self, deck: Deck) -> None:
self.hit(deck)
self.hit(deck)
print_line('Dealer Cards')
self.dealer_visual()
time.sleep(1)

def reset(self):
self.hand = ()
self.alive = True

def card_reveal(self):
print_line('Dealer Cards')
time.sleep(1)
self.card_visual()
time.sleep(1)

def dealer_move(self, deck: Deck) -> None:
self.card_reveal()
while True:
if self.hand_score() in range(17, 22):
break
if self.hand_score() > 21:
self.alive = False
break
if self.hand_score() < 17:
self.hit(deck)
time.sleep(1)
self.card_visual()

def dealer_visual(self):
card_list = ()
hidden_card = visuals.reg_hidden_card
card_list.append(hidden_card)

for card in self.hand(1:):
card_vis = visuals.reg_card_visual(card)
card_list.append(card_vis)

visuals.print_cards(card_list)

def play_again():
if validate_answer("Would you like to play another round? (y / n): ", YES_NO):
clear()
return True
return False

def print_line(word: str) -> None:
print(f"n______________________({word})______________________________n")

def game():
print_line('WELCOME TO BLACKJACK!!')
num_decks = 6
player_chips = 1_000

player = Player(player_chips)
dealer = Dealer()
deck = Deck(num_decks)

deck.shuffle()

while True:
if player.chips == 0:
print("You're out of money. Game Over")
break
print(f"Percentage of shoe not yet dealt: {len(deck)/(52*num_decks):.2%}")
if deck.is_shuffle_time():
deck.shuffle_time()

player.wager()
dealer.deal_cards(deck)
player.deal_cards(deck)

if not player.split_cards:
player.player_move(deck)
if player.alive:
dealer.dealer_move(deck)
player.compute_results(dealer)
# PLAYER SPLIT CARDS
else:
if player.alive or player.hand_two.alive:
dealer.dealer_move(deck)
print("HAND ONE:")
player.compute_results(dealer)
print("HAND TWO:")
player.hand_two.compute_results(dealer)

# Any chips won by second hand: Add it to total balance
player.chips += player.hand_two.chips

player.print_balance()
if play_again():
player.reset()
dealer.reset()
continue
else:
break

print("Thanks for playing. Goodbye.")

if __name__ == "__main__":
game()
``````

## If/else representation with stream and Java 8

I have following interface with implementations:

``````public interface Parser {
void parse();
boolean canParse(String message);
}

class StackParser implements Parser {
public void parse(){
System.out.println("Parsing stackoverflow");
}
public boolean canParse(String message){
return message.equals("stackoverflow");
}
}

public void parse() {
}
public boolean canParse(String message) {
}
}
``````

I go to check incoming message and parse stackoverflow or youtube:

``````public class Main {
private List<Parser> parsers;

public static void main(String() args) {
}

void doSomething(String message){
parsers.stream()
.filter(p -> p.canParse(message))
.forEach(p -> p.parse());
}

}
``````

Okay, pretty good. But what if message is not “stackoverflow” or “youtube”? App will be silent, but I want to send another “default” message if no matches were found, like “I can’t parse this web!”.

I know that will not works (even compile), but it’s also should print “I can’t parse this web” only one time, not for every “false” condition.

``````parsers.stream()
.filter(p -> {
if (p.canParse(message) == false) {
System.out.println("I can't parse it!");
}
})
.forEach(p -> p.parse());
``````

How can I do it?

## linear algebra – Spotting the matrix representation of the quantum AND operation

https://people.maths.bris.ac.uk/~csxam/teaching/qc2020/lecturenotes.pdf

Applying the above construction to AND we get the map $$(x1,x2,y) rightarrow (x1,x2,y⊕(x1∧x2))$$ for $$x1,x2,y in {0,1}$$. The unitaryoperator which implements this is then simply the map $$|x1〉|x2〉|y> rightarrow |x1〉|x2〉|y oplus (x1∧x2)〉$$.

Written as a matrix with respect to the computational basis this is

$$begin{bmatrix} 1&0&0&0&0&0&0&0\0&1&0&0&0&0&0&0\0&0&1&0&0&0&0&0\0&0&0&1&0&0&0&0\0&0&0&0&1&0&0&0\0&0&0&0&0&1&0&0\0&0&0&0&0&0&0&1\0&0&0&0&0&0&1&0 end{bmatrix}$$

How can you just spot what the matrix is with respect to the computational basis?

## rt.representation theory – Question on the residual representation

Let $$P=MN$$ be a standard parabolic subgroup $$G=SO_n$$ and $$sigma$$ a cuspidal representation of $$M$$.

Consider the normalized parabolic induced representation $$text{Ind}_P^G(sigma|cdot|^z)$$ and for sufficiently large $$z$$, we can define Eisenstein series $$E(z,phi)$$ for $$phi in text{Ind}_P^G(sigma)$$. Since $$E(z,phi)$$ has a meromorphic continuation, let $$z_0$$ be a simple pole of $$E(z,phi)$$. Put $$mathcal{E}(phi,z_0)$$ a residue of $$E(z,phi)$$ at $$z=z_0$$.

I am wondering if there are two $$phi_1,phi_2 in text{Ind}_P^G(sigma)$$ such that $$mathcal{E}(phi_1,z_0)=mathcal{E}(phi_2,z_0)$$, then $$mathcal{E}(phi_1,z)=mathcal{E}(phi_2,z)$$ as meromorphic functions on $$mathbb{C}$$. Is it right?

## arithmetic geometry – Generalized Hodge-Tate weights of \$p\$-adic Galois representation

Let $$K$$ be an finite extension of $$mathbb{Q}_p$$, and $$E$$ be a Galois extension of $$K$$ whose Galois group is a open subgroup of $$text{SL}_2(mathbb{Z}_p)$$, then we have a $$2$$-dim $$p$$-adic Galois representation given by $$G(bar{K}/K)rightarrow G(E/K)rightarrowtext{SL}_2(mathbb{Z}_p)rightarrowtext{GL}_2(mathbb{Q}_p),$$then I want to know why the sum of the two Sen weights of this representation is $$0$$. Note that by definition, Sen weights or generalized Hodge-Tate weights are the eigenvalues of Sen operator.

Thanks!

## javascript – Good representation for list of items that can be grouped together

I am building the frontend of a web app in JavaScript that manages list of past events. It basically has the following requirements:

• Events are displayed in a vertical list.
• Events can be moved to arbitrary different positions in the list.
• Any event can be “connected” to the event before or after it, by clicking an icon that appears between them.
• When two events are connected, they form a ‘group’.
• Connecting further events to a group merges the events into the group.
• Groups move as if they were single items: moving a group moves all the events within that group.
• Groups can also be disconnected by clicking another icon that appears between events, which will split the group into two groups (or individual events, if only one event in a group was left isolated).

How would you structure the data representation of such a system? i.e. what would the data structure representing the list be, what operations would exist to implement the move and display operations? I’m talking purely on the frontend here.

My naive idea was that the event list is basically an array, where each element of the array is a union type that can be either a group (which is itself an array) or a single item. But that seems inelegant in many ways when it comes to the moving, reading, and split operations. I am wondering if there is a better representation that I have missed that can simplify the implementation of these operations.