(* Definition of the Clifford dual with the geometric product *)
(* Direct (in terms of binary trees) definition of the Clifford dual *)
Fixpoint cliff_starb n b : kn n -> vect n -> vect n :=
match n return kn n -> vect n ->  vect n with
|    0 => fun _ a => a
| S n1 => fun l v =>
let b1 := negb b in
let (c, l1) := l in
let  (x, y) := v in
((if b then c else (-c)%f) .* cliff_starb n1 b1 l1 y,
(c * c)%f .* cliff_starb n1 b1 l1 x)
end.
(* Actual definition of Clifford dual *)
Definition cliff_star n l := cliff_starb n true l.

(* Specifications: *)
(* OK usual definition and direct definition match *)
Lemma cdual_cliff n l x : cdual n l x = cliff_star n l x.
Fixpoint l_contra (n : nat) : kn n -> vect n -> vect n -> vect n :=
match n return (kn n -> vect n -> vect n -> vect n) with
| 0%nat => fun _ x y => (x * y)%f
| S n1 =>
fun l x y =>
let (k, l1) := l in
let (x1, x2) := x in
let (y1, y2) := y in
(l_contra n1 l1 (x2^_'f) y1,
k .*  l_contra n1 l1 (x1^_'f) y1 + l_contra n1 l1 x2 y2)
end.