title: check/2 predicate in prolog that will have sorted list of lists
body: <p>I am new to prolog and I am trying to create a simple predicate which will have sorted list of lists from a unsorted list of lists. check(A,B).</p>
  
  <pre><code>check( [ [], [1], [1,1] ], [ [], [1,1], [1] ] ). returns true
  check( [ [], [1], [1,1] ], [ [1,1], [1] ] ). returns false.
  </code></pre>
  
  <p>Note that even if A is sorted it should only contain elements from B and not anything more or less.</p>
  
  <p>How do I implement this without any built in prolog predicates? </p>