I have type
Variable l: list (a * b * option c * option d).
Variable ls : list (list l).
I would like to take the type option d from the head of the list and check the whole list after that. My code look like this:
Definition test (l: list (a * b * option c * option d)):=
match l with
| nil => ... (* not important *)
| (_,_,_,od) :: l' =>
match od with
| None => ... (* not important *)
| Some d => if forallb (fun li => forallb (fun ci => do_something ci d)) ls) l'
end
end.
My question is that the testing if forallb (fun li => forallb (fun ci =>do_something ci d))ls)l' I added forallb (fun li =>...)because I would like it test in the whole list l'. But I did not use the argument liat all.
EDIT: My question focus on the if forallb (fun li => forallb (fun ci => do_something ci d))ls)l'. I added forallb (fun li => because I would like to test on the rest of the list l'. Without forallb (fun li I can archive this test if (forallb (fun ci => do_something ci d))ls but I don’t know how to test this condition again in the list l'.
Your context is inconsistent.
Variable l : …
make that l is a list
Variable ls : list (list l).
assume that l is a type.
Maybe you meant:
Definition l := list (a * b * option c * option d).
Variable ls := list (list l).
This makes ls to be a list of list of lists (like a three-dimensional array).
Now, assuming that you meant do_something to have type l -> d -> bool
I guess you wanted to test do_something with all elements of type l in ls and all elements of type d in the argument of test (also called l, yuck).
you should have
…
|Some d => if forallb (fun li => forallb (fun ci => do_something ci d)) ls then test l’ else false
…
But frankly, your question leaves to much for the answerer to guess!