<m:mrow>
<m:mtext mathcolor="Red">We can prove</m:mtext>
<m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[position()=3]"/>
+ <!-- the last child is either the expected type, if provided,-->
+ <!-- or the synthesized type. -->
+ <xsl:apply-templates select="*[position()=last()]"/>
<m:mrow>
<m:mphantom><m:mtext>_</m:mtext></m:mphantom>
<m:mtext mathcolor="Green">(explain)</m:mtext>
</m:mrow>
</m:mtd>
</m:mtr>
+ <xsl:variable name="hidedetails">
+ <m:mrow>
+ <m:mphantom>
+ <m:mtext>_</m:mtext>
+ </m:mphantom>
+ <xsl:if test="$test">
+ <m:mtext mathcolor="Green">(hide details)</m:mtext>
+ </xsl:if>
+ </m:mrow>
+ </xsl:variable>
<m:mtr>
<m:mtd>
<m:mrow>
<m:mtext mathcolor="Red">we proved</m:mtext>
<m:mphantom><m:mtext>_</m:mtext></m:mphantom>
<xsl:apply-templates select="*[position()=3]"/>
- <m:mrow>
- <m:mphantom>
- <m:mtext>_</m:mtext>
- </m:mphantom>
- <xsl:if test="$test">
- <m:mtext mathcolor="Green">(hide details)</m:mtext>
- </xsl:if>
- </m:mrow>
+ <xsl:if test="not(*[4])">
+ <xsl:copy-of select="$hidedetails"/>
+ </xsl:if>
</m:mrow>
</m:mtd>
</m:mtr>
+ <xsl:if test="*[4]">
+ <m:mtr>
+ <m:mtd>
+ <m:mrow>
+ <m:mtext mathcolor="Red">that is equivalent to</m:mtext>
+ <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+ <xsl:apply-templates select="*[position()=4]"/>
+ <xsl:copy-of select="$hidedetails"/>
+ </m:mrow>
+ </m:mtd>
+ </m:mtr>
+ </xsl:if>
</m:mtable>
</xsl:variable>
<xsl:choose>
<m:mrow>
<m:mtext mathcolor="Red">We can prove</m:mtext>
<m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <xsl:apply-templates select="*[position()=3]"/>
+ <!-- the last child is either the expected type, if provided,-->
+ <!-- or the synthesized type. -->
+ <xsl:apply-templates select="*[position()=last()]"/>
<m:mrow>
<m:mphantom><m:mtext>_</m:mtext></m:mphantom>
<m:mtext mathcolor="Green">(explain)</m:mtext>
</m:mrow>
</m:mtd>
</m:mtr>
+ <xsl:variable name="hidedetails">
+ <m:mrow>
+ <m:mphantom>
+ <m:mtext>_</m:mtext>
+ </m:mphantom>
+ <xsl:if test="$test">
+ <m:mtext mathcolor="Green">(hide details)</m:mtext>
+ </xsl:if>
+ </m:mrow>
+ </xsl:variable>
<m:mtr>
<m:mtd>
<m:mrow>
<m:mtext mathcolor="Red">we proved</m:mtext>
<m:mphantom><m:mtext>_</m:mtext></m:mphantom>
<xsl:apply-templates select="*[position()=3]"/>
- <m:mrow>
- <m:mphantom>
- <m:mtext>_</m:mtext>
- </m:mphantom>
- <xsl:if test="$test">
- <m:mtext mathcolor="Green">(hide details)</m:mtext>
- </xsl:if>
- </m:mrow>
+ <xsl:if test="not(*[4])">
+ <xsl:copy-of select="$hidedetails"/>
+ </xsl:if>
</m:mrow>
</m:mtd>
</m:mtr>
+ <xsl:if test="*[4]">
+ <m:mtr>
+ <m:mtd>
+ <m:mrow>
+ <m:mtext mathcolor="Red">that is equivalent to</m:mtext>
+ <m:mphantom><m:mtext>_</m:mtext></m:mphantom>
+ <xsl:apply-templates select="*[position()=4]"/>
+ <xsl:copy-of select="$hidedetails"/>
+ </m:mrow>
+ </m:mtd>
+ </m:mtr>
+ </xsl:if>
</m:mtable>
</xsl:variable>
<xsl:choose>