Documentation

PfsProgs25.Unit10.Half

structure Half (n : ) :
  • val :
  • isHalf : self.val + self.val = n
Instances For
    instance instReprHalf {n✝ : } :
    Repr (Half n✝)
    Equations
    • instReprHalf = { reprPrec := reprHalf✝ }
    def half? (n : ) :
    Equations
    Instances For

      Option is a monad. We can use do notation to simplify the code.

      Equations
      • OneAndAHalf n = do let __discrhalf? n match __discr with | { val := m, isHalf := isHalf } => pure (3 * m)
      Instances For
        def quarter (n : ) :
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          def quarterWithProof (n : ) :
          Option { k : // k + k + k + k = n }
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            def half?' (n? : Option ) :
            Equations
            • half?' n? = do let nn? let __discrhalf? n match __discr with | { val := m, isHalf := isHalf } => pure m
            Instances For
              def half! (n : ) :
              Equations
              Instances For