functional programming – What are the implications of Homotopy Type Theory?

I’ve recently come across the topic of homotopy type theory and I’m interested to learn more. I have a very limited background in type theory.

Can anyone tell me, in functional programming terms or through practical examples, how exactly is HoTT going to change the way we view mathematics, and what are the implications of HoTT on proof assistants? Thanks!

Norm of a functional with restricted domain

Let $X$ be a normed linear space and $Y$ be a subspace of $X$. Let $f$ be a continuous functional and $g$ be a continuous functional such that $g(y)=0$ for all $yin Y$. For all $xin X$ there exist $yin Y$ such that $|f(x)-g(x)|leq |f(y)|$.

$f$ is a extenstion of $f-g$ restricted to $Y$. Maybe I can do use of the theorem of Hahn-Banach.

Hölder continuity of functional calculus

Let $0<beta<1$ and $ f colon (0,1) to (0,1)$ be $beta$ Hölder continuous with constant $C$. Let $H$ be a Hilbert space and $A,B$ be self adjoint operators on $H$, such that $sigma(A+B),sigma(A) subset (0,1)$. Then we can define $f(A+B)$ and $f(B)$ by the continuous functional calculus. Do we then have the estimate
$$ left lvert operatorname{tr} (f(A+B)-f(A)) right rvert le C lVert B rVert_beta^beta$$
This does hold for commutating operators $A,B$ and it seems to hold for 2×2 matrices, if i calculated correctly. There is also the stronger hypothesis, that for any unitary equivalent norm $lVert cdot rVert$, we have the estimate
$$ left lVert f(A+B) – f(A) right rVert le C lVert lvert B rvertbetarVert$$
I am aware of the question Hölder continuity for operators and its answer, but this is different, as the trivial counter example does not hold. The special case $f(t)=t^beta$ is stated as true in an answer to that question.

functional analysis – A cone in the “boundary” of a convex cone, without topology

In a real vector space, I have two nonempty disjoint cones $A,B$, such that:

  1. $A$ is a convex cone.
  2. $A cup B$ is a convex cone.
  3. for all $a in A$ and $b in B$, we have $a+b in A$.

So you see from (3) that $B$ is in some sense contained in the “boundary” of $A$. But I don’t want to assume a topology on the vector space. My question is, has this phenomenon been discussed in any references? Is there a name for it? Are there any relevant tools or implications on $A$ and $B$?

8 – How do I run a BrowserTestBase functional test with blocks?

I have a module that defines a custom block and places it using a block.block.block_name.yml file that I generated by exporting the placement of the block on a dev site. I’ve unit-tested the block code, but now I want a functional test that will tell me whether the block is correctly placed and rendering to the right users;


namespace DrupalTestsmy_moduleFunctional;

use DrupalTestsBrowserTestBase;
use Drupalmy_moduleEnablerService;
use DrupalnodeEntityNode;
use DrupalnodeNodeInterface;
use DrupaluserEntityUser;

 * Main test class for the my_module module
 * @group my_module

class ImplementationTests extends BrowserTestBase {

  public $defaultTheme = 'bootstrap';

   * Modules to enable.
   * @var array

  public static $modules = ('block', 'node', 'my_module', 'user');

  private NodeInterface $node;
  private User $user;

  # from
  protected function getConfigSchemaExclusions() {
    return array_merge(parent::getConfigSchemaExclusions(), ('bootstrap.settings'));
   * {@inheritdoc}
  protected function setUp(): void {

   * some test
  public function test_nothing() {

However, when I run this, I get this error:

Trying to access array offset on value of type null


Looking at the first file in the stack (/opt/drupal/web/core/lib/Drupal/Core/Block/BlockPluginTrait.php:90), I see this:

 80   /**
 81    * Returns generic default configuration for block plugins.
 82    *
 83    * @return array
 84    *   An associative array with the default configuration.
 85    */
 86   protected function baseConfigurationDefaults() {
 87     return (
 88       'id' => $this->getPluginId(),
 89       'label' => '',
 90       'provider' => $this->pluginDefinition('provider'),
 91       'label_display' => BlockPluginInterface::BLOCK_LABEL_VISIBLE,
 92     );
 93   }

My guess is that BrowserTestBase needs some additional code to properly set up the blocks module, but I’m not sure what else I need to do. Any ideas?

8 – hook_menu_local_tasks_alter is not invoked during functional tests

I have an implementation of hook_menu_local_tasks_alter in my module, which works fine on my dev environment, but when I try to run my module using BrowserTestBase the hook is not invoked when visiting a node. Why?

Here is a mock instance of the hook that I’ve set up just to see if the hook is being called:

function implementations_menu_local_tasks_alter(array &$data, $route_name, DrupalCoreCacheRefinableCacheableDependencyInterface &$cacheability) {

  throw new Exception('whoops');

I’ve ruled out the module not being installed properly, as the other hooks are invoked without issue. Looking at the html produced by BrowserTestBase I can see that some header links are present in the header, but I don’t see any view/edit tabs present in the body of the html. I tried changing BrowserTestBase::$defaultTheme to both 'classy' and 'bartik' with the same result.

ID #21 (Previous | Next)
Called from GuzzleHttpPromiseFulfilledPromise::GuzzleHttpPromise{closure}() line 39
GET request to: http://localhost/node/2
Skip to main content
Status message
Implementation Some Title has been created.
Some Title
Member for
3 seconds
Submitted by p6fNZyQj on Sun, 10/18/2020 - 15:26
Parent Idea
array (
  'Date' => 'Sun, 18 Oct 2020 04:26:21 GMT',
  'Server' => 'Apache/2.4.38 (Debian)',
  'X-Powered-By' => 'PHP/7.4.11',
  'X-Drupal-Assertion-0' => 'a%3A3%3A%7Bi%3A0%3BO%3A25%3A%22Drupal%5CCore%5CRender%5CMarkup%22%3A1%3A%7Bs%3A9%3A%22%00%2A%00string%22%3Bs%3A217%3A%22The%20signature%20of%20the%20%22Drupal%5CComponent%5CEventDispatcher%5CContainerAwareEventDispatcher%3A%3Adispatch%28%29%22%20method%20should%20be%20updated%20to%20%22dispatch%28%24event%2C%20string%20%24eventName%20%3D%20null%29%22%2C%20not%20doing%20so%20is%20deprecated%20since%20Symfony%204.3.%22%3B%7Di%3A1%3Bs%3A24%3A%22User%20deprecated%20function%22%3Bi%3A2%3Ba%3A3%3A%7Bs%3A8%3A%22function%22%3Bs%3A72%3A%22Symfony%5CComponent%5CEventDispatcher%5CLegacyEventDispatcherProxy%3A%3Adecorate%28%29%22%3Bs%3A4%3A%22file%22%3Bs%3A74%3A%22%2Fopt%2Fdrupal%2Fvendor%2Fsymfony%2Fevent-dispatcher%2FLegacyEventDispatcherProxy.php%22%3Bs%3A4%3A%22line%22%3Bi%3A41%3B%7D%7D',
  'X-Drupal-Assertion-1' => 'a%3A3%3A%7Bi%3A0%3BO%3A25%3A%22Drupal%5CCore%5CRender%5CMarkup%22%3A1%3A%7Bs%3A9%3A%22%00%2A%00string%22%3Bs%3A155%3A%22The%20%22Symfony%5CComponent%5CHttpFoundation%5CFile%5CMimeType%5CMimeTypeGuesser%22%20class%20is%20deprecated%20since%20Symfony%204.3%2C%20use%20%22Symfony%5CComponent%5CMime%5CMimeTypes%22%20instead.%22%3B%7Di%3A1%3Bs%3A24%3A%22User%20deprecated%20function%22%3Bi%3A2%3Ba%3A3%3A%7Bs%3A8%3A%22function%22%3Bs%3A9%3A%22include%28%29%22%3Bs%3A4%3A%22file%22%3Bs%3A76%3A%22%2Fopt%2Fdrupal%2Fvendor%2Fsymfony%2Fhttp-foundation%2FFile%2FMimeType%2FMimeTypeGuesser.php%22%3Bs%3A4%3A%22line%22%3Bi%3A18%3B%7D%7D',
  'X-Drupal-Assertion-2' => 'a%3A3%3A%7Bi%3A0%3BO%3A25%3A%22Drupal%5CCore%5CRender%5CMarkup%22%3A1%3A%7Bs%3A9%3A%22%00%2A%00string%22%3Bs%3A181%3A%22The%20%22Symfony%5CComponent%5CHttpFoundation%5CFile%5CMimeType%5CFileBinaryMimeTypeGuesser%22%20class%20is%20deprecated%20since%20Symfony%204.3%2C%20use%20%22Symfony%5CComponent%5CMime%5CFileBinaryMimeTypeGuesser%22%20instead.%22%3B%7Di%3A1%3Bs%3A24%3A%22User%20deprecated%20function%22%3Bi%3A2%3Ba%3A3%3A%7Bs%3A8%3A%22function%22%3Bs%3A9%3A%22include%28%29%22%3Bs%3A4%3A%22file%22%3Bs%3A86%3A%22%2Fopt%2Fdrupal%2Fvendor%2Fsymfony%2Fhttp-foundation%2FFile%2FMimeType%2FFileBinaryMimeTypeGuesser.php%22%3Bs%3A4%3A%22line%22%3Bi%3A18%3B%7D%7D',
  'X-Drupal-Assertion-3' => 'a%3A3%3A%7Bi%3A0%3BO%3A25%3A%22Drupal%5CCore%5CRender%5CMarkup%22%3A1%3A%7Bs%3A9%3A%22%00%2A%00string%22%3Bs%3A177%3A%22The%20%22Symfony%5CComponent%5CHttpFoundation%5CFile%5CMimeType%5CFileinfoMimeTypeGuesser%22%20class%20is%20deprecated%20since%20Symfony%204.3%2C%20use%20%22Symfony%5CComponent%5CMime%5CFileinfoMimeTypeGuesser%22%20instead.%22%3B%7Di%3A1%3Bs%3A24%3A%22User%20deprecated%20function%22%3Bi%3A2%3Ba%3A3%3A%7Bs%3A8%3A%22function%22%3Bs%3A9%3A%22include%28%29%22%3Bs%3A4%3A%22file%22%3Bs%3A84%3A%22%2Fopt%2Fdrupal%2Fvendor%2Fsymfony%2Fhttp-foundation%2FFile%2FMimeType%2FFileinfoMimeTypeGuesser.php%22%3Bs%3A4%3A%22line%22%3Bi%3A18%3B%7D%7D',
  'Cache-Control' => 'must-revalidate, no-cache, private',
  'X-Drupal-Dynamic-Cache' => 'MISS',
  'Link' => '<http://localhost/node/2>; rel="canonical";<http://localhost/node/2>; rel="shortlink";<http://localhost/node/2/delete>; rel="delete-form";<http://localhost/admin/content/node/delete?node=2>; rel="delete-multiple-form";<http://localhost/node/2/edit>; rel="edit-form";<http://localhost/node/2/revisions>; rel="version-history";<http://localhost/node/2>; rel="revision"',
  'X-UA-Compatible' => 'IE=edge',
  'Content-language' => 'en',
  'X-Content-Type-Options' => 'nosniff',
  'X-Frame-Options' => 'SAMEORIGIN',
  'X-Drupal-Cache-Tags' => 'http_response node:1 node:2 node_view rendered user:2 user_view',
  'X-Drupal-Cache-Contexts' => 'languages:language_interface theme timezone url.query_args:_wrapper_format user.permissions user.roles:anonymous',
  'Expires' => 'Sun, 19 Nov 1978 05:00:00 GMT',
  'X-Generator' => 'Drupal 9 (',
  'Vary' => 'Accept-Encoding',
  'Transfer-Encoding' => 'chunked',
  'Content-Type' => 'text/html; charset=UTF-8',

How can I invoke hook_menu_local_tasks_alter from a functional test?

functional programming – Doesn’t “Always test through the public interface” contradict testing of individual composed functions?

I’m currently reading “Composing Software” by Eric Elliott, which is about functional programming in JavaScript. He states that if you compose multiple functions together, and that these functions have been fully tested in isolation – then you don’t need to unit test the composed function (as that can be done using an integrated test that performs all the side effects.)

But isn’t simply testing the individual functions violating the core TDD principle of “always test the public inteface, and not the implementation”? Arguably the composing of the smaller functions is an implementation detail. As long as my service performs the action that it says it will do, we shouldn’t really care about the small “private” functions being composed in order to get the right behaviour.

I’m trying to reconcile the two ideas but I’m struggling. The only way around this (that I can think of) is to mock the dependencies that my service needs so that it can be tested through the public interface, but going functional was my attempt to stop using mocks in the first place.

integration – Calculate the Euler-Lagrange for a functional with two nested integrals?

I’ve been reading papers about a fairly unknown topic in quantum mechanics called the quantum backflow effect. And in many of the papers they find an eigen value problem corresponding to the maximal amount of backflow. I understand all of the proof except from the last step in which they find the Euler-Lagrange of a functional ($I(phi)$) to maximise it.

$$I(phi) = int^infty_0{int^infty_0{phi^*(p)K(p,q)phi(q)dp}dq} – lambdaint^infty_0{phi^*(p)phi(p)dp}$$

Is the functional to be maximised and the Euler-Lagrange is

$$int^infty_0{K(p,q)phi(q)dq} = lambdaphi(p).$$

Although none of the papers explain why this is the case and I’ve been searching the internet for how to solve a problem in this form for days and can’t seem to find anything. If anyone knows why this is the Euler-Lagrange of $I(phi)$ any help would be greatly appreciated. Thanks in advance.

calculus of variations – Find the extremal of the functional int_{0.5}^1(e^y+xy’)dx with y(0)=0 and y'(1)=0

Thanks for contributing an answer to Mathematics Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

fa.functional analysis – Trying to recover a proof of the spectral mapping theorem from old thesis/paper with continuous functional calculus

In my research group in functional analysis and operator theory (where we do physics and computer science as well), we saw in an old Russian combination paper/PhD thesis in our library a nice claim about the spectral mapping theorem’s possible proof. Let me attempt to bring the context here. I should mention there are some nice results in this paper that I wanted to use and generalize for my own research, I hope to accurately bring the context below.

They bring up the continuos functional calculus $phi: C(sigma(A)) rightarrow L(H)$ for a bounded, self-adjoint operator on a Hilbert space A. This is an algebraic *-homomorphism from the continuous functions on the spectrum of $A$ to the bounded operators on $H$. The paper’s spectral mapping theorem basically says in this context $$ sigma(phi(f)) =f(sigma(A)) $$ and the paper says something nice about this. It does not actually give a proof but it says there is a nice way to prove it using both inclusions with the inclusion $ f(sigma(A)) subseteq sigma(phi(f)) $ sketched in the following way: the author supposes $ lambda in f(sigma(A)) $ and says “it is very obvious” that there exists a vector $h in H$ with $|h|=1$ such that $|phi(f)-lambda)h|$ is arbitrarily small which shows $lambda in sigma(phi(f))$ which shows the desired inclusion.

The author says that it is “very obvious” to show this but I am a bit stumped. The way I would construct the continuous functional calculus is to start with polynomials and then generalize to $ C(sigma(A)) $ based on the Weierstrass approximation theorem on the real compact set $sigma(A)$ and the BLT theorem. The inclusion $sigma(phi(f)) subseteq f(sigma(A))$ is, I think, quite obvious but the other one in the above context has me stumped. Since I am already working on generalizing some results, I would really love to know how the author proves the inclusion with the method of showing the mentioned vector exists. Maybe use approximation in some way, but even though I suspect it is simple, I still do not see the author’s proposed proof. Can someone here please help me recover it? I thank all interested persons.