Mining logical circuits in fungi

Living substrates are capable for nontrivial mappings of electrical signals due to the substrate nonlinear electrical characteristics. This property can be used to realise Boolean functions. Input logical values are represented by amplitude or frequency of electrical stimuli. Output logical values are decoded from electrical responses of living substrates. We demonstrate how logical circuits can be implemented in mycelium bound composites. The mycelium bound composites (fungal materials) are getting growing recognition as building, packaging, decoration and clothing materials. Presently the fungal materials are passive. To make the fungal materials adaptive, i.e. sensing and computing, we should embed logical circuits into them. We demonstrate experimental laboratory prototypes of many-input Boolean functions implemented in fungal materials from oyster fungi \emph{P. ostreatus}. We characterise complexity of the functions discovered via complexity of the space-time configurations of one-dimensional cellular automata governed by the functions. We show that the mycelium bound composites can implement representative functions from all classes of cellular automata complexity including the computationally universal. The results presented will make an impact in the field of unconventional computing, experimental demonstration of purposeful computing with fungi, and in the field of intelligent materials, as the prototypes of computing mycelium bound composites.


Introduction
The fungi are one of the largest, the oldest, most adaptive and widely distributed group of organisms [9]. Smallest fungi are single cells. The largest mycelium spreads in hectares [46]. 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 biomaterials [26,25,10,1]. They are already used in acoustic [40,15,41] and thermal [52,51,19,14,49,8] insulation panels and cladding, materials for packaging [21,45,36] and wearables [2,44,26,4,24]. 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.
Fungal colonies are characterised by rich typology of mycelium networks [20,18,16,17,23] in some cases similar to fractal structures [37,39,7,31,6,38]. 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 in [3,43]. 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 computing [48,28,11,27,12] and in materio computing [32,33,47,34,35] 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 ± 0.5°and relative humidity of air 40 ± 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 mV to 175 mV with step 5 mV, for each input state, 0000 to 1111.
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 nontrivial gate was A + B + C + D, n = 145. The top 16 occurring non-trivial

Count
Boolean function 145 Let us discuss complexity of the functions discovered (Tab. 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 de-   pending 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 ∈ Z, updates its state at time t as a function of states of its four neighbours: . To map functions from Tab. 1 to the rules governing the cellular automata we assume that A corresponds to For example, a cell x i of cellular automaton governed by the function F 5 (Tab. 1) updates its state as 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 compression [42,22,13] is a variation of the classical Lempel-Ziv 1977 algorithm [53]. 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 (Tab. 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 Tab. 1 in the Wolfram classification [50] of cellular automaton behaviour. Functions F 1 , F 6 , F 8 , F 9 and F 1 1 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. [30,29].

Discussion
Mycelium bound composites transform electrical signals in a non-linear manner due to mem-fractive and capacitive properties of the fungal tissue [5]. 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. 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.

Acknowledgement
This project has received funding from the European Union's Horizon 2020 research and innovation programme FET OPEN "Challenging current thinking" under grant agreement No 858132.