Documentation

Bookshelf.Avigad.Chapter_2

Avigad.Chapter2 #

Dependent Type Theory

Exercise 1 #

Define the function Do_Twice, as described in Section 2.4.

Equations
Instances For
    def Avigad.Chapter2.ex1.doTwiceTwice (f : (NatNat)NatNat) (x : NatNat) :
    NatNat
    Equations
    Instances For

      Exercise 2 #

      Define the functions curry and uncurry, as described in Section 2.4.

      def Avigad.Chapter2.ex2.curry {α : Type u_1} {β : Type u_2} {γ : Sort u_3} (f : α × βγ) :
      αβγ
      Equations
      Instances For
        def Avigad.Chapter2.ex2.uncurry {α : Type u_1} {β : Type u_2} {γ : Sort u_3} (f : αβγ) :
        α × βγ
        Equations
        Instances For

          Exercise 3 #

          Above, we used the example vec α n for vectors of elements of type α of length n. Declare a constant vec_add that could represent a function that adds two vectors of natural numbers of the same length, and a constant vec_reverse that can represent a function that reverses its argument. Use implicit arguments for parameters that can be inferred. Declare some variables nd check some expressions involving the constants that you have declared.

          Exercise 4 #

          Similarly, declare a constant matrix so that matrix α m n could represent the type of m by n matrices. Declare some constants to represent functions on this type, such as matrix addition and multiplication, and (using vec) multiplication of a matrix by a vector. Once again, declare some variables and check some expressions involving the constants that you have declared.