Skip to content

Commit 026f87b

Browse files
authored
Add related_hetero_and_Proper (#128)
For mit-plv/fiat-crypto#1761
1 parent c45abd0 commit 026f87b

File tree

2 files changed

+388
-8
lines changed

2 files changed

+388
-8
lines changed

src/Rewriter/Language/Language.v

+20-8
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,26 @@ Module Compilers.
100100
| arrow s d => respectful_hetero _ _ _ _ (@related_hetero _ _ _ R s) (fun _ _ => @related_hetero _ _ _ R d)
101101
end%signature.
102102

103+
Fixpoint related_hetero_and_Proper {skip_base : bool} {base_type} {base_interp1 base_interp2 : base_type -> Type}
104+
(R1 : forall t, relation (base_interp1 t))
105+
(R2 : forall t, relation (base_interp2 t))
106+
(R : forall t, base_interp1 t -> base_interp2 t -> Prop) {t : type base_type}
107+
: interp base_interp1 t -> interp base_interp2 t -> Prop
108+
:= match t return interp base_interp1 t -> interp base_interp2 t -> Prop with
109+
| base t
110+
=> fun f1 f2
111+
=> if skip_base
112+
then R t f1 f2
113+
else Proper (R1 _) f1
114+
/\ Proper (R2 _) f2
115+
/\ R t f1 f2
116+
| arrow s d
117+
=> fun f1 f2
118+
=> Proper (related R1) f1
119+
/\ Proper (related R2) f2
120+
/\ respectful_hetero _ _ _ _ (@related_hetero_and_Proper skip_base _ _ _ R1 R2 R s) (fun _ _ => @related_hetero_and_Proper skip_base _ _ _ R1 R2 R d) f1 f2
121+
end%signature.
122+
103123
Fixpoint related_hetero3 {base_type} {base_interp1 base_interp2 base_interp3 : base_type -> Type}
104124
(R : forall t, base_interp1 t -> base_interp2 t -> base_interp3 t -> Prop) {t : type base_type}
105125
: interp base_interp1 t -> interp base_interp2 t -> interp base_interp3 t -> Prop
@@ -166,14 +186,6 @@ Module Compilers.
166186

167187
Notation is_not_higher_order := (@is_not_higher_order_than 1).
168188

169-
Lemma eqv_of_is_not_higher_order {base_type base_interp t}
170-
(H : is_not_higher_order t = true)
171-
: forall v, Proper (@related base_type base_interp (fun _ => eq) t) v.
172-
Proof.
173-
cbv [Proper]; induction t; cbn; eauto; try apply HR; repeat intro; cbn in *.
174-
cbv [is_base Proper] in *; break_innermost_match_hyps; cbn in *; subst; try congruence; eauto.
175-
Qed.
176-
177189
Section interpM.
178190
Context {base_type} (M : Type -> Type) (base_interp : base_type -> Type).
179191
(** half-monadic denotation function; denote [type]s into their

0 commit comments

Comments
 (0)