Executable Specification

[View append]

Reasoning

[View append]

Click on a command or tactic to see a detailed view of its use.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This example demonstrates how to use schematic polymorphism to
%% prove properties about inductively defined polymorphic definitions
%% at the specification level
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Specification "append".

% Append is deterministic in its third argument
Theorem app_det[A] : forall (L1 : list A) L2 L3 L3',
  {append L1 L2 L3} -> {append L1 L2 L3'} -> L3 = L3'.

% The determinacy property at some particular type instances
Kind nat type.

% Apply app_det to list of natural numbers
Theorem app_det_nat : forall (L1: list nat) L2 L3 L3',
  {append L1 L2 L3} -> {append L1 L2 L3'} -> L3 = L3'.

% Apply app_det to polymorphic lists of lists
Theorem app_det_list[B] : forall (L1 : list (list B)) L2 L3 L3',
  {append L1 L2 L3} -> {append L1 L2 L3'} -> L3 = L3'.