| 1 |
Global Set Asymmetric Patterns. |
| 2 |
Inductive type := base | arrow (s d : type). |
| 3 |
Fixpoint for_each_lhs_of_arrow (f : Type) (t : type) : Type |
| 4 |
:= match t with |
| 5 |
| base => unit |
| 6 |
| arrow s d => f * @for_each_lhs_of_arrow f d |
| 7 |
end. |
| 8 |
Inductive expr {var : Type} : type -> Type := |
| 9 |
| Var {t} (v : var) : expr t |
| 10 |
| Abs {s d} (f : var -> expr d) : expr (arrow s d) |
| 11 |
. |
| 12 |
Class parameters := {}. |
| 13 |
Record rep {p : parameters} := {}. |
| 14 |
Axiom listZ_local : forall {p}, @rep p. |
| 15 |
Axiom p : parameters. |
| 16 |
#[export] Existing Instance p. |
| 17 |
Axiom cmd : forall {p : parameters}, Type. |
| 18 |
Axiom ltype : forall {p : parameters} {listZ : @rep p}, Type. |
| 19 |
Axiom translate_cmd |
| 20 |
: forall {p : parameters} |
| 21 |
(e : expr (var:=@ltype p (@listZ_local p)) base), |
| 22 |
cmd. |
| 23 |
Axiom admit : forall {T}, T. |
| 24 |
Existing Class rep. |
| 25 |
Fixpoint translate_func' (pv:=_) {t} (e : @expr ltype t) |
| 26 |
: for_each_lhs_of_arrow ltype t -> @cmd pv := |
| 27 |
match e with |
| 28 |
| Abs base d f => |
| 29 |
fun (args : _ * for_each_lhs_of_arrow _ d) => |
| 30 |
translate_func' (f (fst args)) (snd args) |
| 31 |
| Var base v => |
| 32 |
fun _ => translate_cmd (Var v) |
| 33 |
| _ => fun _ => admit |
| 34 |
end. |
| 35 |
(* Used to be: File "./bug_01.v", line 30, characters 30-31: |
| 36 |
Error: Cannot infer this placeholder of type "parameters" (no type class |
| 37 |
instance found).*) |