Skip to content

Commit

Permalink
matches_map_group_equiv_concat
Browse files Browse the repository at this point in the history
  • Loading branch information
tahina-pro committed Jan 6, 2025
1 parent 50e84eb commit 8aaa1ec
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cddl/spec/CDDL.Spec.MapGroup.Base.fsti
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,15 @@ val t_map_eq
end)
[SMTPat (t_map g x)]

let matches_map_group_equiv
(g1 g2: map_group)
: Tot prop
= forall m . matches_map_group g1 m <==> matches_map_group g2 m

val t_map_ext
(g1 g2: map_group)
: Lemma
(requires (forall m . matches_map_group g1 m <==> matches_map_group g2 m))
(requires (matches_map_group_equiv g1 g2))
(ensures (t_map g1 == t_map g2))

let t_map_concat_cut_r
Expand Down
44 changes: 44 additions & 0 deletions src/cddl/spec/CDDL.Spec.MapGroup.fsti
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,50 @@ let map_group_footprint_concat_consumes_all_recip'
= let (_, _) = map_group_footprint_concat_consumes_all_recip g1 g2 f1 f2 m in
()

#restart-solver
let matches_map_group_equiv_concat'
(g1 g1' g2 g2': det_map_group)
(f1 f1' f2 f2': typ)
(m: cbor_map)
: Lemma
(requires (
map_group_footprint g1 f1 /\
map_group_footprint g1' f1' /\
map_group_footprint g2 f2 /\
map_group_footprint g2' f2' /\
matches_map_group_equiv g1 g1' /\
matches_map_group_equiv g2 g2' /\
typ_disjoint f1 f2 /\
typ_disjoint f1' f2' /\
matches_map_group (map_group_concat g1 g2) m
))
(ensures (
matches_map_group (map_group_concat g1' g2') m
))
= let (m1, m2) = map_group_footprint_concat_consumes_all_recip g1 g2 f1 f2 m in
map_group_footprint_concat_consumes_all g1' g2' f1' f2' m1 m2

#restart-solver
let matches_map_group_equiv_concat
(g1 g1' g2 g2': det_map_group)
(f1 f1' f2 f2': typ)
: Lemma
(requires (
map_group_footprint g1 f1 /\
map_group_footprint g1' f1' /\
map_group_footprint g2 f2 /\
map_group_footprint g2' f2' /\
matches_map_group_equiv g1 g1' /\
matches_map_group_equiv g2 g2' /\
typ_disjoint f1 f2 /\
typ_disjoint f1' f2'
))
(ensures (
matches_map_group_equiv (map_group_concat g1 g2) (map_group_concat g1' g2')
))
= Classical.forall_intro (Classical.move_requires (matches_map_group_equiv_concat' g1 g1' g2 g2' f1 f1' f2 f2'));
Classical.forall_intro (Classical.move_requires (matches_map_group_equiv_concat' g1' g1 g2' g2 f1' f1 f2' f2))

#restart-solver
let map_group_choice_compatible_match_item_for_concat_right
(k: cbor)
Expand Down

0 comments on commit 8aaa1ec

Please sign in to comment.