Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

OCaml : Sorted lists Consider the functions for ordered lists from the ordered list.ml le in the code-examples direc- tory of the public class repository:

OCaml :

Sorted lists

Consider the functions for ordered lists from the ordered list.ml le in the code-examples direc-

tory of the public class repository:

let rec place e l = match l with

| [ ] -> [e]

| x::xs -> if e < x then e::x::xs

else x :: (place e xs)

let rec is_elem e l = match l with

| [ ] -> false

| x::xs -> e = x || (e > x && is_elem e xs)

let rec sorted l = match l with

| [ ] -> true

| x::[] -> true

| x1::x2::xs -> x1 <= x2 && sorted (x2::xs)

Using induction, show that

sorted l => sorted (place e l)

Your proof must explicitly and clearly indicate the base case you prove, the inductive case you prove and what the inductive hypothesis provides in the proof.

Each step in your proof must be accompanied by a justication describing why that step could be taken.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

Discuss the influence of iterative approaches.

Answered: 1 week ago