Lectures in pattern theory