1

Coq is version 8.10.2 and I use category-theory library made by jwiegley.

I want to define Category whose objects are Euclidean spaces and arrows are Parametrised function (P -> A -> B) between Objects A and B. parameter P is arbitrary Euclidean space but not object of Category.

I wrote this code. Definition of Category Class is here

Require Import Coq.Reals.Reals.
Require Import Category.Theory.

Inductive Euc:nat -> Type:=
|RO : Euc 0
|Rn : forall n:nat, R -> Euc n -> Euc (S n).

Record SuperEuc := {
dim : nat;
}.

Program Instance Para :Category:= {
obj := SuperEuc;
hom := fun A B:SuperEuc => forall {P:SuperEuc}, Euc (dim P) -> Euc (dim A) -> Euc (dim B);

compose := fun A B C I J {P:SuperEuc} (p:Euc (dim P)) (a:Euc (dim A)) {Q:SuperEuc} (q:Euc (dim Q))
                                        => J _ q ((I _ p) a);
}.

The error message is this.

The type of this term is a product while it is expected to be (Euc (dim C)).

I want to pass the two parameters of different Euclidean spaces to I and J like this.

compose := fun A B C I J {P:SuperEuc} (p:Euc (dim P)) (a:Euc (dim A)) {Q:SuperEuc} (q:Euc (dim Q))
                                    => J _ q ((I _ p) a);

But in fact, compose accepts only one parameter like this.

compose := fun A B C I J {P:SuperEuc} (p:Euc (dim P)) (a:Euc (dim A))
                                    => J _ p (I _ p a);

Why does compose accept only one parameter? How do I fix it?

Daisuke Sugawara
  • 311
  • 4
  • 20
  • This doesn't seem right. A `SuperEuc` is a dimensionality `n` (`: nat`) and a *point* in the Euclidean space `E^n` (`: Euc n`). With `obj := SuperEuc`, the set of objects of your category is the disjoint union of the set of points of all the Euclidean spaces; i.e. you have `obj := list R`. If the objects are supposed to be Euclidean spaces, then wouldn't you just want `obj := nat`, where each object `n : nat` represents `Euc n`? Or are the spaces pointed? `P` would be `: nat` in `hom`, and I think you need `sigT`, not `forall`, and I think you'd need to do some addition/splitting in `compose`. – HTNW Aug 10 '20 at 20:58
  • The objects of my category must be Euclidean spaces, not a natural number. I want to formalize my category as in which objects are Euclidean space. – Daisuke Sugawara Aug 11 '20 at 00:06
  • And now I delete "EucType :> Euc dim" from SuperEuc. – Daisuke Sugawara Aug 11 '20 at 00:13

2 Answers2

1

I believe what you really want is this

Fixpoint split_Euc {n m : nat} (xi : Euc (n + m)) : Euc n * Euc m.
Proof.
  destruct n as [ | n].
  - exact (RO, xi).
  - inversion_clear xi as [ | ? x0 xi'].
    apply split_Euc in xi' as [l r].
    exact (Rn _ x0 l, r).
Defined.
Program Definition Para : Category := {|
  obj := nat;
  hom n m := {p : nat & Euc p -> Euc n -> Euc m};
  homset n m := {| Setoid.equiv := eq |}; (* Using eq requires some axioms (funext, I think) *)
  id n := existT _ 0 (fun _ x => x);
  compose n m l ml nm :=
    let (ml_p, ml) := ml in let (nm_p, nm) := nm in
    existT
      _ (nm_p + ml_p)
      (fun pi xi =>
        let (nm_pi, ml_pi) := split_Euc pi in
        ml ml_pi (nm nm_pi xi));
|}.

obj should not be thought of as representing the actual objects. obj should be the type of the labels of the objects of your category. Each Euclidean space E^n appears once inside Para, corresponding to the nat n. Also, I think your quantifier in hom was wrong. Your word "arbitrary" was not very clear, but the way you had it, an arrow from E^n to E^m was an infinity of functions Euc p -> Euc n -> Euc m, one for each p. I think you actually wanted an arrow to be one function for a single p. Composition then enlarges the "extra" argument to the cartesian product of the extra argument demanded by the composing arrows and splits that argument among them.

HTNW
  • 27,182
  • 1
  • 32
  • 60
0

You probably need to replace compose by this:

compose := fun A B C I J {P:SuperEuc} (p:Euc (dim P)) (a:Euc (dim A)) 
                                    => J p ((I p) a);
Arthur Azevedo De Amorim
  • 23,012
  • 3
  • 33
  • 39