Definition get_val_equiv_single_exception k (s s' : state) : Prop :=
  forall k', k' <> k -> get_val k' s = get_val k' s'.Definition get_val_equiv_double_exception k1 k2 (s s' : state) : Prop :=
  forall k', k' <> k1 -> k' <> k2 -> get_val k' s = get_val k' s'.Definition near_stable {X} (m : Poram X) k : Prop :=
  forall s, well_formed s -> poram_lift (state_equiv s) (get_val_equiv_single_exception k s) triv m.

Lemma state_equiv_trans : forall s1 s2 s3, state_equiv s1 s2 -> state_equiv s2 s3 -> state_equiv s1 s3.