  Simulink is a de-facto industrial standard for the design of embedded
systems. In previous work, we developed a compositional analysis framework for
Simulink models in Isabelle -- the Refinement Calculus of Reactive Systems
(RCRS), which allows checking compatibility and substitutability of components.
However, standard type checking was not considered in that work. In this paper
we present a method for the type inference of hierarchical block diagrams using
the Isabelle theorem prover. A Simulink diagram is translated into an (RCRS)
Isabelle theory. Then the Isabelle's powerful type inference mechanism is used
to infer the types of the diagram based on the types of the basic blocks. One
of the aims is to handle formally as many diagrams as possible. In particular,
we want to be able to handle even those diagrams that may have typing
ambiguities, provided that they are accepted by Simulink. This method is
implemented in our toolset that translates Simulink diagrams into Isabelle
theories and simplifies them. We evaluate our technique on several case
studies, most notably, an automotive fuel control system benchmark provided by
Toyota.
