-(* single = is for the abstract equality of setoids, == is for concrete
- equalities (that may be lifted to the setoid level when needed *)
-notation < "hvbox(a break mpadded width -50% (=)= b)" non associative with precedence 45 for @{ 'eq_low $a $b }.
-notation > "a == b" non associative with precedence 45 for @{ 'eq_low $a $b }.
-
-
-(* XXX move to lists.ma *)
-ninductive list (A:Type[0]) : Type[0] ≝
- | nil: list A
- | cons: A -> list A -> list A.
-
-nlet rec eq_list (A : setoid) (l1, l2 : list A) on l1 : CProp[0] ≝
-match l1 with
-[ nil ⇒ match l2 return λ_.CProp[0] with [ nil ⇒ True | _ ⇒ False ]
-| cons x xs ⇒ match l2 with [ nil ⇒ False | cons y ys ⇒ x = y ∧ eq_list ? xs ys]].
-
-interpretation "eq_list" 'eq_low a b = (eq_list ? a b).
-
-ndefinition LIST : setoid → setoid.
-#S; @(list S); @(eq_list S);
-##[ #l; nelim l; //; #; @; //;
-##| #l1; nelim l1; ##[ #y; ncases y; //] #x xs H y; ncases y; ##[*] #y ys; *; #; @; /2/;
-##| #l1; nelim l1; ##[ #l2 l3; ncases l2; ncases l3; /3/; #z zs y ys; *]
- #x xs H l2 l3; ncases l2; ncases l3; /2/; #z zs y yz; *; #H1 H2; *; #H3 H4; @; /3/;##]
-nqed.
-
-alias symbol "hint_decl" (instance 1) = "hint_decl_Type1".
-unification hint 0 ≔ S : setoid;
- T ≟ carr S,
- P1 ≟ refl ? (eq0 (LIST S)),
- P2 ≟ sym ? (eq0 (LIST S)),
- P3 ≟ trans ? (eq0 (LIST S)),
- X ≟ mk_setoid (list S) (mk_equivalence_relation ? (eq_list T) P1 P2 P3)
-(*-----------------------------------------------------------------------*) ⊢
- carr X ≡ list T.
-
-unification hint 0 ≔ SS : setoid;
- S ≟ carr SS,
- TT ≟ setoid1_of_setoid (LIST SS)
-(*-----------------------------------------------------------------*) ⊢
- list S ≡ carr1 TT.
-
-unification hint 0 ≔ S:setoid,a,b:list S;
- R ≟ eq0 (LIST S),
- L ≟ (list S)
-(* -------------------------------------------- *) ⊢
- eq_list S a b ≡ eq_rel L R a b.
-
-alias symbol "hint_decl" (instance 1) = "hint_decl_CProp2".
-unification hint 0 ≔ S : setoid, x,y;
- SS ≟ LIST S,
- TT ≟ setoid1_of_setoid SS
-(*-----------------------------------------*) ⊢
- eq_list S x y ≡ eq_rel1 ? (eq1 TT) x y.
-
-notation "hvbox(hd break :: tl)"
- right associative with precedence 47
- for @{'cons $hd $tl}.
-
-notation "[ list0 x sep ; ]"
- non associative with precedence 90
- for ${fold right @'nil rec acc @{'cons $x $acc}}.
-
-notation "hvbox(l1 break @ l2)"
- right associative with precedence 47
- for @{'append $l1 $l2 }.
-
-interpretation "nil" 'nil = (nil ?).
-interpretation "cons" 'cons hd tl = (cons ? hd tl).