aboutsummaryrefslogtreecommitdiff
path: root/src/Reflection/ApplicationRelations.v
blob: 9a1daa97e215fb18b8a9d2ced80ee0dc446a614c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Require Import Crypto.Reflection.Syntax.
Require Import Crypto.Reflection.Application.

Section language.
  Context {base_type1 base_type2 : Type}
          {interp_base_type1 : base_type1 -> Type}
          {interp_base_type2 : base_type2 -> Type}
          {op1 : flat_type base_type1 -> flat_type base_type1 -> Type}
          {op2 : flat_type base_type2 -> flat_type base_type2 -> Type}
          {interp_op1 : forall src dst, op1 src dst -> interp_flat_type interp_base_type1 src -> interp_flat_type interp_base_type1 dst}
          {interp_op2 : forall src dst, op2 src dst -> interp_flat_type interp_base_type2 src -> interp_flat_type interp_base_type2 dst}
          (R : forall t1 t2, interp_base_type1 t1 -> interp_base_type2 t2 -> Prop).

  Fixpoint rel_interp_all_binders_for' {t1 : type base_type1} {t2 : type base_type2}
    : interp_all_binders_for' t1 interp_base_type1 -> interp_all_binders_for' t2 interp_base_type2 -> Prop
    := match t1, t2 return interp_all_binders_for' t1 _ -> interp_all_binders_for' t2 _ -> Prop with
       | Tflat T1, Tflat T2 => fun _ _ => True
       | Arrow A1 B1, Arrow A2 B2
         => fun x y => R _ _ (fst x) (fst y) /\ @rel_interp_all_binders_for' _ _ (snd x) (snd y)
       | Tflat _, _
       | Arrow _ _, _
         => fun _ _ => False
       end.
  Definition rel_interp_all_binders_for {t1 : type base_type1} {t2 : type base_type2}
             (x : interp_all_binders_for t1 interp_base_type1) (y : interp_all_binders_for t2 interp_base_type2)
    : Prop
    := rel_interp_all_binders_for' (interp_all_binders_for_to' x) (interp_all_binders_for_to' y).
End language.