Introduction

The fungi are one of the largest, the oldest, most adaptive and widely distributed group of organisms1. Smallest fungi are single cells. The largest mycelium spreads in hectares2. When growing in a bulk medium of wood or plant shavings fungi bind the medium in a solid monolith with outstanding mechanical properties. The mycelium bound composites are seen as future environmentally sustainable growing biomaterials3,4,5,6. They are already used in acoustic7,8,9 and thermal10,11,12,13,14,15 insulation panels and cladding, materials for packaging16,17,18 and wearables3,19,20,21,22. The currently used fungal materials are passive and inert because the fungi in the composites are dead and treated to prevent decay. To make the fungal materials adaptive and intelligent we must either (1) leave part of the fungal materials alive, or (2) dope the materials with functional nanoparticles and polymers. In the present paper we explore the first option of sensing and computing with living mycelium.

Why do we need to compute with fungi? The research is undertaken in the frame for the FUNGAR (www.fungar.eu), acronym for Fungal Architectures, a EU Horizon 2020 research project that seeks to develop a fully integrated structural and computational living monolith by using fungal mycelium. The goal, to advance towards the realisation of full-scale intelligent bio-buildings and other functional bio-structures. Distributions of Boolean gates depends on environmental and physiological conditions of the mycelium bound composites and therefore will provide a computational characterisation of the fungal material states. This distribution of logical functions will be somewhat analogous to Kolmogorov complexity of the living building materials.

Fungal colonies are characterised by rich typology of mycelium networks23,24,25,26,27 in some cases similar to fractal structures28,29,30,31,32,33. Rich morphological features might imply rich computational abilities and thus worth to analyse from a realising Boolean functions point of view. To implement logical functions we adopted a theoretical approach developed in34,35. The technique is based on selecting a pair of input sites, applying all possible combinations of inputs, where logical values are represented by electrical characteristics of input signals, to the sites and recording outputs, represented by electrical responses of the substrate, on a set of the selected output sites. The approach belong to the family of reservoir computing36,37,38,39,40 and in materio computing41,42,43,44,45 techniques of analysing computational properties of physical and biological substrates.

The paper is structured as follows. First, the experimental setup will be described, then the procedure for data gathering and analysis will be outlined.

Methods

A hemp shavings substrate was colonised by the mycelium of the grey oyster fungi, P. ostreatus (Ann Miller’s Speciality Mushrooms Ltd, UK). Recordings were carried out in a stable indoor environment with the temperature remaining stable at $$22 \pm 0.5$$°and relative humidity of air $$40 \pm 5$$%. The humidity of the substrate colonised by fungi was kept at c. 70-80%.

Hardware was developed that was capable of sending sequences of 4 bit strings to a mycelium substrate. The strings were encoded as step voltage inputs where -5 V denoted a logical 0 and 5 V a logical 1. The hardware was based around an Arduino Mega 2560 (Elegoo, China) and a series of programmable signal generators, AD9833 (Analog, USA). The 4 input electrodes were 1 mm diameter platinum rods inserted to a depth of 50 mm in the substrate in a straight line with a separation of 20 mm. Data acquisition (DAQ) probes were placed in a parallel line 50 mm away separated by 10 mm. The electron sink and source was placed 50 mm on from DAQ probes. There were 7 DAQ differential inputs from the mycelium substrate to a Pico 24 (Pico Technology, UK) analogue-to-digital converter (ADC), the 8th channel was used to pass a pulse to the ADC on every input state change, see Fig. 1 for a schematic of the apparatus. The substrate and probes were placed in a semi-sealed container. After each experimental repeat the substrate was sprayed with water, left for an hour and then the next repeat was conducted. There were a total of 14 repeats.

A sequence of 4 bit strings counting up from binary 0000 to 1111, with a state change every hour, were passed into the substrate, see Fig. 2 for timing details. In all 14 repeats of the experiment were done on the same substrate to capture changes in structure of the growing mycelium. Samples from 7 channels were taken at 1 Hz over the whole duration of a given experimental run. Peaks for each channel were located for a set of 32 thresholds, from 20 to 175 mV with step 5 mV, for each input state, 0000 to 1111.

The voltage spiking events occur at the scale of seconds usually during state transitions which happen every hour which is in line with the decay time after a spike. Boolean strings were extracted from the data, where a logic “1” was noted for a channel if it had a peak outside the threshold band for a particular state else, a value of “0” was recorded, the polarity of the peak was not considered.

The strings for each experimental repeat were stored in their respective Boolean table. To extract state graphs, a state/node was defined as the string of output values from each channel at each input state, transitions/edges were defined as a change in input state. This led to a total of 448 state graphs. The sum of products (SOP) Boolean functions were calculated for each output channel. For each repeat there were 7 channels and 32 thresholds giving total of 3136 individual truth tables.

See Fig. 3 for SOP extraction. If a peak is found in Fig. 3a during an input state then this is considered a logical 1, highlighted in yellow in table Fig. 3b are the thresholded values for channel 5, the resulting truth table is then reduced to a sum products shown below the table.

Results

We have discovered total of 3136 4-inputs-1-output Boolean functions. 470 unique functions are presented in Supplementary Materials. Figure 4 shows the Boolean function distribution. The two peak values were logical False, $$n=238$$, and logical True, $$n=237$$. The highest occurring non-trivial gate was $${\overline{A}}+{\overline{B}}+{\overline{C}}+{\overline{D}}$$, $$n=145$$. The top 16 occurring non-trivial Boolean functions are listed in Table 1. The only single gate functions found were for nand ($${\overline{A}}+{\overline{B}}+{\overline{C}}+{\overline{D}}$$), $$n=145$$, or ($$A+B+C+D$$), $$n=46$$, and and (ABCD), $$n=8$$.

Let us discuss complexity of the functions discovered (Table 1) via complexity of the space-time configurations of one-dimensional cellular automata governed by the functions. We consider an array Z of finite state machines, called cells, where every cell takes states ‘0’ or ‘1’ and updates its state depending on the states of its four immediate neighbours. All cells update their states by the same rule and in discrete time. For example, a cell with index i, $$x_i \in Z$$, updates its state at time t as a function of states of its four neighbours: $$x^{t+1}=f(x_{i-2}^t, x_{i-1}^t, x_{i+1}^t, x_{i+2}^t)$$. To map functions from Table 1 to the rules governing the cellular automata we assume that A corresponds to $$x_{i-2}^t$$, B to $$x_{i-1}^t$$, C to $$x_{i+1}^t$$ and D to $$x_{i+1}^t$$. For example, a cell $$x_i$$ of cellular automaton governed by the function $$F_5$$ (Table 1) updates its state as $$x^{t+1}= \overline{x_{i-2}}x_{i-1}+x_{i+1}\overline{x_{i+2}}+\overline{x_{i-2}}x_{i+2}$$.

Automaton governed by $$F_1$$, $$F_6$$, $$F_8$$ fall into absorbing state where all cells are in state ‘0’. The automaton governed by rule $$F_9$$ falls into the state where all cells are in state ‘1’. Space-time configurations, random initial conditions and absorbing boundaries, of automata governed by other rules are shown in Fig. 5. We characterise a complexity of the space-time patterns via Lempel-Ziv complexity (compressibility) LZ. The LZ complexity is evaluated by a size of concentration profiles saved as PNG files of the configurations. This is sufficient because the ’deflation’ algorithm used in PNG lossless compression46,47,48 is a variation of the classical Lempel–Ziv 1977 algorithm49. The frequency of the functions occurrence in the experimental circuit mining versus LZ complexity of the functions is shown in Fig. 6. We can see that there is no correlation between how often a function can be found and how complexity the function is. Thus, e.g. the function $$F_{13}$$ (Table 1) generates most complex space-time configuration (Fig. 5i) yet it is in the mid-range of the frequency of experimental occurrence. The less complex functions $$F_5$$, $$F_7$$, $$F_{12}$$, $$F_{15}$$ span the interval [29,55] counts of occurrences in experimental laboratory mining.

Let us consider positions of the functions Table 1 in the Wolfram classification50 of cellular automaton behaviour. Functions $$F_1$$, $$F_6$$, $$F_8$$, $$F_9$$ and $$F_11$$ belong to the class I, the class of automata exhibiting a dull dynamics and evolving to a stable state where all cells are in the same state. Functions $$F_2$$, $$F_7$$, $$F_{12}$$, $$F_{14}$$, $$F_{15}$$ belong to the class II: the automata fall into global cells do not update their state or update them cyclically from ‘0’ to ‘1’. Functions $$F_4$$, $$F_{10}$$ and $$F_{13}$$ belong to class III: the space-time dynamics is characterised by quasi-random behaviour and difficult predictability of the successions of the global states. These functions generate the most complex, as evaluated by LZ measure, space-time configurations. Function $$F_2$$ shows an interesting example of the function belonging to classes II and III. Two functions $$F_3$$ and $$F_{16}$$ belong to class IV: the space-time dynamics of automata show gliders (compact patterns translating in space) with non-trivial interactions between the gliders. The automata governed by rules $$F_3$$ and $$F_{16}$$ are computationally universal, because it is possible to implement an arbitrary logical circuit via collisions between the gliders, see e.g.51,52.

Discussion

Mycelium bound composites transform electrical signals in a non-linear manner due to mem-fractive and capacitive properties of the fungal tissue53. Whilst exact biophysical mechanisms of the signal transformation by the mycelium remain unknown we can explore the non-linear properties of this living substrate to implement logical circuits. In experimental laboratory studies we demonstrated that mycelium bound composites implement a wide range of Boolean circuits. Analyses of the functions extracted in terms of space-time dynamics of cellular automata helped us to order the functions in several classes of complexity and pinpoint the functions supporting a universal computation. It would be possible to concatenate outputs from the different channels to create another layer of logic gate outputs. The current study looked at single output systems via SOP but the potential of using multiple outputs in parallel is there.

The first ever prototype of the fungal reservoir computer, presented in the paper, demonstrates that a computation can be embedded into living materials. The research presented also pinpointed a high degree of variability in the logical circuits implemented by the fungi. This is because the live mycelium remain in the continuous process of growth and reconfiguration. To decrease the variability of the results we could consider to functionalise the mycelium networks with semi-conductive particles and polymers and allow the mycelium to dry. The resulting networks will have a permanent structure which will guarantee repeatability of the experimental circuits discovered. This will be a topic of our future studies.